| CPSC 320: Analysis of Algorithms | Spring 2026 |
(a) To guarantee $O(n)$ time, the median-of-medians algorithm makes recursive calls only when the input size $n \ge 80$. It turns out that the choice of this constant $80$ is somewhat arbitrary. In fact, we can still achieve $O(n)$ time even if we make recursive calls on smaller input. What is the smallest input size with which we can make a recursive call, while maintaining $O(n)$ time? Carefully justify your answer.
(b) The median-of-medians algorithm partitions the input into groups of five elements, but it also works if we partition the input into groups of seven. Prove carefully that this modified algorithm still runs in $O(n)$ time.
|
|
CPSC 320 home page |
|
|