Jump to content
  • Advertisement
  • 09/13/99 06:19 PM
    Sign in to follow this  

    Radix Sort

    General and Gameplay Programming

    Myopic Rhino
    Unlike most other sorting algorithms, Radix Sort does not involve comparison between the items being sorted. Instead, Radix Sort shuffles the items into small bins, then recollect the bins and repeat the process until the array is sorted.

    The magic of Radix Sort lies in finding the key to shuffle the items. For integer data, the key is each individual digits. In a group of data, there can be up to ten bins for each digit (0 - 9). Thus we isolate each individual digit of each data, and place into the corresponding bin. When we start, we start with the least significant digit and work our way up to the most significant digit.

    Below is the pseudo-code of Radix Sort.

    Radix Sort (Sorting array A[size])

    Create all of the bins.
    From the least significant digit to the most significant digit
    For each element (from the first to the last)
    Isolate the value of the significant digit.
    Store the element in the bin with the matching significant digit value.
    For each bin (from the first to the last)
    Retrieve all of the elements and store them back into the array.
    Destroy all of the bins.

      Report Article
    Sign in to follow this  

    User Feedback

    There are no comments to display.

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!