/ * Title: Quicksort * / / * ideas: an array into two portions, is smaller than the index numbers on the left, right of the number is greater than the index, after a sorted array formed after recursive partitioning. * / Void the QuickSort (int Data [], int length, int Start, End int) { IF (== Start End) return; int index = the Partition (Data, length, Start, End); IF (index> Start) { the QuickSort (Data, length, Start, index-. 1); } IF (index <End) { the QuickSort (Data, length, index +. 1, End); } } int the Partition (int Data [], int length, int Start, End int) { IF (Data length == null || <|| Start 0 <0 || End> = length) { the throw new new STD :: Exception ( "invalid the Parameters"); } int index = RandomInRange (Start, End ); Swap (& Data [index], & Data [End]); int small = start-1; for(int index = start; index < end; index++){ if(data[index] < data[end]){ small++; if(small != index){ Swap(&data[small],&data[index]); } } } small++; Swap(&data[small],&data[end]); return small; }