Example 2: Time Complexity of an Algorithm With Nested Loops
This example is about computing the time complexity of an algorithm that involves nested for-loops.
We'll cover the following
In the previous lesson, you learned how to calculate the time complexity of an algorithm that involves a loop. Now, you will extend the same idea to analyzing an algorithm with nested for-loops.
Nested for
loop
Consider the following C# program:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.