1. • A Presentation topic for c++ topic
• A Good style and appreciated
2. Sorting
Sorting takes an unordered collection and
makes it an ordered one.
512354277 101
1 2 3 4 5 6
5 12 35 42 77 101
1 2 3 4 5 6
3. Introduction: Bubble Sort
Also called Exchange sort.
It repeatedly visits the array and compares two items at a
time. It swaps these two items if they are in the wrong order.
It continues to visit the array until no swaps are needed that
means the array is sorted.
79. After Fifth Pass of Outer Loop
452314 33 42 676 98
Finished fifth “Bubble Up”
80. 452314 33 42 676 98
We did not do any swapping,
so all of the other elements
must be correctly placed.
We can “skip” the last two
passes of the outer loop.