input: Write a function to sort an array using selection sort.
  assert selection_sort([4, 6, 1, 3, 8, 2]) == [1, 2, 3, 4, 6, 8]
  assert selection_sort([10, 5, 3, 8, 6]) == [3, 5, 6, 8, 10]
  assert selection_sort([7, 2, 9, 4, 5]) == [2, 4, 5, 7, 9]
output: def selection_sort(arr):
      n = len(arr)
      for i in range(n):
          min_idx = i
          for j in range(i+1, n):
              if arr[j] < arr[min_idx]:
                  min_idx = j
          arr[i], arr[min_idx] = arr[min_idx], arr[i]
      return arr