When analyzing the runtime of a function, it’s necessary to check the number of iterations the loop will perform based on the size of the input.
divideByTwo() function below takes in a positive integer of size
n, and returns the number of times
n must be divided by
2 until it reaches
We can analyze the runtime of this function by counting the number of iterations the
while loop will perform based on the size of the input (