Ich habe ein String-Array, das ich zu Double konvertieren, ich übergebe es in den folgenden Quicksort-Algorithmus und mehrere Fehler sagen, dass ich nicht doppelt in int trotz doppeltem Array umgekehrt. Links und rechts sind 0 bzw. arr.Length - 1.Fehler bei der Verwendung von Quicksort zum Sortieren eines Doppel
public static double[] quick_Sort(double[] arr, double left, double right)
{
double i, j;
double pivot, temp;
i = left;
j = right;
pivot = arr[(left + right)/2];
do
{
while ((arr[i] < pivot) && (i < right)) i++;
while ((pivot < arr[j]) && (j > left)) j--;
if (i <= j)
{
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
i++;
j--;
}
} while (i <= j);
if (left < j) quick_Sort(arr, left, j);
if (i < right) quick_Sort(arr, i, right);
return arr;
}
Von dem Segment, das ich gepostet habe. 8, 11, 12 15, 16, 16, 17. – KevinSpacey
Dieser Code wird nicht kompiliert. – usr
Weil dies ein Segment eines viel größeren Programms ist. – KevinSpacey