Showing the order of growth of the function

The body of the inner loop is executed n times.

The body of the outer loop is executed for all powers of 2 from 1 to n and there are about log2(n) of them, hence the global complexity


Browse More Popular Posts

Leave a Comment