the task says, determine O, Ω, Θ for the following code:
void f1(int n) {
int i;
for (i = n; i > 0; i /= 2) {
printf("%d\n", i % 2);
}
}
Well I know loop is gonna repeat itself until i becomes 0, so i will be n , n/2, n/4 n/8...2/2,0,
I looked in the solutions and the answer to problem is O(log n), Ω(log n), Θ(log n),
Why is the answer log n?
Any help is greatly appreciated!