Interactive Algorithm Visualizer
Practice data structures and algorithms visually. Use this free algorithm visualizer to see how sorting, searching, and pathfinding algorithms work step-by-step. Perfect for beginners, coding interview prep, and computer science students who want to understand Big-O time complexity with animations instead of just theory.
Tip: Use a laptop or desktop for the best experience
Bubble Sort
Bubble Sort repeatedly swaps adjacent elements that are in the wrong order. It's easy to understand but inefficient on large arrays. Each pass through the array bubbles the largest unsorted element to its correct position.
Time Complexity
Current Step
Click Play to start visualization
Implementation
def bubble_sort(arr):
n = len(arr)
for i in range(n):
swapped = False
for j in range(0, n - i - 1):
if arr[j] > arr[j + 1]:
arr[j], arr[j + 1] = arr[j + 1], arr[j]
swapped = True
if not swapped:
break
return arrThe LearnCodingFast algorithm visualizer is a free tool to practice Bubble Sort, Merge Sort, Quick Sort, Binary Search, BFS and more. Use it while learning data structures, preparing for FAANG-style coding interviews, or studying for computer science exams. Combine this page with our Python, JavaScript, and HTML & CSS courses to go from beginner to job-ready developer.