UGC-NET Sep 2013 · Queues

MCQ · 2 marks · Problem PROG-DSTR-0033

The efficient data structure to insert/delete a number in a stored set of number is
  1. A
    Queue
  2. B
    Linked list
  3. C
    Doubly linked list
  4. D
    Binary tree

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

Show the worked solutionFor a sorted set of numbers, once the position is found, a doubly linked list inserts or deletes by changing a constant number of pointers: the node is linked to both its predecessor and successor, which are reachable directly, and no elements are shifted.(A) A queue only allows insertion at the rear and deletion at the front, not at an arbitrary position — incorrect.(B) A singly linked list cannot reach the predecessor of a node, so deleting a given node needs another traversal — less efficient.(D) A plain binary tree has no ordering guarantee or balance, and deleting an internal node needs restructuring — not the intended answer.Answer: C

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