Public class quicksort {
/**
*Quick sorting
* @ Param strdate
* @ Param left
* @ Param right
*/
Public void quicksort (string [] strdate, int left, int right ){
String middle, tempdate;
Int I, J;
I = left;
J = right;
Middle = strdate [(I + J)/2];
Do {
While (strdate [I]. compareto (middle) <0 & I <right)
I ++ ;//Find the number on the left that is greater than the median.
While (strdate [J]. compareto (middle)> 0 & J> left)
J --;//Find a number smaller than the median value on the right.
If (I <= J ){//Replace the large number on the left with the small number on the right.
Tempdate = strdate [I];
Strdate [I] = strdate [J];
Strdate [J] = tempdate;
I ++;
J --;
}
} While (I <= J );//Stop when the two are staggered
If (I <right ){
Quicksort (strdate, I, right );//Slave
}
If (j> left ){
Quicksort (strdate, left, J );
}
}
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
String [] strvoid = new string [] {"11", "66", "22", "0", "55", "22", "0 ", "32 "};
Quicksort sort = new quicksort ();
Sort. quicksort (strvoid, 0, strvoid. Length-1 );
For (INT I = 0; I <strvoid. length; I ++ ){
System. Out. println (strvoid [I] + "");
}
}
}