Redian新闻
>
recovery BST 不考虑相同值的情况么?
avatar
recovery BST 不考虑相同值的情况么?# JobHunting - 待字闺中
c*p
1
BST 定义是left可以等于root,但right必须大于root。
解recovery bst的时候,不考虑相等么?只有大于了才算它错,可是当root和right相
等,这个时候,也是错的吧!
avatar
J*3
2
In computer science, a binary search tree (BST), sometimes also called an
ordered or sorted binary tree, is a node-based binary tree data structure
which has the following properties:[1]
The left subtree of a node contains only nodes with keys less than the node'
s key.
The right subtree of a node contains only nodes with keys greater than the
node's key.
The left and right subtree must each also be a binary search tree.
There must be no duplicate nodes.
Wiki
avatar
c*p
3
是哦,我刚看了一下,确实这么定义的,都没有相等的情况。
可是。。。cc150上边这道题,它这样说的哦。。。。

node'

【在 J****3 的大作中提到】
: In computer science, a binary search tree (BST), sometimes also called an
: ordered or sorted binary tree, is a node-based binary tree data structure
: which has the following properties:[1]
: The left subtree of a node contains only nodes with keys less than the node'
: s key.
: The right subtree of a node contains only nodes with keys greater than the
: node's key.
: The left and right subtree must each also be a binary search tree.
: There must be no duplicate nodes.
: Wiki

avatar
J*3
4
那上面错了吧。 还是以
• every node has a key
• every node’s key is
node
x
larger than all keys in its left subtree smaller than all
keys in its right subtree 这样吧
avatar
c*p
5
嗯嗯,应该错了。。
误导我了。。。

【在 J****3 的大作中提到】
: 那上面错了吧。 还是以
: • every node has a key
: • every node’s key is
: node
: x
: larger than all keys in its left subtree smaller than all
: keys in its right subtree 这样吧

avatar
h*a
6
一个BST里面有没有相同的key都不一定的,要看具体情况,没必要纠结。具体的问题可
以有就有,都unique也正常。

【在 J****3 的大作中提到】
: 那上面错了吧。 还是以
: • every node has a key
: • every node’s key is
: node
: x
: larger than all keys in its left subtree smaller than all
: keys in its right subtree 这样吧

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。