用Java语言实现的各种排序,包括插入排序、冒泡排序、选择排序、Shell排序、快速排序、归并排序、堆排序、SortUtil等。 pm2-F]
?L K
n
插入排序: -|z
]Ir
KU]co4]8^s
package org.rut.util.algorithm.support; Za[?CA
0o2*X|i(
import org.rut.util.algorithm.SortUtil; ;2#9q9(
/** J&P{7a
* @author treeroot BE0Ov{'
* @since 2006-2-2 t`M4@1S"'
* @version 1.0 {^J/S}L]
*/ V /.Na(C~
public class InsertSort implements SortUtil.Sort{ 1iA0+Ex(j
XAb%V'
/* (non-Javadoc) i2+r#Hw#5R
* @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) ;C^!T
*/ .j
et0w
public void sort(int[] data) { M&Q