Singly Linked List is a linear and dynamic data structure. It stores elements at non-contiguous memory locations.
It consists of a group of nodes in a sequence and each node has two fields, one contains data and the other contains the address of the next node.
The linked list does not allow direct access to the element. To access any particular element you have to start at the head and traverses each node until you get to that particular item.
The disadvantage of a linked list over an array is, it uses an extra 4 bytes (on 32-bit CPU) memory as compared to an array to store a reference to the next node.
In the linked list each element is considered as a separate object.
Advantage of Linked Lists
- It is dynamic. It allocates memory when required.
- It can easily implement Insertion and deletion operations.
- It reduces access time.
Disadvantages of Linked Lists
- Memory is wasted because the Linked List requires extra memory to store.
- It cannot access elements randomly.
- It is very difficult to perform Reverse Traversing.
Applications of Linked Lists
Graphs, queues, and stacks can be implemented by using Linked List.