BST T3;
  vector T3x = T2.getPreOrder();
  for (auto token : T3x)
     T3.insert(token);
  cout << \"************ T3 ************\"<< endl;
  T3.inOrder();
  cout << \"****************************\" <  cout << \"T3 Leaf Nodes = \" << T3.CLeaves()<< endl;
  cout << \"T3 Height = \" << T3.height()<< endl;
  cout << \"****************************\" <  return 0;
}
BST.CPP
#include \"BST.h\"
template
void BST::insert(gen x)
{
  insert(root, x);
}
template
bool BST::remove(string value)
{
  return remove(NULL, root, value);
}
template
void BST::preOrder()
{
  preOrder(root);
}
template
void BST::postOrder()
{
  postOrder(root);
}
template
void BST::inOrder()
{
  inOrder(root);
}
template
vector BST::getPreOrder()
{
  vector temp;
  getPreOrder(root, temp);
  return temp;
}
template
vector BST::getPostOrder()
{
  vector temp;
  getPostOrder(root, temp);
  return temp;
}
template
vector BST::getInOrder()
{
  vector temp;
  getInOrder(root, temp);
  return temp;
}
template
int BST::CLeaves()
{
  int s = 0;
  CLeaves(root, s);
  return s;
}
template
int BST::height()
{
  return HeightL(root);
}
template
void BST::DestroyRecursive(BNode* node)
{
  if (node)
  {
     DestroyRecursive(node->LChild);
     DestroyRecursive(node->RChild);
     delete node;
  }
}
template
BST::~BST()
{
  DestroyRecursive(root);
  root = nullptr;
}
template
void BST::insert(BNode*& t, gen x){
  if (!t) { t = new BNode; t->data = x;t->LChild = t->RChild = nullptr; }
  else if (x < t->data)
     insert(t->LChild, x);
  else
     insert(t->RChild, x);
}
template
void BST::preOrder(BNode* t) {
  if (t) {
     cout << t->data <<\"\n\";
     preOrder(t->LChild);
     preOrder(t->RChild);
  }
}
template
void BST::postOrder(BNode* t) {
  if (t) {
     postOrder(t->LChild);
     postOrder(t->RChild);
     cout << t->data <<\"\n\";
  }
}
template
void BST::inOrder(BNode* t) {
  if (t) {
     inOrder(t->LChild);
     cout << t->data <<\"\n\";
     inOrder(t->RChild);
  }
}
template
void BST::getPreOrder(BNode* t,vector& temp) {
  if (t) {
     temp.push_back(t->data);
     getPreOrder(t->LChild,temp);
     getPreOrder(t->RChild,temp);
  }
}
template
void BST::getPostOrder(BNode* t,vector& temp) {
  if (t) {
     getPostOrder(t->LChild,temp);
     getPostOrder(t->RChild,temp);
     temp.push_back(t->data);
  }
}
template
void BST::getInOrder(BNode* t,vector& temp) {
  if (t) {
     getInOrder(t->LChild,temp);
     temp.push_back(t->data);
     getInOrder(t->RChild,temp);
  }
}
template
int BST::HeightL(BNode* P) {
  if (P == NULL)
     return 0;
  else
  {
     /* compute the depth of eachsubtree */
     int lDepth =HeightL(P->LChild);
     int rDepth =HeightL(P->RChild);
     /* use the larger one */
     if (lDepth > rDepth)
        return(lDepth +1);
     else return(rDepth + 1);
  }
}
template
void BST::CLeaves(BNode* P, int& s){
  if (P) {
     if (IsLeaf(P))
        s++;
     CLeaves(P->LChild, s);
     CLeaves(P->RChild, s);
  }
}
BST.h
#pragma once
#include
#include
#include
using namespace std;
template
struct BNode
{
  gen data;
  BNode* RChild;
  BNode* LChild;
  BNode()
  {
     RChild = nullptr;
     LChild = nullptr;
  }
};
template
class BST
{
public:
  BST()
  {
     root = nullptr;
  }
  void insert(gen x);
  bool remove(string value);
  void preOrder();
  void postOrder();
  void inOrder();
  vector getPreOrder();
  vector getPostOrder();
  vector getInOrder();
  int CLeaves();
  int height();
  void DestroyRecursive(BNode* node);
  ~BST();
private:
  BNode* root;
  void insert(BNode*& t, gen x);
  void preOrder(BNode* t);
  void postOrder(BNode* t);
  void inOrder(BNode* t);
  void getPreOrder(BNode* t,vector& temp);
  void getPostOrder(BNode* t,vector& temp);
  void getInOrder(BNode* t,vector& temp);
  int HeightL(BNode* P);
  bool IsLeaf(BNode* P)
  {
     return (!(P->LChild) &&!(P->RChild));
  }
  void CLeaves(BNode* P, int& s);
};
text.file
Enter a line: this is a line and it is with spaces and withoutsemicolons
********** TOKENS **********
this
is
a
line
and
it
is
with
spaces
and
without
semicolons
****************************
************ T1 ************
and
and
a
is
it
semicolons
spaces
line
is
without
with
this
****************************
T1 Leaf Nodes = 4
T1 Height = 5
****************************
************ T2 ************
and
a
and
is
it
is
semicolons
line
spaces
without
with
this
****************************
T2 Leaf Nodes = 4
T2 Height = 9
****************************
************ T3 ************
a
and
and
is
is
it
line
semicolons
spaces
this
with
without
****************************
T3 Leaf Nodes = 4
T3 Height = 9
****************************