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

A18439. 下面代码实现二叉搜索树的插入操作。假设树中不存在重复值,横线处应填写( )。TreeNode* insertNode(TreeNode* root, int x) { if (root == nullptr) { return new TreeNode(x); } if (x < root->val) { __________________________ } else { root->rig…

单选题 困难

题目描述

下面代码实现二叉搜索树的插入操作。假设树中不存在重复值,横线处应填写(    )。

TreeNode* insertNode(TreeNode* root, int x) {
	if (root == nullptr) {
		return new TreeNode(x);
	}
	if (x < root->val) {
		__________________________
	} else {
		root->right = insertNode(root->right, x);
	}
	return root;
}

选项(单选)

上一题 下一题