Extracted text: Run the code below to define the function # In[ ]: E def minIndexAfter (items, startPos) : minIndex = startPos i = startPos + 1 while (i < len="" (items))="" :="" if="" (items[i]="">< items[minindex]):="" minindex="i" i="i" +="" 1="" return="" minindex="" define="" a="" function="" called="" `selectionsort`="" below.="" in="" the="" body="" of="" the="" function,="" you="" will="" need="" to="" call="" the="" `swap="" function="" and="" the="" `minlndexafter`="" function.="" -="" define="" 'selectionsort'="" here="" items="[395,2,-4,20," 47,200,-50,-12]="" selectionsort="" (items)="" print="" (items)="" use="" the="" code="" above="" to="" test="" your="" 'selectionsort'="">
Extracted text: Run the code below to call the function # In[ ]: otherList = [395,2,-4,20,47,200,-50,-12] #a list for testing print ('Before sorting: ', otherList) bubbleSort (otherList) print ('After sorting:', otherList) a) What are the contents of otherList after a single iteration of the outer loop of 'bubbleSort? b) How many iterations of the outer loop happen when sorting `otherList? * Then run both blocks of code (the def block and the test block) again. * Examine the output to answer the question about iterations. Create a new list below with * elements known as "yourList" - a list where you can get 'bubbleSort` to stop early (do fewer iterations). How many times did the outer loop run for 'yourList? # In[ ]: yourList = [] #fill in this list with 8 elements separated by commas print ('Before sorting:', yourList) bubbleSort (yourList) print ('After sorting:', yourList)