Java:快速排序(双指针版)

2019独角兽企业重金招聘Python工程师标准>>> hot3.png


import java.util.Arrays;

public class qucik_sort {

	public static void main(String[] args) {
		// TODO Auto-generated method stub 
		int[] scores={5,4,6,3,7,2,8,1,9,10};
		int[] scores1={4,2,3};
		//System.out.println(partition(scores,0,scores.length));
		System.out.println(Arrays.toString(quick_sort(scores,0,scores.length-1)));
		//System.out.println(Arrays.toString(quick_sort(scores1,0,scores1.length-1)));
	}
	public static int partition(int[] arrays,int p,int q){
		int x=arrays[p];
		int i=p;
		int tmp;
		int j=q;
		while(i =x){
				j--;}
			if(i

 

转载于:https://my.oschina.net/u/2440318/blog/674453

你可能感兴趣的:(Java:快速排序(双指针版))