import dataStructure.tree.BinaryTree;
public class Ancestors {
public static void main(String args[]) {
String[] preorder={"A","B","D",null,"G",null,null,null,"C","E",null,null,"F","H"};
BinaryTree
bitree.preOrder();
String value="H";
BinaryNode
if(find==null)
System.out.println("\n未找到"+value);
else{
BinaryNode
System.out.print("\n"+find.data+"的祖先结点是");
while(parent!=null){
System.out.print(parent.data+" ");
parent = bitree.getParent(parent);
}
System.out.println();
}
}
public BinaryTree(E[] preorder){
root=create(preorder);
}
private int i=0;
private BinaryNode
BinaryNode
if(i
i++;
if(elem!=null){
p=new BinaryNode
p.left=create(preorder);
p.right=create(preorder);
}
}
return p;
}
}
I:\java\第六章144\Ancestors.java:25: 方法声明无效;需要返回类型
public BinaryTree(E[] preorder){
^
1 错误
哪里有问题?麻烦了。谢谢!