lec4 - Outline Recursive Relationship Quicksort, revisit...

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

View Full Document Right Arrow Icon
Outline Recursive Relationship Quicksort, revisit Description Tricks to improve Randomization Probabilities and Randomized Algorithms 1
Background image of page 1

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

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

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

View Full DocumentRight Arrow Icon
Probabilities and Expectation Given two random variables X and Y , on a finite domain
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/17/2010 for the course CS 240 taught by Professor Ortiz during the Spring '09 term at Waterloo.

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 Right Arrow Icon
Ask a homework question - tutors are online