Print next level of taken out item and enque next level 's children
while ( curr != null ) { document . write ( curr . data + " " ) ; if ( curr . child != null ) { q . push ( curr . child ) ; } curr = curr . next ; } } }