posted by Joy on .
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?
Number of comparisons for 6 numbers:
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!