Search code examples
sortingselection-sort

When would someone ever use selection sort?


If there are so many faster and more efficient sorting algorithms available (merge sort, heap sort, quick sort), why is selection sort still taught? If it is because they are still used, when are some examples where this would be true?


Solution

  • I believe it's still taught because it's a simple algorithm to understand and helps build the foundation for other sorting algorithms. It's also an easy exercise in understanding time and space complexity for algorithms. Not aware of any practical usages in modern computing, but it does have very low memory overhead so can be ideal for situations where memory is at a premium.