Show the call stack for sort([2, 3, 5, 1]) using the function defined inListing 15.5.
LISTING 15.5 RecursiveSelectionSort.py1 def sort(lst):2 # Sort the entire list345 if low <>6 # Find the smallest element and its index in lst[low .. high]7 indexOfMin = low
8 min = lst[low]9 for i in range(low + 1, high + 1):10 if lst[i] <>11 min = lst[i]12 indexOfMin = i1314 # Swap the smallest in lst[low .. high] with lst[low]15 lst[indexOfMin] = lst[low]16 lst[low] = min1718 # Sort the remaining lst[low+1 .. high]192021 def main():22 lst = [3, 2, 1, 5, 9, 0]23 sort(lst)24 print(lst)2526 main() # Call the main function
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here