Redian新闻
>
an article from Elsevier Reviewers' update
avatar
t*n
3
中序遍历,记录前一个节点,比较后记数?
avatar
p*2
5
traverse一遍就可以了吧?
avatar
f*l
6
Thanks!
终于知道花瓣的出处了:)

【在 e******r 的大作中提到】
: thanks for sharing!
: -Elsevier

avatar
b*u
7
那样达不到O(1)吧

【在 p*****2 的大作中提到】
: traverse一遍就可以了吧?
avatar
e*r
8
哈哈,我现在这个id用多了,在本版一看见,第一反应就是自作多情的以为点我名儿呢。

【在 f*******l 的大作中提到】
: Thanks!
: 终于知道花瓣的出处了:)

avatar
p*2
9

两个变量就可以了吧?

【在 b*****u 的大作中提到】
: 那样达不到O(1)吧
avatar
b*e
10
very nice :)

【在 e******r 的大作中提到】
: thanks for sharing!
: -Elsevier

avatar
e*e
11
Assume there is only one value got duplicated.
global variable: int count = 0;
void inorderDFS(Node n, MutableInt prev) {
if ( node == null )
return;
inorderDFS( node.left, prev );
if ( n.val == prev.val )
count++;
pre.val = node.val;
inorderDFS( node.right, prev );
}
invoke: inorderDFS( root, new MutableInt() );
return: count
class MutableInt {
int val;
}
avatar
b*e
12
不会吧,我好几篇那的journal

【在 f*******l 的大作中提到】
: Thanks!
: 终于知道花瓣的出处了:)

avatar
k*e
14
还是你厉害,我只有一篇,还是很多年前的了挂名的

【在 b*******e 的大作中提到】
: 不会吧,我好几篇那的journal
avatar
b*e
16
不过4 篇journal在那里,只有6个citation, 我是很郁闷阿。
怎么样,看面相看得如何? 万事大吉?:)

【在 k******e 的大作中提到】
: 还是你厉害,我只有一篇,还是很多年前的了挂名的
avatar
e*e
17
by Interview Candidate: Oct 24, 2012
yes you are correct, I meant a BST

)

【在 G****A 的大作中提到】
: 原题目是 "count the number of duplicates in a binary tree in O(n) time O(1)
: space"
: 没看到说BST啊

avatar
k*e
18
郁闷啥?再多citation也没有给你140approval强:)
给留了一课后作业,下周交

【在 b*******e 的大作中提到】
: 不过4 篇journal在那里,只有6个citation, 我是很郁闷阿。
: 怎么样,看面相看得如何? 万事大吉?:)

avatar
l*a
19
In computer science, a binary search tree (BST), which may sometimes also be
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.
Both the left and right subtrees must also be binary search trees.
There must be no duplicate nodes.

【在 e****e 的大作中提到】
: by Interview Candidate: Oct 24, 2012
: yes you are correct, I meant a BST
:
: )

avatar
b*e
20
好好做功课,呵呵,我明天8:30 am to 下午5:30 pm 还有周日全天也要做功课。

【在 k******e 的大作中提到】
: 郁闷啥?再多citation也没有给你140approval强:)
: 给留了一课后作业,下周交

avatar
e*e
21
在面试中, BST和wiki上的定义弱相关,和面试官头脑里的定义强相关。。。我们现在
也不知道当时的情况,就姑且认为是有一个节点可以重复的树,其他节点满足BST?

be
node'

【在 l*****a 的大作中提到】
: In computer science, a binary search tree (BST), which may sometimes also be
: 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.
: Both the left and right subtrees must also be binary search trees.
: There must be no duplicate nodes.

avatar
k*e
22
嗯,好好加把劲!
我的功课课前都做好了,这个课后的实在是。。。。
BTW,我今晚要出去吃饭,你懂的:)

【在 b*******e 的大作中提到】
: 好好做功课,呵呵,我明天8:30 am to 下午5:30 pm 还有周日全天也要做功课。
avatar
G*A
23
Now, I see.

【在 e****e 的大作中提到】
: by Interview Candidate: Oct 24, 2012
: yes you are correct, I meant a BST
:
: )

avatar
e*r
24
'吃饭"。。我不懂啊,求美妈科普

【在 k******e 的大作中提到】
: 嗯,好好加把劲!
: 我的功课课前都做好了,这个课后的实在是。。。。
: BTW,我今晚要出去吃饭,你懂的:)

avatar
p*2
25

可以有重复

【在 l*****a 的大作中提到】
: 讨论一下
: BST到底是否允许有重复元素

avatar
k*e
26
你专门选有关大密的文章看就懂了:P

【在 e******r 的大作中提到】
: '吃饭"。。我不懂啊,求美妈科普
avatar
l*a
27
哪本书?

【在 p*****2 的大作中提到】
:
: 可以有重复

avatar
b*e
28
Orz hehe

【在 k******e 的大作中提到】
: 嗯,好好加把劲!
: 我的功课课前都做好了,这个课后的实在是。。。。
: BTW,我今晚要出去吃饭,你懂的:)

avatar
p*2
29

CC150

【在 l*****a 的大作中提到】
: 哪本书?
avatar
b*e
30
呵呵,现在流行隐讳的“赤裸裸"

【在 e******r 的大作中提到】
: '吃饭"。。我不懂啊,求美妈科普
avatar
p*p
31
假设一样的走左树,两个变量怎么找下面这个?
(4, 2, #, 1, 3, #, 2, #, 4)

【在 p*****2 的大作中提到】
:
: CC150

avatar
e*r
32
你们俩说黑话,不带我,人家季度了。。再开一颗月季给你们看看

【在 b*******e 的大作中提到】
: 呵呵,现在流行隐讳的“赤裸裸"
avatar
p*2
33

能不能画个树出来看?

【在 p*****p 的大作中提到】
: 假设一样的走左树,两个变量怎么找下面这个?
: (4, 2, #, 1, 3, #, 2, #, 4)

avatar
q*p
34
Blesssssss~~~~~

【在 k******e 的大作中提到】
: 郁闷啥?再多citation也没有给你140approval强:)
: 给留了一课后作业,下周交

avatar
p*p
35


【在 p*****2 的大作中提到】
:
: 能不能画个树出来看?

avatar
q*p
36
i guess that means celebration

【在 e******r 的大作中提到】
: 你们俩说黑话,不带我,人家季度了。。再开一颗月季给你们看看
avatar
p*2
37
1 2 2 3 4 4
这个顺序走吧?
avatar
e*r
38
还是你提醒的好,要big bless 美妈!还要谢谢大蜜送了我包子!

【在 q*p 的大作中提到】
: Blesssssss~~~~~
avatar
e*e
39
我觉得是。

【在 p*****2 的大作中提到】
: 1 2 2 3 4 4
: 这个顺序走吧?

avatar
b*e
40
哎,我抛砖赢余啊,呵呵

【在 e******r 的大作中提到】
: 还是你提醒的好,要big bless 美妈!还要谢谢大蜜送了我包子!
avatar
b*u
41
两个变量的方法能不能elaborate一下或者贴个链接?
我目前搜到的不用递归,不用栈的方法都assume有父指针
avatar
f*l
42
难怪大蜜最近在感叹:现在童鞋们都把好消息捂得很紧,不见兔子不撒网。
一起先公开恭喜美妈了!让她自家出去吃饭吧...

【在 e******r 的大作中提到】
: 还是你提醒的好,要big bless 美妈!还要谢谢大蜜送了我包子!
avatar
p*p
43
了解了,Inorder+两个变量就够了

【在 p*****2 的大作中提到】
: 1 2 2 3 4 4
: 这个顺序走吧?

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