U
U
UID_B Nintendo2018-08-06 06:00:31
Algorithms
UID_B Nintendo, 2018-08-06 06:00:31

Why is n^3 faster than 2^n?

Topic: Estimating the complexity of algorithms. Why is n^3 faster than 2^n ?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Ruslan., 2018-08-06
@LaRN

Because if we substitute N >= 10 into the formula, then the value of 2^N is greater than N^3.

M
Mercury13, 2018-08-06
@Mercury13

One out of two.
Read the definition of Landau symbols, and everything will be clear.
n³ = o(2 n ) as n→∞, which means:
lim{n→∞} n³ / 2 n = 0.
Which means: as n increases infinitely, an algorithm that works for n³ will have more and more advantage over its competitor .
The complexity of the first is O(1) (always two multiplications), the complexity of the second in the general case is O(log n) (due to the fact that logarithms from different bases differ by a constant, and Landau symbols do not take into account the constant, the base of the logarithm is not written) .
UPD. What does "generally" mean? The estimate can be increased by various minor algorithms such as memory allocation and decimalization, and reduced by the fact that 2 n can be calculated by a shift. Don't forget that the complexity of algorithms is defined as n→∞.

R
res2001, 2018-08-06
@res2001

Straightforwardly speaking, N^3 requires 3 multiplication operations (O(3)) for any N.
Moreover, if N > 3, then 2^N will require >3 multiplication operations (N multiplication operations, if done very stupidly) .
But if N is an integer and 2^N is implemented by a shift, not a multiplication, then it will work sooo fast - O (1) for all N in the allowable range.

E
Eugene, 2018-08-06
@evgshk

The answer to the question can be the calculation of the limit of the ratios of two functions. If we say that one "grows" faster than the other, then we take their ratio and calculate its limit (for n->∞). If the value tends to infinity, the statement is true.
In the case of n ^ 3 and 2 ^ n, this is how it turns out :

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question