Post a New Question

Discrete Mathematics

posted by .

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:

    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
Your Answer

Related Questions

More Related Questions

Post a New Question