iterate while length is not equal to n
for ( int i = 0 ; i <= 1 ; i ++ ) { Node * x = new Node ( n , l + 1 , N ) ; for ( int k = 0 ; k < l ; k ++ ) x -> soln [ k ] = n -> soln [ k ] ; x -> soln [ l ] = i ; n -> child . push_back ( x ) ; Q . push ( x ) ; } } }