English

Any algorithm that has a loop (usually 1 to n) will have the time complexity of:

Advertisements
Advertisements

Question

Any algorithm that has a loop (usually 1 to n) will have the time complexity of:

Options

  • 1

  • N

  • N2

  • None of these

MCQ
Advertisements

Solution

N

Explanation:

Any algorithm with a loop (often 1 to n) will take N times as long to complete. This is as a result of the loop running N times.

shaalaa.com
Time Complexity of Algorithms in Python
  Is there an error in this question or solution?
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×