测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

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;
}

选项(单选)

上一题 下一题