Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Translate this C++ code into to C. #include #include #include #include using namespace std; class BinaryTreeNode { public: char data; BinaryTreeNode *left, * right; BinaryTreeNode(char

Translate this C++ code into to C.

#include

#include #include #include using namespace std;

class BinaryTreeNode { public: char data; BinaryTreeNode *left, * right; BinaryTreeNode(char data) { this->data = data; this->left = this->right = NULL; } };

bool find_it(char val) { if (val == '+' || val =='-' || val == '*' || val =='/') return true; else return false; }

void inorder(BinaryTreeNode *tree) { if(tree!= NULL) { inorder(tree->left); cout<data; inorder(tree->right); } }

void postorder(BinaryTreeNode * tree) { if (tree != NULL) { postorder(tree->left); postorder(tree->right); cout<data; } }

void preorder(BinaryTreeNode *tree) { if (tree!= NULL) { cout<data; preorder(tree->left); preorder(tree->right); } } BinaryTreeNode * create_expression(string pf) { stack st; int i=0; BinaryTreeNode * ptr_1, *ptr_2; int sz = pf.length(); for(i=0;ileft = ptr_2; node_opr->right = ptr_1; st.push(node_opr); } } return (st.top()); }

int main() { string pf; cout<<"Enter the postfix expression"<>pf; BinaryTreeNode * root = create_expression(pf); cout<<" Inorder traversal"<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago