Allan Didier

Insertion Sort

Goals

Students will demonstrate their ability to use sort Strings with the Insertion Sort algorithm.

Program Details

Create a program that uses the Insertion Sort technique to sort an array of Strings.  See the Insertion Sort page for a more detailed explanation of the Insertion Sort algorithm.

Main Program:

    1. Create an array of 20 unordered words.
    2. Print the original, unordered array.
    3. Sorts the array of words using the Insertion sort technique.
    4. Print the array during each major iteration of sorting to see how the sorting works. Print the array after each iteration of your main outer for loop (for i), not the inner loops (j and k).
    5. Print the ordered array.

Resources

Edhesive T2 Lesson 15: Insertion Sort

AP College Board Video: Insertion Sort

Geeks for Geeks: text explanation