Skip to main contentSkip to solution

What is the status of list after PASS-3 using Insertion Sort on the List [8,7,13,1,-9,4] ?

Solution

✅ Correct Option: 2

Insertion sort takes the next element in turn and inserts it into its correct place in the sorted part on its left. Pass 1 inserts the 2nd element, pass 2 the 3rd, and pass 3 the 4th.

PassElement insertedList after pass
17 goes before 8[7,8,13,1,-9,4]
213 is already in place[7,8,13,1,-9,4]
31 shifts past 13, 8 and 7[1,7,8,13,-9,4]

Option 1: this is the list after Pass 1 (and also after Pass 2, since 13 does not move).

Options 3 and 4: the order of elements does not follow insertion into a sorted left part, because the sorted part must always be in ascending order.

Keyboard Shortcuts

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