Introduction
Linked List is a linear data structure (Abstract Data Type) just like arrays. Unlike arrays, linked list elements are not stored at contiguous location; the elements are linked using pointers.
Below is a pictorial representation of linked List.

Within the list, a 'node' is a structure comprising fields that store data, with addition of a 'link' field to the location of the next record. Each record is created dynamically as and when required. The location of the first record is held in a variable which points to head or start of the list. The end of the list is normally marked by a special null value in the final link field. Exception in case of Circular Linked List. We will discuss this as a whole in separate topic.
So Why Linked List and not Arrays?
Linked List is a linear data structure (Abstract Data Type) just like arrays. Unlike arrays, linked list elements are not stored at contiguous location; the elements are linked using pointers.
Below is a pictorial representation of linked List.
Within the list, a 'node' is a structure comprising fields that store data, with addition of a 'link' field to the location of the next record. Each record is created dynamically as and when required. The location of the first record is held in a variable which points to head or start of the list. The end of the list is normally marked by a special null value in the final link field. Exception in case of Circular Linked List. We will discuss this as a whole in separate topic.
So Why Linked List and not Arrays?
- Linked List size is not fixed like array. We need not worry for exception like IndexOutOfBoundException while using Linked List as its dynamic in nature.
- Addition and Insertion is costly for arrays as we have to move all the elements in both case. In case of List we can add or remove an element at ease using links.
Drawbacks
Can't access elements randomly, Have to access in a sequential manner.
Extra memory space required for the link field.
Hope you like it.
Happy Learning !!!
0 comments :
Post a Comment