My implementation of the insertion sort algorithm


Insertion Sort sorts an array by using pivots. It first starts by selecting an initial slot and saves it as a pivot, then it checks the next slot and compares it to the initial slot.
If the initial slot is greater than the next slot, then the initial slot will shift and that other slot (or pivot) will be inserted in the initial slot's original place.
This repeats till the whole array is sorted.
Worst case scenario is when the array is reversed, given a complexity of O(n^2).
Best case scenario is when the array is already sorted, given a complexity of O(n).