randomizedQS - ( k ) ≤ n + 2 n n-1 X k =1 ck lg k...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
An analysis of randomized Quicksort CSCE 750, Fall 2011 Stephen A. Fenner September 29, 2011 We showed in class that the expected run time E ( n ) of randomized Quicksort run on a list of n items asymptotically satisfies the recurrence E ( n ) = n + 2 n n - 1 X k =1 E ( k ) . Here we show via the substitution method that E ( n ) = O ( n lg n ). We prove by induction on n that E ( n ) cn lg n for some sufficiently large constant c chosen later. We only give the inductive step. The key trick of the proof is to split the sum. Fix n sufficiently large. We assume (inductive hypothesis) that E ( m ) cm lg m for all 1 m < n . (Note that E ( m ) 0 for all m .) We then have E ( n ) = n + 2 n n - 1 X k =1 E
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ( k ) ≤ n + 2 n n-1 X k =1 ck lg k (inductive hypothesis) = n + 2 c n b n/ 2 c X k =1 k lg k + n-1 X k = b n/ 2 c +1 k lg k ≤ n + 2 c n b n/ 2 c X k =1 k lg n 2 + n-1 X k = b n/ 2 c +1 k lg n = n + 2 c n (lg n-1) b n/ 2 c X k =1 k + lg n n-1 X k = b n/ 2 c +1 k = n + 2 c n lg n n-1 X k =1 k-b n/ 2 c X k =1 k ≤ n + 2 c n ± n 2 lg n 2-b n/ 2 c ( b n/ 2 c -1) 2 ² ≤ n + 2 c n ± n 2 lg n 2-( n/ 3) 2 2 ² = cn lg n-cn 9 + n ≤ cn lg n provided c ≥ 9. 1...
View Full Document

This note was uploaded on 12/13/2011 for the course CSCE 750 taught by Professor Fenner during the Fall '11 term at South Carolina.

Ask a homework question - tutors are online