Sorting Algorithm Visualizer
Bubble · Insertion · Selection · Merge · Quick · Heap
Bubble Sort
Insertion Sort
Selection Sort
Merge Sort
Quick Sort
Heap Sort
Size: 50
Speed: 5
Pattern:
Unsorted
Comparing
Swapping
Pivot
Merging
Sorted
Comparisons:0
Swaps:0
Accesses:0
Time:
Bubble Sort
Best caseO(n)
AverageO(n²)
Worst caseO(n²)
SpaceO(1)
StableYes
Description
Repeatedly steps through the list, compares adjacent elements and swaps them if out of order. Simple but inefficient for large datasets.

Sorting Algorithm Visualizer — Free & Interactive

Watch Bubble, Insertion, Selection, Merge, Quick and Heap Sort animate step by step. Adjust array size up to 150 elements, control speed, choose input patterns, export as PNG or animated GIF. 100% browser-based.

Algorithms

Related Tools

FAQ

Which sorting algorithm is fastest?
Quick Sort is fastest in practice for random data. Merge Sort and Heap Sort guarantee O(n log n). For small or nearly-sorted arrays, Insertion Sort often wins.
What is a stable sort?
A stable sort preserves relative order of equal elements. Bubble, Insertion, and Merge Sort are stable. Selection, Quick, and Heap Sort are not.
How to export a GIF?
Click ⏺ GIF before sorting starts. A red dot shows recording is active. After sorting completes, click again to download the animated GIF.
Facebook WhatsApp