Data Structures & Algorithms using JavaScript
/Intermediate
Big O Notation
Definition
Big O defines the upper bound of an algorithm's complexity. It describes the worst-case scenario for how the runtime or space requirements grow as the input size (N) grows towards infinity.
Explain Like I'm New
If I give you 10 times more work, will it take you 10 times longer (O(N)), 100 times longer (O(N^2)), or the exact same amount of time (O(1))?
Terminal Output
bash / terminal
O(1) - Constant
O(log N) - Logarithmic (Binary Search)
O(N) - Linear (Simple Loop)
O(N log N) - Linearithmic (Merge Sort)
O(N^2) - Quadratic (Nested Loops)
O(2^N) - Exponential (Recursive Fibonacci)
Interactive Coding Challenges
Write a function to implement the core logic of Big O.
Solution Code
Loading...
Console output will appear here...
This is the most straightforward brute-force or fundamental approach.