A linked list is preferred over arrays when

2026

A linked list is preferred over arrays when

  1. A.

    Fast indexing is needed

  2. B.

    Frequent insertion and deletion occur

  3. C.

    Memory is static

  4. D.

    Elements are uniform

Attempted by 1 students.

Show answer & explanation

Correct answer: B

Concept: An array stores its elements in one contiguous block of memory, so every element sits at a fixed, computable offset from the start of the block. A linked list instead stores each element in its own separately-allocated node, connected only by a pointer to the next node, with no requirement that nodes sit next to each other in memory. This one structural difference is what makes each data structure cheap at different operations.

Application:

  1. Because array elements are contiguous, reading the element at position k is a single address computation (base address + k times element size), which takes constant time regardless of array size. But inserting or removing an element in the middle of an array forces every following element to be shifted over by one slot to keep the block contiguous, which takes time proportional to the number of elements that follow.

  2. Because linked-list nodes are connected only by pointers, inserting a new node right after a node you already have a reference to means creating the node and relinking two pointers — a fixed, constant amount of work no matter how long the list is. Deleting a node is likewise just bypassing it with a pointer update, with no other node touched.

  3. Applying this to the four listed conditions: repeated insertion and removal at various positions — the operation that is expensive for an array and cheap for a linked list — is exactly the condition under which a linked list is the preferred structure.

Cross-check — why the other conditions do not point to a linked list:

  • Fast indexing is needed: retrieving an element by position relies on a direct offset computation, which contiguous array storage supports in constant time; a linked list has no such offset and must be walked node by node from the head, so this condition does not call for a linked list.

  • Memory is static: a storage size that is fixed once and does not change is the array's allocation model; it describes upfront, unchanging memory, not a reason to favor a structure whose nodes are instead allocated one at a time as needed.

  • Elements are uniform: every element being the same type and size is what lets an array compute a single fixed per-element stride for its offset formula; it says nothing about how costly insertion or deletion is, so on its own it gives no reason to prefer a linked list.

Result: the condition that makes a linked list preferable over an array is frequent insertion and deletion.

Explore the full course: Niacl Ao It Specialist

Loading lesson…