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