Last reviewed
Correct answer: B. Fast insertion/deletion at a known position, but slower access to a specific position
Explanation
A linked list rewires pointers instead of moving data. Once you already hold the node, splicing one in or cutting one out is a couple of assignments, no matter how long the list is. Reaching a specific position is the expensive half, because the only route to element five hundred is following five hundred links from the head. An array inverts both: NIST defines it as items randomly accessible by integers, so index lookup is arithmetic, while inserting shifts everything after the insertion point.
Python's own docs show the same trade in one library. A deque is a linked structure, and the documentation warns that indexed access slows to O(n) in the middle and tells you to use a list for fast random access; the list entry, in turn, notes O(n) memory movement costs for insert at position zero.
Memory is not a win either way. Every node pays for its pointers and its own allocation header, so a linked list frequently uses more space than a packed array holding the same values. Traversal, meanwhile, is the one thing a linked list does well.
Sources
“An assemblage of items that are randomly accessible by integers, the index.”
“An ordinary linked list must be searched with a linear search.”
“Indexed access is O(1) at both ends but slows to O(n) in the middle. For fast random access, use lists instead.”
Practise 3 questions on this topic
Take Linked Lists — Timed Test (3 questions) — scored instantly, explanation for every question, no login.