LOGBOOK

HELP

Quiz Entry - updated: 2026.09.29

What is a singly-linked list, and what does each node store?

A chain of nodes where each node holds one element and a reference to the next node; the last node points to null, and the list keeps a reference to the first node (the head) as its entry point.

A node is a tiny object with exactly two fields:

public class Node {
  private Element element;   // the content
  private Node next;         // the following node, or null at the end
}

The order of the list is not given by memory positions, as in an array, but by these next references: to get from element A to D you follow A → B → C → D. Because nothing is stored in a contiguous block, the nodes can live anywhere in memory, and inserting a node only means rewiring references, never shifting other elements.

The list object itself stores the head (and often also the tail, the last node). The head is indispensable: it is the only way into the chain. Lose the head and the whole list is unreachable.

The price of this flexibility: there is no way to jump to "element number 500". You have to start at the head and follow 499 references, which is why indexed access on a linked list is $O(n)$.

Go deeper:

  • doc Linked list — singly, doubly and circular variants, with the trade-offs against arrays.
  • tool VisuAlgo — Linked List — animate insert and remove on singly- and doubly-linked lists step by step.

From Quiz: ADS / Linear Data Structures: Lists, Stacks, Queues, Deques, Iterators | Updated: Sep 29, 2026