What is a sentinel node?
Sentinel nodes are specially designed nodes that do not hold or refer to any data of the doubly linked list (that data structure).
To make insertion and deletion operations in a doubly-linked list simple, we have to add one sentinel node at the beginning of the doubly linked list and one at the end of the doubly linked list, as shown in the below diagram.
As shown above, each node other than the sentinel nodes contains the pointer to the previous and next node along with data.
Doubly Linked List using Sentinel Nodes
In the case of the simple doubly linked list, if we have to perform the insertion or deletion operation at the starting of the doubly linked list, end of the doubly linked list, or in between the starting and end nodes for each, we require to check different condition that makes the algorithm complex so to solve this problem we can use doubly linked list along with the sentinel nodes.