Taking the last label of each level of the tree
if ( count == 1 ) { b = temp . second ; } if ( ( temp . first ) -> left ) { qt . push ( make_pair ( temp . first -> left , 2 * temp . second ) ) ; } if ( temp . first -> right ) { qt . push ( make_pair ( temp . first -> right , 2 * temp . second + 1 ) ) ; } count -- ;