So this is a question in my homework….
Given that the efficiency of an algorithm is n3, if a step in the algorithm takes 1 ns (10-9) seconds), how long does it take the algorithm to process an input of size 1,000?
Here is MY question: How do I figure this out? PLEASE DO NOT POST THE ANSWER. Help me learn how to figure this out for myself.
You define
nto be1000. Thus, you need n3 steps, each one of them taking1 ns. Multiply the two and you have the answer.General idea: if an algorithm needs
f(n)number of steps and one step takestthen you needt * f(n)for the algorithm.