- 2070 Bhadra · 3+5 marks
Radix sort on 32, 45, 60, 83, ...
Short answer
Radix sort sorts by digit position from least significant to most, distributing keys into ten queues per pass and collecting in order. Each pass is stable. For the given data, after two passes the sorted list is 32, 43, 45, 60, 69, 70, 75, 83.
Explain radix sort. Sort the given data 32, 45, 60, 83, 75, 43, 70, and 69 using radix sort.
Radix sort sorts keys digit by digit from the least significant digit, distributing keys into ten queues (0 to 9) in each pass and collecting them in queue order. Each pass is stable, so after the pass for the most significant digit the list is sorted. Time is O(d·n) for d-digit keys.
Algorithm
RADIXSORT(a, n)
1. d = number of digits of the largest key
2. for pass = 1 to d
3. put each a[i] at rear of queue[ digit pass of a[i] ]
4. collect queue 0, 1, ..., 9 back into a
Sorting 32, 45, 60, 83, 75, 43, 70, 69 (2 passes)
Pass 1 (units digit)
| Queue | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|
| Keys | 60, 70 | 32 | 83, 43 | 45, 75 | 69 |
List: 60, 70, 32, 83, 43, 45, 75, 69
Pass 2 (tens digit)
| Queue | 0-2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|
| Keys | 32 | 43, 45 | 60, 69 | 70, 75 | 83 |
Answer: 32, 43, 45, 60, 69, 70, 75, 83
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Shell sort on 92, 83, 22, 49, ... · Data Structure and Algorithm, chapter 7
- Radix sort on 345, 654, 924, ... · Data Structure and Algorithm, chapter 7
- Radix sort definition and algorithm · Data Structure and Algorithm, chapter 7
- Merge and radix sort on 142, 523, ... · 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
- Conductor selection, 100 MW 70 km 132 kV · Transmission and Distribution System Design, chapter 4
- Cable size MDB to SDB-1 (60 kW) and SDB-2 (75 kW) · Industrial Power Distribution and Illumination, chapter 5 · asked 4×
- Gumbel design flood, 43 years data, 85% reliability · Engineering Hydrology, chapter 6 · asked 2×
- Cutting volume, 60 m, GL 540.70, formation 538.20 · Surveying I, chapter 9 · asked 7×