How many comparisons will be made in a bubble sort of six items?

Asked Jan 08, 2010
If the items are already in order, five comparisons.

Worst case for an inversely sorted file, 5+4+3+2+1 = 15 comparisons.

Answered Jan 18, 2010

TIP: If it's not your answer to this question, please click "Leave a Comment" button under the question to communicate with the question owner.