标签:main int static stat void print div can new
package Solve; import java.util.Scanner; public class Solve { static Scanner scan = new Scanner(System.in); public static void main(String[] args) { int[] num = { 100,40,60,87,34,11,56,0}; qsort(num,0,num.length - 1); for (int x:num) { System.out.print(x + "\t"); } } static void qsort(int[] arr,int b,int e) { int x = arr[(b + e) / 2]; int i = b,j = e; while ( i < j) //一趟 { while ( arr[i] < x) i++; while ( arr[j] > x) j--; if ( i < j) //! { int t = arr[i]; arr[i] = arr[j]; arr[j] = t; i++;j--; //! } } if ( i < e) //分治 qsort(arr,b,i); if ( j > b) //分治 qsort(arr,b,j); } }
标签:main int static stat void print div can new
原文地址:http://www.cnblogs.com/lfm1996/p/6363550.html