用Java语言实现的各种排序,包括插入排序、冒泡排序、选择排序、Shell排序、快速排序、归并排序、堆排序、SortUtil等。 6$#,$a O
Jk{SlH3'
插入排序: Gd!_9S`68
km>ZhsqD
package org.rut.util.algorithm.support; /Ey%aA4v
QXj #Brp
import org.rut.util.algorithm.SortUtil; ~{DJ,(N"n
/**
n\9IRuYO
* @author treeroot l_k:OZ
* @since 2006-2-2 XY)X-K$
* @version 1.0 W,8Uu1X =
*/ a[;L+
public class InsertSort implements SortUtil.Sort{ W.
d',4)
[fCnq
/* (non-Javadoc) t<Sa;[+
* @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) 0SD'&
*/ Xf ^_y(?
public void sort(int[] data) { ttr`
int temp; &SIf