The Gateway to Computer Science Excellence
0 votes
53 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)
in Algorithms by Junior (961 points) | 53 views
0
is it c?
0
Answer is given as D. I too think it's C..
0

Yup its O(n)

skip to the very end

0
Thanks dude!

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,650 questions
56,238 answers
194,267 comments
95,874 users