ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Discrete Mathematics
    MATH2113
    Progress0 / 25 topics
    Topics
    1. Mathematical Reasoning: Sets, Subsets, Algebra of Sets2. Propositions and Compound Statements3. Basic Logical Operations4. Propositional Logic and its Applications with Statement Problems5. Propositions and Truth Tables6. Tautologies and Contradictions7. Conditional and Bi-conditional Statements8. Arguments in Propositional Logic9. Propositional Functions10. Quantifiers and Negation of Quantified Statements11. Relations and Equivalence Relations12. Partial Ordering Relations13. Functions and Recursively Defined Functions14. Combinatorics: Basics of Counting Methods15. Combinations and Permutations16. Pigeonhole Principle17. Graphs and its Types18. Graph Isomorphism19. Trees in Graph Theory20. Connectivity in Graphs21. Eulerian and Hamiltonian Paths22. Spanning Trees and Shortest Path Problem23. Revisiting Special Functions: Power, Floor, Increasing, Decreasing24. Big O, Little O and Omega Notations25. Orders of the Polynomial Functions
    MATH2113›Big O, Little O and Omega Notations
    Discrete MathematicsTopic 24 of 25

    Big O, Little O and Omega Notations

    11 minread
    1,850words
    Intermediatelevel

    Big O, Little O, and Omega Notations


    In computer science and mathematics, asymptotic notations are used to describe the behavior of functions, particularly in the context of algorithms. These notations give us a way to express the efficiency of an algorithm in terms of time or space complexity as the input size grows. The three most commonly used asymptotic notations are Big O (O), Little o (o), and Omega (Ω). These notations provide different ways to classify and compare the growth rates of functions.

    1. Big O Notation (O)

    Big O notation is the most commonly used notation for describing the upper bound of an algorithm’s complexity. It represents the worst-case scenario, or the maximum amount of time (or space) an algorithm can take to complete as a function of the input size nnn.

    Definition:

    For two functions f(n)f(n)f(n) and g(n)g(n)g(n), we say that:

    f(n)=O(g(n))if there exist positive constants c and n0 such that for all n≥n0, f(n)≤c⋅g(n)f(n) = O(g(n)) \quad \text{if there exist positive constants} \, c \, \text{and} \, n_0 \, \text{such that for all} \, n \geq n_0, \, f(n) \leq c \cdot g(n)f(n)=O(g(n))if there exist positive constantscandn0​such that for alln≥n0​,f(n)≤c⋅g(n)

    In simpler terms, Big O describes an upper bound, meaning that the function f(n)f(n)f(n) will never grow faster than g(n)g(n)g(n), up to a constant factor.

    Example:

    If f(n)=3n2+5n+2f(n) = 3n^2 + 5n + 2f(n)=3n2+5n+2, we can say that f(n)=O(n2)f(n) = O(n^2)f(n)=O(n2), because as nnn grows large, the n2n^2n2 term dominates and the other terms become insignificant. Therefore, we can say that the growth of f(n)f(n)f(n) is bounded by n2n^2n2 in the worst case.

    Key Points:

    • Big O represents the upper bound, focusing on the worst-case behavior.
    • It provides a guaranteed maximum growth rate for the function.
    • The constant factor ccc and threshold n0n_0n0​ are not important in Big O, only the dominant term matters for large nnn.

    Common Big O Complexity Classes:

    • O(1)O(1)O(1): Constant time – the algorithm's runtime does not depend on the input size.
    • O(log⁡n)O(\log n)O(logn): Logarithmic time – the algorithm’s runtime grows logarithmically as the input grows.
    • O(n)O(n)O(n): Linear time – the runtime grows linearly with the input size.
    • O(n2)O(n^2)O(n2): Quadratic time – the runtime grows quadratically with the input size (e.g., bubble sort).
    • O(2n)O(2^n)O(2n): Exponential time – the runtime doubles with each additional input element (e.g., brute-force solutions to the traveling salesman problem).

    2. Little o Notation (o)

    Little o notation is used to describe a strict upper bound, meaning that one function grows strictly slower than another function as the input size grows. In other words, Little o gives a more precise comparison where the growth rate of f(n)f(n)f(n) is strictly smaller than g(n)g(n)g(n), as nnn approaches infinity.

    Definition:

    For two functions f(n)f(n)f(n) and g(n)g(n)g(n), we say that:

    f(n)=o(g(n))if for every constant c>0, there exists n0 such that for all n>n0, ∣f(n)∣<c⋅∣g(n)∣f(n) = o(g(n)) \quad \text{if for every constant} \, c > 0, \, \text{there exists} \, n_0 \, \text{such that for all} \, n > n_0, \, |f(n)| < c \cdot |g(n)|f(n)=o(g(n))if for every constantc>0,there existsn0​such that for alln>n0​,∣f(n)∣<c⋅∣g(n)∣

    This means that f(n)f(n)f(n) grows strictly slower than g(n)g(n)g(n) as nnn becomes very large, and it will eventually be dominated by g(n)g(n)g(n).

    Example:

    If f(n)=nf(n) = nf(n)=n and g(n)=n2g(n) = n^2g(n)=n2, then f(n)=o(g(n))f(n) = o(g(n))f(n)=o(g(n)), because nnn grows strictly slower than n2n^2n2 as nnn increases. For large enough nnn, n2n^2n2 will always be greater than nnn, and nnn is asymptotically insignificant compared to n2n^2n2.

    Key Points:

    • Little o is used to describe functions that grow strictly slower than another function.
    • It provides a stricter form of asymptotic behavior than Big O.
    • It shows that one function grows at a rate significantly smaller than another.

    Example in Algorithmic Complexity:

    If an algorithm has complexity O(n2)O(n^2)O(n2) but the algorithm performs strictly better, such as nlog⁡nn \log nnlogn, we would express the algorithm’s complexity as o(n2)o(n^2)o(n2), meaning it grows strictly slower than n2n^2n2.


    3. Omega Notation (Ω)

    Omega notation is used to describe the lower bound of an algorithm’s complexity. It represents the best-case scenario or the minimum time required by an algorithm, i.e., how fast the algorithm will perform in the best case (but not worse).

    Definition:

    For two functions f(n)f(n)f(n) and g(n)g(n)g(n), we say that:

    f(n)=Ω(g(n))if there exist positive constants c and n0 such that for all n≥n0, f(n)≥c⋅g(n)f(n) = \Omega(g(n)) \quad \text{if there exist positive constants} \, c \, \text{and} \, n_0 \, \text{such that for all} \, n \geq n_0, \, f(n) \geq c \cdot g(n)f(n)=Ω(g(n))if there exist positive constantscandn0​such that for alln≥n0​,f(n)≥c⋅g(n)

    In simpler terms, Omega describes a guaranteed lower bound, meaning that f(n)f(n)f(n) will always take at least as long as g(n)g(n)g(n) up to a constant factor, for large nnn.

    Example:

    If f(n)=n+10f(n) = n + 10f(n)=n+10 and g(n)=ng(n) = ng(n)=n, then f(n)=Ω(n)f(n) = \Omega(n)f(n)=Ω(n), because for large values of nnn, the term nnn dominates and f(n)f(n)f(n) will always be at least as large as nnn, plus a constant.

    Key Points:

    • Omega represents the lower bound, focusing on the best-case (minimum) growth rate.
    • It provides a guaranteed minimum time complexity.
    • The function f(n)f(n)f(n) will not grow slower than g(n)g(n)g(n) for sufficiently large nnn.

    Common Use of Omega Notation:

    • Best-case analysis: When analyzing algorithms, Omega notation gives us the best case, such as the best time an algorithm takes to execute under ideal conditions.
    • For example, a binary search in a sorted array has a best case of Ω(log⁡n)\Omega(\log n)Ω(logn), because even in the best case, it takes at least log⁡n\log nlogn steps to find the element.

    4. Summary and Comparison

    Notation Meaning Type of Bound Best Use Case
    Big O (O) Upper bound (worst-case) behavior of a function. Asymptotic Upper Bound Worst-case performance of algorithms.
    Little o (o) Strictly smaller upper bound (strictly less growth). Strict Upper Bound To express that one function grows strictly slower than another.
    Omega (Ω) Lower bound (best-case) behavior of a function. Asymptotic Lower Bound Best-case performance of algorithms.

    5. Examples and Use Cases:

    • Big O Example: If an algorithm's time complexity is O(n2)O(n^2)O(n2), it means the algorithm's time will grow no faster than n2n^2n2 as the input size increases.

    • Little o Example: If an algorithm's time complexity is o(n2)o(n^2)o(n2), it means the algorithm grows strictly slower than n2n^2n2, implying its complexity is less than quadratic growth (e.g., nlog⁡nn \log nnlogn).

    • Omega Example: If an algorithm’s time complexity is Ω(n)\Omega(n)Ω(n), it means that, in the best case, the algorithm will require at least linear time.


    These notations are essential for analyzing the efficiency of algorithms and understanding their behavior under different conditions, providing valuable insights into both the best and worst-case scenarios.

    Previous topic 23
    Revisiting Special Functions: Power, Floor, Increasing, Decreasing
    Next topic 25
    Orders of the Polynomial Functions

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time11 min
      Word count1,850
      Code examples0
      DifficultyIntermediate