Nov 6, 2014

Insertion Sort :

            In general ,sorting means arranging the numbers (or characters ) either in Ascending order Or Descending order. Most of the operations like searching,deleting becomes much easier with the help of sorting.We have different types of sorting and Insertion Sort is one among them.

                From the name itself u have observed one thing  "INSERTION" that means inserting a value in between the elements.Let me explain it with an example.

As there are two for loops ,The time complexity is O(n^2) for any case.

The code for insertion sort :


The working is explained in slides (the link available below)