hey, im getting a stack overflow error when i run my code! im doing a quicksort algorithm! any ideas??!! here is my code below:
~ Jeff Yan ~
posted 8 years ago
This is wrong:
int x=data[(data.length - 1)];
x is always equal to the last element of the table,
so when the function is called for the first time (j=data.lenght-1), j
is never decremented in the 'while (data[j]>x)' loop,
and then quicksort is recursively called with boundaries: left, j =data.lenght-1 boundaries.
You must take 'x' from somwhere between 'left' and 'right' boundaries.