import random
list_a = []
for i in range(5):
list_a.append(random.randint(0, 100))
print list_a
for j in range(0, len(list_a)):
key = list_a[j]
print key
i = j-1
while i>=0 and list_a[i]>key:
list_a[i+1] = list_a[i]
i = i-1
list_a[i+1] = key
print list_a
print list_a
从头到尾扒一下算法导论。