-3

The steps of algorithm are:

  1. Set J = N
  2. Repeat while J >1 Module A. J = J/2
  3. Return.

I need to find the time complexity of following in Big O notation.

udbhateja
  • 948
  • 6
  • 21

1 Answers1

0

Assuming Module A is a O(k) operation you observe that J is decreasing exponentially most specifically you observe that the loop will always reapeat log n (base 2 because it is halfed at each iteration) times thus you have a time complexity of O(k*log n)