KonkurStudy
همه کارت‌ها

Asymptotic Notation (O, Omega, Theta) Manipulation Rules

Adding terms of lower-or-equal order keeps Theta; the largest term dominates, and identities can break when f is not assumed to grow.

کارت مفهوم کنکور ارشد علوم کامپیوتر

اهمیت
۰/۵

Intuition

Asymptotic classes obey simple algebra: a sum is governed by its largest term, and adding anything that is O(f)O(f) to ff leaves you within a constant factor of ff. But the bound 0≤g(n)0 \le g(n) in the definitions only forces lower bounds when ff itself is bounded below — so identities involving roots or squares can fail for decaying functions.

Result / Method

Let g(n)=O(f(n))g(n)=O(f(n)), i.e. 0≤g(n)≤c f(n)0\le g(n)\le c\,f(n). Then:

  • Sum rule: f(n)+O(f(n))∈Θ(f(n))f(n)+O(f(n))\in\Theta(f(n)), since f(n)≤f(n)+g(n)≤(1+c)f(n)f(n)\le f(n)+g(n)\le(1+c)f(n).
  • Dominant term: Θ(a(n)+b(n))=Θ(max⁡(a(n),b(n)))\Theta(a(n)+b(n))=\Theta(\max(a(n),b(n))). So f+f2+f=Θ(f2)f+f^2+\sqrt{f}=\Theta(f^2) once f→∞f\to\infty — strictly bigger than Θ(f)\Theta(f).
  • Caution: f(n)∈Ω(f(n))f(n)\in\Omega(\sqrt{f(n)}) needs f(n)≥c\sqrt{f(n)}\ge c, which fails if f(n)→0f(n)\to 0.

Worked example (q78)

With f(n)f(n) only "a function of nn" (not assumed →∞\to\infty):

  • I: f(n)+O(f(n))∈Θ(f(n))f(n)+O(f(n))\in\Theta(f(n)) — always true (sandwich above).
  • II: f(n)∈Ω(f(n))f(n)\in\Omega(\sqrt{f(n)}) — false: take f(n)=1/nf(n)=1/n, then f/f=1/n→0f/\sqrt{f}=1/\sqrt{n}\to 0.
  • III: f(n)+f2(n)+f(n)∈Θ(f(n))f(n)+f^2(n)+\sqrt{f(n)}\in\Theta(f(n)) — false: take f(n)=nf(n)=n, sum is Θ(n2)≠Θ(n)\Theta(n^2)\neq\Theta(n).

Only I holds, so the count is 1.

Pitfall: Never silently assume f(n)→∞f(n)\to\infty. "Obvious" identities like f∈Ω(f)f\in\Omega(\sqrt{f}) hold for growing running times but break for a decaying ff such as 1/n1/n. Always probe with both a growing (f=nf=n) and a shrinking (f=1/nf=1/n) counterexample.

فرمول‌های کلیدی

Sum absorbs lower-order term
f(n)+O(f(n))∈Θ(f(n))f(n)+O(f(n))\in\Theta(f(n))

Adding a function bounded by c*f(n) keeps the result within a constant factor of f(n).

Sum equals max
Θ(a(n)+b(n))=Θ(max⁡(a(n),b(n)))\Theta(a(n)+b(n))=\Theta(\max(a(n),b(n)))

A sum's growth rate is set by its dominant term; e.g. f+f^2 = Theta(f^2).

Omega root condition
f(n)∈Ω(f(n))  ⟺  f(n)≥cf(n)\in\Omega(\sqrt{f(n)})\iff \sqrt{f(n)}\ge c

Holds only when f(n) is bounded below by a constant; fails if f(n) -> 0.

#asymptotic-notation#big-theta#big-omega#big-o#growth-rates#dominant-term

سوالات تمرینی