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
相关阅读
求内退walmart lab, Rocket Fuel, Dropbox, Turn, Groupon, Facebook, Linkedin, Twitter, Netflix, Quantcast急问 ITAR是只给公民的嘛?代友发一招聘帖。求facebook内推请问这些要求在面试里怎么体现的google的电面会问设计题吗?J2EE项目管理的经验对SDE求职有帮助不?不知道是不是骗人的Rocket Fuel online test都有什么题目?报一个G的offer并请教offer negotiationSQL语句的两个问题Google电面和onsite题目难度差不多么?毕业之后能当实习生么rocket fuel -web application developer那个streaming data 求出现次数topk的题目 到底怎么做的?Snapchat 有前途吗?帮朋友招ANALOG/MIXED SIGNAL IC 职位 (转载)G家前一段撵走5年以上的惊闻二爷博客关闭了???求教一个SQL的问题