avatar
[合集] 一道CS面试题# JobHunting - 待字闺中
m*n
1
☆─────────────────────────────────────☆
HansLee (迅潇麒麟) 于 (Tue Aug 28 01:45:42 2007) 提到:
一个数组中存放N个整数,如何找到出现次数最多的一个数(即众数),要求用O(N)的
复杂度,而且不能用Hashing(内存和时间都是O(N))。
大家有何见教? (我有一个初步答案,但不一定最佳,改天给出)
☆─────────────────────────────────────☆
obesepig (Obesepig) 于 (Tue Aug 28 02:08:34 2007) 提到:
If space complexity is O(N), then the question is too trivial(Using a
hashtable).
If the space complexity is O(1), it's kind of tricky and I guess probably
your friend is asked to solve the following questi
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。