23 |
30 |
35 |
43 |
4 |
10 |
22 |
4 |
Complete the following:
a) Use the bubble sort to sort the values showing the order of the values in the list after every pass of the sorting algorithm.
b) What is the time complexity of the sort (use the number of comparisons required as a measure of time.)
c) Modify the algorithm so it stops if there are no swaps in a complete pass. How many comparisons would be needed in your specific example?
d) Choose one of the following properties of Algorithms and show that the bubble sort has the given property:
Get Answers For Free
Most questions answered within 1 hours.