← Algo Playground
DATA STRUCTURES · NODES & POINTERS

Each node knows what comes next.

Follow the links. Insert a new neighbor. Reconnect the chain. See how a singly linked list works.

THE NODE CHAIN

Value + next pointer

Singly linked · up to 24 nodes

HEAD is where traversal starts. TAIL is the last node; its next pointer is null. Scroll horizontally for longer lists.

NodeCurrent / predecessorUpdated linkResult
POINTER UPDATEhead → N1 · tail → N3

Values live inside nodes. The next reference connects one node to another.

Ready

Try inserting 25 at index 1, then trace the updated chain.

TRAVERSAL / SEARCH OUTPUT
Run a search or traversal to follow the links.
SIZE0 nodes
HEADnull
TAILnull
NODES VISITED0
OPERATION TRACE

Follow the pointer changes.

  1. Your next operation will appear here.
WHY A LINKED LIST?

Change the links, not every value.

Nodes do not need contiguous memory. This diagram places them in a row for readability; N1, N2, and so on are illustrative IDs, not memory addresses.

Prepend: point the new node at the old head, then move head. O(1).

Append: use the stored tail to attach a node. O(1).

Insert/delete by index: follow links to the predecessor, then reconnect. O(n) overall; changing the links is O(1).

Search/traverse: follow next from head. O(n). There is no direct array-style indexing; deleting the tail still needs its predecessor.