LinkedList is a linear data structure like arrays. In a Linked List each element is actually a separate object linked to the next element using a reference stored in a pointer.
A Linked List is composed of nodes, which are connected to the next node, using memory references or addresses. A Linked List node usually contains 2 properties stored in it. They are:
- The value to be stored in the current node.
- The reference or address of the next node, or NULL if it is the last node.
Linked Lists are of 2 types usually:
- Singly Linked Lists: They are the standard linked list, where the value of the current node and the reference of the next node is only stored. The reference stored in the last node of the list is NULL.
- Doubly Linked Lists: This type of linked list stores all the information of the Singly Linked Lists, along with the reference or memory address of the previous node too if it exists, else NULL.