First node have the address of last node and last node have the address of first node.
Real life example is train in which guard have the information of driver and Vice Versa.

A circular doubly linked list is a simple doubly linked list in which prev link of the first node points to the last node and the next link of the last node points back to the start node .
First node have the address of last node and last node have the address of first node.
Real life example is train in which guard have the information of driver and Vice Versa.
Step 1: Create the NEW_NODE using createnode()
NEW_NODE = createnode();
Step 2: If the linked list is empthy (START == NULL)
START = NEW_NODE
NEW_NODE-> NEXT = START
NEW_NODE ->PREV = START
Step 3: If the linked list is not empthy
NEW_NODE ->NEXT = START
NEW_NODE ->PREV = START ->PREV
START -> PREV -> NEXT = NEW_NODE
START -> PREV = NEW_NODE
Step 4 : Repeat Steps 1,2,3 'N' times
Step 5 : EXIT
Step 1: Create the NEW_NODE using createnode()
NEW_NODE = createnode();
Step 2: If the linked list is empthy (START == NULL)
START = NEW_NODE
NEW_NODE-> NEXT = START
NEW_NODE ->PREV = START
Step 3: If the linked list is not empthy
NEW_NODE ->PREV = START -> PREV
NEW_NODE -> NEXT = START
START -> PREV -> NEXT = NEW_NODE
START -> PREV = NEW_NODE
START = NEW_NODE
Step 4 : EXIT
Step 1: Create the NEW_NODE using createnode()
NEW_NODE = createnode();
Step 2: If the linked list is empthy (START == NULL)
START = NEW_NODE
NEW_NODE-> NEXT = START
NEW_NODE ->PREV = START
Step 3: If the linked list is not empthy
NEW_NODE -> PREV = START ->PREV
NEW_NODE -> NEXT = START
START -> PREV -> NEXT = NEW_NODE
START -> PREV = NEW_NODE
Step 4 : EXIT
0 Comment to "Circular Doubly Linked List- data Structures "
Post a Comment