heap is true but i am not getting y we can't use a balanced binary tree searching for the smallest is logn(leftmost node), then deleting it is logn
so, should it be both?? thanx :) On Sun, Aug 21, 2011 at 6:54 PM, sukran dhawan <[email protected]>wrote: > its heap > > > On Sun, Aug 21, 2011 at 6:52 PM, Puneet Chawla > <[email protected]>wrote: > >> I think Heap DS should be used as to delete smallest element jst apply min >> heap and delete it and for insertion add the element and apply max or min as >> needed Max heap = Min heap both have complexities =O(logn) >> >> >> On Sun, Aug 21, 2011 at 6:46 PM, priya ramesh < >> [email protected]> wrote: >> >>> A data structure is required for storing a set of integers such that each >>> of the following operations can be done in (log n) time, where n is the >>> number of elements in the set. Deletion of the smallest element Insertion of >>> an element if it is not already present in the set Which of the following >>> data structures can be used for this purpose? >>> >>> ยท Pick one of the choices >>> >>> >>> A heap can be used but not a balanced binary search tree >>> >>> >>> A balanced binary search tree can be used but not a heap >>> >>> >>> Both balanced binary search tree and heap can be used >>> >>> >>> Neither balanced binary search tree nor heap can be used >>> >>> -- >>> 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. >>> >> >> >> >> -- >> With regards >> ............ >> Puneet Chawla >> Computer Engineering Student >> NIT Kurukshetra >> >> -- >> 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. > -- 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.
