Insertion Sort

 

Insertion sort was not one of the sorts discussed in Chapter 7. However, inserting into a list was discussed and insertion sort is based on the same algorithm. Each item is inserted one at a time into a sorted list. When all items have been inserted, the list is sorted.

The following applet implements the insertion sort algorithm. Run this applet five times, using 25, 50, 100, 500, and 1000 as the number of items in the list. Record the number of swaps required for each sized list.