Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
25
Task/Sorting-algorithms-Selection-sort/00-TASK.txt
Normal file
25
Task/Sorting-algorithms-Selection-sort/00-TASK.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{{Sorting Algorithm}}
|
||||
[[Category:Sorting]]
|
||||
|
||||
;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 <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.
|
||||
|
||||
|
||||
;References:
|
||||
* Rosetta Code: [[O]] (complexity).
|
||||
* Wikipedia: [[wp:Selection_sort|Selection sort]].
|
||||
* Wikipedia: [[https://en.wikipedia.org/wiki/Big_O_notation Big O notation]].
|
||||
<br><br>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue