GATE | GATE CS 1997 | Question 4
The concatenation of two lists is to be performed in O(1) time. Which of the following implementations of a list should be used?
(A)
singly linked list
(B)
doubly linked list
(C)
circular doubly linked list
(D)
array implementation of lists
Answer: (C)
Explanation:
As list concatenation requires traversing at least one list to the end. So singly linked list and doubly linked list requires O(n) time complexity whereas circular doubly linked list required O(1) time.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Please Login to comment...