Skip to content

Dummy node [mp]

Micro pattern

Description

Place a stable node before a changing list head so pointer operations do not need a special head case.

Problems

Construct a result list

Append or insert nodes after a dummy while retaining the result head.

Simplify deletion of the head

Start traversal at a dummy so the removed node always has a predecessor.

Delimit both ends

Use two dummy nodes to remove empty-list and end-point special cases.