Circular Linked List
In singly linked lists and doubly linked lists, the end of lists are indicated with NULL value. But circular linked lists do not have ends. That means circular linked list is similar to the single linked list except that the last node points to the first node in the list. While traversing the circular linked lists we should be careful; otherwise we will be traversing the list infinitely.
- Circular Doubly Linked Lists are used for implementation of advanced data structures like Fibonacci Heap.
- Entire list can be traversed from any node.
- Despite of being singly circular linked list we can easily traverse to its previous node, which is not possible in singly linked list.
- Circular list are complex as compared to singly linked lists.
- Reversing of circular list is a complex as compared to singly or doubly lists.
- If not traversed carefully, then we could end up in an infinite loop.
- Like singly and doubly lists circular linked lists also doesn’t supports direct accessing of elements.
Applications/Uses of Circular linked list in real life
- Circular lists are used in applications where the entire list is accessed one-by-one in a loop. Example: Operating systems may use it to switch between various running applications in a circular loop.
- It is also used by Operating system to share time for different users, generally uses Round-Robin time sharing mechanism.
- Multiplayer games uses circular list to swap between players in a loop.