Dequeue all Nodes of current level and Enqueue all Nodes of next level
curr_level1 = [ ] NEW_LINE curr_level2 = [ ] NEW_LINE while ( n1 > 0 ) : NEW_LINE INDENT node1 = q1 [ 0 ] NEW_LINE q1 . pop ( 0 ) NEW_LINE if ( node1 . left != None ) : NEW_LINE INDENT q1 . append ( node1 . left ) NEW_LINE DEDENT if ( node1 . right != None ) : NEW_LINE INDENT q1 . append ( node1 . right ) NEW_LINE DEDENT n1 -= 1 NEW_LINE node2 = q2 [ 0 ] NEW_LINE q2 . pop ( 0 ) NEW_LINE if ( node2 . left != None ) : NEW_LINE INDENT q2 . append ( node2 . left ) NEW_LINE DEDENT if ( node2 . right != None ) : NEW_LINE INDENT q2 . append ( node2 . right ) NEW_LINE DEDENT curr_level1 . append ( node1 . data ) NEW_LINE curr_level2 . append ( node2 . data ) NEW_LINE DEDENT