CODE INTERVIEW AND TECHNICAL TEST PREP
Selection Sort in a nutshell — how, when & where
knowledge snippets for your next technical test, JavaScript edition
Selection sort is one of the easiest sorting algorithms to understand. In part, because there is minimal complexity. However, simplicity does come with its pitfalls.
Here is a quick low down on what selection sort is, how to write one, when and where you’d most likely encounter it.
How it works
Selection sort has two things going for it — a current minim and a current item.
The current item moves through the array and decides if the it’s smaller than the current minimum. If it is, the current item gets the new marker as the new current minimum.