given stream of integers, find first 100 large numbers (!!!)

来源:互联网 发布:网络谣言与言论自由 编辑:程序博客网 时间:2024/06/06 08:15

最开始的idea很自然想到用heap,size为100的heap, 计算复杂度为O(nlog100).

不如用bubble sort,bubble100次,因为不需要让这100个数sorted,O(100n) = O(n)

原创粉丝点击