您的位置:首页 > 其它

直接插入排序(内部排序)

2015-03-01 22:38 225 查看
package com.trfizeng.test;

import com.trfizeng.insertionsort.StraightInsertionSort;

/**
* 测试类
*
* @author trfizeng
*
*/
public class SortTest {
// 待排序数组
static int[] array = new int[] { 6, 1, 4, 10, 11, 8, 7, 1 };

/**
* 直接插入排序法测试
*/
public static void straightInsertionSortTest() {
System.out.print("待排序数组:[ ");
for (int i = 0; i < array.length; i++) {
System.out.print(array[i] + " ");
}
System.out.print("]   ");

array = StraightInsertionSort.straightInsertionSort(array);
System.out.print("排好序的数组:[ ");
for (int i = 0; i < array.length; i++) {
System.out.print(array[i] + " ");
}
System.out.print("]");
}

public static void main(String[] args) {
SortTest.straightInsertionSortTest();

}
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: