Significance of selection sort

2019-09-16 18:09发布

问题:

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