算法and数据结构

算法

冒泡排序

流程图

选择排序

流程图

计数排序

a = {
    '0':0,
    '1':2,
    '2':1,
    '3':6,
    '4':4,
    '5':9,
    '6':3,
    'length':7
}
hash = [];
index = 0;
maxIndex = 0;
while index < a['length']
    number = a[index]
    if hash[number] == undefined  // hash[number] 不存在
        hash[number] = 1
    else
        hash[number] = hash[number] ++ 
    while a[maxIndex] < a[index]
        maxIndex = index
        index = index ++
    end

index2 = 0
max = a[maxIndex]  // 最大值9
newArr = []
while index2 <= max
    count =0
    if count < has[index2]
            newArr.push(index2)
            count = count ++ 
    end
    index2 = index2 ++
end
print newArr
end
image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 有些孩子数学不好,其实是因为没有掌握好的技巧。本文分享了8个乘法口算法,让孩子答题速度迅速提升!爸爸妈妈们,赶紧收...
    萌萌哒爱阅读 533评论 0 0
  • ionic3 创建项目至apk打包全过程教程 主要流程: 安装node.js --> 安装jdk --> 安装An...
    丶温瞳阅读 185评论 0 0
  • 靖靖还有几天就百天了。 又带他来洗澡了。
    刘将军阅读 200评论 0 0
  • 成家立业,是古训,也是责任。即将步入30而立的我,究竟要不要买房? 受中国传统观念的影响,有房才算有家。这个观念在...
    小七妈妈阅读 449评论 0 2
  • 看毛选,邓选分三个阶段来看的。起初是带着看故事的心态去看的,再是对某件历史事件感兴趣再看文章求证,第三次看...
    扶路阅读 329评论 0 1