educative.io

Challenge 3: Big O of Nested Loop with Multiplication - Data Structures for

In this example…I am bit confused when there is a nested loop how come the big O value is (outer loop big O + inner loop big O) and not (outer loop big O * inner loop big O) ?

Hi Annie,
It is outer loop + inner loop because they’ve already considered the time complexity of the outer loop when they calculated the time complexity for the inner loop with the geometric series. If you still have doubts, visit the solution of the problem in the next lesson where it is explained very well.