An alternative analysis of the running time of randomized quicksort focuses on the expected running time of

Question:

An alternative analysis of the running time of randomized quicksort focuses on the expected running time of each individual recursive call to RANDOMIZED-QUICKSORT, rather than on the number of comparisons performed.

a.?Argue that, given an array of size?n, the probability that any particular element is chosen as the pivot is?1/n. Use this to define indicator random variables?Xi = I {i th smallest element is chosen as the pivot}. What is E[Xi]?

b.?Let T (n) be a random variable denoting the running time of quicksort on an array of size n. Argue that

image

c.?Show that we can rewrite equation (7.5) as

image

d.?Show that

image

Split the summation into two parts, one for k = 2,3, . . . , ?n/2? - 1 and one for k = ?n/2?, . . . ,n ? 1.

e.?Using the bound from equation (7.7), show that the recurrence in equation (7.6) has the solution E [T (n)] = ?(n lg n). Show, by substitution, that E[T (n)] ? an lg n for sufficiently large n and for some positive constant a.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Introduction to Algorithms

ISBN: 978-0262033848

3rd edition

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

Question Posted: