Link Search Close Search Menu Expand Document

Bubble Sort

Bubble Sort is a simple comparison based sorting algorithm.
It sorts the elements by comparing the adjacent elements and re-arranging them if they are in the wrong order.
After every iteration the highest element moves to the end of the array.
It has best case complexity of O(n), average and worst case complexity of O($n^2$).

Visualization of Bubble Sort

Implementation of Bubble Sort





Back to top

Copyright © 2020-2021 Gajanan Bhat. All rights reserved.