选择排序的意义 [英] Significance of selection sort
本文介绍了选择排序的意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
选择排序的意义是什么?即使在最佳情况下,它的时间复杂度也为O(n ^ 2)。那么为什么它仍然流行呢?
What is the significance of selection sort? It has a time complexity of O(n^2) even in best case scenario. So why is it still prevalent?
推荐答案
- 编写起来很简单,人们也很直观
- 它是最接近真实人类处理列表的方式。
- 它在内存中就地起作用
- 经过n次迭代后,您知道前n个元素已排序。在第一次迭代之后,对第一项进行排序,在第二项完成后,对前两项进行排序,依此类推...
- It is simple to write and intuitive for people to understand
- It is the closest to the way real humans approach sorting lists.
- It functions in-place in memory
- After n iterations you know the first n elements are sorted. After the first iteration the first item is sorted, after the second is finished the first 2 are sorted, etc...
这篇关于选择排序的意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文