**Circular Single Linked List of Data Structure:**

*It is just a single linked list in which the link field of the last node points back to the address of the first node. A circular linked list has no beginning and no end. It is necessary to establish a special pointer called start pointer always pointing to the first node of the list. Circular linked lists are frequently used instead of the ordinary linked list because many operations are much easier to implement. In circular linked list no null pointers are used, hence all pointers contain a valid address.*

*The basic operations in a circular singly linked list are:*

*a. Creation.*

*c. Deletion.*

*d. Traversing.*

**Creating a circular single Linked List with ‘n’ number of nodes:***The following steps are to be followed to create 'n' number of nodes:*

*a. Get the new node using getnode().*

*newnode = getnode();*

*b. If the list is empty, assign new node as start.*

*start = newnode;*

*c. If the list is not empty, follow the steps given below:*

*temp = start;*

*while(temp -> next != NULL)*

*temp = temp -> next;*

*temp -> next = newnode;*

*Repeat the above steps 'n' times.*

*newnode -> next = start;*

**Inserting a node at the beginning of the**

**Circular Single Linked List**

**:***The following steps are to be followed to insert a new node at the beginning of the circular list:*

*a. Get the new node using getnode().*

*newnode = getnode();*

*b. If the list is empty, assign new node as start.*

*start = newnode;*

*newnode -> next = start;*

*c. If the list is not empty, follow the steps given below:*

*last = start;*

*while(last -> next != start)*

*last = last -> next;*

*newnode -> next = start;*

*start = newnode;*

*last -> next = start;*

**Inserting a node at the end**

**of the**

**Circular Single Linked List**

**:***The following steps are followed to insert a new node at the end of the list:*

*a. Get the new node using getnode().*

*newnode = getnode();*

*b. If the list is empty, assign new node as start.*

*start = newnode;*

*newnode -> next = start;*

*c. If the list is not empty follow the steps given below:*

*temp = start;*

*while(temp -> next != start)*

*temp = temp -> next;*

*temp -> next = newnode;*

*newnode -> next = start;*

**Deleting a node at the beginning**

**of the**

**Circular Single Linked List**

**:***The following steps are followed, to delete a node at the beginning of the list:*

*a. If the list is empty, display a message 'Empty List'.*

*b. If the list is not empty, follow the steps given below:*

*last = temp = start;*

*while(last -> next != start)*

*last = last -> next;*

*start = start -> next;*

*last -> next = start;*

*c. After deleting the node, if the list is empty then start = NULL.*

**Deleting a node at the end**

**of the**

**Circular Single Linked List**

**:***The following steps are followed to delete a node at the end of the list:*

*a. If the list is empty, display a message 'Empty List'.*

*b. If the list is not empty, follow the steps given below:*

*temp = start;*

*prev = start;*

*while(temp -> next != start)*

*{*

*prev = temp;*

*temp = temp -> next;*

*}*

*prev -> next = start;*

*c. After deleting the node, if the list is empty then start = NULL.*

**Thanks**

**Mukesh Rajput**
## Post A Comment:

## 0 comments:

Thanks

Mukesh Rajput