插入排序: package org.rut.util.algorithm.support; import org.rut.util.algorithm.SortUtil; /** * @author treeroot * @since 2006-2-2 * @version 1.0 */ public class InsertSort implements SortUtil.Sort{ /* (non-javadoc) * @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) */ public void sort(int[] data) { int temp; for(int i=1;i0)&&(data[j]i;j--){ ...
public class Sort2 { //交换排序之--最简单的冒泡排序法 public static void BubbleSort(int[] a) { int i,j,temp; int n = a.length; for(i=0;ia[j]) { temp = a; a = a[j]; a[j] = temp; } } } } //插入排序-- 直接插入排序 public static void InsertSort(int[] a) { ...
插入排序: package org.rut.util.algorithm.support; import org.rut.util.algorithm.SortUtil; /** * @author treeroot * @since 2006-2-2 * @version 1.0 */ public class InsertSort implements SortUtil.Sort{ /* (non-javadoc) * @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) */ public void sort(int[] data) { int temp; for(int i=1;i0)&&(data[j]i;j--){ ...
权当复习,以备引用(理论来源于: http://www.zsqz.com/jsbase/Suanfa/index.html?defination.htm ,感谢该网站。java源码为我-- 流星絮语 所写) 1、冒泡排序 Bubble Sort 最简单的排序方法是冒泡排序方法。这种方法的基本思想是,将待排序的元素看作是竖着排列的“气泡”,较小的元素比较轻,从而要往上浮。在冒泡排序算法中我们要对这个“气泡”序列处理若干遍。所谓一遍处理,就是自底向上检查一遍这个序列,并时刻注意两个...
经常我们会用到一些排序算法,下面是用java的实现 package jt.test; public class SortUtil { /** * 交换数组中i和j的位置 * * @param array * @param i * @param j */ private static void swap(int[] array, int i, int j) { int tmp = array; array = array[j]; array[j] = tmp; } private static boolean lt(int x, int y) { return x ...
插入排序: package org.rut.util.algorithm.support; import org.rut.util.algorithm.SortUtil; /** * @author treeroot * @since 2006-2-2 * @version 1.0 */ public class InsertSort implements SortUtil.Sort{ /* (non-javadoc) * @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) */ public void sort(int[] data) { int temp; for(int i=1;i0)&&(data[j] } 冒泡排序: package...
插入排序: package org.rut.util.algorithm.support; import org.rut.util.algorithm.SortUtil; /** * @author treeroot * @since 2006-2-2 * @version 1.0 */ public class InsertSort implements SortUtil.Sort{ /* (non-javadoc) * @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) */ public void sort(int[] data) { int temp; for(int i=1;i0)&&(data[j] } 冒泡排序: package ...
java 爱好者 爱好java 关注开源 java资料大全 我的小窝 在线音乐 全部分类 | General | OpenSource | java | Life | Person « Matisse GroupLayout has been i... | Weblog | IBM releases User Interface He... » 星期四 2006年03月23日 各种排序算法java实现 zz 各种排序算法java实现 插入排序: package org.rut.util.algorithm.support; import org.rut.util.algorithm.SortUtil; /** ...
插入排序: package org.rut.util.algorithm.support; import org.rut.util.algorithm.SortUtil; /** * @author treeroot * @since 2006-2-2 * @version 1.0 */ public class InsertSort implements SortUtil.Sort{ /* (non-javadoc) * @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) */ public void sort(int[] data) { int temp; for(int i=1;i0)&&(data[j]i;j--){ ...
[code] /**
2 *
3 * @author yuzhiping
4 * @version 1.0
5 * 功能说明:计算机领域经典的算法
6 *
7 */
8 public class sortAlgorithm