Question: C++ implementation for a recursive function, which takes in the root node of a Binary Expression Tree, and returns an infix expression string for the

 C++ implementation for a recursive function, which takes in the root

C++ implementation for a recursive function, which takes in the root node of a Binary Expression Tree, and returns an infix expression string for the tree. For example a given a tree which is built by the postfix expression: b5+a+b+6-2-x+ The function should return the string: (((((b+5)+a)+b)-6)-2)+x

struct node { char data; shared_ptr left; shared_ptr right; node (char data) { this->data = data; left = NULL; right = NULL; }

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!