Answers:
这取决于对数在哪里。如果这只是一个因素,那没有什么区别,因为big-O或允许您乘以任何常数。
如果采用则基数很重要。在基数2中,您只有,在基数10中,它约为。
因为渐进符号忽略了常数因子,并且任何两个对数相差一个常数因子,所以底数没有区别:对所有a ,,b > 1。因此,在使用渐近表示法时,无需指定对数的底数。
在大多数情况下,删除对数的底数是安全的,因为,正如其他答案所指出的那样,对数的基础更改公式意味着所有对数都是彼此的常数倍。
在某些情况下,这样做是不安全的。例如,@ gnasher729指出,如果指数中有一个对数,则对数底数的确很大。
. For any fixed integer this simplifies to . However, what happens if isn't a constant? A clever technique is to pick , in which case the runtime simplifies to . Since = , the overall expression simplifies to . Notice that, in this case, the base of the logarithm is indeed significant because it isn't a constant with respect to the input size. There are other algorithms that have similar runtimes (an old analysis of disjoint-set forests ended up with a term of somewhere, for example), in which case dropping the log base would interfere with the runtime analysis.
Another case in which the log base matters is one in which there's some externally-tunable parameter to the algorithm that control the logarithmic base. A great example of this is the B-tree, which requires some external parameter . The height of a B-tree of order is , where the base of the logarithm is significant in that is not a constant.
To summarize, in the case where you have a logarithm with a constant base, you can usually (subject to exceptions like what @gnasher729 has pointed out) drop the base of the logarithm. But when the base of the logarithm depends on some parameter to the algorithm, it's usually not safe to do so.