Step 1: Comparison sort compares 4 and 2, swaps because 4 > 2
[2, 4, 7, 1, 3]
Why: We need to order elements by comparing pairs
Step 2: Comparison sort compares 4 and 7, no swap needed
[2, 4, 7, 1, 3]
Why: 4 is less than 7, so order is correct
Step 3: Comparison sort compares 7 and 1, swaps because 7 > 1
[2, 4, 1, 7, 3]
Why: 7 is bigger than 1, so swap to move smaller number forward
Step 4: Non-comparison sort places 1 in bucket 1
Buckets: 1:[1], 2:[], 3:[], 4:[], 7:[]
Why: Directly use value to place element
Step 5: Non-comparison sort places 2 in bucket 2
Buckets: 1:[1], 2:[2], 3:[], 4:[], 7:[]
Why: Each number goes to its own bucket
Step 6: Non-comparison sort places 3, 4, 7 in their buckets
Buckets: 1:[1], 2:[2], 3:[3], 4:[4], 7:[7]
Why: All elements sorted by direct placement
Step 7: Non-comparison sort collects buckets in order
[1, 2, 3, 4, 7]
Why: Concatenate buckets to get sorted array
Result: Comparison sort final: [1, 2, 3, 4, 7]
Non-comparison sort final: [1, 2, 3, 4, 7]