English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2006-09-23 09:33:46 · 2 answers · asked by oscdoz 1 in Computers & Internet Programming & Design

2 answers

Selection sort is a sorting algorithm, a comparison sort that works as follows:

1. find the minimum value in the list
2. swap it with the value in the first position
3. sort the remainder of the list (excluding the first value)

Example:
a=[9,7,5,3,1,0,4,6,8]
0 is lowest value, swap with 9
a=[0,7,5,3,1,9,4,6,8]
1 is lower than 7, swap these numbers
a=[0,1,5,3,7,9,4,6,8]
3 is lower than 5, swap these two numbers
a=[0,1,3,5,7,9,4,6,8]
...
until the list is sorted.

2006-09-23 09:45:02 · answer #1 · answered by Gordo J 2 · 0 0

How Selection Sort Works

2017-01-19 07:36:14 · answer #2 · answered by ? 4 · 0 0

fedest.com, questions and answers