Sorting Algorithms

SlowerFaster

Bubble Sort

A simple comparison-based sorting algorithm. Bubble sort repeatedly compares and swaps adjacent elements if they are in the wrong order, moving larger elements towards the end with each pass through the list. This process continues until the list is sorted and no more swaps are needed.

Time Complexity

Worst Case:O(n²)

Average Case:O(n²)

Best Case:O(n)