Python 实现的插入法排序代码
#-*- coding: utf-8 -*- # the insertation sort # 2012-07-29 noon a = [3, 2, 4, 1, 5, 4, 2, 3, 6, 5, 7, 4, 1, 0] for j in range(1, len(a)): i = 0 while a[j] > a[i]: i = i + 1 m = a[j] for k in range(j-i): a[j-k] = a[j-k-1] a[i] = m print a