首页 > 代码库 > 插入法

插入法

INSERTION SORT;

fork code:

1 for j=2 to A.length
2    key=A.[j]
3    //Insert A[j] into the sorted
4       sequence A[1...j-1].
5    i=j-1
6    while i>0 and A[i]>key
7       A[i+1]=key

  c code:

 

插入法