10_rand_II - Chapter 10 Randomized Algorithms II By Sariel...

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

View Full Document Right Arrow Icon
Randomized Algorithms II By Sariel Har-Peled , September 28, 2007 ± Version: 0.1 10.1 QuickSort with High Probability One can think about QuickSort as playing a game in rounds. Every round, QuickSort picks a pivot, splits the problem into two subproblems, and continue playing the game recursively on both subproblems. If we track a single element in the input, we see a sequence of rounds that involve this element. The game ends, when this element find itself alone in the round (i.e., the subproblem is to sort a single element). Thus, to show that QuickSort takes O ( n log n ) time, it is enough to show, that every element in the input, participates in at most 32 ln n rounds with high enough probability. Indeed, let X i be the event that the i th element participates in more than 32 ln n rounds. Let C QS be the number of comparisons performed by QuickSort . A comparison between a pivot and an element will be always charged to the element. And as such, the number of compar- isons overall performed by QuickSort is bounded by i r i , where r i is the number of rounds the i th element participated in (the last round where it was a pivot is ignored). We have that α = Pr ± C QS 32 n ln n ² Pr [ i X i n X i = 1 Pr [ X i ] . Here, we used the union rule , that states that for any two events A and B , we have that Pr [ A B ] Pr [ A ] + Pr [ B ]. Assume, for the time being, that Pr [ X i ] 1 / n 3 . This implies that α n X i = 1 Pr [ X i ] n X i = 1 1 / n 3 = 1 n 2 . Namely, QuickSort performs at most 32 n ln n comparisons with high probability. It follows, that QuickSort runs in O ( n log n ) time, with high probability, since the running time of QuickSort is proportional to the number of comparisons it performs. ± This work is licensed under the Creative Commons Attribution-Noncommercial 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. 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
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/14/2009 for the course CS 473 taught by Professor Viswanathan during the Fall '08 term at University of Illinois at Urbana–Champaign.

Page1 / 6

10_rand_II - Chapter 10 Randomized Algorithms II By Sariel...

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

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