We can't use a heap. Balanced BST is correct because "Deletion of the
smallest element Insertion of an
element if it is not already present in the set" -> for this we need
to search for the element and searching in heap is O(n).

On Aug 21, 6:16 pm, priya ramesh <love.for.programm...@gmail.com>
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 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.

Reply via email to