Efficiency of Different Sorting Algorithms

 

In Chapter 7, three sorting algorithms were presented and discussed: selection sort, bubble sort, and Quicksort. In this lab, you will experiment with each of these algorithms by changing the size of the list to be sorted and observing the number of times the contents of two places are swapped. The number of swaps is often used to measure sorting efficiency.

Go to each of the pages listed below and follow the directions.


Selection Sort

Short Bubble

Quicksort

Insertion Sort


Look carefully at the number of swaps required in each case. From what you know of the algorithms, would you say that the number of swaps is a good measure to use to compare these algorithms? Explain your answer.

Next