{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lec4 - Outline Recursive Relationship Quicksort revisit...

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

Outline Recursive Relationship Quicksort, revisit Description Tricks to improve Randomization Probabilities and Randomized Algorithms 1

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

View Full Document
Recursive Relationship, Template T ( n ) = 2 T ( n/ 2) + Θ( n ) Θ( n log n ) T ( n ) = 2 T ( n/ 2) + Θ(1) Θ( n ) T ( n ) = T ( n/ 2) + Θ(1) Θ(log n ) 2
Randomized Quicksort Pivot selection and modification (ver 1) partition (from, to) i ← b (from - to + 1) * rand() c + from Partition A [from..to] using A [ i ] as the pivot return i Pivot selection and modification (ver 2) partition (from, to) do i ← b (from - to + 1) * rand() c + from r 0 // compute the rank of A [ i ] for j = from to to if A [ i ] > A [ j ] r r + 1 until ((from-to)/4 < r < 3(from-to)/4) Partition A [from..to] using A [ i ] as the pivot using i as the pivot as before return i 3

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

View Full Document
Probabilities and Expectation Given two random variables X and Y , on a finite domain
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

lec4 - Outline Recursive Relationship Quicksort revisit...

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

View Full Document
Ask a homework question - tutors are online