Related Articles

Related Articles

GATE | GATE 2017 MOCK II | Question 21
  • Last Updated : 31 Jan, 2017

Which data structure would be the most appropriate to implement a collection of values with the following three characteristics?

i) Items are retrieved and removed from the collection in FIFO order.
ii) There is no priori limit to the number of items in the collection.
iii) The size of an item is large relative to storage required for a memory address.
(A) Singly linked list with head and tail pointers
(B) Doubly linked list with only a head pointer
(C) Binary tree
(D) Hash table

Answer: (A)

Explanation: Head and tail pointers in singly link list will make the insertion and deletion in O(1) time complexity if we are accessing the elements in FIFO order.

In doubly link list since only head pointer is given then for insertion we have to traverse the complete link list so insertion will be O(n) so not appropriate.

In binary tree we have only a pointer to the root. Insertion and deletion in binary tree will be
O(log n) so not appropriate.

In hash table accessing the data in FIFO order will not be possible.

Quiz of this Question


My Personal Notes arrow_drop_up
Recommended Articles
Page :