Approximate how large of a problem instance you need before algorithm A is faster than algorithm B? How much time does the algorithm take on that instance?
Algorithm A takes n(n + 10) hours to solve a problem of size n
Algorithm B takes n^3 seconds on the same problem
Hey here is answer to your question.
SO as per given question
Algo A takes n(n+10) hours means n(n+10)*3600 seconds.
Algo B takes n^3 seconds.
if we start comparing that till which point algo B is good means n^3 < n(n+10)*3600 so we get that
till the size of n < 3609 algo B will take less time
but right on n = 3610 and futher algo A will become better in case
of time taken.
there is not much calculation just comaping both expression to compare at which point one takes over another.
Get Answers For Free
Most questions answered within 1 hours.