Question: The following the class template for a binary tree that can hold values of any data type. Your task is to complete the coding for

The following the class template for a binary tree that can hold values of any data type. Your task is to complete the coding for the function that performs an inorder, postorder or preorder display for this tree class. Use the program's given constructs and variables as appropriate.

#ifndef BINARYTREE_H

#define BINARYTREE_H

#include

using namespace std;

template

class BinaryTree

{

public:

struct TreeNode

{

T value;

TreeNode *left;

TreeNode *right;

};

TreeNode *root;

void insert(TreeNode *&, TreeNode *&)

void destroySubTree(TreeNode *);

void deleteNode(T, TreeNode *&);

void makeDeletion(TreeNode *&);

void displayInOrder(TreeNode *);

void displayPreOrder(TreeNode *);

void displayPostOrder(TreeNode *);

public:

BinaryTree()

{ root = nullptr;}

~BinaryTree()

{ destroySubTree(root);}

void insertNode(T);

bool searchNode(T);

void remove(T);

void displayInOrder()

{ displayInOrder(root);}

void displayPreOrder()

{ displayPreOrder(root);}

void displayPostOrder()

{ displayPostOrder(root); }

};

// Write the displayInOrder function

// YOUR CODE HERE

//******************************************************************

// The displayInOrder member function displays the values

//******************************************************************

//Using parentheses instead of tags because they are absorbed into the HTML template ((class T))

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!