Posted by Joy on Friday, July 26, 2013 at 2:30pm.
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  MathMate, Friday, July 26, 2013 at 3:31pm
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  Joy, Friday, July 26, 2013 at 4:45pm
Thanks for explaining this to me!

Discrete Mathematics :)  MathMate, Friday, July 26, 2013 at 5:04pm
You're welcome!
Answer This Question
Related Questions
 Discrete Mathematics  Sort with Insertion Sort and Selection Sort algorithms ...
 Simple Array Process  need help with this generate only the pseudocode. No ...
 CIS/Visual Logic  Design an application that accepts 10 numbers and displays ...
 Programming  2. Then it should prompt the user for the input file name of the ...
 JAVA PROGRAM SELECTION SORT USING RECURSION  JAVA PROGRAM Details: I'm having a...
 math 3 grader  Sort these numbers describe your sort rule 5, 10, 16, 19, 24, 37...
 Math  In the list of numbers 1,2,3,4,5,6,7,8,9, how many of the numbers in the ...
 java programming  You need to provide more than a yes or no answer for this ...
 math  Sort these numbers. Describe your sort rule. 5 10 16 19 24 37 40
 algebra  Sort these numbers describe your sort rule 5, 10, 16, 19, 24, 37, 40
More Related Questions