int x = array[top];
int i = top - 1;
int j = bottom + 1;
int temp;
do
{
do
{
j - -;
}while (x >array[j]);
do
{
i++;
} while (x <array[i]);
if (i < j)
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}while (i < j);
return j;
}
this is a quicksort partitioning program that ive been trying to understand however. To me it seems that I and j are pointing at non existing elements?
considering in my eyes
Top is meant to be array [0] and bottom[last aray]
I think I have definetly viewed this in the wrong way probably didn't understand this.
this
// top = subscript of beginning of array
// bottom = subscript of end of array