@abhinav: if you want to search just 15 in log(n) time then you can use the concept of heap tree.. apply one round of heapification (not for all elements but just one time it will be complete in log(n) times), and you will need to swap elements but when you got element 15 you can stop.. although space complexity has increased... you will need one redundant array to use heap operation so that finally you will have original array as it is...
Thanks and Regards: Rahul Kumar Patle On Sun, Jun 3, 2012 at 8:31 PM, abhinav gupta <[email protected]> wrote: > > We have given a list 14 6 7 15 8 9 ............we have to find 15 in > (log n ) times. > -- > > *Thanks and Regards,* > > Abhinav Kumar Gupta > **[email protected] > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
