U
U
UmOx2018-06-13 10:54:06
Algorithms
UmOx, 2018-06-13 10:54:06

Machine constants and asymptotic analysis of algorithms?

Good day to all!
The question arose while studying the asymptotic analysis of algorithms.
In the article I am studying, there is a paragraph that if you test two different algorithms on two different machines (one is linear, the other is logarithmic; one is slow, the other is faster), then for sizes of input values ​​that exceed a certain mark, the algorithm on a slow machine will run faster due to its logarithmic growth.
And there is the line "So the machine dependent constants can always be ignored after certain values ​​of input size".
I don't understand what machine constants are in question and why they can be ignored after a certain input size.
In general, the question is what kind of machine constants do they mean.
Thank you for your attention.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-06-13
@UmOx

machine constant dependents is the number of cycles per algorithm cycle and the processor clock speed.
Let's assume that the O(n) linear algorithm is running on a fast computer and each cycle takes 1 nanosecond, so the total time will be 1×n. The logarithmic algorithm O(log n) runs on a slow computer and each cycle takes 100 nanoseconds, the total time is 100×log(n) Let's see how the time of the algorithm will change when n changes.

n    | O(n) | O(log n)
1    |    1 |   100
10   |   10 |   200
100  |  100 |   300
1000 | 1000 |   400

That is, in the range from 100 to 1000 there is a value n, after which the logarithmic algorithm runs faster even on a slower computer.
In general, the value of n can be obtained from the equalitya×n = b×log(n)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question