input: Write a function to sort a list of numbers using an optimized selection sort algorithm.
  assert optimized_sort([64, 25, 12, 22, 11]) == [11, 12, 22, 25, 64]
  assert optimized_sort([5, 3, 6, 2, 10]) == [2, 3, 5, 6, 10]
  assert optimized_sort([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]
output: def optimized_sort(arr):
      n = len(arr)
      for i in range(n):
          min_index = i
          for j in range(i+1, n):
              if arr[j] < arr[min_index]:
                  min_index = j
          if min_index != i:
              arr[i], arr[min_index] = arr[min_index], arr[i]
      return arr