4 rules. That's all.
Tap to start →
A loop inside a loop: multiply their counts. n × n = O(n²).
One loop, then another loop: n + n = 2n, which is still O(n).
If i doubles or n halves each step, that loop is O(log n).
Calls × work per call. Fibonacci with two calls each time grows like 2ⁿ.
Calling a loop O(n) when its counter doubles. That's O(log n).
Tap an answer. The full video explains why.
Free DSA in Java course. Subscribe to Compiled Canvas on YouTube.