INSERTION 
IN 
CIRCULAR DOUBLY 
LINKED LIST 
BY 
Roshan Chaudhary
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.
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.
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.
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.
Thank you

Doubly circular linked list

  • 1.
    INSERTION IN CIRCULARDOUBLY LINKED LIST BY Roshan Chaudhary
  • 2.
    CIRCULAR DOUBLY LINKEDLIST • 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 fromany 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.
  • 6.