Bubble Sort Visualization


Bubble Sort - Sorting Algorithm Visualizer

DESCRIPTION

Bubble Sort is a simple and intuitive **comparison-based sorting algorithm** that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. This process is repeated until the entire list is sorted.

The algorithm works by making multiple passes through the array, with each pass "bubbling" the largest unsorted element to its correct position at the end. This continues until no more swaps are needed, indicating that the array is sorted.

Since Bubble Sort repeatedly swaps adjacent elements, it is known for its **simplicity** but is not the most efficient sorting algorithm for large datasets.

The worst and average-case time complexity of Bubble Sort is **O(n²)**, making it inefficient for large lists. However, if the array is already **nearly sorted**, an optimized version of Bubble Sort can detect this and reduce the number of passes, improving its performance.

Bubble Sort is an **in-place sorting algorithm**, meaning it does not require extra memory. Additionally, it is a **stable sort**, ensuring that duplicate elements maintain their relative order.

COMPLEXITY

Average Complexity O(n²)
Best Case O(n)
Worst Case O(n²)
Space Complexity O(1)
Bubble Sort Visualization

BUBBLE SORT IMPLEMENTATION

                    
                
Bubble Sort Visualization