BUBBLE SORT


This technique is called bubble sort or sinking sort because the smaller values gradually "bubble" their way upward to the top of the aaray like air bubbles rising in water, while the larger values sink to the bottom of the array.

The technique is to make several passes through the array. On each pass, successive pairs of elements are compared. If a pair is in decreasing order, their values are swapped in the array.

The chief vertue of the bubble sort is that it is easy to program. However, the bubble sort runs slowly. This becomes apparent when sorting large arrays.

Start the animation
Home Next algorithm