big o - Big O complexity of this loop -


if have

int i; for(i = 1; < n; *= 2) //n size of array passed function {   //o(1) code here } 

what big o complexity? "i *= 2" bit confusing me. tried operation counting i'm more confused.

it looks o(log(n)), because iterate not on whole sequence, use power-of-two steps.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -