我正在尝试递归调用搜索,或者使用带有 rootNode(这是 BSTN)的搜索,这给了我一个错误,说错误的类型,或者用 rootNode 的子树调用 getNode(错误说 BST 类型未定义),这给了我一个错误以及说明我有错误的类型
package sizebst;
public class sizeBST {
sizeBSTN rootNode;
public SizeBST(BSTN root){
rootNode = root;
}
public boolean search(int target){
//isn't complete but I want to recrusively search the tree calling methods from the other class
getNode(rootNode.LSubtree, target);
}
这是我想从中调用 getNode 的方法。
package sizebst;
public class SizeBSTN {
SizeBSTN LSubtree;
SizeBSTN RSubtree;
int data;
int size;
public SizeBSTN(int data){
LSubtree = null;
RSubtree = null;
this.data = data;
size = 1;
}
public static SizeBSTN getNode(SizeBSTN node, int target){
// isn't working yet but it finds a node and returns it.
}
}