# Lecture14 - CSE 421 Algorithms Richard Anderson Lecture 14...

This preview shows pages 1–7. Sign up to view the full content.

CSE 421 Algorithms Richard Anderson Lecture 14 Inversions, Multiplication, FFT

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Divide and Conquer Algorithms Mergesort, Quicksort Strassen’s Algorithm Closest Pair Algorithm (2d) Inversion counting Integer Multiplication (Karatsuba’s Algorithm) FFT Polynomial Multiplication Convolution
Inversion Problem Let a 1 , . . . a n be a permutation of 1 . . n • (a i , a j ) is an inversion if i < j and a i > a j Problem: given a permutation, count the number of inversions This can be done easily in O(n 2 ) time Can we do better? 4, 6, 1, 7, 3, 2, 5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Counting Inversions 11 12 4 1 7 2 3 15 9 5 16 8 6 13 10 14 Count inversions on lower half Count inversions on upper half Count the inversions between the halves
11 12 4 1 7 2 3 15 11 12 4 1 7 2 3 15 9 5 16 8 6 13 10 14 9 5 16 8 6 13 10 14 Count the Inversions 11 12 4 1 7 2 3 15 9 5 16 8 6 13 10 14 4 1 2 3 14 10 19 8 6 43

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Problem – how do we count inversions between sub problems in O(n) time?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern