GATE CS 2003 · Arrays & Matrix Representation

MCQ · 1 mark · Problem PROG-DSTR-0173

A data structure is required for storing a set of integers such that each of the following operations can be done in \(O(\log n)\) time, where n is the number of elements in the set.1. Deletion of the smallest element2. Insertion of an element if it is not already present in the setWhich of the following data structures can be used for this purpose?
  1. A
    A heap can be used but not a balanced binary search tree
  2. B
    A balanced binary search tree can be used but not a heap
  3. C
    Both balanced binary search tree and heap can be used
  4. D
    Neither balanced search tree nor heap can be used

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionOfficial GATE Answer Key: Option B.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/950/gate2003-63-isro2009-25

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com