check out this: RANDOMIZED-SELECT in O(n): http://amiteshsingh.wordpress.com/2012/06/08/iterative-randomized-select/
-- Amitesh On Sun, Jun 17, 2012 at 1:24 PM, Ashish Goel <ashg...@gmail.com> wrote: > is the modification of the given array allowed? > > if yes use quick select, otherwise build tree where each node keeps count > of its left subtree > Best Regards > Ashish Goel > "Think positive and find fuel in failure" > +919985813081 > +919966006652 > > > > On Sun, Jun 17, 2012 at 8:13 AM, Prem Nagarajan <prem.cmna...@gmail.com>wrote: > >> Give an array of unsorted elements, find the kth smallest element in the >> array. >> >> The expected time complexity is O(n) and no extra memory space should be >> used. >> >> Quickselect algorithm can be used to obtain the solution. Can anyone >> explain how quickselect works? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@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. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@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. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@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.