Context:FIT1008_MOC, FIT1058_MOC, FIT2004_MOC · backbone clustering the asymptotic-analysis toolkit — the O/Ω/Θ bounds, the dominance method, the combining algebra, and the growth-rate ladder
FIT2004 emphasis: all three bounds stated formally with witnesses; a bound is judged valid or invalid, separately from whether it is tight; the notation is orthogonal to the case (best/worst) — fixing one does not fix the other.
Quick Revision
🎯 Objective: describe order of growth as n→∞ ➔ keep the dominant term, drop constants, compare by scalability.
📦 Core Components:O/Ω/Θ ➔ upper/lower/tight | dominance ➔ limit test | algebra ➔ sum/product | class ladder.
⚡ Key Constraint:Θ=O∩Ω; a valid bound need not be tight (3n2+100n=O(n3) is TRUE); the polynomial vs exponential line is the tractability frontier (P vs NP).
📝 Core
1. Big-O (Asymptotic Upper Bound)
Definition ➔ f=O(g)⟺∃c,n0>0:0≤f(n)≤cg(n)∀n≥n0.
Set membership ➔ O(g) is a set; "f=O(g)" abuses ”=” for f∈O(g).
Sequence form (FIT1058) ➔ an=O(f)⟺∃c,N∀n≥N:an≤cf(n).
2. Big-Omega & Big-Theta (Lower / Tight)
All three formally — what must EXIST, and for which n the inequality must hold:
Claim
There exist
Such that, ∀n≥n0
f=O(g)
c>0,n0>0
0≤f(n)≤cg(n)
f=Ω(g)
c>0,n0>0
0≤cg(n)≤f(n)
f=Θ(g)
c1,c2>0,n0>0
0≤c1g(n)≤f(n)≤c2g(n)
Θ=O∩Ω ➔ to disprove a Θ claim it suffices to break either side; to prove one you must exhibit both constants.
Typical usage, not a law ➔ Ω is usually how a problem’s intrinsic difficulty is stated (no algorithm beats it) and Θ how an algorithm’s exact rate is stated; O meeting Ω ⟹ optimal. But all three apply to any function — Ω is applied to a single algorithm’s cheapest case throughout the W1 applied sheet.
3. Asymptotic Analysis (Dominance Method)
Mechanism ➔ keep the single dominating term, discard constants + lower-order terms.
Limit test ➔ L=limf/g: 0⇒o(g) | 0<L<∞⇒Θ(g) | ∞⇒ω(g).
Boundary ➔ dangerous when n stays small or constants are enormous (pair with benchmarking).
4. Properties (Combining Algebra)
Sum ➔ O(g1)+O(g2)=O(max(g1,g2)) (sequential code / branches).
One-sided ➔ manipulate upper bounds only; transitivity chains through helpers (no lower bound — use Θ).
5. Complexity Classes (Growth Ladder)
Ladder ➔ 1≺logn≺n≺n≺nlogn≺n2≺n3≺2n≺n!≺nn.
Tractability line ➔ polynomial vs exponential = tractable vs intractable (P-vs-NP frontier).
Doubling n ➔ O(n2)→4T (scalable); O(2n)→T2 (catastrophic); class jumps need a new idea, not micro-optimisation.
6. Validity vs Tightness, and Case-Independence
Valid ≠ tight ➔ O is an upper bound, not the upper bound ➔ 3n2+15logn+100n=O(n3) is TRUE (witness c=118,n0=1), merely loose. “Quote the tightest bound” is style advice, not a truth condition — on a true/false question, answer the definition.
Θ is where looseness becomes falsity ➔ the same function is notΘ(n3), because Ω(n3) fails: T(n)/n3→0, so no c>0 survives.
Notation ⊥ case ➔ O/Ω/Θ bound a function; best/worst select which function. Both must be named — “insertion is O(logn)” is meaningless until you say which case.
“Any operation is …” quantifies over ALL inputs ➔ so O(g) must bound the dearest case and Ω(g) must bound the cheapest ➔ a Θ claim over “any operation” holds only if cheapest and dearest share an order.
Fixing the case restores Θ ➔ BST insertion admits noΘ over all insertions (cheapest Θ(1), dearest Θ(n)), yet worst-case insertion is cleanly Θ(n).
⚙️ Core Implementation
🔹 Dominant-term reasoning + log rules
worked O judgements
4n^2 + 1000n + 100 = O(n^2)? YES (c=20, n_0=63)n^3 + n^2 log^2 n = O(n^2 log^2 n)? NO -> n^3 dominates => O(n^3)t_n = 100n + 10n^2 + 2^n + log n => O(2^n) (n>=10: each other term <= 2^n, so t_n <= 4*2^n)log(n^2) = 2 log n = O(log n); log(3^n) = n log 3 = O(n)
💡 Common Mistake:Constant factors absorbed, base is not ➔ write O(2n) not O(4⋅2n), but tn=O(1.9n) since 2n/1.9n→∞; prefer the tightest valid bound when asked to characterise, but never call a loose bound false.
🔹 The combining algebra on real code
nested-loop cost via Sum/Product
def func0(n): for i in range(n): # O(n) * (...) a = b + 2 # O(1) for j in range(100): # fixed -> O(1) factor res += func1(res) # func1 is O(n) res -= func2(res) # func2 is O(2^n)# body = O(1) + O(1)*O(n) + O(2^n) = O(2^n) [Sum keeps dominant]# total = O(n) * O(2^n) = O(n 2^n) [Product]
💡 Common Mistake:Sum keeps the max, not the sum ➔ Product multiplies; these manipulate upper bounds only and cannot yield a lower bound.
⚖️ Core Decision Matrix
Notation
Bound
Condition
Limit
Describes
O(g)
upper
f≤cg
limf/g<∞
ceiling — bounds the dearest case
Ω(g)
lower
f≥cg
limf/g>0
floor — bounds the cheapest case
Θ(g)
tight
c1g≤f≤c2g
0<limf/g<∞
exact rate — needs both to agree
o(g)
strict upper
—
limf/g=0
strictly slower
ω(g)
strict lower
—
limf/g=∞
strictly faster
When It Flips: growth ladder on doubling n — O(1) unchanged · O(logn)+1 · O(n)×2 · O(n2)×4 · O(2n)squared. Θ exists when best=worst (Merge SortΘ(nlogn)); quicksort has no single Θ (Θ(nlogn) avg, Θ(n2) worst) — the same reason "any BST insertion" has none.
⚠️ Common Mistakes
💡 Marking a loose bound FALSE ➔ T(n)=O(n3) for a quadratic T is true; the definition asks only that somec,n0 exist, not that the bound be tight.
💡 Upgrading O to Θ for free ➔ Θ needs the matching Ω; check the limit f/g is bounded away from 0, not merely finite.
💡 Quantifier slip on “any” ➔ “any operation is Ω(logn)” is a claim about the cheapest operation, not the typical one — one O(1) input falsifies it.
💡 Naming a bound without naming a case ➔ always pair them (“worst-case Θ(n)”); an unqualified Θ over all inputs asserts cheapest and dearest agree.
✍️ Practice
Practice 1: Prove the Sum rule O(g1)+O(g2)=O(max(g1,g2)).
Hint: Add the two witness inequalities, then bound both g‘s by their max.
Short answer: with c=c1+c2, n0=max(n1,n2) the definition holds ⟹ the sum keeps the dominant term.
Practice 2: For T(n)=3n2+15logn+100n, decide TRUE/FALSE with proof: (b) T=O(n3) · (c) T=Θ(n3) · (d) T=Ω(n).
Hint: Answer from the definition each time; do not substitute “is it the tightest?“.
Answer
(b) TRUE. For n≥1: logn≤n3 and n≤n3 and n2≤n3, so T(n)≤(3+15+100)n3=118n3. Witnesses c=118,n0=1. Loose, but valid.
(c) FALSE.Θ needs Ω(n3) too: n3T(n)=n3+n315logn+n2100→0, so for anyc>0 the inequality T(n)≥cn3 fails for all large n. No c1 exists.
(d) TRUE. All terms are non-negative for n≥1, so T(n)≥100n. Witnesses c=100,n0=1.
Why:Validity is decided by the definition, tightness is a separate question ➔ the tight characterisation is T(n)=Θ(n2), yet (b) and (d) remain true because O and Ω only demand some surviving constant.
Practice 3: A BST holds n keys. TRUE/FALSE for insertion: Ω(1) · Ω(logn) · Ω(n) · O(1) · O(logn) · O(n) · Θ(1) · Θ(logn) · Θ(n) · worst case Θ(logn) · worst case Θ(n).
Hint: “Any insertion” ranges over every tree shape AND every key — so cost spans Θ(1) to Θ(n).
Answer
Cost span ➔ an insertion walks to its position, costing Θ(depth): as low as Θ(1) (key lands beside the root — e.g. a descending chain and a key smaller than all) and as high as Θ(n) (degenerate chain, key at the far end).
TRUE: Ω(1), O(n), worst case Θ(n).Ω(1) floors the cheapest insertion; O(n) ceilings the dearest; fixing the worst case pins a single function, which is Θ(n).
FALSE: everything else.Ω(logn)/Ω(n) die on the Θ(1) insertion · O(1)/O(logn) die on the Θ(n) insertion · every unqualified Θ dies because cheapest Θ(1) and dearest Θ(n) disagree · worst case Θ(logn) is false since the worst case is Θ(n), not Θ(logn).
Why:Quantifier before notation ➔ “any insertion” forces O to cover the max and Ω to cover the min; only once a case is fixed does the cost become one function that Θ can describe. Balance is the discriminator — see Binary Search Tree (BST).
🧠 Active Recall
State the formal definition of O and prove 4n2+1000n+100=O(n2).
Hint: Exhibit witnesses c,n0.
Answer
Short answer:f=O(g)⟺∃c,n0>0:0≤f≤cg∀n≥n0.
Why:Witnesses ➔ c=20,n0=63: for n≥63, 1000n+100≤16n2 ⟹ 4n2+1000n+100≤20n2.
Why do we usually prove Ω bounds for problems and Θ bounds for algorithms — and why is that a convention rather than a rule?
Hint: Lower bound = property of the problem; but Ω is just a function relation.
Answer
Short answer:Ω on a problem asserts no algorithm beats it; Θ on an algorithm states its exact rate. But Ω is defined for any function, so it applies equally to one algorithm’s cheapest case (“any BST insertion is Ω(1)”).
Why:Optimality framing ➔ the convention exists because matching an algorithm’s O to a problem’s Ω proves optimality; reading it as a restriction makes true statements like “any insertion is Ω(1)” look ill-formed.
T(n)=3n2+15logn+100n. Is T(n)=O(n3) true? Is T(n)=Θ(n3)? Why do these differ?
Hint: One bound is one-sided, the other needs both sides.
Answer
Short answer:O(n3)TRUE (c=118,n0=1); Θ(n3)FALSE — the Ω(n3) half fails since T(n)/n3→0.
Why:Overshoot is legal upward only ➔ O tolerates any amount of slack, so every function is O of anything that grows faster; Θ forbids slack in either direction, which is why it, not O, carries information.
For tn=100n+10n2+2n+logn, justify O(2n) — and why is O(1.9n) false while O(4⋅2n) is poor style?
Hint: Constant factor vs exponential base.
Answer
Short answer: For n≥10 each other term ≤2n ⟹ tn≤4⋅2n=O(2n).
Why:Base ≠ constant ➔ Big-O absorbs the 4; O(1.9n) is false since 2n/1.9n=(2/1.9)n→∞.
Where is the practical "tractability" line, and what happens to O(N2) vs O(2N) when N doubles?
Hint: Polynomial vs super-polynomial scaling.
Answer
Short answer: Between polynomial (nc) and exponential (2n, n!).