本文共 583 字,大约阅读时间需要 1 分钟。
import java.awt.image.PixelInterleavedSampleModel;public class Main { public static void main(String[] args) { // TODO Auto-generated method stub //int[] test = {5,4,3,2,1}; int[] test={49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,99,98,54,56,17,18,23,34,15,35,25,53,51}; quickSort(test,0,test.length-1); for(int i=0;i= right ) { return; } /*选出pivot的index作为参考,根据pivot对原数组进行划分,再分别对左右子数组递归调用quickSort*/ //此处选择二分法选择pivot int pivotIndex = (left+right)/2; //调用partition,根据pivotValue对数组进行重排 int regroupIndex = partition(a,left,right,pivotIndex); // for(int i=0;i
转载地址:http://cthii.baihongyu.com/