Sorting Algorithm Visualizer

← Back to Home

Algorithm: Bubble Sort

Time Complexity: O(n²)

Comparisons: 0 | Swaps: 0

About This Visualization

This interactive demo visualizes how different sorting algorithms work. Each bar represents a number, with height corresponding to its value. Red bars indicate elements being compared, and green bars show sorted elements.

Algorithm Descriptions
  • Bubble Sort: Repeatedly steps through the list, compares adjacent elements and swaps them if they're in the wrong order.
  • Selection Sort: Divides the list into sorted and unsorted regions, repeatedly selecting the smallest element from the unsorted region.
  • Insertion Sort: Builds the final sorted array one item at a time, inserting each element into its proper position.
  • Quick Sort: Picks a pivot element and partitions the array around it, then recursively sorts the sub-arrays.
  • Merge Sort: Divides the array into halves, recursively sorts them, then merges the sorted halves.
  • Heap Sort: Builds a max heap from the array, then repeatedly extracts the maximum element.