java - complexity of simple algorithm -


i have following algorithm dont know its' complexity. me? input size n.

int x = n; while (x > 0) {     system.out.println("value is" + x);     x = x/5; } 

thanks lot!

in each iteration x divided 5. how many iterations take x become lower 1 (and therefore 0)?

the answer log5(n) (logarithm base 5 of n), o(log(n)).


Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -