O(k) in the worst-case , then i guess it would better to use median-of median algo to find element at rank k. and comparing with x.
or we can us hashtable to solve this. On Tue, Dec 13, 2011 at 3:23 PM, Ankur Garg <ankurga...@gmail.com> wrote: > Given an array-based heap on n elements and a real number x, efficiently > determine whether the kth smallest element in the heap is greater than or > equal to x. Your algorithm should be O(k) in the worst-case, independent of > the size of the heap. > > > This question was also asked in Amazon > > -- > 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.