跳至内容

Ch-3 Algorithm

Word Table

术语翻译术语翻译术语翻译
definiteness确定性correctness正确性finiteness有限性
generality通用性notation记号complexity复杂度

The Growth of Functions

asymptotic running time is the number of operation used by the algorithm as the input size approaches infinity

Big-O notation

Let \(f\) and \(g\) be functions from \(\mathrm{Z}\) (or \(\mathrm{R}\)) to \(\mathrm{R}\) , we say that \(f(x)\) is \(O(g(x))\) if there are constants \(C\) and \(k\) such that \(|f(x)|\leq C|g(x)|\) whenever \(x>k\)

Big-Omega notation

Let \(f\) and \(g\) be functions from \(\mathrm{Z}\) (or \(\mathrm{R}\)) to \(\mathrm{R}\) , we say that \(f(x)\) is \(\Omega(g(x))\) if there are constants \(C\) and \(k\) such that \(|f(x)|\geq C|g(x)|\) whenever \(x>k\)

Big-Theta notation

Let \(f\) and \(g\) be functions from \(\mathrm{Z}\) (or \(\mathrm{R}\)) to \(\mathrm{R}\) , we say that \(f(x)\) is \(\Theta(g(x))\) if \(f(x)\) is \(O(g(x))\) and \(f(x)\) is \(\Omega(g(x))\) ,there are constants \(C_1,C_2\) and \(k\) such that \(0\leq C_1g(x)\leq f(x)\leq C_2g(x)\) whenever \(x>k\)

Complexity Table

ComplexityTerminology
\(\Theta(1)\)constant complexity
\(\Theta(\log n)\)logarithmic complexity
\(\Theta(n)\)linear complexity
\(\Theta(n\log n)\)/
\(\Theta(n^b)\)polynomial complexity
\(\Theta(b^n),b>1\)exponential complexity
\(\Theta(n!)\)factorial complexity