3.1.6 · D4Complexity Analysis

Exercises — Tight bounds — Θ notation; lower bounds — Ω notation

2,275 words10 min readBack to topic

Before we start, the three definitions this whole page leans on — so the page stands alone even if you skipped the parent:

And one picture to keep in your head the whole way down — the sandwich that is :

Figure — Tight bounds — Θ notation; lower bounds — Ω notation

The blue curve is your cost . The green floor and the yellow ceiling are two scaled copies of the same reference . Past the red threshold , is trapped between them. That trapping is the entire definition — every proof below is just "find the two constants and the threshold that build this exact picture." We will point back to this figure at each level.


Level 1 — Recognition

Here you only decide which symbol is correct. No proofs yet — just read the shape.

Recall Solution L1-a

WHAT: we compare against . WHY : the leading term is , which grows exactly like ; the is a constant that washes out. Since is both a floor and a ceiling (with , , : for , so ), the tight symbol applies. Picture: in the sandwich figure this is the case where (here ) slots between and past . Answer: .

Recall Solution L1-b

True. is only a ceiling. Since for all , sits under , so — even though is a loose ceiling here. This is exactly the " can be loose" point from the parent: a smaller-order function is always of a larger one. Picture: only the yellow ceiling of the sandbox figure is used; there is no matching green floor of shape under .

Recall Solution L1-c

. Change-of-base gives , a constant multiple of . A constant factor is exactly what absorb, so the bases don't matter: . This is why we often write with no base in complexity.


Level 2 — Application

Now prove the bound: exhibit (and ) and an .

Recall Solution L2-a

WHAT: we bound above by a scaled . WHY the step: replace the smaller-order term by something a copy of , because making the right side bigger keeps the "" valid. For , . So Picture: is the yellow ceiling of the sandwich figure for this . Answer: , . Hence . ∎

Recall Solution L2-b

WHAT: we need a floor . WHY the step: drop the positive term — throwing away a positive quantity only shrinks the expression, which is exactly the direction a floor needs. For , So , gives . (We pick rather than to keep the whole page on the same domain — the same domain where dividing by is safe.) Picture: is the green floor of the sandwich figure. Conclude : combining L2-a and this, for , so with — the full sandwich is now built. ∎

Recall Solution L2-c

WHY the limit test: the parent's shortcut says a finite nonzero ratio means "same shape." Compute Since , we land in the case. Answer: . The value is literally a legal between the sandwich constants — in the figure, any traps .


Level 3 — Analysis

Here bounds can fail. Find where and why.

Recall Solution L3-a

WHAT: show no constant makes hold for all large . WHY by contradiction: suppose such exists. Divide both sides by (legal for positive ): The picture: this demands the ever-growing quantity stay under a fixed number forever — impossible, since eventually passes any fixed (take , which is ). No ceiling of shape can hold down: in the sandwich figure the yellow line would be crossed by . Contradiction. Answer: ; hence but not . ∎

Recall Solution L3-b

No. A single would need one sandwiching for every input of size . But ranges from order (sorted input) to order (reverse input) — two different orders. No single power can be both floor and ceiling across that spread. Correct statement: overall and ; the tight exists only per case. See Best, worst, and average case analysis.

Recall Solution L3-c

WHY the limit: it separates strict orders. but not : is strictly larger order than . Using the definition from the top of this page, that "strictly larger, not tight" situation is exactly (little-omega). Answer: , not .


Level 4 — Synthesis

Combine tools: recurrences, sums, multiple functions.

Recall Solution L4-a

WHY the Master Theorem: it hands a directly for divide-and-conquer recurrences . Here , , . Compare with . They match ⇒ the "balanced" case ⇒ multiply by a : Sanity check: this is exactly merge sort's recurrence, and merge sort is . ✓

Recall Solution L4-b

WHAT: bound the sum both ways. The closed form is . Ceiling: for , so (yellow line of the sandwich). Floor: (drop the positive ), so (green line). Answer: for . ∎

Recall Solution L4-c

WHY: in a sum of two nonnegative growths, the larger order dominates — the smaller one is eventually a lower-order term absorbed by the sandwich constants. Formally (ceiling) and (floor, since ). Answer: .


Level 5 — Mastery

Invent and justify bounds; reason about problems, not just single functions.

Recall Solution L5-a

The two bounds live on different objects:

  • is a bound on the problemevery possible comparison-based algorithm must make at least this many comparisons in the worst case. It comes from the decision tree: a tree with leaves (one per possible ordering) has height , and .
  • is a bound on one algorithm (merge sort's worst-case cost). Why optimal: the algorithm's ceiling meets the problem's floor at the same order. No algorithm can beat , and merge sort reaches it, so merge sort is worst-case and cannot be asymptotically improved. ∎
Recall Solution L5-b

Ceiling: each of the factors is , so , giving . So . Floor: keep only the top half of the factors — the integers from up to are each : The justification step: we want . Rearranging, this is , i.e. , i.e. . So precisely because forces , the inequality holds. Therefore for , i.e. . Answer: for . ∎

Recall Solution L5-c

First pair: , a constant. yes, : multiplying an exponent's argument shift by a constant just rescales — a constant factor the sandwich absorbs. Contrast: . Here the base differs, so : (little-omega — strictly larger order, as defined at the top), not . Moral: constant multipliers keep the class; different bases change it. See Asymptotic comparison of functions.


Recall One-line summary of the ladder

L1 recognise the symbol → L2 exhibit → L3 find where a bound fails → L4 combine tools (Master Theorem, sums) → L5 reason about problems and prove optimality.

Connections