Use Bubble Sort to sort the list:

7, 12, 5, 22, 13, 32

What is the maximum number of comparisons required for a list of 6 numbers?

How many vcomparisons did I actually need?

3 answers

Number of comparisons for 6 numbers:
5+4+3+2+1=15

You need all 15 comparisons unless you modify the algorithm to keep track of exchanges.

There are 4 exchanges in this particular example.
Thanks for explaining this to me!
You're welcome!