I have a static method (quicksort) that looks to me like it should return a new set of data thats sorted, but should not change the org. data set.
//dataCopy is a float[]
QuickSortStatic.quickSort(dataCopy);
......
public static float[] quickSort(float[] input)
{
data = input;
recQuickSort(0, data.Length - 1); //does the qsort
return data;
}
I want to have a line
float[] f = QuickSortStatic.quickSort(dataCopy);
I want f to be an array that is sorted, and dataCopy to be the org.,
unsorted data. Instead, both f and dataCopy come back as sorted. Somehow dataCopy is being mutated by quicksort. How can I maintain the org. array?