Mike Stein wrote:In the swap method I should have labeled the swaps++ as moves++ because that is a more accurate description of what is going on.
Mike Stein wrote:Just one swap would be needed.
Those code lines from your quick sort algorithm does 1 swap. Changing places of numbers 2 and 1.
But you are counting as 3 swaps. So you have to fix it.
Mike Stein wrote:for my particular project I have to count every assignment (e.g. temp = array[index]) and every single comparison (array[index] < value or something like that).
Mike Stein wrote:
Mike Stein wrote:Since I need it to count when both true and false it is redundant to have the counter in the if statement!
You don't need to increment the number of comparisons when something is true or false. You need to increment the number of comparisons when a comparison takes place.