Tuesday, October 26, 2010
The balloon sort is similar to its cousin, the bubble sort, in that it compares elements of the array and swaps those that are not in their proper positions. (Some people refer to the "balloon sort" as a "bubble sort".)
The difference between these two sorts is the manner in which they compare the elements. The balloon sort compares the first element with each following element of the array, making any necessary swaps
When the first pass through the array is complete, the balloon sort then takes the second element and compares it with each following element of the array swapping elements that are out of order. This sorting process continues until the entire array is ordered.
The balloon sort, in some situations, is slightly more efficient than the bubble sort. It is not necessary for the balloon sort to make that final complete pass needed by the bubble sort to determine that it is finished.
Sharing is so Easy: