Gate CS-2003 Question Paper With Solutions

Q. 75 A data structure is required for storing a set of integers such that each of the
following operations can be done is (logn) time, where n is the number of elements
in the set.

1. Deletion of the smallest element.
2. 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 ?

(A) A heap can be used but not a balanced binary search tree

(B) A balanced binary search tree can be used but not a heap

(C) Both balanced binary search tree and heap can be used

(D) Neither balanced binary search tree nor heap can be used

Answer: (B)

Explanation:

Gate CS-2003 Question Paper With Solutions

Learn More:   Gate EC-2015 - 2 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here