Redian新闻
>
讨论个常见的面试题:一个数据流里面随时找出median
avatar
讨论个常见的面试题:一个数据流里面随时找出median# JobHunting - 待字闺中
i*n
1
method 1: keep a balanced binary search tree
method 2(theoretically work): keep a min heap, a max heap, keep it balanced
and all elements in min heap > all elements in max heap (tricky to solve
this, still figuring out)
Welcome to discuss an efficient way ha~
avatar
g*e
2
method 1 能行吗?怎么保证左右子树的元素一样多?
avatar
i*n
3
equal to the problem of : findKthElement in a binary search tree
using a balanced binary search tree means the median is near the top
avatar
h*w
4
the method 1 assume build up balanced binary search three. If the number is
odd, then the root is median. If the number is even, I don't know~~
do not understand the 2nd solution, any one knows?
avatar
a*y
5
用第二种办法吧
avl 树能保证两边节点个数一样多么

balanced

【在 i*******n 的大作中提到】
: method 1: keep a balanced binary search tree
: method 2(theoretically work): keep a min heap, a max heap, keep it balanced
: and all elements in min heap > all elements in max heap (tricky to solve
: this, still figuring out)
: Welcome to discuss an efficient way ha~

avatar
z*t
6
Share a blog on this interview question:
http://codercareer.blogspot.com/2012/01/no-30-median-in-stream.
Enjoy it:)

balanced

【在 i*******n 的大作中提到】
: method 1: keep a balanced binary search tree
: method 2(theoretically work): keep a min heap, a max heap, keep it balanced
: and all elements in min heap > all elements in max heap (tricky to solve
: this, still figuring out)
: Welcome to discuss an efficient way ha~

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