This code will run but it has some errors in it( I mean,logically wrong.) What is its error? Can you help me figure it out?
void preOrder(){
myPreOrderTraversal(this);
}
int myPreOrderTraversal(BinaryTree t){
if (t != null) // {} missing
return t.getRoot(); //return should be removed
myPreOrderTraversal(this.getLeft()); //replace this with t
myPreOrdertraversal(this.getRight()); //replace this with t
}