Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
BSTree节点的深度(java)_Java - Fatal编程技术网

BSTree节点的深度(java)

BSTree节点的深度(java),java,Java,我卡在B树节点的深度 有人有算法或代码来查找BSTree节点的深度吗? 谢谢Psuedocode: Function Depth If the right child isn't null, set left_depth to Depth(left_child), else set left_depth to 0. If the left child isn't null,set right_depth to Depth(right_child), else set right_

我卡在B树节点的深度
有人有算法或代码来查找BSTree节点的深度吗?
谢谢

Psuedocode:

Function Depth
    If the right child isn't null, set left_depth to Depth(left_child), else set left_depth to 0.
    If the left child isn't null,set right_depth to Depth(right_child), else set right_depth to 0.
    return maximum(left_depth, right_depth) + 1;

请参阅张贴的代码。

您能把问题说清楚一点吗?树的深度是否定义为树的高度??您的BST是AVL(平衡树)吗?另外,您的BST数据结构是否得到了扩充?