Question: #ifndef EXPRESSIONTREE _ H #define EXPRESSIONTREE _ H #include #include using namespace std; #pragma warning ( disable : 4 2 9 0 ) template class
#ifndef EXPRESSIONTREEH
#define EXPRESSIONTREEH
#include
#include
using namespace std;
#pragma warning disable :
template
class ExprTree
public:
Constructor
ExprTree ;
ExprTreeconst ExprTree& source;
ExprTree& operatorconst ExprTree& source;
Destructor
~ExprTree ;
Expression tree manipulation operations
void build ;
void expression const;
DataType evaluate const throw logicerror;
void clear ; Clear tree
void commute;
bool isEquivalentconst ExprTree& source const;
Output the tree structure used in testingdebugging
void showStructure const;
bool isEmpty const;
private:
class ExprTreeNode
public:
Constructor
ExprTreeNode char elem,
ExprTreeNode leftPtr ExprTreeNode rightPtr ;
Data members
char dataItem; Expression tree data item
ExprTreeNode left Pointer to the left child
right; Pointer to the right child
;
Recursive helper functions for the public member functions insert
prototypes of these functions here.
void showHelper ExprTreeNode p int level const;
Data member
ExprTreeNode root; Pointer to the root node
;
#endif #ifndef EXPRESSIONTREEH
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
