Question 1

The concatenation of two lists is to be performed in O(1) time. Which of the following implementations of lists could be used?

  1. ASingly linked list
  2. BDoubly linked list
  3. CCircular doubly linked list
  4. DArray implementation of list
Show answerHide answer

Correct answer: (C) Circular doubly linked list

Explanation

In a circular doubly linked list the last node is reached directly through head->prev. So two lists can be joined by changing a few pointers in O(1) time, without traversing.

From DSSSB TGT Computer Science Practice Set 4

This is question 1 of DSSSB TGT Computer Science Practice Set 4. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.