Skip to content

Files

Latest commit

author
Shuo
Nov 27, 2021
cb30580 · Nov 27, 2021

History

History

design-an-expression-tree-with-evaluate-function

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Nov 27, 2021

< Previous                  Next >

Related Topics

[Math] [Stack] [Tree] [Design] [Binary Tree]

Hints

Hint 1 Apply the concept of Polymorphism to get a good design
Hint 2 Implement the Node class using NumericNode and OperatorNode classes.
Hint 3 NumericNode only maintains the value and evaluate returns this value.
Hint 4 OperatorNode Maintains the left and right nodes representing the left and right operands, and the evaluate function applies the operator to them.