Issues with Binary Trees and subtrees
I need to build a tree like this,and produce the numbers below randomly,and the operators
also produced randomly.Please note that there are 4 constants,and 3 operators all to be randomly generated.The tree is such:
-10
/
-
/ \
/*
/ \/ \
16.0 16.0 2.0 5.0
In arithmetic format it is: ((16.0 / 16.0) - (2.0 * 5.0)) = - 10
So far,this is what I have,not sure how to proceed from here,any help would be greatly appreciated.Is this what is called recursions? Not sure.
publicclass TestTree{
// evaluate ((16.0 / 16.0) - (2.0 * 5.0)) = - 10
publicstaticvoid main(String[] args){
System.out.println("");
}
publicint randContants(){
}
publicchar randOperators(){
}
public String toString(){
return"";
}
}

