#3773. [GESP202503 六级 C++] 第 5 题
[GESP202503 六级 C++] 第 5 题
以下代码实现了二叉排序树的哪种操作?
TreeNode* op(TreeNode* root, int val) {
if (root == nullptr) return new TreeNode(val);
if (val < root->val) {
root->left = op(root->left, val);
} else {
root->right = op(root->right, val);
}
return root;
}
{{ select(1) }}
- 查找
- 插入
- 删除
- 遍历