79194539

Date: 2024-11-16 04:51:22
Score: 0.5
Natty:
Report link

The code has two loops:

Outer Loop:

Inner Loop:

So

This continues until i reaches n.

total number of iterations of the inner loop is: 1+2+4+8+⋯+n

This means the inner loop runs 𝑂(𝑛) times in total when you add up all the work across the outer loop.

The runtime of the entire code is 𝑂(𝑛) because the inner loop dominates the total work done.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Gerard Haw