subject

Write a C++ program to print the elements of binary trees using preorder, inorder, and postorder traversal. The program includes the following Declare and implement functions preorder, inorder, and postorder in the file funcs. cpp
// funcs. cpp
#include< iostream>
using namespace std;
template
struct BinaryNode
T element;
BinaryNode left;
BinaryNode right;
BinaryNode(const T & d T()) : element(d)
left nullptr;
right nullptr;
//print the elements of binary tree in preorder
template
void preorder (const BinaryNode* root) //
add your code //
print the elements of binary tree in inorden
template
void inorder(const BinaryNode root) //
add your code //
print the elements of binary tree in postorder
void postorder(const BinaryNode root) // add your code ename T> .
The main function is contained in the file lab06. cpp
// lab06.cpp
#include "funcs. cpp..
BinaryNode BinaryNodeくchar>* BinaryNode(char>*
BinaryNode* BinaryNode BinaryNode< char>*
node-A node-B
node_C
node-D
node-E new BinaryNode(char»('A');
new BinaryNode«char»('B');
new BinaryNode('C');
new BinaryNode«char»('D');
new BinaryNode('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() BinaryNode* root create-binary-tree(); = //
add your code //
call traversal functions to print elements

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What is used to analyze and summarize your data without graphical support
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Kenny works with an it company. his company is about to launch new software in the market. he has to ensure that this new software is functional and meets all of the quality standards set up at the planning stage. which job profile is kenny likely to have? kenny is likely to have the job profile of a blank .
Answers: 2
question
Computers and Technology, 24.06.2019 17:40
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately
Answers: 2
question
Computers and Technology, 24.06.2019 18:30
Is a type of bullying that takes place when a person intentionally posts negative information about another person that is not true.
Answers: 2
You know the right answer?
Write a C++ program to print the elements of binary trees using preorder, inorder, and postorder tra...
Questions
question
Mathematics, 04.10.2020 15:01
question
Mathematics, 04.10.2020 15:01
question
Mathematics, 04.10.2020 15:01
Questions on the website: 13722360