tap for sound

Top algorithm

Fast

Slow and simple

No comparing

Just for fun

Make video

Battle · 10 s

1080×1920 with sound, ready for TikTok, Reels and Shorts.

This one's a Pro video

It uses battle videos. Pro unlocks every look and sound, battle and multi-sort videos, and no watermark.

Secure checkout with Stripe · 14-day refund

Customize

Layout
ColoursRainbow
BackgroundMidnight
Glow100%
Size100%

Bubble Sort vs Insertion Sort

Same 110 values, same shuffle, same speed. Insertion Sort finishes first and turns gold: 5,689 operations to 8,678.

The numbers

Bubble operations
8,678
Insertion operations
5,689
Bubble average
n²
Insertion average
n²
Bubble worst
n²
Insertion worst
n²

Bubble Sort

Bubble Sort walks through the list swapping neighbours that are out of order, until a pass makes no swaps. More on Bubble Sort.

Insertion Sort

Insertion Sort takes each value in turn and slides it left until it sits in the right place. More on Insertion Sort.

FAQ

Which is faster, Bubble Sort or Insertion Sort?

On this shuffle of 110 values, Insertion Sort needed 5,689 operations and Bubble Sort needed 8,678, about 1.5× as many. On average Bubble Sort is n² and Insertion Sort is n².

Which one is stable?

Both are stable.

How is the race fair?

Both algorithms start from the same shuffle and run the same number of operations per frame. Every comparison, swap and write counts as one operation, so the one that needs fewer operations finishes first.