for each power of two find logarithm
for i in range ( 1 , n + 1 ) : NEW_LINE INDENT if ( currPower2 == i ) : NEW_LINE INDENT currLog2 += 1 NEW_LINE currPower2 *= 2 NEW_LINE DEDENT log2 [ i ] = currLog2 NEW_LINE DEDENT return numberOfHeaps ( n ) NEW_LINE