The algorithm proceeds by finding the smallest (or largest, depending on sorting order) component in the unsorted sublist, exchange (swapping) it with the leftmost unsorted component (putting it in sorted order), and move the sublist boundaries one component to the right. It has an O(n2) time complexity, which makes it inefficient on large lists, and generally performs worse than the like insertion sort.

COMING SOON!

```
pub fn selection_sort<T: Ord>(arr: &mut [T]) {
let len = arr.len();
for left in 0..len {
let mut smallest = left;
for right in (left + 1)..len {
if arr[right] < arr[smallest] {
smallest = right;
}
}
arr.swap(smallest, left);
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn basic() {
let mut res = vec!["d", "a", "c", "b"];
selection_sort(&mut res);
assert_eq!(res, vec!["a", "b", "c", "d"]);
}
#[test]
fn empty() {
let mut res = Vec::<u8>::new();
selection_sort(&mut res);
assert_eq!(res, vec![]);
}
#[test]
fn one_element() {
let mut res = vec!["a"];
selection_sort(&mut res);
assert_eq!(res, vec!["a"]);
}
#[test]
fn pre_sorted() {
let mut res = vec!["a", "b", "c"];
selection_sort(&mut res);
assert_eq!(res, vec!["a", "b", "c"]);
}
}
```