Bubble Sort Algorithm (Future Uni)
Bubble Sort Algorithm (Future Uni)
BUBBLE SORT
Outline
What is sorting?
3
Sorting Algorithms
1. Bubble Sort
2. Selection Sort
3. Insertion Sort
4. Quick Sort
5. Merge Sort
4
Bubble Sort Algorithm
Bubble Sort is the simplest sorting algorithm.
5
Bubble Sort Example
6
Example (cont.)
9
Pros and Cons
Pros:
1. It is very simple to learn.
2. Easy to implement.
Cons:
1. This algorithm is not suitable for large data sets.
2. Its average and worst case complexity are of Ο(n2) where n is the
number of items.
10
The key takeaways
Bubble sorting is a simple sorting algorithm that works by
repeatedly comparing adjacent elements in an array and
swapping them if they are in the wrong order.
11