How it works
Common classes
From fastest to slowest: O(1), O(log n), O(n), O(n log n), O(n squared), and O(2 to the n).
Time and space
Analyze both runtime and extra memory; a faster algorithm may use more space.
How to reason
Count how work grows with n, keep the dominant term, and drop constants and lower-order terms.