00:00

Advantages and Disadvantages of Singly Linked List

Last updated:

A singly linked list is the simplest linked structure, and its strengths and weaknesses both come from the same design choice: each node knows only the node after it. This page first recalls that structure and then weighs its advantages against its disadvantages.

What is Singly Linked List?

A singly linked list is a chain of nodes. Each node has a data field and a next reference to the following node. The list is reached through a head reference to the first node (null for an empty list), and the last node's next is null.

Singly linked list: head points to the first node, each node points to the next, and the last node points to null

Because the links point only forward, the list can be walked from the head towards the end but never backwards.

Advantages of Singly Linked List

  • No fixed capacity: nodes are created one at a time as values are added, so there is no initial size to choose and no array to resize and copy.

  • O(1) insertion and deletion at the head: only the head reference and one next link change; no other element moves.

  • O(1) insertion after a known node: once you hold a reference to a node, a new node can be linked in right after it without touching the rest of the list.

  • Smallest linked node: one reference per node, half the link overhead of a doubly linked list.

  • Natural building block: stacks, queues (with a tail reference), hash-table buckets and graph adjacency lists are easy to build on it.

Disadvantages of Singly Linked List

The single forward link also limits what the list can do efficiently:

  • No random access: reaching the k-th node means following k links from the head, O(k); binary search is therefore not practical.

  • No backward movement: deleting the last node, or the node before a given one, needs an O(n) walk to find the predecessor; printing in reverse needs recursion or a stack.

  • Extra memory per element: each value carries a reference and, in Java, an object header, so a list of small values uses several times the memory of an array.

  • Poor cache locality: nodes are scattered in memory, so traversal is slower in practice than looping over an array.

  • Easy to lose nodes: overwriting a next link in the wrong order cuts off the rest of the list. In Java the cut-off nodes are reclaimed by the garbage collector once nothing refers to them; in C or C++ they would also have to be freed by hand.