✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Consider the following algorithm (insertion sort):
def sort(array): n = len(array)
for i in range(1, n):
key = array[i]
j = i -
1
while j >= 0 and array[j] > key:
array[j +
1] = array [j]
j = j -
1 array[j +
1] = key
print(array)
return array
What is the time complexity
in the worst case?Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!