Function to print the leaf nodes
static void printLeafNodes ( ArrayList < Integer > arrlist ) { for ( int i = arrlist . size ( ) - 1 ; i >= 0 ; i -- ) { System . out . print ( arrlist . get ( i ) + " ▁ " ) ; } }