2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,8 +1,21 @@
|
|||
{{Sorting Algorithm}}
|
||||
In this task, the goal is to sort an [[array]] (or list) of elements using the Selection sort algorithm. It works as follows:
|
||||
|
||||
;Task:
|
||||
Sort an [[array]] (or list) of elements using the Selection sort algorithm.
|
||||
|
||||
|
||||
It works as follows:
|
||||
|
||||
First find the smallest element in the array and exchange it with the element in the first position, then find the second smallest element and exchange it with the element in the second position, and continue in this way until the entire array is sorted.
|
||||
Its asymptotic complexity is [[O]](n<sup>2</sup>) making it inefficient on large arrays. Its primary purpose is for when writing data is very expensive (slow) when compared to reading, eg. writing to flash memory or EEPROM.
|
||||
|
||||
|
||||
Its asymptotic complexity is <big> [[O]](n<sup>2</sup>) </big> making it inefficient on large arrays.
|
||||
|
||||
Its primary purpose is for when writing data is very expensive (slow) when compared to reading, eg. writing to flash memory or EEPROM.
|
||||
|
||||
No other sorting algorithm has less data movement.
|
||||
|
||||
For more information see the article on [[wp:Selection_sort|Wikipedia]].
|
||||
|
||||
;Reference:
|
||||
* Wikipedia: [[wp:Selection_sort|Selection sort]]
|
||||
<br><br>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue