Open In App

GATE | GATE CS 1997 | Question 4

Like Article
Like
Save
Share
Report

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


Last Updated : 14 Oct, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads