Input n Repeat n= n/2 Until n<= 1
i'm not sure whether this has a time complexity of O(n) or O(log n) since n is being halved in every iteration of the loop...
I know that to calculate the time complexity you have to go through each operation and see how many times it will be executed with respect to the input, the part that confuses me is that since we are changing the value of the input with every iteration of the loop, what effect does that have on the total time complexity?
any information about calculating time complexity of algorithms from just looking at code would be appreciated as i still don't quite have a hang of it...