HSCS.159 Selection and Insertion Sort
0%
Skill Level🔴 Hard
00:00
Progress to Next Level25% to Medium
EasyMediumHardMastery100%

Text-based stimulus: Two-row trace table with columns labeled index 0 through 6. The first row is labeled 'before pass' and shows [D:17, C:17, F:17, G:20, E:24, B:13, A:13]. Shade indices 0 through 4 as the sorted prefix and place a key marker above index 5. It also includes visible text: 'insertion sort, ascending order, key at i = 5'. A lab queue is sorting samples shown as label:reading. Trace one insertion-sort pass in ascending order using records shown as label:value and compared by the number after the colon. The code stores keyItem = a[i], sets j = i - 1, and shifts while j >= 0 and key(a[j]) > key(keyItem). Before the pass, a = [D:17, C:17, F:17, G:20, E:24, B:13, A:13] and i = 5. Which array state correctly follows the next pass after keyItem is inserted?