计数排序
2018-03-06 00:38:28 6 举报
计数排序伪代码流程
作者其他创作
大纲/内容
if hash[number]==undefined
index2 -index2+1
入桶
No
Yes
End
print newArr
countIndex-0
newArr-{}
index-0
number - a[index]
max-findMax(a)//找到最大值
while indexa['length']
countIndex - countIndex+1
hash[number]-1
index - index+1
hash[number]=hash[nummber]+1
出桶
count != undefined
hash-{}
while index2max+1
newArr.push(index2)
count - hash[index2]
Start
index2-0
while countIndexcount
0 条评论
下一页