Bubble Sort

Graph : Time Complexities of Sorting Algorithms

Comparison with other sorting algorithms

Algorithm Sort Algorithm Average Time Best Time Worst Features Space
Bubble Sort O(n2) O(n2) O(n2) Constant
Modified Bubble Sort O(n2) O(n) O(n2) Constant
Selection Sort O(n2) O(n2) O(n2) Constant
Insertion Sort O(n2) O(n) O(n2) Constant
Heap Sort O(n*log(n)) O(n*log(n)) O(n*log(n)) Constant
Merge Sort O(n*log(n)) O(n*log(n)) O(n*log(n)) Depends
Quick Sort O(n*log(n)) O(n*log(n)) O(n2) Constant