Dsl5
Dsl5
Construct an expression tree from the given prefix expression eg. +--a*bc/def and
traverse it using post order traversal (non recursive) and then delete the entire tree.
Program :
#include <iostream>
#include<stack>
using namespace std ;
class Node{
public:
char data ;
Node* left ;
Node* right ;
};
int main(){
Node* root ;
create( root );
//preOrder(root);
cout << endl;
//inOrder(root);
cout << endl;
postOrder(root);
return 0 ;
Output :
fe+d-c-b*a/