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.
}
}