select algorithm in order statistics given in cormen book. get kth smallest
element in O(n) and output all array elements from index 0 to the index of
that kth smallest element. So better than Heap approach which is O(n+klogn)

Thanks & regards,
Laxmikant Agrawal

"Journey is more important than final goal."


On Sun, Mar 28, 2010 at 2:14 AM, sharad kumar <aryansmit3...@gmail.com>wrote:

> i feel heapify the array to get a min heap and keep extracting root k
> times.any further optimisations???
>
>
>
> On Sun, Mar 28, 2010 at 11:33 AM, Priyanka Chatterjee <dona.1...@gmail.com
> > wrote:
>
>> Design the most efficient algorithm to find  the first k smallest elements
>> in an array  ?
>>
>> --
>> Thanks & Regards,
>> Priyanka Chatterjee
>> Third Year Undergraduate Student,
>> Computer Science & Engineering,
>> National Institute Of Technology,Durgapur
>> India
>> http://priyanka-nit.blogspot.com/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to