1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/// Returns the selection sorted version of the input.
///
/// Takes a list reference as input and returns a `Vec<i32>` or an error explainint the situation.
///
/// # Examples
///
/// Basic usage:
/// ```
/// let result = algorithmz::sorting::selection_sort(&[2,1,4,3,6,5]).unwrap();
/// assert_eq!(result,[1,2,3,4,5,6]);
/// ```
///
/// Match example:
/// ```
/// use algorithmz::sorting::selection_sort;
///
/// match selection_sort(&[5,4,7,6,8,7,9,10]) {
/// Ok(n) => println!("The result was: {:?}",n),
/// Err(e) => eprintln!("The error was: {}",e),
/// }
/// ```