Learn the vocabulary of a sequence of nodes linked by pointers instead of stored in contiguous array slots.
0 / 5 completed
1 / 5
At standup, a dev mentions a sequence of nodes where each node holds a value and a pointer to the next node, so inserting or removing an element only requires updating a couple of pointers instead of shifting every later element. What is this structure called?
Linked list is exactly this: a linked list is a sequence of nodes where each node holds a value and a pointer to the next node in the sequence, so inserting or removing an element only requires updating a couple of neighboring pointers instead of shifting every later element the way an array would. A hash collision is an unrelated hash-table concept about two keys sharing a bucket. This pointer-update-only insert and remove is exactly why a linked list avoids an array's costly shifting of every later element.
2 / 5
During a design review, the team picks a linked list for a sequence with frequent insertions and removals in the middle, specifically because updating a couple of pointers costs constant time, unlike an array, which must shift every element after the insertion or removal point. Which capability does this provide?
Linked list here provides Constant-time insertion and removal once the position is known, since only the pointers immediately around the insertion or removal point need to change, with no other node in the list affected at all, unlike an array, which must physically shift every element after the affected position. An array must shift every element after the insertion or removal point, which costs time proportional to the list's remaining length. This pointer-only update is exactly why a linked list is favored whenever insertions and removals happen frequently in the middle of a sequence.
3 / 5
In a code review, a dev notices a feature that frequently inserts and removes elements in the middle of a sequence stores that sequence in a plain array, paying the cost of shifting every later element on each insertion or removal, instead of using a linked list. What does this represent?
This is a missed linked-list opportunity, since using a linked list would let each insertion or removal update only a couple of neighboring pointers, instead of shifting every later element the way an array must. A cache eviction policy is an unrelated concept about discarded cache entries. This array-with-frequent-shifting pattern is exactly the kind of avoidable cost a reviewer flags once insertions and removals happen frequently in the middle of the sequence.
4 / 5
An incident report shows a feature that frequently inserts and removes elements in the middle of a sequence slowed down sharply as the sequence grew, because it stored the sequence in a plain array and paid the cost of shifting every later element on each change. What practice would prevent this?
Switching the sequence to a linked list eliminates the shifting cost entirely. Continuing to store the sequence in a plain array and shift every later element on each middle insertion or removal regardless of how large the sequence grows is exactly what caused the issue described in this incident. This linked-list approach is the standard fix once insertions and removals happen frequently in the middle of a growing sequence.
5 / 5
During a PR review, a teammate asks why the team reaches for a linked list instead of a plain array, given that an array supports direct index-based access to any element. What is the reasoning?
A linked list makes middle insertion and removal cheap by only updating a couple of neighboring pointers, but it gives up an array's constant-time indexed access entirely, since reaching the nth node still requires walking the list one pointer at a time from the start. This is exactly why a linked list is favored when middle insertion and removal dominate, while a plain array remains preferred when indexed access is the common operation.