How to find the height of the deepest full level in a binary search tree? [closed]

If a node has no left or right node, you know that the deepest full level is 1 – the node itself.

If it has left and right nodes, recurse and choose the smaller.

highestFull(BinaryNodeX<Comparable> *t)
   if ( ! t->left || ! t->right ) return 1;
   return 1 + std::min( highestFull(t->left), highestFull(t->right) );

Leave a Comment