• Function in Python
  • def bubbleSort(arr):
  •     for i in range(len(arr)):
  •         for j in range(0, (len(arr)-i-1)):
  •             if arr[j] > arr[j+1]:
  •                 arr[j], arr[j+1] = arr[j+1], arr[j]


1. What are the correct intermediate steps of the following data set when it is being sorted with the bubble sort? 15,20,10,18
    15,10,20,18 -- 15,10,18,20 -- 10,15,18,20
    10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20
    15,20,10,18 -- 15,10,20,18 -- 10,15,20,18 -- 10,15,18,20
    15,18,10,20 -- 10,18,15,20 -- 10,15,18,20 -- 10,15,18,20

2. In a bubble sort structure, there is/are?
    A single for loop
    Three for loops, all separate
    A while loop
    Two for loops, one nested in the other

3. What is the maximum number of comparisons if there are 5 elements in array x?
    10
    2
    5
    25


s