traverse current level and find minimum and maximum value of this level .
while ( levelSize > 0 ) : NEW_LINE INDENT root = q . queue [ 0 ] NEW_LINE q . get ( ) NEW_LINE levelSize -= 1 NEW_LINE minval = min ( minval , root . key ) NEW_LINE maxval = max ( maxval , root . key ) NEW_LINE if ( root . left ) : NEW_LINE INDENT q . put ( root . left ) NEW_LINE DEDENT if ( root . right ) : NEW_LINE INDENT q . put ( root . right ) NEW_LINE DEDENT DEDENT