标签:range 插入排序 log elf self turn code int div
class insertSort: def insert(self,arr): for i in range(1,len(arr)): for t in range(i): if arr[t] <= arr[i]: self.move(arr,t,i) return arr def move(self, arr, t, i): current = 0 previous = 0 for y in range(t,i+1): current = arr[y] arr[y] = previous previous = current arr[t] = previous example = [0,-1,0,-1,0,3, 2, 3, 4, 4345, 6, 557, 2, 8768, 7, 0, 8, 435, 3, 3, 1] obj = insertSort() print obj.insert(example)
练手ing
标签:range 插入排序 log elf self turn code int div
原文地址:http://www.cnblogs.com/weihuan098/p/7745150.html