複雜度定義 The Definition of Complexity
阿新 • • 發佈:2018-11-26
The upper bound Big-O:
Definition: f(n) is in O(g(n)) if there are constants c0 and N0 such that f(n) < c0*g(n) for all n>N0. We are only interested in large n, n>N0.
(Heuristics)計算方法:刪掉低階變數(包括零階),只保留最高階變數,變數前的係數變為1。如15n2 + 33n + 17 is in O(n2),當然15n2 + 33n + 17 is in O(n3 )也是對的,但我們通常只關心cloest bound。
Dominance Relation: n! >>2n >> n2 >> n3 >> nlogn >> n >> logn >> 1
在Dominance Relation中忽略log的底,可以通過換底公式換成相同的底,且因為係數忽略,所以底不重要。
(Arithmetic)計算方法:
(截自Comp20003, University of Melbourne)
The lower bound Big-Omega(Ω):
Definition: f(n) is Ω(g(n)) if g(n) is O(f(n))。
The tight bound / the growth rate Big-Omega(Ω):
Definition: f(n) is θ(g(n)) is f(n) is O(g(n)) and f(n) is Ω(g(n))