Solution: Big O of Nested Loop with Multiplication
This review provides a detailed analysis of the different ways to solve the Big O of Nested Loop with Multiplication problem.
We'll cover the following...
Solution
Python 3.5
n = 10 # Can be anythingsum = 0pie = 3.14var = 1while var < n:print(pie)for j in range(var):sum += 1var *= 2print(sum)
Explanation
The answer is . Have a look at the slides below for an in-depth explanation of the answer.
In the slides below, rtc abbreviates the running time complexity.
Time Complexity
The above slides give a detailed, step-by-step analysis of the code. Here, we provide a more summarized version.
The outer loop here runs ...