38,40,46,56,79,84
你可以试一下这个算法,C#的:
private static void QuickSort(int[] R, int low, int high)
{
int pivotLoc = 0;
if (low < high)
{
pivotLoc = Partition(R, low, high);
QuickSort(R, low, pivotLoc - 1);
QuickSort(R, pivotLoc + 1, high);
foreach (object obj in R)
{
Console.Write(obj + " ");
}
Console.WriteLine("\n");
}
}
private static int Partition(int[] R, int low, int high)
{
int temp = R[low];
while (low < high)
{
if (low < high && temp