public class NiBoLan {
private static final int MAX_NODE = 100;
// 二叉树的结点类
private static class MyTreeNode {
public double value;// 若结点是数字,则保存为该结点的值;若是符号,则此字段无意义
public char symbol;// '+','-','*','/','d'
public int left;// 左孩子
public int right;// 右孩子
public int father;// 爹地
public void init() {
value = 0;
symbol = '\0';
left = -1;
right = -1;
father = -1;
}
}
private static boolean isOperator(char c) {
if (c == '+' || c == '-' || c == '*' || c == '/') {
return true;
}
return false;
}
private static boolean isDigit(char c) {
if ((c <= '9' && c >= '0') || c == '.') {
return true;
}
return false;
}
// 用递归计算树的值
private static double getNodeValue(MyTreeNode[] tree, int nodeNum)