CS460 Notes
CS460 Notes
Sherwin Fernandes
September 10, 2024
1
1 Big O Rules
1.1 Big O Definition
By definition,
f(n) is O(g(n)) iff ∃ (there exists) c1 , n0 > 0 where f(n) ≤ c ∗ g(n) ∀ n ≥ n0
Trying option A:
Knowing Big O equation:
√ f(n) ≤ c1 ∗ g(n) for some n ≥ n0
n + log(n) ≤ c * n for some n ≥ n0
Going to option B:
prove g(n) is O(f(n)), prove g(n) ≤ c ∗ f (n) ∀ n ≥ n0
To √
so n ≤ c ∗ (n + log(n)) ∀ n ≥ n0
substituting c = 1, n0 = 1 the equality would be valid
2
Big Theta is the tightest bound (avg)