Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Apply the concept of Polymorphism to get a good design
Implement the Node class using NumericNode and OperatorNode classes.
NumericNode only maintains the value and evaluate returns this value.
OperatorNode Maintains the left and right nodes representing the left and right operands, and the evaluate function applies the operator to them.