Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#We\'ve written the function, selectionsort, below. It takes #in one list parame

ID: 3717375 • Letter: #

Question

#We've written the function, selectionsort, below. It takes #in one list parameter, alist. Our version of selection sort #involves finding the minimum value and moving it to an #earlier spot in the list. However, some lines of code are blank. Complete these lines #to complete the selections°rt function. You should only need #to modify the section marked 'write your code here!' def selectionSort (aList): #For each in for i in range(len (aList)): dex in the list Assume first that current item is already correct minIndex-i For each index from 1 to the end for j in range(i + 1, len (aList)): Complete the reasoning of this conditional to complete the algorithm ! Remember, the goal is #to find the lowest item in the list between findex i and the end of the list, and store its index in the variable minIndex. #Write your code herel Save the current minimum value since we're about to delete it minvalue = aListmin Index) Delete the minimum value from its current index del aList[minIndex] #Ingert the minimum value at its new index aList.insert(i, minValue) #Return the resultant list return aList The code below will test your fix. It is not used for #grading, so feel free to modify it. As written, it should #print a sorted list. print(selectionSort (5, 3, 1, 2, 4]))

Explanation / Answer

def selectionSort(aList): for i in range(len(aList)): minIndex = i for j in range(i+1, len(aList)): if aList[j]