CS 411 Fall 2025 > Outline for August 29, 2025
CS 411 Fall 2025
Outline
for August 29, 2025
Outline
Asymptotic Notation [L 2.2]
- Big-\(O\) notation
  - Used to express order of growth
- Is about a function. Most common function is one that gives maximum number of steps required for a given input size.
 
- \(\Omega\) and \(\Theta\) notations
- Property: this-then-that
  - Order of sum is max of orders.
    - Example: \(n+n^2\) is \(\Theta(n^2)\).
 
- So if an algorithm does this and then that, the order of growth of the number of steps required is the max of the order of this & the order of that.
 
- Order of sum is max of orders.
    
- Using limits
  - To determine whether \(f(n)\) or \(g(n)\) is of higher order,
  we can compute
\[ \lim_{n\to+\infty} \frac{f(n)}{g(n)}. \] - If the result is \(0\), then \(g(n)\) is of higher order.
- If the result is \(+\infty\), then \(f(n)\) is of higher order.
- If the result is a constant \(c > 0\), then \(f(n)\) and \(g(n)\) are of the same order.
 
- When dealing with factorials,
  the computations are often simpler if we use
  Stirling’s formula:
 This is a good approximation for the factorial in the following sense:\[ n! \approx \frac{n^n}{e^n}\sqrt{2\pi n}. \] 
 Because of this, the approximation to the factorial given by Stirling’s formula is more than good enough for order-of-growth computations.\[ \lim_{n\to+\infty} \frac{\frac{n^n}{e^n}\sqrt{2\pi n}}{n!} = 1. \] 
 
- To determine whether \(f(n)\) or \(g(n)\) is of higher order,
  we can compute
- Classes (small to large;
the base of logarithms does not matter)
  - \(1\): constant
- \(\log n\): logarithmic
- \(n\): linear
- \(n\log n\): linearithmic, a.k.a. log-linear
- \(n^2\): quadratic
- \(n^3\): cubic
- \(c^n\) for a constant \(c > 0\): exponential
- \(n!\): factorial