e*8
2 楼
counting sort...
if we don't require the sorting to be stable, we don't need to use an
auxiliary array of size O(n); just an array of size O(k) = O(1) is
sufficient.
if we don't require the sorting to be stable, we don't need to use an
auxiliary array of size O(n); just an array of size O(k) = O(1) is
sufficient.
h*7
3 楼
可是 counting 的话是 O(K) space ...
o*n
7 楼
a=[22,3,556,223,56556,23,2,767,0, 55, 19,200,300,452,95]
m=max(a) +1
count=[0] * m
for i in a:
count[i]=1
for j in range(m):
if count[j] ==1: print j
m=max(a) +1
count=[0] * m
for i in a:
count[i]=1
for j in range(m):
if count[j] ==1: print j
相关阅读
有接wechat app 开发的吗?版上大牛们说说ads还有前途吗问一个题 house paintbig bang theory里那个小印算是stereotype么 (转载)On site以后不联系了是个什么情况?Job opening: SDE II plus in Microsoft, Bellevue, WA新老工作overlapping如果要找现公司match,最好是什么时机?手上有专利的看过来 (转载)基金data analyst/developer internal referral,德州印度阿三即将占领中国职场 (转载)以后不说“印度人”,直接说“阴毒人” (转载)有面过MS data scientist的同学吗?太吓人啦!微软总部发生强奸案onsite以后大概多久没回音就可以moveon了?提供Google内推求职求内推:嵌入式软硬件工程师(地点不限),本人现住Rochester-NY长期提供yahoo工作refer为什么十年前台湾人在硅谷压着印度人打 (转载)问一道题(2)