Skip to main content

Merge sort on 85, 76, 46, 92, ...

Short answer

Using merge sort, recursively divide 85,76,46,92,30,41,12 into single elements. Merge stepwise: [85]&[76]→76,85; [46]&[92]→46,92; [30]&[41]→30,41; then merge [76,85]&[46,92]→46,76,85,92; merge [30,41]&[12]→12,30,41; final merge yields 12,30,41,46,76,85,92.

Trace the steps to sort the following set of data using merge sort: 85, 76, 46, 92, 30, 41 and 12.

Merge sort uses divide and conquer: split the list into two halves until each part has one element, then merge the sorted parts pairwise. Here the left half gets the extra element when the size is odd.

Dividing

85 76 46 92 30 41 12
  85 76 46 92 | 30 41 12
  85 76 | 46 92 | 30 41 | 12
  85 | 76 | 46 | 92 | 30 | 41 | 12

Merging

StepMergeResult
1[85] + [76][76, 85]
2[46] + [92][46, 92]
3[30] + [41][30, 41]
4[76, 85] + [46, 92][46, 76, 85, 92]
5[30, 41] + [12][12, 30, 41]
6[46, 76, 85, 92] + [12, 30, 41][12, 30, 41, 46, 76, 85, 92]

Answer: 12, 30, 41, 46, 76, 85, 92

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Structure and Algorithm chapter 7 questions →