Significance of selection sort

六月ゝ 毕业季﹏ 提交于 2019-12-12 00:51:11

问题


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?


回答1:


  • 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...


来源:https://stackoverflow.com/questions/56065957/significance-of-selection-sort

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!