Given list L=[8, 7, 13, 1, -9, 4]
Perform Insertion sort and identify the correct order of sort.
(A) 7, 8, 13, 1, -9, 4
(B) -9, 1, 7, 8, 13, 4
(C) -9, 1, 4, 7, 8, 13
(D) 1, 7, 8, 13, -9, 4
Given list L=[8, 7, 13, 1, -9, 4]
Perform Insertion sort and identify the correct order of sort.
(A) 7, 8, 13, 1, -9, 4
(B) -9, 1, 7, 8, 13, 4
(C) -9, 1, 4, 7, 8, 13
(D) 1, 7, 8, 13, -9, 4
Solution
Insertion sort takes each element in turn and inserts it into its correct place in the sorted part on its left. The sorted part grows by one element per pass, so the states appear in this order:
(A) 7, 8, 13, 1, -9, 4: 7 is inserted before 8.
(D) 1, 7, 8, 13, -9, 4: 13 stays in place, then 1 moves to the front.
(B) -9, 1, 7, 8, 13, 4: -9 moves to the front.
(C) -9, 1, 4, 7, 8, 13: 4 is inserted after 1, giving the fully sorted list.
In (D), the first four elements are sorted but -9 and 4 are untouched. In (B), the first five are sorted, so (D) must come before (B).
Related questions:
2025: 16 May Shift 1
2025: 13 May Shift 2
2026: 20 May Shift 1
2026: 20 May Shift 1