Question: using namespace std; template struct BinaryNode T element; BinaryNode* left; BinaryNode* right; Bina ryNode(const T & d = T()) : element (d) Left nullptr; right

 using namespace std; template struct BinaryNode T element; BinaryNode* left; BinaryNode*
right; Bina ryNode(const T & d = T()) : element (d) Left
nullptr; right nullptr: //print the elements of binary tree in preorder template

using namespace std; template struct BinaryNode T element; BinaryNode* left; BinaryNode* right; Bina ryNode(const T & d = T()) : element (d) Left nullptr; right nullptr: //print the elements of binary tree in preorder template void preorder (const BinaryNodeelement -. preorder (root->left) preorder (root->right) //print the elements of binary tree in inorder template void inorder(const BinaryNodeleft); cout element -; inorder(root->right); //print the elements of binary tree in postorder template void postorder(const BinaryNoderight): cout element ('E') node A->left node B; node A->right node C; node B.>left node D node B->right node E; return node A; int main() BinaryNodecchar* root - create binary tree); // add your code / call traversal functions to print elements Please read the comments and implement the three traversal functions in funcs.cpp. Then complete the following steps: 1. In the main), declare a binary tree root in which elements are char type, and call three traversal functions to print the elements of this binary tree 2. Compile and run the program to make sure that your functions work correctly 3. Add a new function create binary tree int), in which elements are integers. The binary tree shape is, 4. In the main), declare a binary tree root int in which elements are int type, and call three traversal functions to print the elements of this binary tree. 5. Compile and run the program to make sure that your functions work correctly. preorder: 1 - 7 -26->5 -> 11 -3 ->9 4 -> r: 2511 .> 6 .> 7493

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!