Pop all items one by one . Do following for every popped item a ) print it b ) push its right child c ) push its left child Note that right child is pushed first so that left is processed first
struct Node * pre = NULL ; while ( nodeStack . empty ( ) == false ) {