[Solved]QuickSort highest lowest Situation
The problem was bad syntax
Ok, I've been putting alot of these up lately, but here's the situation.
for (int index = 0; index <count; index++)
list[index] = (int) (Math.random() * 100000);
for(int index=0; index<count; index++)
System.out.print(list[index]+ " ");
We have to quicksort with median and middle. So, this is the case where it will eventually use the median value as the pivot. This is the general problem, It will pick up the highest or the lowest value, currently its only picking up the highest, insted of both. Before that it was picking up the lowest only.
Though the methods are both seperate, and use local veriables thtat are set to what they need to be independent of eachother. So before I can figure my way through the quick sort itself, I was wondering fi someone could see something wronge with the code that I've missed.
These are the two methods, if you see something please tell me. I'm ripping out hair here.
public static int getLowest(int x)
min = x;
for (int j = 0; j < x.length; j++)
if (min > x[j])
min = x[j];
public static int getHighest(int x)
max = x;
for (i = 0; i < x.length; i++)
if (max < x[i])
max = x[i];