/* */
def insertion_sort(list):
# Start at the second element (pos 1).
# Use this element to insert into the
# list.
for keyPos in range(1, len(list)):
# Get the value of the element to insert
keyValue = list[keyPos]
# Scan to the left
scanPos = keyPos - 1
# Loop each element, moving them up until
# we reach the position the
while (scanPos >=0) and (list[scanPos] > keyValue):
list[scanPos+1] = list[scanPos]
scanPos = scanPos - 1
# Everything's been moved out of the way, insert
# the key into the correct location
list[scanPos+1] = keyValue