摘要:
题目:输入一颗二叉树根节点,复制该树,返回新建树的根节点。分析:跟求二叉树的高度类似,使用递归调用,先序遍历即可完成。参考代码:BNode* CopyBST(BNode* root){ if(root == NULL) return NULL; BNode* sub_tree = new BNode; sub_tree->data = root->data; sub_tree->left = CopyBST(root->left); sub_tree->right = CopyBST(root->right); return sub_tree;}题目:判断两 阅读全文