input: Write a function to implement selection sort.
  assert selection_sort([2, -3, 1, 10, 0]) == [-3, 0, 1, 2, 10]
  assert selection_sort([5, 3, 8, 4, 2]) == [2, 3, 4, 5, 8]
  assert selection_sort([1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1]
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