Redian新闻
>
本人预计明天Dow Jones明天涨1.8%个点,citi反弹极限值3.2%,不低于2%
avatar
本人预计明天Dow Jones明天涨1.8%个点,citi反弹极限值3.2%,不低于2%# Stock
l*8
1
Give a string, calculate the numbers of distinct sub-string of it.
avatar
a*n
2
顺便说一句:美股无论如何,也会跌到9200点的,在2个月之内
avatar
n*a
3
这个题目可以用suffix tree做吗?
每个node纪录建tree的时候路过的次数,然后遍历找到所有次数为1的node
时间复杂度O(n^2)
avatar
l*8
4
恩,可能也就是O(n^2)了吧

【在 n******a 的大作中提到】
: 这个题目可以用suffix tree做吗?
: 每个node纪录建tree的时候路过的次数,然后遍历找到所有次数为1的node
: 时间复杂度O(n^2)

avatar
r*7
5
bruce force 也是O(n^2)啊

【在 l*********8 的大作中提到】
: 恩,可能也就是O(n^2)了吧
avatar
n*a
6
brute force是n^3吧

【在 r****7 的大作中提到】
: bruce force 也是O(n^2)啊
avatar
n*a
7
感觉不管怎么着也要是n^2了
望大牛赐教更好的做法

【在 l*********8 的大作中提到】
: 恩,可能也就是O(n^2)了吧
avatar
e*m
8
distinct substring的总数是O(n2),复杂度不可能小于 O(n2)

【在 n******a 的大作中提到】
: 感觉不管怎么着也要是n^2了
: 望大牛赐教更好的做法

avatar
l*8
9
是啊

【在 e***m 的大作中提到】
: distinct substring的总数是O(n2),复杂度不可能小于 O(n2)
avatar
r*7
11
一个极端的例子是,如果所有character都是不一样的,可以立即算出来是(n+1)*n/2
如果n^2直接遍历放hash table里不就行了

【在 l*********8 的大作中提到】
: 是啊
avatar
x*y
12
It should be O(n) in suffix tree. It uses succinct format to do recording,
so even if there could be O(n^2) results, to get the number of distinct
substring, it's linear.

【在 n******a 的大作中提到】
: 这个题目可以用suffix tree做吗?
: 每个node纪录建tree的时候路过的次数,然后遍历找到所有次数为1的node
: 时间复杂度O(n^2)

avatar
l*8
14
我觉得用suffix tree还是O(n^2)啊。 能否解释一下如何达到O(n) ?

,

【在 x***y 的大作中提到】
: It should be O(n) in suffix tree. It uses succinct format to do recording,
: so even if there could be O(n^2) results, to get the number of distinct
: substring, it's linear.

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