#ifndef _TREESETBST_H #define _TREESETBST_H #include using namespace std; #include "tree.h" class TreeSetBST { public: TreeSetBST(); virtual bool contains(const string& s) const; virtual int size() const; virtual void print() const; virtual void levelPrint() const; virtual void insert(const string& s); virtual void insert(TreeSetBST * ts); protected: struct TreeNode { string info; int height; TreeNode * left; TreeNode * right; TreeNode(const string& s, TreeNode * lptr, TreeNode * rptr) : info(s), height(1), left(lptr), right(rptr) { } }; int inline max(int x, int y) { return x > y ? x : y; } virtual int height(TreeNode * root) const; virtual void doInsert(const string& s, TreeNode * & root); virtual void doInsert(TreeNode * otherRoot); virtual void doPrint(TreeNode * root) const; virtual void doLevelPrint(TreeNode * root, int level) const; TreeNode * myRoot; int myCount; }; #endif