Radix Sort
Radix Sort
•Key Advantage:
1. Starting from the least significant digit to the most significant digit.
2. Use a stable sorting algorithm (e.g., Counting Sort) to sort numbers based on the current
digit.
Example Overview
•Result After Pass 1: [720, 355, 436, 657, 457, 329, 839]
Pass 2 (Sorting by applying count sort on next higher digits)
•Array After Pass 1: [720, 355, 436, 657, 457, 329, 839]
•Result After Pass 2: [720, 329, 436, 839, 355, 657, 457]
Pass 3 (Sorting by Hundreds Place)
•Array After Pass 2: [720, 329, 436, 839, 355, 657, 457]
•Result After Pass 3: [329, 355, 436, 457, 657, 720, 839]
Final Sorted Array
•Final Sorted Array: [329, 355, 436, 457, 657, 720, 839]
•Steps Recap:
• Sorted by units place.
• Sorted by tens place.
• Sorted by hundreds place.
•When to Use:
• Suitable for sorting integers, strings, and other data with a fixed size.
• Not suitable for floating-point numbers or data with a large range of values.