A simple sorting algorithm which moves elements one at a time into the correct position, moving higher ranked elements up as necessary. It repeats until no input elements remain.
sudo code for algorithm
for i = 1 to n - 1 //loops over the index of the entry to be inserted
j = i
while j > 0 and A[j] < A[j - 1] // while loop performs the insertion
swap(A[j], A[j - 1}) //swaps the element before as long as it is less
j = j - 1
Good
Bad
Good