In c++, Program a binary search tree with Person objects (name, age, height, wei
ID: 3741148 • Letter: I
Question
In c++, Program a binary search tree with Person objects (name, age, height, weight). Implement the following functionality:
Insert: build by alphabetical order of names
Preorder traversal
Inorder traversal
Postorder traversal
Levelorder traversal
Delete: Deleting a value without sending the deleted value back
DeleteBack: Deleting a value and sending it back to the calling function
Minimum
Maximum
Search (search by name)
SearchBack (search by name and return the value back)
Explanation / Answer
#include #include #include #include "binarySearchTree.h" using namespace std; class person{ public: string getName(); void setName(string nm); string getAddress(); void setAddress(string addy); string getPhoneNumber(); void setPhoneNumber(string num);} bool person::operator==(const person& right) const; bool person::operator!=(const person& right) const; bool person::operator=(const person& right) const; ostream& operatorllink); copyTree(copiedTreeRoot->rlink, otherTreeRoot->rlink); } } //end copyTree template void binaryTreeType::inorder(nodeType *p) { if(p != NULL) { inorder(p->llink); coutrlink)); } template int binaryTreeType::max(int x, int y) { if(x >= y) return x; else return y; } #endifRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.