What exactly does big Ө notation represent?

前端 未结 6 2294
南笙
南笙 2020-11-22 11:31

I\'m really confused about the differences between big O, big Omega, and big Theta notation.

I understand that big O is the upper bound and big Omega is the lower b

6条回答
  •  春和景丽
    2020-11-22 12:25

    First of All Theory

    1. Big O = Upper Limit O(n)

    2. Theta = Order Function - theta(n)

    3. Omega = Q-Notation(Lower Limit) Q(n)

    Why People Are so Confused?

    In many Blogs & Books How this Statement is emphasised is Like

    "This is Big O(n^3)" etc.

    and people often Confuse like weather

    O(n) == theta(n) == Q(n)

    But What Worth keeping in mind is They Are Just Mathematical Function With Names O, Theta & Omega

    so they have same General Formula of Polynomial,

    Let,

    f(n) = 2n4 + 100n2 + 10n + 50 then,

    g(n) = n4, So g(n) is Function which Take function as Input and returns Variable with Biggerst Power,

    Same f(n) & g(n) for Below all explainations

    Big O - Function (Provides Upper Bound)

    Big O(n4) = 3n4, Because 3n4 > 2n4

    3n4 is value of Big O(n4) Just like f(x) = 3x

    n4 is playing a role of x here so,

    Replacing n4 with x'so, Big O(x') = 2x', Now we both are happy General Concept is

    So 0 ≤ f(n) ≤ O(x')

    O(x') = cg(n) = 3n4

    Putting Value,

    0 ≤ 2n4 + 100n2 + 10n + 50 ≤ 3n4

    3n4 is our Upper Bound

    Theta(n) Provides Lower Bound

    Theta(n4) = cg(n) = 2n4 Because 2n4 ≤ Our Example f(n)

    2n4 is Value of Theta(n4)

    so, 0 ≤ cg(n) ≤ f(n)

    0 ≤ 2n4 ≤ 2n4 + 100n2 + 10n + 50

    2n4 is our Lower Bound

    Omega n - Order Function

    This is Calculated to find out that weather lower Bound is similar to Upper bound,

    Case 1). Upper Bound is Similar to Lower Bound

    if Upper Bound is Similar to Lower Bound, The Average Case is Similar
    
    Example, 2n4 ≤ f(x) ≤ 2n4,
    Then Omega(n) = 2n4
    

    Case 2). if Upper Bound is not Similar to Lower Bound

    in this case, Omega(n) is Not fixed but Omega(n) is the set of functions with the same order of growth as g(n).
    
    Example 2n4 ≤ f(x) ≤ 3n4, This is Our Default Case,
    Then, Omega(n) = c'n4, is a set of functions with 2 ≤ c' ≤ 3
    

    Hope This Explained!!

提交回复
热议问题