2. Basic Introduction:
Bubble Sort is a simple yet effective sorting algorithm.
Data is placed adjacent to each other.
The sort starts from one end (the beginning), compares
2 adjacent data, and swaps them if they are in the
wrong order.
It moves on down the list and continues doing so.
When it reaches the end of the data, it starts over until
all the data is in the right order.
*As easy as the Bubble Sort is, it is sometimes
ineffective if there is a lot of data.
3. When to Use Bubble Sort
Not much use in the real world, but is a great learning tool
because it’s easy to understand and fast to implement.
Use when a fast algorithm is needed to sort:
1.) an extremely small set of data (Ex. Trying to get the books on
a library shelf back in order.)
or
2.) a nearly sorted set of data. (Ex. Trying to decide which
laptop to buy, because it is easier to compare pairs of laptops
one at a time and decide which you prefer, than to look at them
all at once and decide which was best.)
4. When to Not Use Bubble Sort
When dealing with a large set of data.
When you are looking for a quick algorithm.
Compared to other sorting algorithm, bubble sort is
really slow.