data structures using inserting new node in circular doubly linked list in this sectionwe will see how new node is added into an already existing circular doubly linked list we will take two cases and then see how insertion is done in each case rest of the cases are similar to that given for doubly linked lists case the new node is inserted at the beginning case the new node is inserted at the end inserting node at the beginning of circular doubly linked list consider the circular doubly linked list shown in fig suppose we want to add new node with data as the first node of the list thenthe following changes will be done in the linked list start allocate memory for the new node and initialize its data part to take pointer variable ptr that points to the first node of the list start,ptr move ptr so that it now points to the last node of the list insert the new node in between ptr and the start node ptr start start will now point to the new node start figure inserting new node at the beginning of circular doubly linked list figure shows the algorithm to insert step if avail null write overflow new node at the beginning of circular doubly go to step linked list in step we first check whether [end of ifmemory is available for the new node if the free step set new_node avail step set avail avail -next memory has exhaustedthen an overflow message step set new_node -data val is printed otherwisewe allocate space for the step set ptr start new node set its data part with the given val and step repeat step while ptr -next !start its next part is initialized with the address of the step set ptr ptr -next [end of loopfirst node of the listwhich is stored in start step set ptr -next new_node now since the new node is added as the first node step set new_node -prev ptr of the listit will now be known as the start nodestep set new_node -next start that isthe start pointer variable will now hold step set start -prev new_node step set start new_node the address of new_node since it is circular step exit doubly linked listthe prev field of the new_node figure algorithm to insert new node at the beginning is set to contain the address of the last node