为什么大哦符号示例中 (n) 的值不同?

why the value of (n) in big oh notation examples is different?

谁能解释为什么示例 4.10 中的 (n) 的值大于或等于二,而示例 4.11 中的值大于或等于一(请注意,术语 n log n 在两个示例中都是 Existing !)

示例 4.10 :

5n^2 + 3nlogn + 2n + 5 is O(n^2) 

理由:5n^2 + 3nlogn + 2n + 5 <= (5+3+2+5)n^2 = cn^2 , for c=15 , when n greater than or equal to 2 (note that n log n is zero for n = 1 ).

示例 4.11 :

20n^3 + 10nlogn  + 5 is O(n^3) 

理由:20n^3 + 10nlogn + 5 <= 35n^3 , for n greater than or equal to 1 .

函数 f(n) 被称为 O(g(n)) 当且仅当存在这样的常数 C 和这样的 n0 使得 f(n) <= C*g(n) 对于所有 n>=n0.

此定义不需要 n0 的任何特定值。因此,在您的第一个示例 n0=2 中,在您的第二个示例中 n0=1,但是特定值对于 big-O 定义并不重要,它只需要 some (any) 这样的 n0 存在。

(但是,价值对于证明很重要,这就是价值不同的原因。)

另请注意,C 常量也不同:第一个示例中的 C=15 和第二个示例中的 C=35