Question: Implement a generic binary tree and a generic binary search tree where the data is stored in a STL vector. Steps 1. Inherit a class

Implement a generic binary tree and a generic binary search tree where the data is stored in a STL vector.

Steps

1. Inherit a class "binaryTree" from binaryTreeInterface.h and overload all the functions. When adding and removing items, the order doesn't matter at all. You can add anywhere in the tree and move items around when removing an item if you need to.

2. Inherit a class "binarySearchTree" from "binaryTree" of the previous step or the binaryTreeInterface.h and overload at least the addNode, remove_one, and remove_all functions. Remember that in a binary search tree, in-order traversal of the tree visits the items in the increasing order.

Implement a generic binary tree and a generic binary search tree where

#ifndef BINARYTREEINTERFACE_A #define BINARYTREEINTERFACE_A 4 template 5 class binaryTreeInterfacet public: virtual void addNode(E i tm)=0; // removes all instances of itm void remove_all(E itm); 10 12 13 14 15 16 17 18 19 20 21 // tries removing one instance of itm // if the tree doesn't contain itm returns false bool remove_one(E itm); bool isEmpty) int size); void pre0rderPrint); void postOrderPrint); void inOrderPrint); int height); 23 24 25 26 27 28 29 30 #endif 31

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!