3 ms·
I am sooo not a math person. Let's not forget there is overhead to loops. At a minimum let's assume there is a single statement in the loop body, an increment
by austincheney 9y ago
I am sooo not a math person.
Let's not forget there is overhead to loops. At a minimum let's assume there is a single statement in the loop body, an increment statement and a terminal condition. In a single loop of 1000 iterations there are 3000 things to evaluate. The math becomes:
(n * 3)^x
If a simple loop is nested twice (3 depths) there would be 1 billion iterations but about 27 billion evaluations. Would it be correct to say that is just slightly faster polynomial growth?