Run this while loop till queue got empty
while ( Q . Count != 0 S . Count != 0 ) { while ( S . Count != 0 ) { temp = S . Peek ( ) ; S . Pop ( ) ; Console . Write ( temp . data + " ▁ " ) ; if ( dir == LEFT ) { if ( temp . left != null ) Q . Enqueue ( temp . left ) ; if ( temp . right != null ) Q . Enqueue ( temp . right ) ; }