我怎样才能找到我们用来在二叉搜索树中找到最大值的路径的长度(如表单A ====> B一步和A ====>乙====> C三个步骤) ,这里是我的代码以找到最大价值,我已经试过在她的每一个解决方案,但我没有找到答案计算在二进制搜索树中查找最大值的路径长度
public int findMax(){
if(root == null){ // check if the root is not empty
return 0;
}
Node current = root;
while(current.rightChild != null){
current =current.rightChild ;
}
return current.value ;
}