用Java语言实现的各种排序,包括插入排序、冒泡排序、选择排序、Shell排序、快速排序、归并排序、堆排序、SortUtil等。 9bxBm
TB@0j
;g
插入排序: |RA|nu
dHUcu@,
package org.rut.util.algorithm.support; : =J^ "c
=rB=! ;
import org.rut.util.algorithm.SortUtil; Cr a@
/** |_A DG
* @author treeroot RY4b<i3
* @since 2006-2-2 }nO[;2Na
* @version 1.0 it\U+xu
*/ z/Kjz$l!
public class InsertSort implements SortUtil.Sort{ 7F;dLd'
0)^$9Z
/* (non-Javadoc) T]fBVA
* @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) Ug1[pONk
*/ XoZw8cY
public void sort(int[] data) { dm+}nQI\
int temp; s&