Skip to content

Selection Sort

Murilo Costa edited this page Sep 30, 2017 · 1 revision

Selection Sort

let’s take a bookcase as example. We want the books in this bookcase in alphabetical order. This task can be achieved with a bunch of algorithms. But today we gonna see just one, the selection sort algorithm.

Selection Sort in Simple English

First we’ll select the book with the name that come before all the books and put he in the first position. Now we’ve one part of the bookcase ordered and one part messy. So, we have to select the second book with the name that come before all the books in the messy part and then put he in the second position. And so on…

We have a set O, all books ordered, and a set M, all books yet messy. We want to find a book in the set M such that this book is have the name that come before all books in M. With this book in hand put it in the final of set O.

The step describe above have to be iterated until penultimate book. Because when a set has only one element he is already ordered.

Clone this wiki locally