Consider the routine below which sorts the input array (very inefficiently). Determine the run-time complexity of the routine using Big-O notation.
def slow_sort(myArray):
n = length(myArray)
sorted_array = new array, same length as myArray
for i in [0, 1, ..., n - 1]:
min_val = array[0]
min_location = 0
for j in [0, 1, ..., length(myArray) - 1]:
if array[j] < min_val:
min_val = myArray[j]
min_location = j
sorted[i] = min_val
delete myArray[min_location] #reduces the size of the input array
return sorted_array
The algorithm as written above has a run-time complexity of
Box 1: Select the best answer