Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the base of the logarithm for the purposes of Algorithms?

Tags:

big-o

While considering O(log(N)) for time complexity, what is the base of log?

like image 598
sabika shamim Avatar asked Nov 11 '09 04:11

sabika shamim


People also ask

Which algorithm is the base of the algorithm?

The joint best basis algorithm computes the jointly best bases given: the set of signals, an information cost function and a wavelet basis, see (Wickerhauser 1994) and (Coifman and Wickerhauser 1992).

Is algorithm related to logarithm?

The word algorithm is derived from the Old French word algorisme, which was the term for the Arabic numeral system. A logarithm is a quantity that represents the power to which the base or fixed number must be raised in order to produce a specific number.

Why log is used in algorithm?

– In complexity theory, they are used to measure input sizes, especially when the input is numeric and we want to count the number of digits. – In complexity theory, the complexity functions for algorithms that repeatedly split their input into two halves involve logs to the base 2.

What is the base of the logarithmic complexity?

In Computer Science, it's often base 2. This is because many divide and conquer algorithms that exhibit this kind of complexity are dividing the problem in two at each step. Binary search is a classic example.


1 Answers

All logarithms are related by some constant. (Hence the change-of-base formula). Because we generally disregard constants in complexity analysis, the base doesn't matter.

Usually, the base is considered to be 2, when deriving the algorithm. Consider a sort like merge sort. You can construct a tree out of it, and the tree has a height of log₂ n, because each node has two branches.

like image 95
GManNickG Avatar answered Oct 20 '22 16:10

GManNickG