What is Insertion Sort? Insertion sort is one of the simplest sorting algorithm. It breaks the input into sorted and unsorted list, picks next element from unsorted list and puts it into right place in sorted list.
Let’s break this down into concrete steps -
iterate over the array n - 1 times that is from index 1 to n-1 in each iteration let’s say i, pick i+1th element and put it into existing sorted list [0, i] such that the resultant list [0, i+1] is also sorted Implementation Let’s create a new directory inside $GOPATH/src.