Insertion sort:
- In insertion sort; in the first step, second element compares with first element and swapping them if required.
- In the second step, third element compares with first 2 elements to insert the element into its position.
- In the nth step, n-1 elements will be compared.

Code:
