Question: Project Description: An Expression Tree Builder/Evaluator An arithmetic expression can be represented using a binary tree whose leaves are associated with variables or constants, and

 Project Description: An Expression Tree Builder/Evaluator An arithmetic expression can be

Project Description: An Expression Tree Builder/Evaluator An arithmetic expression can be represented using a binary tree whose leaves are associated with variables or constants, and whose internal nodes are associated with one of the operators +, -, *, and . Each node has a value associated with it. write an implementation of the B?ExpTree class. You can use either array-based or linked-based implementation. The BiExpTree class has the following methods 1. BiExpTree0: to construct an empty binary expression tree 2. CreateExp (exp) takes a fully parenthesized expression and builds a binary expression tree representation for t. You may assume that all operators are values (variables are not required). 3. prefix) displays the prefix form of the expression 4. infix0: displays the infix form of the expression stored in the 5. evalExp0: evaluates the arithmetic expression stored in the stored in the calling BiExpTree object calling BiExpTree object calling BiExpTree object and returns its value gram: Write a menu-driven program to implement an expression tree builder and evaluator. The menu includes the following options 1. Input new arithmetic expression. The program w prompt the user to enter a fully parenthesized arithmetic expression. A binary expression tree corresponding to that expression is created. You may assume that only valid input is expected 2. Display prefix form of expression The programw invoke the prefix) method from the B?ExpTree class to display a prefix form of the expression. 3. Display infix form of expression. The program invoke the infix) method from the B?ExpTree class to display an infix form of the expression. 4. Evaluate expression. The programwl call the EvalExprO method from the BiExpTree class. 5. Exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!