用Java语言实现的各种排序,包括插入排序、冒泡排序、选择排序、Shell排序、快速排序、归并排序、堆排序、SortUtil等。 se(_`a/4Q
插入排序: A
u(Ng q
U24?+/5D]
package org.rut.util.algorithm.support; xT=|Uc0
neOR/]
import org.rut.util.algorithm.SortUtil; 9Y-s],2V
/** 0~^opNR
* @author treeroot [nflQW6
* @since 2006-2-2 =zI
eZ7
* @version 1.0 nDaQ1
*/ "3}Bv
X
public class InsertSort implements SortUtil.Sort{ *4+;Ey
x~Pv
/* (non-Javadoc) ^WM)UZEBC
* @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) %]
*/ 8tPq5i
public void sort(int[] data) { Q=w\)qJ
int temp; x{&