QuestionQuestion

You are to create a binary tree class template to create a tree of people or some other class that has a name that can be arranged in alphabetical order.

You may want to modify the linked list class to implement the tree. A tree simply has two links instead of one.
This can be done recursively: insert a person into the tree. If the tree is empty, put the person as the root of the tree. Otherwise insert the person into either the left (if the name of the new person comes before the name at the root) or right subtree otherwise.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#ifndef BINARYTREE_H
#define BINARYTREE_H

#include <iostream>
#include <cstdlib>

using namespace std;
template <class T>
class Node{
    public:
       T data;
       Node<T> * left;
       Node<T> * right;
       Node(T data, Node<T> * left = NULL, Node<T> * right = NULL){
            this->data = data;
            this->left = left;
            this->right = right;
       }
};

template <class T>
class BinaryTree{
    public:
       BinaryTree();
       void insert(T data);
       void print();...
$40.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats