Selection Reset Progress Reveal Solutions
In the select algorithm, the runtime is represented with the recurrence relation
n
7n
T (n) = O(n) + T +T .
5 10
Here, T ( n5 ) is for selecting the pivot, and T ( 7n
10 ) is for the recursive call to select the k-th element.
Consider the modified version of the select algorithm, where we split our array into d n7 e groups of size
≤ 7 instead. What would be the recurrence relation for this modified version? Specifically, if we write
the recurrence relation as T (n) = O(n) + T ( na ) + T ( bn
c ), where a, b, and c are non-negative integers,
what are the smallest possible values of a, b, and c?
a=
Correct
b=
Correct
c=
Correct
What is the smallest exponent x such that the modified version of the select described above on an
array of size n always takes time O(nx )?
Correct
Now assume that the O(n) work per recursive step takes exactly n units of time on our machine. In
other words, suppose that the recurrence relation for the runtime is
n
bn
T (n) = n + T +T .
a c
What is the smallest coefficient C such that we can use the substitution method to prove that the
recurrence relation for the modified select algorithm is T (n) ≤ Cn
Correct
Now consider another modified version of the select algorithm, where we split our array into dn/3e
groups of size ≤ 3 instead. What would be the recurrence relation for this modified version? Specifically,
if we write the recurrence relation as
n
bn
T (n) = n + T +T ,
a c
where a, b, and c are non-negative integers, what are the smallest possible values of a, b, and c?
a=
Correct
b=
Correct
c=
Correct
Which one is true for the modified select recurrence relation that you came up with in the last part?
T (n) = Θ(n)
T (n) = Θ(n log n)
T (n) = Θ(n2 )
Correct