The best optimization in place currently is using a grid search for depths where all nodes have children. Each gridpoint is a tree itself. This could recurse in instances where only a few subtrees have a high depth, to prevent them from having to do a full tree traversal whenever called in that region.
The best optimization in place currently is using a grid search for depths where all nodes have children. Each gridpoint is a tree itself. This could recurse in instances where only a few subtrees have a high depth, to prevent them from having to do a full tree traversal whenever called in that region.