2
$\begingroup$

All we know what is Deterministic Selection Algorithm:

  • Line up elements in groups of five (this number $5$ is not important, it could be e.g. $7$ without changing the algorithm much). Call each group $S[i]$, with $i$ ranging from $1$ to $n/5$.

  • Find the median of each group. (Call this $x[i]$). This takes $6$ comparisons per group, so $6n/5$ total (it is linear time because we are taking medians of very small subsets).

  • Find the median of the $x[i]$, using a recursive call to the algorithm. If we write a recurrence in which $T(n)$ is the time to run the algorithm on a list of n items, this step takes time $T(n/5)$. Let M be this median of medians.

  • Use M to partition the input and call the algorithm recursively on one of the partitions, just like in quickselect.

    In the case of dividing the array into five groups, we get the recurrence: $T(n)=T(n/5)+T(7n/10)$. That simply means that the value returned by partitioning is al least $3n/10−3/2$ and at most $7n/10+3/2$. However, what happens if we divide the array into 3 groups? What will be the upper and lower bounds? And what will be the recurrence of the runtime of the whole algo?

My thoughts: So the upper bound for $k=5$ is $7n/10 +3/2$. However, I do not understand where this $3/2$ come from? So for $k=3$ it should be like $2n/3 +?$. And also please explain what will be the lower bound? Thanks in advance.

$\endgroup$
1
  • $\begingroup$ Welcome to Computer Science! The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you! $\endgroup$
    – Raphael
    Commented Feb 2, 2018 at 7:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.