I think it does not matter what is the base of the log as the relative complexity is the same irrespective of the base used.
So you can think of it as O(log2X) = O(log10X)
Also to mention that logarithms are related by some constant.
So
log??(x) = log?(x) / log?(10)
So most of the time we generally disregard constants in complexity analysis, and hence we say that the base doesn't matter.
Also you may find that the base is considered to be 2 most of the time like in Merge Sort. The tree has a height of log? n
, since the node has two branches.
1)I am confused over whether is it Log base 10 or Log base 2 as
different articles use different bases for their Logarithm .
So as explained above this change of base doesn't matter.
2) Does it make a difference if its Log base 2 or Log base 10??
No it does not matter.
3)Can we assume it mean Log base 10 when we see O(LogN)???
Yes you can assume that provided you know the base conversion rule.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…