You have 3 free guides left 😟
Unlock your guides
You have 3 free guides left 😟
Unlock your guides

3.1 Big O, little o, and related notations

3 min readaugust 9, 2024

Asymptotic notations help us understand how functions grow as inputs get really big. , , , and give us ways to compare and classify functions, which is super useful for figuring out how efficient algorithms are.

These notations are key tools for analyzing the long-term behavior of functions and algorithms. They let us ignore small details and focus on the big picture, making it easier to compare different approaches and predict performance as data sizes grow.

Asymptotic Notations

Big O and Little o Notations

Top images from around the web for Big O and Little o Notations
Top images from around the web for Big O and Little o Notations
  • Big O notation describes of for functions
  • Formally defined as f(n)=O(g(n))f(n) = O(g(n)) if c>0\exists c > 0 and n0>0n_0 > 0 such that 0f(n)cg(n)0 \leq f(n) \leq cg(n) for all nn0n \geq n_0
  • Used to classify algorithms by their efficiency (time complexity, space complexity)
  • Common Big O notations include O(1)O(1), O(logn)O(\log n), O(n)O(n), O(nlogn)O(n \log n), O(n2)O(n^2) (constant, logarithmic, linear, linearithmic, quadratic)
  • Little o notation provides a stricter upper bound than Big O
  • Defined as f(n)=o(g(n))f(n) = o(g(n)) if limnf(n)g(n)=0\lim_{n \to \infty} \frac{f(n)}{g(n)} = 0
  • Indicates that f(n)f(n) grows strictly slower than g(n)g(n) asymptotically

Omega and Theta Notations

  • Omega notation describes of growth rate for functions
  • Formally defined as f(n)=Ω(g(n))f(n) = \Omega(g(n)) if c>0\exists c > 0 and n0>0n_0 > 0 such that 0cg(n)f(n)0 \leq cg(n) \leq f(n) for all nn0n \geq n_0
  • Theta notation represents both upper and lower bounds simultaneously
  • Defined as f(n)=Θ(g(n))f(n) = \Theta(g(n)) if f(n)=O(g(n))f(n) = O(g(n)) and f(n)=Ω(g(n))f(n) = \Omega(g(n))
  • Provides a tight asymptotic bound on the growth rate of a function
  • serve as shorthand notations for these asymptotic behaviors
  • Include OO, oo, Ω\Omega, ω\omega, and Θ\Theta symbols

Asymptotic Analysis

Asymptotic Equivalence and Growth Rate

  • compares functions as they approach infinity
  • Two functions f(n)f(n) and g(n)g(n) are asymptotically equivalent if limnf(n)g(n)=1\lim_{n \to \infty} \frac{f(n)}{g(n)} = 1
  • Denoted as f(n)g(n)f(n) \sim g(n)
  • Growth rate measures how quickly a function increases as its input grows
  • Classified into categories such as constant, logarithmic, linear, polynomial, exponential
  • Faster growth rates include factorial (n!n!) and double exponential (22n2^{2^n})

Analyzing Asymptotic Behavior

  • focuses on the behavior of functions as input size approaches infinity
  • Ignores constant factors and lower-order terms
  • Helps compare algorithms' efficiency for large input sizes
  • Involves techniques such as limit comparison and series expansion
  • Useful for understanding long-term trends in data and algorithm performance
  • Applied in various fields including computer science, physics, and economics

Bounds

Upper and Lower Bounds

  • Upper bound represents maximum value or growth rate a function can achieve
  • In Big O notation, g(n)g(n) serves as an upper bound for f(n)f(n) if f(n)=O(g(n))f(n) = O(g(n))
  • Lower bound represents minimum value or growth rate a function can achieve
  • In Omega notation, g(n)g(n) serves as a lower bound for f(n)f(n) if f(n)=Ω(g(n))f(n) = \Omega(g(n))
  • Tight bounds occur when upper and lower bounds match (represented by Theta notation)
  • Loose bounds provide less precise information about a function's behavior
  • Bounds help in analyzing best-case, worst-case, and average-case scenarios for algorithms
  • Used in complexity theory to classify problems based on their computational difficulty
© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.


© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.
Glossary
Glossary