log2 implementation is bad
It looped forever on input 0. This naieve implementation of log2 does not handle that edge case properly, such that a repeated division by 2 will never fail, causing an infinite loop.
And to be precise, “slow” means that it is O(n)!!
Log in to post comments