MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What kind of linked list is best to answer question like “What is the item at position n?”
A
Singly linked list
B
Doubly linked list
C
Circular linked list
D
Array implementation of linked list
Explanation: 

Detailed explanation-1: -Array implementation of linked list.

Detailed explanation-2: -Singly linked list is preferred when we need to save memory and searching is not required as pointer of single index is stored. If we need better performance while searching and memory is not a limitation in this case doubly linked list is more preferred.

Detailed explanation-3: -In the linked list, we need to traverse through each element until we reach the nth position. Time taken to access an element represented in arrays is less than the singly, doubly and circular linked lists. Thus, array implementation is used to access the item at the position n.

Detailed explanation-4: -Better use of Memory: From a memory allocation point of view, linked lists are more efficient than arrays. Unlike arrays, the size for a linked list is not pre-defined, allowing the linked list to increase or decrease in size as the program runs.

Detailed explanation-5: -A Linked List is composed of nodes, which are connected to the next node, using memory references or addresses. A Linked List node usually contains 2 properties stored in it. They are: The value to be stored in the current node. The reference or address of the next node, or NULL if it is the last node.

There is 1 question to complete.