logo CodeStepByStep logo

insertionSort2

Language/Type: Java insertion sort sorting
Related Links:
Author: Sara Jackson (on 2017/12/16)

Write the state of the elements of the list below after the first three odd passes of the outermost loop of the insertion sort algorithm.

// index     0   1   2   3   4   5   6  7
// values  {35, 33, 72, 13, 91, 42, 13, 2}
ArrayList<Integer> numbers = new ArrayList<Integer>(Arrays.asList(35, 33, 72, 13, 91, 42, 13, 2));
insertionSort(numbers);
after pass 1
after pass 3
after pass 5

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.