If stack is not empty , print contents of stack Here assumption is that the key is there in tree
while ( ! st . isEmpty ( ) ) { System . out . print ( st . peek ( ) . data + " ▁ " ) ; st . pop ( ) ; } }