If stack is not empty , print contents of stack Here assumption is that the key is there in tree
while ( len ( st ) != 0 ) : NEW_LINE INDENT print ( st [ - 1 ] . data , end = " ▁ " ) NEW_LINE st . pop ( ) NEW_LINE DEDENT