Question: As discussed in our video lecture, selection sort is a simple sorting algorithm that works by repeatedly finding the minimum element from unsorted part and

As discussed in our video lecture, selection sort is a simple sorting algorithm that works by repeatedly finding the minimum element from unsorted part and putting it the sorted portion of

Goal: 10 pts] As discussed in our video lecture, selection sort is a simple sorting algorithm that works by repeatedly findin

Starter Code:

def selectionSort (numList) Takes a list and returns 2 values 1st returned value: a dictionary with the state of the list aft

Goal: [10 pts] As discussed in our video lecture, selection sort is a simple sorting algorithm that works by repeatedly finding the minimum element from unsorted part and putting it the sorted portion of the list, so in every pass of selection sort, we put the minimum element from the unsorted subarray in the proper place in the sorted portion of the list. Write the function selectionSort(numList) that takes an unsorted list of numbers and uses the selection sort algorithm to return the sorted list. The function also returns a dictionary with the state of the list after each complete pass. - You are not allowed to use the sorted() method or the sort operator. Your code will not get credit if you use them - You are not allowed to use the min() or max() built-in methods Function returns 2 values: return dictionary, sorted list (there is no need to add parentheses) Method should mutate the original list >>> x= [9,3,5,4,1, 67, 78] >>> selectionSort (x) ({1: [9, 3, 5, 4, 1, 67, 78], 2: [1, 3, 5, 4, 9, 67, 781, 3: [1, 3, 5, 4, 9, 67, 78], 4: [1, 3, 4, 5, 9, 67, 78], 5: [1, 3, 4, 5, 9, 67, 78], 6: [1, 3, 4, 5, 9, 67, 78], 7: [1, 3, 4, 5, 9, 67, 78]), [1, 3, 4, 5, 9, 67, 781) >>> X [1, 3, 4, 5, 9, 67, 78] Second returned value, the sorted list def selectionSort (numList): 111 Takes a list and returns 2 values 1st returned value: a dictionary with the state of the list after each complete pass of selection sort 2nd returned value: the sorted list >>> selectionSort ( [9, 3, 5, 4, 1, 78,67]) ({1: [9, 3, 5, 4, 1, 78, 67], 2: [1, 3, 5, 4, 9, 78, 67], 3: [1, 3, 5, 4, 9, 78, 67], 4: [1, 3, 4, 5, 9, 78, 67], 5: [1, 3, 4, 5, 9, 78, 67], 6: [1, 3, 4, 5, 9, 78, 67], 7: [1, 3, 4, 5, 9, 67, 78]), [1, 3, 4, 5, 9, 67, 78]) # YOUR CODE STARTS HERE

Step by Step Solution

3.38 Rating (142 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement a selection sort in Python without using the sorted min or max functions follow the steps below Well create a function selectionSort that ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!