第41741题 判断题
以下函数可以正确完成二叉搜索树的插入,并保持二叉搜索树性质。( )
class TreeNode:
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None

def insertNode(root, x):
    if not root:
        return TreeNode(x)

    if x < root.val:
        root.right = insertNode(root.right, x)
    else:
        root.left = insertNode(root.left, x)

    return root
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
知识点:
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析