c++ - Not sure what this recursive function returns -


i reading recursive functions, , have been trying figure out mathematical formula one. thought maybe logarithmic function, not seem it. if point me in right direction, appreciate it.

unsigned f(unsigned n){     if(n<2)     return 1;      return 1 + f(n/2); } 

it logarithm function, base 2. more specifically, it's ceil 1 + floor(log2(n)).


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -