+1 vote
in Data Structures & Algorithms I by (110k points)
The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?

(a) Singly linked list

(b) Doubly linked list

(c) Circular doubly linked list

(d) Array implementation of list

Origin of the question is Singly Linked List Operations in portion Abstract Data Types of Data Structures & Algorithms I

This question was addressed to me in class test.

1 Answer

+1 vote
by (412k points)
selected by
Best answer
The correct answer is (c) Circular doubly linked list

Best explanation: We can easily concatenate two lists in O (1) time using singly or doubly linked list, provided that we have a pointer to the last node at least one of the lists. But in case of circular doubly linked lists, we will break the link in both the lists and hook them together. Thus circular doubly linked list concatenates two lists in O (1) time.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.