Algorithmic Analysis Notation
- 21Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What does the notation f(n)=O(g(n)) mean mathematically?
It means there exist suitable constants c and n0 such that f(n) is bounded by c⋅g(n) for all n≥n0. This assumes f(n) is non-negative.
Or swipe the card
21 cards
What does the notation f(n)=O(g(n)) mean mathematically?
It means there exist suitable constants c and n0 such that f(n) is bounded by c⋅g(n) for all n≥n0. This assumes f(n) is non-negative.
How does the
equalsign behave in asymptotic notation like f(n)=O(g(n))?The equal sign is asymmetric. It should be read as 'is' or 'is in the set of'. For example, 2n2=O(n3) means 2n2 is in the set of functions that are O(n3), but O(n3)=2n2 is not valid.
Explain the macro usage of Big O-notation, such as f(n)=n3+O(n2).
When O(n2) appears on the right-hand side of an equation, it represents some function h(n) such that h(n)=O(n2), and f(n)=n3+h(n). It essentially provides an error bound for the lower-order terms.
What does it mean to have Big O-notation on the left-hand side, e.g., O(n2)=O(n3)?
When O(n2)=O(n3) is written, it implies that for any function f(n) in the set O(n2), that function f(n) is also in the set O(n3). This maintains the asymmetric 'is' interpretation.
Define Big Omega-notation, f(n)=Ω(g(n)) and provide an example.
It means there exist suitable constants c and n0 such that f(n)≥c⋅g(n) for all n≥n0. It represents an asymptotic lower bound. An example is n=Ω(lgn).
What is the relationship between Big O, Big Omega, and Big Theta notation?
Big O (O) represents 'less than or equal to' (upper bound), Big Omega (Ω) represents 'greater than or equal to' (lower bound), and Big Theta (Θ) represents 'equal to' (tight bound, meaning both an upper and lower bound).
Distinguish between little o-notation (o) and little omega-notation (ω).
Little o (o) corresponds to 'strictly less than', meaning for every constant c, f(n)<c⋅g(n) for sufficiently large n. Little omega (ω) corresponds to 'strictly greater than', meaning for every constant c, f(n)>c⋅g(n) for sufficiently large n. There is no little theta.
What are the three main methods for solving recurrences in algorithm analysis?
The three main methods are the substitution method, the recursion-tree method, and the master method.
What is the primary drawback of the substitution method for solving recurrences?
The primary drawback is that Step 1 is to guess the answer (or its form). Without a correct guess, the method cannot proceed to verify the solution by induction.
Why is it important to avoid using Big O-notation directly within the substitution method's inductive step?
Using Big O directly can lead to false proofs because the implicit constants in Big O can change with each inductive step, making the constant dependent on n instead of being a fixed value.
When proving an upper bound T(n)=O(g(n)) using the substitution method, what is the 'residual' and what condition must it satisfy?
The residual is the difference between the desired inductive step target (c⋅g(n)) and what is derived from the expansion of T(n). For the induction to hold, the residual must be non-negative (greater than or equal to zero).
What technique is often required to prove a tight upper bound, such as T(n)=O(n2), for a recurrence like T(n)=4T(n/2)+n using the substitution method?
It often requires strengthening the induction hypothesis by subtracting lower-order terms. For T(n)=4T(n/2)+n, instead of guessing T(n)≤cn2, one might guess T(n)≤c1n2−c2n.
Describe the intuition behind the recursion-tree method for solving recurrences.
The recursion-tree method visualizes the recurrence as a tree, where each node represents the cost of a subproblem. The total cost is found by summing the costs at each level of the tree and then summing the costs of all levels.
What is the main non-rigorous aspect of the recursion-tree method?
The main non-rigorous aspect comes from the use of 'dot, dot, dots' to represent the continuation of the tree and summations, requiring careful justification or subsequent formal proof by substitution.
For the recurrence T(n)=T(n/4)+T(n/2)+n2, how is the total cost calculated using the recursion-tree method?
The total cost is calculated by summing the non-recursive work at each level. The levels' costs are n2, then (n/4)2+(n/2)2=(5/16)n2, then (n/16)2+(n/8)2+(n/8)2+(n/4)2=(25/256)n2, and so on. This forms a geometric series sum n2(1+5/16+25/256+…), which is O(n2).
What is the general form of recurrences that the Master Method can solve?
The Master Method solves recurrences of the form T(n)=aT(n/b)+f(n), where a≥1, b>1, and f(n) is an asymptotically positive function.
What key function is compared against f(n) in the Master Method, and what does it represent in the recursion tree?
The key function is nlogba. It represents the number of leaves in the recursion tree, up to a constant factor, or the cost at the bottom level of the recursion tree if each leaf incurs a constant cost.
State Case 1 of the Master Method.
If f(n)=O(nlogba−ϵ) for some constant ϵ>0 (meaning f(n) is polynomially smaller than nlogba), then T(n)=Θ(nlogba).
State Case 2 of the Master Method.
If f(n)=Θ(nlogbalgkn) for some constant k≥0 (meaning f(n) is roughly equal to nlogba up to a polylogarithmic factor), then T(n)=Θ(nlogbalgk+1n).
State Case 3 of the Master Method.
If f(n)=Ω(nlogba+ϵ) for some constant ϵ>0 (meaning f(n) is polynomially larger than nlogba), AND af(n/b)≤cf(n) for some constant c<1 and all sufficiently large n (regularity condition), then T(n)=Θ(f(n)).
What kind of recurrence would the Master Method not apply to?
The Master Method would not apply to recurrences like T(n)=T(n/4)+T(n/2)+n2, because it has multiple subproblems of different sizes (n/4 and n/2). It also wouldn't apply if f(n) falls into the gaps between the cases (e.g., f(n)=nlogba/lgn).

Ask anything
We've read this whole study set, so questions about it get the best answers.