sorted
结果:
time cost is 35.358285 s*
sort
结果:
time cost is 34.877686 s
总结
- 对于 list 而言,sort() 比 sorted() 效率要高
- 但是 sorted() 用途更广,可以用于任何可迭代容器;而 sort() 只能用于 list
结果:
time cost is 35.358285 s*
结果:
time cost is 34.877686 s
下一篇:回文序列
list.sort()和函数sorted(list)
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M