print when level is equal to k
if ( level == klevel && temp != null ) { flag = true ; document . write ( temp . data + " " ) ; } q . shift ( ) ; if ( temp == null ) { if ( q [ 0 ] != null ) q . push ( null ) ; level += 1 ;