Okay, I see where the error is now, your quicksort algorithm had an error, it should be this:
Code:
if ( left > right )
{
pivot = partition( list, left, right );
quicksort( list, left, pivot);
quicksort( list, pivot+1, right );
}
}
You only do +1 and -1 with quicksort algorithms that place the pivot in between the two partitions. That being said, do this algorithm on something small like array={4,5} and you'll see that the quicksort loops infininetly if you choose 5 as the pivot, since 5 keeps getting swapped with itself, returning a partition of size 2 and a partition of size 0, thus starting over again. If you want to do the last number of the pivot, you need to change the quicksort to:
Code:
if ( left > right )
{
pivot = partition( list, left, right );
quicksort( list, left, pivot-1);
quicksort( list, pivot, right );
}
}