Searching, Sorting & Selection

Your answer
Answer & solution
Answer: B: 8,15,20,47,4,9,30,40,12,17 (no official key was published)
Step through it (10 steps)
Pass one merges singleton runs into pairs: [20,47], [8,15], [4,9], [30,40], [12,17]. Pass two merges adjacent pairs into four-element sorted runs. The first two yield [8,15,20,47]; the next two yield [4,9,30,40]. The final pair has no partner and remains [12,17]. Concatenating these runs gives B. The whole array is not yet sorted; later passes merge the length-four runs and the remaining tail.