Then calculate nodes for leaves present at height h - 1
i = X NEW_LINE while ( left_leaf_nodes > 1 and i > 0 ) : NEW_LINE INDENT left_leaf_nodes = ceil ( left_leaf_nodes / 2 ) NEW_LINE i -= 1 NEW_LINE DEDENT