@Rahul: but for heapify, i need to build heap tree first from the list. which will cost linear traversal of the elements, that will cost O(n). but i need to search it in O(log n) or polylogrithmic complexity of (log n) i.e. (log^2 n).
On Sun, Jun 3, 2012 at 8:55 AM, Rahul Kumar Patle <[email protected] > wrote: > @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. > -- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *Technical Skill is the mastery of complexity, while Creativity is the master of presence of mind. ** * - Morihei Ueshiba ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *Thanks and Regards,* Abhinav Kumar Gupta *M. Tech. (Software Engineering)* Motilal Nehru National Institute of Technology Allahabad(UP)-211004 +919628358065 [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.
