📜  Big Oh、Big Omega 和 Big Theta 之间的区别

📅  最后修改于: 2021-09-28 10:11:43             🧑  作者: Mango

先决条件 – 渐近符号,渐近符号的属性
1.大哦符号 (O) :
大 oh 符号用于描述渐近上限。

在数学上,如果 f(n) 描述算法的运行时间; f(n) 是 O(g(n)) 如果存在正常数 C 并且不存在这样的

0 <=f(n) <= c g(n) for all n>=n0

n = 用于给出a函数的上限。
如果一个函数是 O(n),那么它也自动是 O(n-square) !

Big oh (O) 的图形示例:

2. 大欧米茄符号(Ω):
就像 O 符号提供渐近上限一样,Ω 符号提供渐近下界。
让 f(n) 定义算法的运行时间;

如果存在正常数 C 和 (n 0 ) 使得 f(n) 称为 Ω(g (n))

O<= C g(n) <= f(n) for all n>=n 0

n= 用于给出函数的下界
如果一个函数是 O(n-square),那么它也自动是 O(n)。

Big Omega (Ω) 的图形示例:

3.大Theta符号(Θ):
让 f(n) 定义算法的运行时间。

如果 f(n) 为 O(g(n)) 且 f(n) 为 Ω(g(n)),则称 f(n) 为 Θ(g(n))

在数学上,

O<=f(n)<=C 1 g(n) for n>=n 0

O<= C 2 g(n)<=f(n) for n >=n 0

合并两个方程,我们得到:

O<=C 2 g(n)<=f(n)<=C 1 g(n) for n>=n 0

该等式仅表示存在正常数 C 1 和 C 2 使得 f(n) 夹在 C 2 g(n) 和 C 1 g(n) 之间。

Big Theta (Θ) 的图形示例:

Big oh、Big Omega 和 Big Theta 之间的区别:

S.No. 
 
Big Oh 
 
Big Omega 
 
Big Theta 
 
1. It is like <= 
rate of growth of an algorithm is less than or equal to a specific value 
 
It is like >= 
rate of growth is greater than or equal to a specified value 
 
It is like == 
meaning the rate of growth is equal to a specified value 
 
2. The upper bound of algorithm is represented by Big O notation. Only the above function is bounded by Big O. asymptotic upper bond is it given by Big O notation. The algorithm’s lower bound is represented by Omega notation. The asymptotic lower bond is given by Omega notation The bounding of function from above and below is represented by theta notation. The exact asymptotic behavior is done by this theta notation.
3. Big oh (O) – Worst case Big Omega (Ω) – Best case Big Theta (Θ) – Average case
4. Big-O is a measure of the longest amount of time it could possibly take for the algorithm to complete. Big- Ω is take a small amount of time as compare to Big-O it could possibly take for the algorithm to complete. Big- Θ is take very short amount of time as compare to Big-O and Big-? it could possibly take for the algorithm to complete.
5. Mathematically – Big Oh is 0 <=f(n) <= c g(n) for all n>=n0 Mathematically – Big Omega is O<= C g(n) <= f(n) for all n>=n 0 Mathematically – Big Theta is O<=C 2 g(n)<=f(n)<=C 1 g(n) for n>=n 0