Question discussion

Which of the following is an advantage of the linked list over an array?

359457Medium DSSSB TGT Computer Science 0 replies 0 views
0
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.
Correct answer: C

Explanation

A node can be inserted at the beginning of a linked list in O(1), whereas an array needs shifting all elements.

Discussion 0

Nobody has replied yet. Start the discussion!