The example of this article tells the way Java achieves fast sorting. Share it for everyone for your reference. The specific implementation method is as follows:
Public class quick {public static int [] data = {9, 8, 7, 1, 12, 15, 63, 15, 20}; Public Static void Quick (int left, int right) {int i, j; int Pivot; int temp; i = left; j = right; Pivot = Data[(left+right)/2]; while (i < j) { while (Data[i] < Pivot)i++; while (Data[j ]> Pivot) j-; if (i <= j) {temp = data [i]; data [i] = data [j]; data [j] = test; i ++; j ---;}} if ( left <j) Quick (left, j); if (I <Right) Quick (I, Right);} Public Static Void Main (String [] ARGS) {System.out.println ("AAA"); Quick (0 , 9); System.out.println ("BBB"); for (int a = 0; a <data.Length; a ++) {system.out.print (data [a]+"");}}}}}}
It is hoped that this article is helpful to everyone's Java program design.