DEV Community

Discussion on: A coffee-break introduction to time complexity of algorithms

qequ profile image
λlvaro Frias

Hello there!

A small mistake i've seen in your post is in the example of giving forks. The initial program is O(n) no O(n^2). That's because the first loop is constant (it is not looping over n).
I suggest you to correct that, because that example, for someone who just started in algorithm analysis, could induce to think that every program with, let's say, k nested loops will be at least O(n^k), when that it is not true.
Out of that, great introduction to this awesome subject that is algorithm analysis!

Greetings :)