mercredi 31 août 2016

What's the time complexity of this while loop?

while(n>x) 
  x*=x;

The correct answer is log(log(n)), I can see the log(n) since x^k>=n is when the while loop will stop. so I got to log(n), what am I missing?

P.S: it is given that x=2.

Aucun commentaire:

Enregistrer un commentaire