Lecture5 - Lecture 5 Oct 5 2010 Randomized Algorithms...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 62 Randomized Algorithms Algorithm can “toss coins”. No specific input leads to worst-case behavior. Distinction between randomized algorithms and random data ! Lecture 5, Oct. 5, 2010 63 Analyzing Quicksort Partition around a randomly chosen element and let T(n) be the expected time to sort . Consider the case where the partition is (k, n-k-1). Conditioned on partition turning to be (k, n-k-1) , the expected time to terminate is: Note that any value of k , from 0 to n-1 is equally likely . T k T n k n ( ) ( ) ( )   1 1 0 ( , 1) split) Pr[( , 1) split] ( , 1) split) 1 = 2 ( ) ( ) ( | ( | ( ) ( 1 ) ( ) ( ) k k k n k k n k k n k k n k n n n T n E T n T n T k T n k n T k     
Image of page 1

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

View Full Document Right Arrow Icon