Question: we know an algorithm for computing the kth smallest number in a given list of n numbers in time O(n). The algorithm worked by breaking
we know an algorithm for computing the kth smallest number in a given list of n numbers in time O(n). The algorithm worked by breaking the numbers into n/5 sets of size 5, and the then considering the medians of these sets. We set w to be the median of these medians, and used it to split all the numbers and recurse. show steps and proof that what bound would you obtain if you analyzed the algorithm that uses sets of size 4 in the above process? (The median of 4 numbers a1 a2 a3 a4 is (a2+a3) / 2 )
This Answer is not sufficient, so it needs prove and need to show the steps.
The bound will still be O(n) as just one operation are going to be increased as (a2+a3)/2 is O(1) operation thus it'll not affected the previous time complexity also in worst case we've to think about all n elments . Thus bound are going to be still O(n).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
