1. Engineering
  2. Computer Science
  3. 4 25 points here is a python implementation of another...

Question: 4 25 points here is a python implementation of another...

Question details

4. (25 points) Here is a Python implementation of another sorting algorithm 1. def bubblesort (A): 2, n=len(A) 3. for i in range (n-1): 4. 5. for j in range(n-1, i, -1): 7. 8. Aj-1-u a) Let A 7,2,5,3 What value does i have the first time the loop on line 3 is executed? What value does i have the last time the loop is executed? Hint: Try range(10) in Python b) Let A 1,7,2,5, 3. If i 3, what values of j are used in the loop on line 4? Hint: Try range (10, 2. -1) in Python c) Let A = [1, 7, 2, 5,3]. If i is zero, then j takes on the values 4, 3, 2 aid 1, work through lines 4-8 manully to show what happens
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution