p***s 发帖数: 78 | 1 这道题怎么做 ?
duplicates in array is nlogn (不用hash), 这个怎么更快? |
d****o 发帖数: 1055 | 2 中序遍历bst,然后duplicate的肯定是挨着出现得。
【在 p***s 的大作中提到】 : 这道题怎么做 ? : duplicates in array is nlogn (不用hash), 这个怎么更快?
|
p***s 发帖数: 78 | 3 这个算不算BST?
10
/ \
8 12
/ \
7 9
\
8
【在 d****o 的大作中提到】 : 中序遍历bst,然后duplicate的肯定是挨着出现得。
|
l****c 发帖数: 782 | 4 不算吧,最下面的8,BST不能擦到那里吧。
【在 p***s 的大作中提到】 : 这个算不算BST? : 10 : / \ : 8 12 : / \ : 7 9 : \ : 8
|
p***s 发帖数: 78 | 5 根据这个定义,下面这个是吧,否则最后一个8怎么放
http://en.wikipedia.org/wiki/Binary_search_tree#Insertion
10
/ \
8 12
/ \
7 9
/
8
【在 l****c 的大作中提到】 : 不算吧,最下面的8,BST不能擦到那里吧。
|
M******k 发帖数: 51 | 6 it is BST; and 8 and 8 are still adjacent in in-order traversal
【在 p***s 的大作中提到】 : 这个算不算BST? : 10 : / \ : 8 12 : / \ : 7 9 : \ : 8
|