Skip to main contentSkip to solution

Consider a list of elements:

numList =[8,7,13,1,-9,4].

Determine the partially sorted list after three complete passes of the list using insertion sort.

Solution

✅ Correct Option: 4

Insertion sort treats the first element as already sorted. Each pass takes the next element and inserts it into its correct place in the sorted part on the left.

PassElement insertedList after the pass
17[7,8,13,1,-9,4]
213 (already in place)[7,8,13,1,-9,4]
31 (moves to the front)[1,7,8,13,-9,4]

Option 1: this is the list after pass 1 (and also after pass 2), not pass 3.

Option 3: this is the fully sorted list, which needs five passes.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question