Question: 1. Divide the n elements into groups of size 5. So n/5 groups. 2. Find the median of each group. 3. Find the median x

1. Divide the n elements into groups of size 5. So n/5 groups.
2. Find the median of each group.
3. Find the median x of the n/5 medians by a recursive call to Select.
4. Call Partition with x as the pivot.
5. Make a recursive call to Select either on the smaller elements or larger elements (depending on the situation); if the pivot is the answer we are done.
Intermediate/advanced. In Chapter 9, we learned two algorithms for the selection problem, one simple randomized and one sophisticated deterministic algorithm. We learned that the recurrence for running time of the determinist algorithm is T(n) = T(1/5n) +T(7/10 n) + Theta(n)^1. Here T(1/5n) comes from Step 3 (see page 220) and T(7/10n) from Step 5. What happens to the recurrence if each group size is 7, instead of 5? More precisely, you will get a new recurrence of the same form, T(n) = T(an) + T(bn) + Theta (n). Then, what are a and b? Intermediate/advanced. In Chapter 9, we learned two algorithms for the selection problem, one simple randomized and one sophisticated deterministic algorithm. We learned that the recurrence for running time of the determinist algorithm is T(n) = T(1/5n) +T(7/10 n) + Theta(n)^1. Here T(1/5n) comes from Step 3 (see page 220) and T(7/10n) from Step 5. What happens to the recurrence if each group size is 7, instead of 5? More precisely, you will get a new recurrence of the same form, T(n) = T(an) + T(bn) + Theta (n). Then, what are a and b
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
