Read all the instructions given below and mark the checkboxes once read. When all the checkboxes are marked simulator will be enabled.
You can choose the time of simulation from the slider given below.
Values of array should be entered in the text box given below separated by space.
Values must be always number.
Click on generate button to create the array.
Click on find to start the simulation.
Once simulation is over you will be see questions please answer them.
Click on reset button to reset the simulator.
1 Sec
2 Sec
3 Sec
4 Sec
5 Sec
Please insert space sepeated numbers only.
Array Values
Generate
Start
Reset
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]
Please attempt all the questions.
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
Please mark all the answers.
Submit
s