标签:style blog color for div log sp on 时间
def insert_sort(old): for i in range(1, len(old)): for j in range(i, 0, -1): if(old[j] < old[j-1]): tmp = old[j] old[j] = old[j-1] old[j-1] = tmp # test case old = [2, 5, 3, 0, 2, 3, 0, 3] insert_sort(old) print old
插入排序的时间复杂度O(N^2)
标签:style blog color for div log sp on 时间
原文地址:http://www.cnblogs.com/ruccsbingo/p/3947755.html