Get width of each level and compare the width with maximum width so far
for i in range ( 1 , h + 1 ) : NEW_LINE INDENT width = getWidth ( root , i ) NEW_LINE if ( width > maxWidth ) : NEW_LINE INDENT maxWidth = width NEW_LINE DEDENT DEDENT return maxWidth NEW_LINE