What is the Big-O of a nested loop, where number of iterations in the inner loop is determined by the current iteration of the outer loop?

Yep, it’s still O(n^2), it has a smaller constant factor, but that doesn’t affect O notation.

Leave a Comment