Circular Linked List

A linked list (singly or doubly) in which starting from a given node we can reach all the nodes and comeback to the node we started i.e a linked list in which all nodes form a circle is called a circular linked list.

A Pictorial Representation :


A circular linked list has the following operations associated with it:
  1. Insertion in an empty
  2. Insertion at the beginning of the list
  3. insertion at end of the list
  4. insertion between the list
Here we will take a head pointer to point of starting of our list:


Problems :
  1. Cycle Detection
  2. Remove Friends ( HackerEarth )
  3. Reversed Linked List ( HackerEarth )
  4. Implement circular linked list for doubly linked list

We use a circular linked list whenever we have to go through the data of the list repeatedly such as an operating system using a list to do a set of operations by CPU.

If there is an error or want to discuss your approach, then please feel free to drop in the comment section.

Thank You

Comments