Monday
March 27, 2017

Post a New Question

Posted by 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?

  • Discrete Mathematics - ,

    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.

  • Discrete Mathematics - ,

    Thanks for explaining this to me!

  • Discrete Mathematics :) - ,

    You're welcome!

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question