2. INSERTION SORT
• Complexity of Insertion sort is also N 2
like bubble sort. It
assumes that the first element is sorted and then tries to
put second element in place with respect to first. Then
first two are sorted and third element is placed either
before first or in middle of first and second or after second
element depending on the relation that a[3] is more of
less than a[2] and a[1]. And so on for all the elments.
• Insertion sort is so called because we insert the element in
its proper position in the first part of the array.