input: Write a function to sort an array in ascending order using selection sort algorithm.
  assert sort_array([1, 5, 3, 8, 4, 2]) == [1, 2, 3, 4, 5, 8]
  assert sort_array([10, 7, 8, 9, 1, 5]) == [1, 5, 7, 8, 9, 10]
  assert sort_array([5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5]
output: def sort_array(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