Skip to content

Commit b8df19d

Browse files
Merge pull request #17 from Knhash/patch-1
Update README.md : Selection Sort
2 parents e3c24fe + 1963a59 commit b8df19d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: README.md

+16
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@ __Properties__
6161

6262
###### View the algorithm in [action][quick-toptal]
6363

64+
## Selection
65+
![alt text][selection-image]
66+
67+
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.
68+
69+
__Properties__
70+
* Worst case performance O(n^2)
71+
* Best case performance O(n^2)
72+
* Average case performance O(n^2)
73+
74+
###### View the algorithm in [action][selection-toptal]
75+
6476

6577
## Search Algorithms
6678

@@ -87,3 +99,7 @@ Add comments here
8799
[merge-toptal]: https://www.toptal.com/developers/sorting-algorithms/merge-sort
88100
[merge-wiki]: https://en.wikipedia.org/wiki/Merge_sort
89101
[merge-image]: https://upload.wikimedia.org/wikipedia/commons/c/cc/Merge-sort-example-300px.gif "Merge Sort"
102+
103+
[selection-toptal]: https://www.toptal.com/developers/sorting-algorithms/selection-sort
104+
[selection-wiki]: https://en.wikipedia.org/wiki/Selection_sort
105+
[selection-image]: https://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Selection_sort_animation.gif/250px-Selection_sort_animation.gif "Selection Sort Sort"

0 commit comments

Comments
 (0)