Linked List Data Structure




Linked List is a linear data structure similar to arrays where elements are not stored in contagious memory locations. Linked List consists of nodes while each node have at least two fields, data & reference to next node.

A linked list can be visualized as:

The first node of the list is called head node and we only have information about the head. Simply, to access the value of the third element in the list, we will find the pointer to which head is pointing i.e. second the node then we will look for the pointer stored in the second node, which will be pointing to the third node and that's how we can access the third node in the list and hence its value.

Properties:

1. In a linked list (LL), nodes are not necessarily stored in contagious memory locations.
2.Array have fixed size while LL have a dynamic size.
3.Insertion opertation in LL don't require shifting of other elements like in arrays.
4.We cannot directly select any elementin LL.
5.There is no memory wastage in due to exact number of nodes as elements in LL.

Insertion in Linked List

To insert a node in a list follow two steps:
Let's say we want to insert node B between A and C
1. point B's pointer to C
2. point A's pointer to B


Deletion in Linked List

To delete a node in a list follow two steps:
Let's say we want to delete node B between A and C
1. point A's pointer to C
2. release the memory of node B

Modifications of Linked Lists

The above linked list is a singly linked list.
Other types are:
1. Doubly Linked List
2. Circular Linked List
3. Doubly Circular Linked List
Each type of linked list is suitable for different purposes.

Need more Information?
Click here for YouTube Channel
Very Easy! Follow my video lectures on YouTube Channel link and keep reading my blog here for more information. In the video lectures, I have explained all the basic and minor details. The same content will be posted on this website if you like reading more than watching.