由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - recovery BST 不考虑相同值的情况么?
相关主题
BST 找重复节点数bloomberg onsite题
这个Binary Tree的题来看看Lowest common ancestor of two nodes of Binary Tree
请教find number of duplicates in a binary search tree请教一个Leetcode付费题
一个很简单的问题,有没有快一点的算法?Lowest Common Ancestor of multiple nodes in a binary tree
Google Front-end Software Engineer Phone InterviewFind number of subtrees with the same value
How to find the kth biggest number in a BST请问如何求binary tree的lowest common ancestor
Find the node with given value in binary tree in in-order问个老题,find the next larger in BST
Amazon 打印给定node距离最近的K个nodesG家onsite面经
相关话题的讨论汇总
话题: bst话题: node话题: 65532话题: subtree话题: binary
进入JobHunting版参与讨论
1 (共1页)
c********p
发帖数: 1969
1
BST 定义是left可以等于root,但right必须大于root。
解recovery bst的时候,不考虑相等么?只有大于了才算它错,可是当root和right相
等,这个时候,也是错的吧!
J****3
发帖数: 427
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
c********p
发帖数: 1969
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

J****3
发帖数: 427
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 这样吧
c********p
发帖数: 1969
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 这样吧

h*****a
发帖数: 1718
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 这样吧

1 (共1页)
进入JobHunting版参与讨论
相关主题
G家onsite面经Google Front-end Software Engineer Phone Interview
G家intern电面How to find the kth biggest number in a BST
请教cracking the code interview两题Find the node with given value in binary tree in in-order
关于inordertraversal 的iterative wayAmazon 打印给定node距离最近的K个nodes
BST 找重复节点数bloomberg onsite题
这个Binary Tree的题来看看Lowest common ancestor of two nodes of Binary Tree
请教find number of duplicates in a binary search tree请教一个Leetcode付费题
一个很简单的问题,有没有快一点的算法?Lowest Common Ancestor of multiple nodes in a binary tree
相关话题的讨论汇总
话题: bst话题: node话题: 65532话题: subtree话题: binary