Which of the following is an advantage of the linked list over an array?
ALinked list takes less storage to store the n elements as compared to array.
BLinked list takes less time to access the ith element as compared to array.
CInserting an element at beginning of the linked list takes less time as compared to
array.
DInserting an element as last element of the linked list takes less time as compared to
array.
Show answerHide answer
Correct answer: (C) Inserting an element at beginning of the linked list takes less time as compared to
array.
Explanation
Inserting at the beginning of a linked list only changes the head pointer, which is O(1). An array must shift every element, which is O(n). Array access by index is faster.