There are two sections in the list being sorted as below.
Insertion sort keeps a sorted section at the beginning of the list.
It takes the next item from the unsorted section — the one at
index i —
and inserts it where it belongs in the sorted section,
increasing the
size of the sorted section by one.
It works by finding out where L[b]
belongs and then moving it
into the sorted section L[:i+1]
.
Insertion Sort Coding