Now let's determine which sort was the most time-efficient. To do this, we will count the number of operations each sort performed. Most of the operations that are done by the computer during sorting fall into two groups: copying numbers or comparing numbers. The algorithm which requires the least copying and comparing is the one that will execute the fastest.

Type of Efficiency Measures
Time

# of items copied
# of items swapped
# of items compared

For the Insertion Sort and the Selection Sort, it will be easier to count the number of swaps that are done rather than the number of copies. Remember that the swap operation requires three copies. We can find the total number of copies that the algorithms perform by counting the number of swaps and multiplying by three. The Simple Sort does not use the swap operation, so you can count the number of copies directly.

For each sort, calculate the number of copies that the algorithm required, and then enter your answers in the boxes below to see if they are correct. You will need to return to the sorting pages to review the steps of the algorithm. Click on the sort names to open the appropriate page in a new browser window. For Insertion Sort and Selection Sort, don't forget to convert your answer from swaps to copies.

Now calculate the number of comparisons that each algorithm required, and then enter your answers in the boxes below to see if they are correct.