Last Updated: 06 October, 2024 5 Mins
A Linked List is a linear data structure that consists of a collection of elements; each element in a linked list is called a Node. The node contains two parts: the first part contains data, and the second part contains the address of the next node.
There are mainly three types of linked lists in data structures as given below:
A Singly Linked List is a linear (ordered) data structure that contains a collection of elements, and each element is connected to its next element in a sequence.
Each element in a singly linked list is called a Node. The node consists of two fields: a data field and the reference field (address of the next node).
There is a HEAD pointer, which points to the first node of the singly linked list, and if the list is empty, then it stores NULL and the last node is called the Tail, and it stores NULL in the reference field (next).
A singly linked list can traverse only in the forward direction because each node contains the address of the next node.
A doubly linked list is a linear data structure; it is another form of Linked List.
A doubly linked list is a collection of seqential nodes (elements); each node consists of three fields: two pointer fields (references to the previous and to the next node in the sequence of nodes) and one data field.
A double linked list can be traversed in forward and backward directions because each node has two pointers, previous and next.
In the Doubly Linked List, each node consist of three parts:
A circular linked list is another type of linked list where the last node points to the first node of the list, creating a circular structure. Unlike a normal linked list, a circular linked list does not have a NULL pointer at the end.
As with other linked lists, circular linked lists can also grow or shrink dynamically as elements are added or removed.
That's all, guys. I hope this article is helpful for you.
Happy Learning... 😀
feedback@javabytechie.com