Skip to content
Azhimathi Mayam logoDSA Study HubPCCST303 · KTU · S3
Module 1 · syllabusAsked 2× in KTU papersLesson live

Asymptotic notations

Big-O, Omega and Theta — the ceiling, the floor and the sandwich — with proofs you can write in 3 lines.

Syllabus says: “Asymptotic Notations”

On this page · 10 sections
ormakkurippu ✎
Never-forget card

O = CEILING (never goes above). Ω = FLOOR (never goes below). Θ = SANDWICH (squeezed between both).

Picture it

Auto fare from Thampanoor to Technopark: “at most ₹300” is Big-O, “at least ₹150” is Omega, “between ₹150 and ₹300” is Theta.

Write this in the exam

f(n) = O(g(n)) if there exist positive constants c and n₀ such that f(n) ≤ c·g(n) for all n ≥ n₀.

O മേൽക്കൂര, Ω തറ, Θ സാൻഡ്‌വിച്ച്!

What you will be able to do

  • Define O, Ω and Θ formally (KTU Nov 2025 Q9a, May 2026 Q9a).
  • Illustrate each one graphically.
  • Prove a bound by finding c and n₀.

The story

For big inputs, small details stop mattering. An algorithm taking 3n² + 50n + 7 steps behaves like n² once n is large: at n = 1000 the 3n² part is 3,000,000 and 50n is only 50,000. Asymptotic notation is how we say “behaves like n²” precisely, ignoring constants and lower-order terms.

The three definitions

DefinitionBig-O (upper bound)

f(n) = O(g(n)) iff there exist positive constants c and n₀ such that f(n) ≤ c·g(n) for all n ≥ n₀.

f(n) = O(g(n))
n₀nf(n)c·g(n)
After n₀, f(n) never rises above c·g(n).
DefinitionOmega (lower bound)

f(n) = Ω(g(n)) iff there exist positive constants c and n₀ such that f(n) ≥ c·g(n) for all n ≥ n₀.

f(n) = Ω(g(n))
n₀nf(n)c·g(n)
After n₀, f(n) never drops below c·g(n).
DefinitionTheta (tight bound)

f(n) = Θ(g(n)) iff there exist positive constants c₁, c₂ and n₀ such that c₁·g(n) ≤ f(n) ≤ c₂·g(n) for all n ≥ n₀.

f(n) = Θ(g(n))
n₀nf(n)c₂·g(n)c₁·g(n)
After n₀, f(n) stays inside the band between c₁·g(n) and c₂·g(n).

Two more, for completeness: little-o — f(n) = o(g(n)) if f(n)/g(n) → 0 (strictly smaller growth). Little-omega — f(n) = ω(g(n)) if f(n)/g(n) → ∞ (strictly larger growth).

Worked example

1. Show 3n + 2 = Θ(n)

  1. Upper: 3n + 2 ≤ 3n + n = 4n for n ≥ 2. So c₂ = 4, n₀ = 2 → 3n + 2 = O(n).
  2. Lower: 3n + 2 ≥ 3n for n ≥ 1. So c₁ = 3 → 3n + 2 = Ω(n).
  3. Both hold for n ≥ 2, hence 3n + 2 = Θ(n) with c₁ = 3, c₂ = 4, n₀ = 2.

2. Show 10n² + 4n + 2 = O(n²)

10n² + 4n + 2 ≤ 11n² ⇔ n² ≥ 4n + 2, which is true for n ≥ 5 (25 ≥ 22). So c = 11, n₀ = 5.

3. Show 2ⁿ ≠ O(n²) (disproof)

Suppose 2ⁿ ≤ c·n² for all n ≥ n₀. But 2ⁿ/n² → ∞ as n grows, so for any c there is an n where 2ⁿ > c·n². Contradiction.

Pro tipShortcut for polynomials

If f(n) = aₘnᵐ + … + a₀ with aₘ > 0, then f(n) = Θ(nᵐ). Keep the biggest power, drop the constants.

Common mistakes

  • Forgetting the “for all n ≥ n₀” part of the definition.
  • Thinking Big-O means worst case. O is a bound on a function; you can give an O-bound for the best case too.
  • Writing O(3n) or O(n² + n) — simplify to O(n) and O(n²).
  • Drawing the graph without labelling n₀ and c·g(n).

Asked in KTU exams (2)

Quick check — can you get them all?

Question 1

Q1.3n + 2 = O(n). Which constants prove it?

Question 2

Q2.Which notation gives a tight bound (both upper and lower)?

Question 3

Q3.Is n² = O(n³)?

Practice

Every visualizer has a Practice mode: predict the next state before the animation reveals it. You can also work through the topic's question set on the practice page.

Exam-ready summary

  • O: f ≤ c·g after n₀ (ceiling). Ω: f ≥ c·g after n₀ (floor). Θ: c₁g ≤ f ≤ c₂g (sandwich).
  • Always state c and n₀.
  • Polynomial of degree m → Θ(nᵐ).
  • Order: 1 < log n < n < n log n < n² < n³ < 2ⁿ < n!

References

  • Horowitz, Sahni & Anderson-Freed, Fundamentals of Data Structures in C, 2/e — §1.5.3 (Asymptotic notation)
  • Cormen, Leiserson, Rivest & Stein, Introduction to Algorithms, 3/e — §3.1

Explanations on this page are original. Textbook references point to where the standard treatment can be read; no text is reproduced from them.

Prefer revising from notes? Module-wise notes and question papers on Azhimathi Mayam (opens in a new tab)