We can define a LinkedList as a data structure that's linear in nature and all of the elements establish a link to their next element. These are few properties we can find in a LinkedList:
- Along with a value, each element in a LinkedList is responsible for holding the reference of the next element.
- As all elements hold multiple things in them, generally they're all objects and are called node instead of the element.
- The first node is called the head of the LinkedList.
- The last node has a null reference as there's no next node.
- All nodes in a LinkedList aren't stored in a contiguous memory location.
Based on the technique used to link the nodes of a LinkedList, we can categorize them into the following types:
- Singly Linked List
- Doubly Linked List
- Circular Linked List
Let's explore each of these types in detail.
...