Linked Lists
Linked List
Linked list is a linear Data structure. It is also a collection of more than one data items of a disimilar data type like array but it can not stored it in contiguous memory location. It can be stored randomly in a main memory.
So that linkedlist contains two part: one for Data and second part for the Address of the next data element.
Types of linked list
1. Singly Linked List:
A singly linked list is a linear data structure where each element (node) contains a data part and a pointer to the next node in the sequence. The last node points to NULL.
2. Doubly Linked List:
A doubly linked list contains nodes with three fields: a data part, a pointer to the next node, and a pointer to the previous node. This allows traversal in both directions.
3. Circular Linked List:
In a circular linked list, the last node points back to the first node, forming a circle. It can be singly or doubly linked. There is no NULL reference in the last node.
4. Doubly Circular Linked List:
A doubly circular linked list is a combination of a doubly linked list and a circular linked list. Each node points to both its previous and next node, and the last node links back to the first and vice versa.