Question: / / bintree.h - - - - - - - - - - - - - - - - - - - - - -
bintree.h
ADT Binary Search Tree using nodes
Includes all of the common BST functions as well as some aditional functions
Does not include a remove function
#include input and output
#include
#include
using namespace std;
const int ARRAYSIZE ;
BST Node contains pointer for left, right, and data
struct Node
string data;
Node left;
Node right;
;
class BinTree
Overloaded : prints BinTree in correct structure
friend ostream &operatorostream & const BinTree &;
public:
Constructors
BinTree;
BinTreeconst BinTree &;
Desctructor
~BinTree;
required public methods
bool isEmpty const; check if tree is empty
retrieve the pointer of the node of given data
bool retrieveconst string & Node & const;
bool insertconst string &; insert node with the node data
displays the tree in preorder, provide prefix Root L R
void displayTree const;
void displaySideways const; displays the tree sidways
get height of a node starting from leaf
int getHeightconst string & const;
Overload operators
Assignment Operator
BinTree &operatorconst BinTree &; this rhs
Comparison Operators
bool operatorconst BinTree & const; this rhs
bool operator!const BinTree & const; this rhs
Miscellaneous Functions
void bstreeToArraystring;
void arrayToBSTreestring;
private:
Node root; Points to the root of the BST
You can add private methods here
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
