What is a Linked List ?

A linked list is a linear data structure where each element is known as a node. A node is consist of a pointer and an object. The pointer is pointing to the next node in the list and the object represent the value of the node. There is also a head which is pointing to the start of the Linked List. Following diagram is an example of a Linked List.

Advantage:

1. One disadvantage of using arrays to store data is that arrays are static structures and therefore cannot be easily extended or reduced to fit the data set. Arrays are  also expensive to maintain new insertions and deletions.

2. A linked list is a dynamic data structure. The number of nodes in a list is not fixed and can grow and shrink on demand. Any application which has to deal with an unknown number of objects will need to use a linked list.

Disadvantage:

1. One disadvantage of a linked list against an array is that it does not allow direct access to the individual elements. If you want to access a particular item then you have to start at the head and follow the references until you get to that item.

2. One more disadvantage is that it used extra memory Next Pointers.

Use of Linked List :

1. The cache in your browser that allows you to hit the BACK button (a linked list of URLs)
2. Undo functionality in Photoshop or Word (a linked list of state)
3. A stack, hash table, and binary tree can be implemented using a doubly linked list.

Linked List can be of three Types.

1. Singly Linked List (One way)
2. Doubly Linked List. (Two way)
3. Circular Linked List(Last node will point the first node)

Algorithm 12

FOLLOW US ON LinkedIn



Explore Tutu'rself