随机产生的数组:
36 98 47 85 64 78 86 8 25 22 43 96 16 32 78 52 92 66 84 15
----------------------------
快速排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:3873118
----------------------------
改进的快速排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:731936
-----------------------------
Shell排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:571302
------------------------------
冒泡排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:578566
------------------------------
堆排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:2693638
------------------------------
插入排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:514031
------------------------------
归并排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:559289
------------------------------
选择排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:1720890
以上是集中方法的测试结果 由于代码太多一次贴不了这么多.....具体的优劣势 大家能看到了吧....
36 98 47 85 64 78 86 8 25 22 43 96 16 32 78 52 92 66 84 15
----------------------------
快速排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:3873118
----------------------------
改进的快速排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:731936
-----------------------------
Shell排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:571302
------------------------------
冒泡排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:578566
------------------------------
堆排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:2693638
------------------------------
插入排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:514031
------------------------------
归并排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:559289
------------------------------
选择排序后的结果:
8 15 16 22 25 32 36 43 47 52 64 66 78 78 84 85 86 92 96 排序消耗时间:1720890
以上是集中方法的测试结果 由于代码太多一次贴不了这么多.....具体的优劣势 大家能看到了吧....
import java.util.Calendar;/**
*
* @author Administrator
*/
public class Sort { public static void main(String args[]){
int[] needSort={36,98,47,85,64,78,86,8,25,22,43,96,16,32,78,52,92,66,84,15}; long timebegin=Calendar.getInstance().getTimeInMillis();
Arrays.sort(needSort);
System.out.println(Calendar.getInstance().getTimeInMillis()-timebegin);
for(int i=0;i<needSort.length;i++){
System.out.println(needSort[i]);
} }}