Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Sorts/SelectionSort.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
Selection sort is fairly simple. Assume the left part of your array is
sorted and right part is unsorted. Inititally the sorted(left) part is
empty. Now select the smallest element from the unsorted(right) part and
swap it with the first element of the unsorted(right) part. Now this element
is sorted, move to the next iteration and repeat without touch the sorted(left)
part.
*/

export default SelectionSort = function (arr) {
let n = arr.length;

Expand All @@ -22,3 +31,5 @@ export default SelectionSort = function (arr) {
}
return arr;
};

// This has the time complexity of O(n^2)
30 changes: 0 additions & 30 deletions Sorts/selectionSort.js

This file was deleted.