In a singularly linked list a dummy head cuts down the edge cases to check which reduces code. Is it similar for a circular, doubly linked list?
Circular/Doubly Linked Lists
Array Vs Linked list
Why aren't linked lists more popular?
Queue Implementation using Circular Array vs. using Linked List
Can you search for an element in a Circular Doubly Linked List?
What are the main components of a node in a Circular Doubly Linked List?
How do you delete a node from the end of a Circular Doubly Linked List?
Since we only worked with singly linked lists the past two weeks, I wanted to know how doubly linked lists would be structured. This led to the discovery of circular lists as well.
Singly linked lists, as we know, contains a data variable and the pointer object next. The two of them make up a node. The first node is the head node, and the last node is the tail node. To help compare with the other linked lists, it's important to note that singly linked lists end with tail->next (NULL).
Doubly linked lists are similar in structure, but instead of having only a pointer object next, there is now a pointer object prev. In the same way *next points to the next node, *prev points to the previous node. This makes our one-way connection into more of a two-way network. Interestingly, while *next of the tail node and the *prev of the head node both point to NULL, it's important to note that the two-way connection connects the head and tail nodes together, which is something that can't be done with singly linked lists.
Circular linked lists are more alike to singly linked lists, but instead of the tail->next pointing to NULL, it now points to the head node. The list is now circular, which creates a more streamlined connection between the head and tail nodes (especially since the tail and head nodes aren't directly linked in doubly linked lists).
A doubly circular linked list is the combination of all the other types of linked lists I just mentioned. Like doubly linked lists, there is the presence of both *next and *prev. Like circular linked lists, tail->next points to the head node. The one special feature of a doubly circular linked list is that head->prev points to the tail node.
This is a mere summary of the types of linked lists, and their basic structure/functionality. I don't yet know when one would be more advantageous than another. Perhaps if you were doing something sequential (like a metronome tick), a circular linked list would be best. What would be some real-world applications for these linked list types?
Check out the link below for greater detail into linked lists.
https://www.geeksforgeeks.org/cpp-linked-list/