How to Learn Radix Sort Algorithm in Simple words

 


Radix Sort Algorithm

Radix sort is one of the sorting algorithms used to sort a list of integer numbers in order. In radix sort algorithm, a list of integer numbers will be sorted based on the digits of individual numbers. Sorting is performed from least significant digit to the most significant digit.
Radix sort algorithm requires the number of passes which are equal to the number of digits present in the largest number among the list of numbers. For example, if the largest number is a 3 digit number then that list is sorted with 3 passes.

Radix sort ant Bucket sort algorithm are almost equivalent. Bucket sort goes from MSD to LSD while Radix sort is capable of both direction that is LSD or MSD

Step by Step Process

The Radix sort algorithm is performed using the following steps...

  • 1 - Define 10 queues each representing a bucket for each digit from 0 to 9.
  • 2 - Consider the least significant digit of each number in the list which is to be sorted.
  • 3 - Insert each number into their respective queue based on the least significant digit.
  • 4 - Group all the numbers from queue 0 to queue 9 in the order they have inserted into their respective queues.
  • 5 - Repeat from step 3 based on the next least significant digit.
  • 6 - Repeat from step 2 until all the numbers are grouped based on the most significant digit.


Post a Comment

0 Comments