Question: The worst-case number T(n) of comparisons used by SELECT to select the ith order statistic from n numbers was shown to satisfy T(n) = Θ(n),

The worst-case number T(n) of comparisons used by SELECT to select the ith order statistic from n numbers was shown to satisfy T(n) = Θ(n), but the constant hidden by the Θ-notation is rather large. When i is small relative to n, we can implement a different procedure that uses SELECT as a subroutine but makes fewer comparisons in the worst case.
a. Describe an algorithm that uses Ui (n) comparisons to find the ith smallest of n elements, where.


if i z n/2. (T(n) In/2] + U,([n/21) + T (2i) otherwise. U,(n) = U,(n)

b. Show that, if i c. Show that if i is a constant less than n/2, then Ui (n) = n + O (lg n)..
d. Show that if i = n/k for k ≥ 2, then Ui (n) = n + O (T (2n/k) lg k)..

if i z n/2. (T(n) In/2] + U,([n/21) + T (2i) otherwise. U,(n) = U,(n)

Step by Step Solution

3.36 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Our algorithm relies on a particular property of SELECT that not only does it return the i th smal... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

C-S-A (93).docx

120 KBs Word File

Students Have Also Explored These Related Algorithms Questions!