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

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

View Full Document Right Arrow Icon
CSE 421 Algorithms Richard Anderson Lecture 14 Inversions, Multiplication, FFT
Background image of page 1

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

View Full DocumentRight Arrow Icon
Divide and Conquer Algorithms Mergesort, Quicksort Strassen’s Algorithm Closest Pair Algorithm (2d) Inversion counting Integer Multiplication (Karatsuba’s Algorithm) FFT Polynomial Multiplication Convolution
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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
Background image of page 5

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

View Full DocumentRight Arrow Icon
Problem – how do we count inversions between sub problems in O(n) time? Solution – Count inversions while merging
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/25/2012 for the course CSE 421 taught by Professor Richardanderson during the Fall '06 term at University of Washington.

Page1 / 20

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

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online