74 views
Consider the multi selection problem:

Given a set 'S' of n elements and set 'K' of 'r' ranks $K_{1}$, $K_{2}$, ....$K_{r}$. Find the $K_1^{th}$, $K_2^{th}$, ....$K_r^{th}$ smallest elements.

Example K = {3,7,10,50} the problem is to find the $3^{rd}$, $7^{th}$, $10^{th}$, $50^{th}$ smallest elements. The time complexity of the most efficient algorithm to solve this problem is

A. O(n.r)
B. O($n^2$.log r)
C. O(n)
D. O(n.log r)
| 74 views
0
is it c?
0
Answer is given as D. I too think it's C..
0

Yup its O(n)

0
Thanks dude!

+1 vote