Answer the question
In order to leave comments, you need to log in
Why is log n written without a base in the complexity estimate of an algorithm?
Well, the question is from above.
I don’t understand why the base is not written
. And what will be the answer for example 64?
Answer the question
In order to leave comments, you need to log in
O(n) is a very rough estimate of the complexity of an algorithm. In particular, it discards all constants. From the algebra course:
log a n = (log b n)/(log b a), log b is a-constant and discarded.
As you can see from this expression, the base of the logarithm in the O(n) estimate is meaningless.
However, most often base-2.
In this context, the expression log 64 does not make much sense. The complexity of the algorithm is not about how much time (or memory) it will exactly take, but how the dependence grows with n. (See the notion Asymptotic complexity of an algorithm). As stated in other answers - this is a very rough estimate, and what the base of the logarithm is does not play a special role. The main thing is that it is not linear, not quadratic, etc., namely, "logarithm graph forms." No more and no less.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question