- 2068 Bhadra · 3 marks
Merge sort on 47, 27, 56, 23, ...
Short answer
Merge sort recursively divides list into halves then merges sorted halves. The final sorted list is 3, 9, 11, 23, 27, 47, 56, 94.
Trace the sorting steps in merge sort for the data: 47, 27, 56, 23, 3, 9, 94, 11.
Merge sort splits the list in halves down to single elements and then merges sorted halves.
Dividing
47 27 56 23 3 9 94 11
47 27 56 23 | 3 9 94 11
47 27 | 56 23 | 3 9 | 94 11
47 | 27 | 56 | 23 | 3 | 9 | 94 | 11
Merging
| Step | Merge | Result |
|---|---|---|
| 1 | [47] + [27] | [27, 47] |
| 2 | [56] + [23] | [23, 56] |
| 3 | [3] + [9] | [3, 9] |
| 4 | [94] + [11] | [11, 94] |
| 5 | [27, 47] + [23, 56] | [23, 27, 47, 56] |
| 6 | [3, 9] + [11, 94] | [3, 9, 11, 94] |
| 7 | [23, 27, 47, 56] + [3, 9, 11, 94] | [3, 9, 11, 23, 27, 47, 56, 94] |
Answer: 3, 9, 11, 23, 27, 47, 56, 94
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Merge sort algorithm and trace · Data Structure and Algorithm, chapter 7
- Merge and radix sort on 142, 523, ... · Data Structure and Algorithm, chapter 7
- Merge sort on 85, 76, 46, 92, ... · Data Structure and Algorithm, chapter 7
- Selection sort with trace · Data Structure and Algorithm, chapter 7
- Radix sort on 25, 57, 48, 37, ... · Data Structure and Algorithm, chapter 7
- Straight selection sort on 33, 90, 45, ... · Data Structure and Algorithm, chapter 7
- De Morgan's theorem and (-47+27) by 2's complement · Digital Logic, chapter 2
- Subnet 10.10.10.0/24 for 5, 16, 23, 27 · Computer Networks and Security, chapter 4 · asked 2×