2. CIRCULAR DOUBLY LINKED LIST
• Doubly Circular linked list has both the properties of doubly
linked list and circular linked list.
• Two consecutive elements are linked by previous and next
pointer and the last node points to first node by next pointer
and also the previous pointer of the head node points to the
tail node.
3. Node traversal from any direction is possible and also
jumping from head to tail or from tail to head is only one
operation: head pointer previous is tail and also tail pointer
next is head.
4. INSERTING A NODE
function insertAfter(Node node, Node newNode)
newNode.next = node.next
newNode.prev = node
node.next.prev = newNode
node.next = newNode
This simple function inserts a node into a doubly-linked
circularly linked list after a given element.
5. INSERTING A NODE (CONT.)
function insertEnd(List list, Node node)
if list.lastNode == null
node.prev := node
node.next := node
else
insertAfter(list.lastNode, node)
list.lastNode := node
To insert at the beginning.