✍️ Get Writing Help
WhatsApp

Bubble sort algorithm

Suppose that L is a list of 6,500 elements. Find the average number of comparisons made by bubble sort, selection sort, and insertion sort to sort L. (2)

a.  It was remarked in this chapter that the performance of bubble sort can be improved if we stop the sorting process as soon as we find that in an iteration no swapping of elements take place. Write a function that implements bubble sort algorithm using this fact. (2)

b.  Using the algorithm that you designed in part (a), find the number of iterations that are needed to sort the list: 65, 14, 52, 43, 75, 25, 80, 90, 95. (2)

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102