I've learned that a while loop such as
int i = 100;
while (i >= 1){
...
///Stuff
i = i/2
}
will run in logarithmic time, specifically, O(logn)
, since it keeps dividing in half each time (like a binary search).
However, what if my while loop looks like this
int i = 100;
while (i >= 1){
...
///Stuff
i = i/3
}
Is the complexity still O(logn)
?
Can someone explain yes/no and why?