MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used?
A
Singly linked list
B
Doubly linked list
C
Circular doubly linked list
D
Array implementation of list
Explanation: 

Detailed explanation-1: -8. The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used? 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.

Detailed explanation-2: -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.

Detailed explanation-3: -With a circularly linked list, you can easily concatenate them in O(1) time.

Detailed explanation-4: -12) If we want to concatenate two linked lists which of the following gives O(1) complexity? Ans: c(Circular Doubly Linked Lists).

Detailed explanation-5: -Concatenation operator (+) for List Concatenation. The ‘+’ operator can be used to concatenate two lists. It appends one list at the end of the other list and results in a new list as output.

There is 1 question to complete.