Lecture5

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

Info iconThis 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 nk n () ( )   1 1 0 (, 1 ) s p l i t ) Pr[( , 1) split] ( , 1) split) 1 = 2 (| ( 1 ) k k k n k kn k n n n Tn E Tn Tn Tk Tn k n Tk      
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 64 Solving the recurrence 1 1 22 lg ( ) n k akk n b n nn   21 1 lg 2 ( ) 28 an n n b n n     11 00 We will try to prove that ( ) lg First, choose b large enough to satisfy: (1) lg1 Inductive step (note that (0) 0): () ( l g ) kk Tn an n b Tab b T
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/08/2011 for the course CS 161 at Stanford.

Page1 / 5

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

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

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