What is the total running time of counting from 1 to n in binary if the time needed to add 1 to the current number i is proportional to the number of bits in the binary expansion of i that must change in going from i to i+1?

Leave a Reply

Your email address will not be published. Required fields are marked *