//File bstree.h #ifndef BSTREEH #define BSTREEH #include #include #include #include "queue.h" enum travtype {PREORDER,INORDER,POSTORDER}; class information { public: information(char* wd=NULL,int pnum=0); void load(char* wd,int pnum); char* word() {return w;}; int pagenumber() {return pagenum;}; private: char* w; int pagenum; }; class bstnode { friend class binstree; public: bstnode(information item); ~bstnode() {}; void see() const { cout.setf(ios::left, ios::adjustfield); cout<< setw(25) << setfill(' ') <see(); cout << endl; }; private: char* key; queue* data; bstnode* left; bstnode* right; }; class binstree { public: //member functions binstree():root(NULL) {}; ~binstree() {postorderdissolve(root);}; void insert(information item); void remove(char* itemkey); boolean search(char* itemkey) const; void retrieve(char* itemkey,int*& itemdata) const; void traverse(travtype order); private: //member functions void postorderdissolve(bstnode*& p); void addroot(information item); void addleft(bstnode* p,information item); void addright(bstnode* p,information item); void removenode(bstnode*& p); // boolean srch(bstnode* p,char* itemkey) const; bstnode* srch(bstnode* p,char* itemkey) const; queue* retr(bstnode* p,char* itemkey) const; void preordertraversal(bstnode* p); void inordertraversal(bstnode* p); void postordertraversal(bstnode* p); private: //data members bstnode* root; char keyLetter; }; class bstTest { public: bstTest(); }; #endif