Answer the question
In order to leave comments, you need to log in
Why is the speed of an algorithm measured in number of operations and not in seconds?
Hello!
I'm wondering
Why is the speed of the algorithm measured in number of operations and not in seconds?
Couldn't it be that a multiple line program runs faster than a two line function (built-in)?
Answer the question
In order to leave comments, you need to log in
And what will seconds give you?
Here you have two programs that process the same data and get the same results using different algorithms. The first program does it in 10 seconds, the second in 20. How to estimate how much the processing time will increase with an increase in the amount of data by 10 times?
No way, until we know the complexity of the algorithm. If the first has complexity O(n 2 ), and the second - O(n), then the running time of the first will increase by 100 times and will be 1000 seconds, and the second - only 10 times (200 seconds). That is, a program that was faster on a small dataset suddenly becomes much slower on a large dataset. And the determining parameter here is precisely the computational complexity of the algorithm.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question