Example 1: Measuring Time Complexity of a Single Loop Algorithm

Learn how to compute the time complexity of an algorithm that involves a for-Loop.

In the previous lesson, you calculated the time complexity of the algorithm implemented in a simple C# program.

A for Loop with n iterations

Now, consider what happens when a loop is involved. Consider the following C# program:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.