About this document
Bubble Sort Algorithm Explained by MH Moin is a document available to read on EtoBox.
The bubble sort algorithm repeatedly steps through a list, compares adjacent elements, and swaps them if they are in the wrong order until the list is fully sorted. It has a worst-case and average-case time complexity of O(n^2) due to potentially making n(n-1)/2 comparisons in each pass through the list. An optimized version with an early exit can reduce the best-case complexity to O(n).
- Author
- MH Moin
- Language
- EN