mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Update README.md
Add description for Selection Sort
This commit is contained in:
parent
e3c24fe59a
commit
1963a59622
16
README.md
16
README.md
@ -61,6 +61,18 @@ __Properties__
|
|||||||
|
|
||||||
###### View the algorithm in [action][quick-toptal]
|
###### View the algorithm in [action][quick-toptal]
|
||||||
|
|
||||||
|
## Selection
|
||||||
|
![alt text][selection-image]
|
||||||
|
|
||||||
|
From [Wikipedia][selection-wiki]: The algorithm divides the input list into two parts: the sublist of items already sorted, which is built up from left to right at the front (left) of the list, and the sublist of items remaining to be sorted that occupy the rest of the list. Initially, the sorted sublist is empty and the unsorted sublist is the entire input list. The algorithm proceeds by finding the smallest (or largest, depending on sorting order) element in the unsorted sublist, exchanging (swapping) it with the leftmost unsorted element (putting it in sorted order), and moving the sublist boundaries one element to the right.
|
||||||
|
|
||||||
|
__Properties__
|
||||||
|
* Worst case performance O(n^2)
|
||||||
|
* Best case performance O(n^2)
|
||||||
|
* Average case performance O(n^2)
|
||||||
|
|
||||||
|
###### View the algorithm in [action][selection-toptal]
|
||||||
|
|
||||||
|
|
||||||
## Search Algorithms
|
## Search Algorithms
|
||||||
|
|
||||||
@ -87,3 +99,7 @@ Add comments here
|
|||||||
[merge-toptal]: https://www.toptal.com/developers/sorting-algorithms/merge-sort
|
[merge-toptal]: https://www.toptal.com/developers/sorting-algorithms/merge-sort
|
||||||
[merge-wiki]: https://en.wikipedia.org/wiki/Merge_sort
|
[merge-wiki]: https://en.wikipedia.org/wiki/Merge_sort
|
||||||
[merge-image]: https://upload.wikimedia.org/wikipedia/commons/c/cc/Merge-sort-example-300px.gif "Merge Sort"
|
[merge-image]: https://upload.wikimedia.org/wikipedia/commons/c/cc/Merge-sort-example-300px.gif "Merge Sort"
|
||||||
|
|
||||||
|
[selection-toptal]: https://www.toptal.com/developers/sorting-algorithms/selection-sort
|
||||||
|
[selection-wiki]: https://en.wikipedia.org/wiki/Selection_sort
|
||||||
|
[selection-image]: https://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Selection_sort_animation.gif/250px-Selection_sort_animation.gif "Selection Sort Sort"
|
||||||
|
Loading…
Reference in New Issue
Block a user