Data structures from scratch- Bot-up series #14[Illustrations of Insertion/Deletion operations II]

Understanding basic operations through illustrations

Today we will see a linked list

Say we stored ‘RONALDO’ in a Linked List


Insertion at first which means we missed ‘R’ in ‘RONALDO’

Notice we just changed the pointer link of ‘R’ to ‘O’ address

There are no further operations like shifting all the elements to the right because of no indexing for ‘Linked Lists’.

Insertion at the middle which means we missed ‘A’ in ‘RONALDO’.



Notice only link or pointer changes to different memory locations. That too previous and next link.

Inserting at last position — Missing ‘O’ in RONALDO


Since ‘O’ is the last element, we made ‘D’ pointing to ‘O’ and ‘O’ pointing to ‘null’

The same is the case with the ‘Deletion’ operation but opposite.

No matter where the insertion or deletion is(i.e First, middle or last), the Linked list concerns only the previous and next link.

Therefore time consumed for this operation is less and constant and it is always the best-case scenario.

Therefore for Insertion and deletion operations, linked lists serves best