#!/usr/bin/python
#Copyleft (C) 1996 William Totten
#biell@udel.edu

#This library implements the insertion sort method of sorting lists

def insort(list):
	N=len(list)

	for i in xrange(1,N):
		tmp=list[i]
		j=i
		while(j>0 and tmp<list[j-1]):
			list[j]=list[j-1]
			j=j-1
		list[j]=tmp

	return list

if __name__ == '__main__':
	from posix import times
	list=[23,90,34,56,78,11,1,9,87,142,984,128,842,724,83,29,88,66,9]
	print list
	t=times()[0]
	print insort(list), "\nUser Time: ", times()[0] - t
