判断给定C++函数实现了二叉排序树的哪种操作
给定以下C++函数,判断其实现了二叉排序树(BST)的哪一种操作:
TreeNode* op(TreeNode* root, int x) {
if (!root) return new TreeNode(x);
if (x < root->val)
root->left = op(root->left, x);
else
root->right = op(root->right, x);
return root;
}
正在加载题目数据…
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析