Print the node of ith level
for ( int j = 0 ; j < result . get ( i ) . size ( ) ; j ++ ) System . out . print ( result . get ( i ) . get ( j ) + " ▁ " ) ; System . out . println ( ) ; } } public static void main ( String [ ] args ) { Node root = newNode ( 1 ) ; ( root . child ) . add ( newNode ( 2 ) ) ; ( root . child ) . add ( newNode ( 3 ) ) ; ( root . child . get ( 0 ) . child ) . add ( newNode ( 4 ) ) ; ( root . child . get ( 0 ) . child ) . add ( newNode ( 5 ) ) ; ( root . child . get ( 1 ) . child ) . add ( newNode ( 6 ) ) ; ( root . child . get ( 1 ) ) . child . add ( newNode ( 7 ) ) ; ( root . child . get ( 1 ) . child ) . add ( newNode ( 8 ) ) ;