A28385. 以下代码实现了二叉排序树的哪种操作?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…
单选题
困难
知识点
题目描述
以下代码实现了二叉排序树的哪种操作?
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;
}选项(单选)
答案解析
详细答案解析为会员权益,按每日次数查看。
开通 / 升级会员
上一题
下一题