二叉树建立过程见下面是关于二叉树的遍历、查找、删除、更新数据的代码(递归算法):#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef int T; class bst { struct Node { T data; Node* L; Node* R; Node(const T& d,Node* lp=NULL,Node* rp=NULL):data(d),L(lp),R(rp) {} }; Node* root; int num; public: bst():root(NULL),num(0) {} void clear(Node* t) { if(t==NULL) return; clear(t->L); clear(t->R); delete t; } ~bst() { clear(root); } void clear() { clear(root); num = 0; root = NULL; } bool empty() { return root==NULL; } int size() { return num; } T getRoot() { if(empty()) throw "empty tree"; return root->data; } void travel(Node* tree) { if(tree==NULL) return; travel(tree->L); cout data R); } void travel() { travel(root); cout L); int rh = height(tree->R); return 1+(lh>rh?lh:rh); } int height() { return height(root); } void insert(Node*& tree,const T& d) { if(tree==NULL) tree = new Node(d); else if(ddata) insert(tree->L,d); else i