CIRCULAR LINKED LIST
TEAM MEMBERS:
SAKTHIVEL
AKSHAY
SHERIN ZEBIAH
RITHIKA
NAVEEN KUMAR
INTRODUCTION
Circular linked list is a linked list where all nodes are connected to
form a circle.
There is no NULL at the end.
A circular linked list can be as follows:
1. Singly circular linked list
2. Doubly circular linked list
NODE PARAMETERS
For Singly linked list,
we need two parameters. 1. Data
2. Address of next node
NODE PARAMETERS
For doubly linked list,
three parameters that are. 1. Data
2. Forward pointer
3. Backward pointer
Circular Doubly Linked List
Circular Doubly Linked List has properties of both doubly linked list
and circular linked list
Two consecutive elements are linked or connected by previous and
next pointer and the last node points to first node by next pointer
and also the first node points to last node by previous pointer.
Notations
Circular Doubly Linked List notation is as follows;
struct node // Structure of the node
{
int data;
struct node *next; // Pointer to next node
struct node *prev; // Pointer to previous node
};
Traversal
In a conventional linked list, we traverse the list from the head node
and stop the traversal when we reach NULL.
In a circular linked list, we stop traversal when we reach the first
node again.
Following is C code for linked list traversal.
Traversal Implementation
Insertion
Insertion at the end of list or in an empty list
Insertion at the beginning of the list
Insertion in between the nodes of the list
Example program
Insertion in between the nodes of the list;
Deletion
Deletion at the end of list
Deletion at the beginning of the list
Deletion in between the nodes of the list
Deletion at Middle
Thank you