0
1
2
3
Input Size (N)4
Complexity
O(1)

The Speed Limit

Imagine algorithms are robots. Some are fast, some are slow. 'Big O' is how we measure their speed. It tells us: 'If the job gets bigger, how much slower do you get?'

Constant Time (O(1))

We call this 'Constant' because the time STAYS THE SAME. Like a Teleporter robot: 10 boxes? 1 step. 1 million boxes? Still 1 step. It never slows down.

Linear Time (O(n))

This is 'Linear' because if you double the boxes, you double the time. It walks in a straight line. 5 boxes = 5 steps. 100 boxes = 100 steps. Fair and predictable.

Quadratic Time (O(n²))

This is 'Quadratic' (Squared). It's the danger zone! The robot checks every box against every other box. 5 boxes -> 25 steps. 10 boxes -> 100 steps! It gets slow VERY fast.

Logarithmic Time (O(log n))

The 'Logarithmic' robot (The Hacker) is a genius. It cuts the problem in half every time. It grows very slowly. Even with billions of boxes, it only takes a few jumps.

Choose Wisely

Now you know the names: Constant (Best), Logarithmic (Great), Linear (Okay), and Quadratic (Slow!). Aim for the Green and Blue zones!

Mastered.

You now speak the language of algorithmic efficiency.

AlgoAnimator: Interactive Data Structures