Solution Review: Big (O) of Nested Loop with Subtraction
Explore how to analyze the time complexity of nested loops by examining each statement's execution frequency in C#. Learn to calculate running time and simplify to Big O notation, focusing on O(n squared) complexity.
We'll cover the following...
We'll cover the following...
Solution
On line 10 in the outer loop, int i=n; runs once. i>=1; gets executed times, and i-=3 executed times. In the inner loop, int j=n; gets executed times in total. j>=0; executes times, and j-- gets executed ...