Code Binary Search Given Write Main Program Create Binary Tree Type String Display Values Q37083344

The code for binary search is given to you on

Write the main program and create a binary tree of type string.Display the values using in order traversal.

Find the count of the nodes in the binary tree.

Find the number levels.

The Language is C++

Main

#include <iostream>
#include <iomanip>
#include “Tree.h” // Tree class definition
using namespace std;

int main()
{
Tree< int > intTree; // create Tree of int values
  
cout << “Enter 10 integer values:n”;
  
// insert 10 integers to intTree
for ( int i = 0; i < 10; ++i )
{
int intValue = 0;
cin >> intValue;
intTree.insertNode( intValue );
} // end for
  
cout << “nPreorder traversaln”;
intTree.preOrderTraversal();
  
cout << “nInorder traversaln”;
intTree.inOrderTraversal();
  
cout << “nPostorder traversaln”;
intTree.postOrderTraversal();
  
Tree<

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.