python实现插入排序
python"> #coding: UTF-8 def arrage(temp_list): num = len(temp_list) for i in range(1,num): for j in range(i): if temp_list[i] >= temp_list[j] and j == (i-1): break elif temp_list[i] <= temp_list[j] and j == 0: temp_list.insert(0,temp_list.pop(i)) elif temp_list[i] <= temp_list[j+1] and temp_list[i] >= temp_list[j]: temp_list.insert((j+1),temp_list.pop(i)) def main(): temp_list = [2,3,6,5,15,4,7,6,34,23,1,24] arrage(temp_list) print temp_list main()