In words
What it is, why it matters, and what it is like.
Why am I learning this?
Big-O notation is the language every developer and engineer uses to talk about how fast or slow a program is, even before they run it. When you build anything with AI — a model that answers questions, a system that retrieves documents, or a small model running on your phone — you need to know: if I double the amount of data, will my program take twice as long, or will it take four times as long, or will it take forever? Big-O gives you a quick way to answer that, without having to test every possible input. It's the tool that lets you compare two algorithms and choose the one that will scale. Later, when you study Binary Search, Dynamic Programming, Merge Sort, and Quicksort — all of which are in your library — you will use Big-O to describe their cost and to decide which to use. Without Big-O, you can't judge a model's performance or understand why a loop inside a loop is so slow. This concept unlocks further study in Algorithms and Complexity, which is the backbone of writing efficient AI systems.
The idea, in plain terms
Imagine you are a chef preparing meals for a party. The amount of time it takes you to cook depends on the number of guests. If you have to chop each vegetable for each guest, then doubling the guests doubles your chopping time. That's called linear growth: time grows in direct proportion to guests. But if you have to compare every guest with every other guest to decide seating, then doubling the guests more than doubles the work: with 2 guests you have 1 comparison, with 4 guests you have 6 comparisons, with 8 guests you have 28. That's quadratic growth. Big-O notation is a way to describe this relationship between input size and time (or memory) without getting bogged down in exact details. It asks: as the input gets very large, what is the dominant factor that determines how long it takes? It ignores constants like 'the chef is fast' or 'the kitchen is small' and focuses on the shape of the curve: is it a straight line, a steep curve, or something even worse? Big-O answers: 'If I double the input, what happens to the time?' If time doubles, it's O(n). If time quadruples, it's O(n^2). If time doesn't change at all, it's O(1). That's the whole idea: growth, not speed.
An analogy
Think of Big-O as the story of a photocopier in an office. Suppose you have a stack of pages to copy. If you copy each page one at a time, the time it takes is directly proportional to the number of pages: copy 10 pages, 10 minutes; copy 20 pages, 20 minutes. That's O(n) — linear. Now suppose instead of copying each page individually, you have to compare each page with every other page to check for duplicates. With 10 pages, that's 45 comparisons; with 20 pages, that's 190 comparisons. Doubling the pages roughly quadruples the work: that's O(n^2). But there's a third scenario: you have a stack of pre-printed forms and you just need one blank sheet — you always take the same 30 seconds regardless of how big the stack is. That's O(1) — constant. The photocopier analogy shows that Big-O is not about how fast the machine is (that's the constant factor) but about how the workload grows as the stack grows. One important place where the analogy breaks down is that real machines have memory hierarchies: sometimes a program that looks slower in Big-O terms is actually faster because it fits in cache. So Big-O is a guide, not a law. It tells you the shape of the curve, but the exact height of the curve can be affected by hardware, compiler, and other practical details.
Definition
Big-O notation is a mathematical way to describe how the time or space required by an algorithm grows as the size of the input grows, ignoring constant factors and lower-order terms to focus on the dominant term that dictates scaling behaviour.
Where this sits
You have not studied any other concepts yet, so this is your starting point. Big-O is the first stone in the foundation of Algorithms and Complexity. It connects directly to Binary Search (which achieves logarithmic time — O(log n) — by repeatedly halving the search interval), to Dynamic Programming (which can turn exponential time into polynomial time), to Merge Sort and Quicksort (which are analysed with Big-O, generally O(n log n)), and to Space-Time Tradeoffs (where you trade memory for speed, and the choice is often about Big-O). All of these are in your library, and once you master Big-O, you will be able to understand their costs and make informed choices.