...

/

Example: Measuring Time Complexity of a Single Loop Algorithm

Example: Measuring Time Complexity of a Single Loop Algorithm

In this lesson, we are going to learn how to compute the time complexity of an algorithm that involves a for loop.

A For Loop With n Iterations

Now, let’s consider what happens when a loop is involved. Consider the following javascript program:

Access this course and 1400+ top-rated courses and projects.