Skip to content
Sharp

Collections · interview question

Why can using an ArrayList over a LinkedList when frequently inserting elements at the beginning of the list become a problem in practice?

Multiple choiceMediumchapter-4-curatedpremiumcollectionslist-interface-and-arraylist
Choose one answer
Answer and explanation

Correct answer

D. Higher time complexity for insertions

Why

Inserting elements at the beginning of an ArrayList requires shifting all existing elements, which results in O(n) time complexity, whereas LinkedList can insert in O(1).

Test yourself on Collections

A free test with instant, explained results. No account needed.

Start free test
All Collections questions →