For example, if an algorithm runs in the order of n 2, replacing n by cn means the algorithm runs in the order of c 2 n 2, and the big O notation ignores the constant c 2. Changing units is equivalent to multiplying the appropriate variable by a constant wherever it appears. For example, 2 n and 3 n are not of the same order.Ĭhanging units may or may not affect the order of the resulting algorithm. On the other hand, exponentials with different bases are not of the same order. Similarly, logs with different constant bases are equivalent. The logarithms differ only by a constant factor (since log( n c) = c log n) and thus the big O notation ignores that. The set O(log n) is exactly the same as O(log( n c)). We may ignore any powers of n inside of the logarithms. An algorithm can require time that is both superpolynomial and subexponential examples of this include the fastest known algorithms for integer factorization and the function n log n. One that grows more slowly than any exponential function of the form c n is called subexponential. A function that grows faster than n c for any c is called superpolynomial. If c is greater than one, then the latter grows much faster. The sets O( n c) and O( c n) are very different. In particular, if a function may be bounded by a polynomial in n, then as n tends to infinity, one may disregard lower-order terms of the polynomial. Example of Big O notation: f ( x ) ∈ O ( g ( x ) )
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |