I created a Binary Tree of an expression and has the operators (+, -, /, *) as roots and operands (values) as the children left/right. I need to evaluate that expression in the Binary Tree taking the parameters (T, v) where 'T' is the binary tree and 'v' is a node where postorder traversal starts.
I have searched on how postorder traversal works and all of that which I understand. But I don't know how to implement the code using a node 'v' for the postorder traversal.
My method looks like this...
public int evaluateExpression (LinkedBinaryTree<T> tree, Position<T> v) {
}
This should return the operator being used on its operators (children of the root). So, I understand what to do, I am stuck on how to actually do it. -.-