* * Selection sort - http://en.wikipedia.org/wiki/Selection_sort */
(arr []int)
| 5 | */ |
| 6 | |
| 7 | func SelectionSort(arr []int) { |
| 8 | var min int = 0 |
| 9 | var tmp int = 0 |
| 10 | |
| 11 | for i := 0; i < len(arr); i++ { |
| 12 | min = i |
| 13 | for j := i + 1; j < len(arr); j++ { |
| 14 | if arr[j] < arr[min] { |
| 15 | min = j |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | tmp = arr[i] |
| 20 | arr[i] = arr[min] |
| 21 | arr[min] = tmp |
| 22 | } |
| 23 | } |
nothing calls this directly
no outgoing calls
no test coverage detected