Compare Algorithms Side by Side
Time complexity is easier to see than to memorise. Put your program next to another one, run both on the same input and watch the counters: steps, comparisons, loop rounds and swaps, line by line, until one finishes first.
- Two dry runs side by side, the current line highlighted in each
- Live counters: steps, decisions (comparisons), loop rounds and swaps
- A winner at the finish, with how much less work it did
- Race your code against any of the 80+ library programs, or your own boards
- Different inputs? Re-run the opponent with yours for a fair race
- Slow, normal or fast, with a slider to scrub back
How it works
- Paste your program and a small sample input
- Open 🏁 Race and pick an opponent
- Press ▶ Start race
- Compare the counters and read the code that did less work
Try it with
- int n, i, sum = 0; scanf("%d", &n); for (i = 1; i <= n; i++) sum = sum + i; printf("Sum = %d", sum);
- n = int(input()) fact = 1 for i in range(1, n + 1): fact = fact * i print(fact)
- int a, b, c; scanf("%d %d %d", &a, &b, &c); if (a >= b && a >= c) printf("%d", a); else if (b >= c) printf("%d", b); else printf("%d", c);
Frequently asked questions
Is it free?
Racing is free: the counters come from dry runs you already have. Making the flowchart and dry run of your own code uses one AI credit, and re-running an opponent with your input uses one more.
What do the counters mean?
Steps are dry-run steps. Decisions count every comparison or condition checked. Loop rounds count each time a loop goes back for another pass. Swaps count two values trading places in an array.
Why did the race stop early?
Dry runs stop after about 45 steps so they stay readable. For sorting and searching, race on a small input (4 or 5 numbers) so both programs finish and the result is real.
Is it the same as Big-O?
It shows the work for one input, which makes the difference visible. Big-O describes how that work grows as the input gets bigger; try the race with 3, then 5 numbers and watch the gap grow.
Classic programs with flowchart, algorithm and code
- Prime Number Check: flowchart, algorithm and program
- Factorial of a Number: flowchart, algorithm and program
- Fibonacci Series: flowchart, algorithm and program
- Palindrome Number: flowchart, algorithm and program
- Armstrong Number: flowchart, algorithm and program
- Reverse a Number: flowchart, algorithm and program
- Sum of Digits: flowchart, algorithm and program
- Leap Year: flowchart, algorithm and program
- Largest of Three Numbers: flowchart, algorithm and program
- Bubble Sort: flowchart, algorithm and program
- Binary Search: flowchart, algorithm and program
- Factorial Using Recursion: flowchart, algorithm and program
- All 88 programs →