Skip to content

Wrong complexity for problem

In the problem

https://gl.mathhub.info/courses/FAU/AI/problems/-/blob/main/source/complexity/prob/loop-complexity.en.tex

The complexity for the first problem is calculated wrong since the j loop only runs once (j is never reset to 0). In the end it doesn't matter since in both cases the complexity ends up being O(n), but as j is never reset, it goes from 0 to 10 (11 times, not 10) once, then never again, so it's O(n) + O(11)