Level 1: Bronze
A memorized definition. Not wrong, but it stops there.
A notation for how fast an algorithm is.
2 stars Asked often.
In one or two sentences
They describe how running time grows as input size grows. Big O writes the upper bound of that growth rate.
Say it out loud, or type it below. What you type never leaves this device.
A memorized definition. Not wrong, but it stops there.
A notation for how fast an algorithm is.
Correct, but too broad or missing context.
It writes how the number of operations grows with input size n. Constants and lower order terms are dropped, giving forms like O(n), O(n log n) and O(n^2).
Reaches principle, use and trade-off, with words that invite the next question.
Big O describes the shape of growth, not exact time, so it is a tool for comparing at large n. On small input an algorithm with a large constant can be slower. The same algorithm can differ between average and worst case, so say which one you mean. Look at space complexity too. Recursion depth uses space, and trading space for time, as hashing and caching do, is common. In an interview, state the value and add one sentence on why.
These are likely next questions from an interviewer. Think of your answer first, then press the button.
1 / 3
Can an O(n) algorithm beat an O(log n) one?
On small input, or with a very large constant, yes. Big O only speaks to growth when n is large enough.
2 / 3
What is amortized analysis?
Even if an operation is occasionally expensive, spreading the cost over many operations gives a low cost per operation. Appending to a dynamic array is the example.
3 / 3
How do you find the complexity of a recursive function?
Write the calls as a recurrence and solve it. When subproblems repeat, memoization saves results and cuts the cost.
This is a textbook level concept, so no outside source is listed.