{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

Chapter 10 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 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 i = 1 Pr [ X i ] n 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.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern