(arr []T)
| 3 | import "github.com/TheAlgorithms/Go/constraints" |
| 4 | |
| 5 | func Selection[T constraints.Ordered](arr []T) []T { |
| 6 | for i := 0; i < len(arr); i++ { |
| 7 | min := i |
| 8 | for j := i + 1; j < len(arr); j++ { |
| 9 | if arr[j] < arr[min] { |
| 10 | min = j |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | arr[i], arr[min] = arr[min], arr[i] |
| 15 | } |
| 16 | return arr |
| 17 | } |
nothing calls this directly
no outgoing calls
no test coverage detected