Big-O notation
Big-O notation explained for beginners and interviews: what it measures, the common complexities from O(1) to O(2^n) with code examples, rules for working out the complexity of loops and recursion, space complexity, best, worst and average cases, amortised cost, and how it guides real decisions.
CodexBash, , 6 min read
Two programs can produce the same answer while one finishes instantly and the other takes hours as the input grows. Big-O notation is the language for describing that difference: how the running time or memory of an algorithm grows as the input size grows. It lets you compare approaches before writing them, predict whether a solution will survive a million records, and answer the question every coding interviewer asks: "What is the time and space complexity?" This article explains the notation, the common classes and how to work out complexity yourself.
Sign in to read the rest
The whole 6 minute article is free with an account, along with every problem, lesson and tutorial. No card.