python
def insertSort(list): for i in range(1,len(list)): j = i-1 temp = list[i] while (j>=0) & (temp < list[j]): list[j+1] = list[j] j = j-1 list[j+1]=temp return list list = [6,2,7,4,3] print insertSort(list) #[2, 3, 4, 6, 7]
标签:pytho pos turn sort amp style gpo span col
python
def insertSort(list): for i in range(1,len(list)): j = i-1 temp = list[i] while (j>=0) & (temp < list[j]): list[j+1] = list[j] j = j-1 list[j+1]=temp return list list = [6,2,7,4,3] print insertSort(list) #[2, 3, 4, 6, 7]
标签:pytho pos turn sort amp style gpo span col
原文地址:https://www.cnblogs.com/Jomini/p/8615902.html