traverse current level and find minimum and maximum value of this level .
while ( levelSize > 0 ) { root = q . Peek ( ) ; q . Dequeue ( ) ; levelSize -- ; minval = Math . Min ( minval , root . key ) ; maxval = Math . Max ( maxval , root . key ) ; if ( root . left != null ) q . Enqueue ( root . left ) ; if ( root . right != null ) q . Enqueue ( root . right ) ; }