Neural Sync Active
Complexity
Registry Synced
Complexity
97 words
1 min read
Complexity
Complexity describes how work grows as input grows.
Big-O intuition
Big-O is not about exact seconds. It is about growth shape.
O(1): same amount of work.O(n): work grows with input size.O(n^2): nested growth, often from comparing every item to every other item.
Read loops
A single loop over
n items is usually O(n).Two nested loops over the same list are often
O(n^2).Practice
Before optimizing, ask:
- What input size do we expect?
- Which line repeats most?
- Can a dictionary remove repeated lookup work?