手机版
网站地图
美文美图
最新动态
你好,欢迎访问
好美文阅读网
个性皮肤
搜索
网站首页
美文
文章
散文
日记
诗歌
小说
故事
句子
作文
签名
祝福语
情书
范文
读后感
文学百科
美文摘抄
节日文章
名家散文
网名大全
座右铭
口号大全
面试技巧
说说大全
阅读答案
诗词默写
流言蜚语
节日祝福
好句子
经典台词
谚语大全
亲情故事
友情故事
表白情书
工作报告
活动总结
心得体会
专题汇总
美文网首页
golang 排序耗时总结
golang 排序耗时总结
作者:
小明2021
| 来源:发表于
2023-09-20 10:21 被阅读0次
golang 排序耗时总结
总结:
知道快排速度快,但是没想到这么快,比golang系统自带的排序快了将近一倍
比选择、插入、冒泡等快了几十上百倍。。。。
快排:
「左右指针,往中间靠拢,交换,递归」
1百万随机数字耗时 0.12 秒左右
1千万随机数字耗时 1.3 秒左右
1亿随机数字耗时 15 秒左右
golang自带sort排序:
1百万随机数字耗时 0.18 秒左右
1千万随机数字耗时 2.15 秒左右
1亿随机数字耗时 24.8 秒左右
选择排序:
「每次选出最小的一个,跟外层i比较交互」
1万随机数字耗时 0.05 秒左右
5万随机数字耗时 1.28 秒左右
十万随机数字耗时 5.14 秒左右
插入排序:
「每次往前面排序后的数据里一个个比较插入合适的位置」
1万随机数字耗时 0.08 秒左右
5万随机数字耗时 1.94 秒左右
十万随机数字耗时 7.8 秒左右
冒泡排序:
1万随机数字耗时 0.06 秒左右
5万随机数字耗时 2.35 秒左右
十万随机数字耗时 9.51 秒左右
相关文章
网友评论
本文标题:
golang 排序耗时总结
本文链接:
https://www.haomeiwen.com/subject/qygovdtx.html
延伸阅读
那年盛夏诗歌
环境监察队工作总结范文
优秀教师学习心得范文
华胥引的读后感300字
《Its red》教学反思范文
农资购销的合同范本
竞选中队委优秀演讲稿
辞金蹈海的成语解释
《世纪宝鼎》公开课教案设计
因为爱你,所以牵挂
今生今世红尘醉——美到
一个90后的内心独白
致已逝去的高中年华
深度阅读
您也可以注册成为美文阅读网的作者,发表您的原创作品、分享您的心情!
情人节
母亲节
重阳节
清明节
端午节
植树节
元宵节
妇女节
愚人节
圣诞节
父亲节
教师节
儿童节
劳动节
青年节
建军节
万圣节
平安夜
光棍节
中秋节
国庆节
感恩节
腊八节
更多话题
栏目导航
摄影
故事
互联网
读书
旅行
热点阅读
凡事皆利弊互存,就看怎么去看了。
左侠(11)
Xcode15问题点记录
又闻枫叶城
day160 我值得被爱
我是南阳西游月季的小雪,南阳人,地地道道的南阳人,在石桥种植繁育
解药
第十七话 烟火,画鱼
红尘作伴
曼迪的故事之 婚姻是一场劫
网友评论