用Java语言实现的各种排序,包括插入排序、冒泡排序、选择排序、Shell排序、快速排序、归并排序、堆排序、SortUtil等。 LcZ|A;it
(9R;-3vY:S
插入排序: Gk]ZP31u
t{s*,X\b
package org.rut.util.algorithm.support; k!Q{u2
eR0$CTSw
import org.rut.util.algorithm.SortUtil; DD2K>1A1
/** .+,U9e:%
* @author treeroot Wy%FF\D.Y
* @since 2006-2-2 6$[7hlE
* @version 1.0 T*nP-b
*/ zz
/4 ()u
public class InsertSort implements SortUtil.Sort{ 3)yL#hXg)
vA}_x7}n(
/* (non-Javadoc) 4jt(tZS
* @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) mRa\ wEg%
*/ oKb"Ky@s
public void sort(int[] data) { -We9
FO~
int temp; L&