02 / 16

What is a Sentinel Node/Dummy Node? Why is it useful?

Sentinel or Dummy Nodes

javascript
  1. 1

    It reduces conditional logic for head insertion and deletion.

  2. 2

    It makes merging linked lists easier.

  3. 3

    It simplifies removing a node after a known predecessor.

  4. 4

    The sentinel is not considered part of the logical data.

  5. 5

    It can make code easier to prove correct because boundary cases become ordinary cases.

Difficulty: 2/10

Follow-up Questions

  • How does a dummy node simplify list merging?
  • Can a sentinel be used at both ends of a doubly linked list?