0

I want to know if it is more efficient to use a Radix sort with Integer values or to convert the values to Binary and then sort them.

Can someone explain to me the pro's and con's of sorting values using a Radix sort with Binary numbers instead of just using Integers?

For example, I want to sort 5 values. (170, 2, 19, 40, 100)

Using a radix sort what would the Pro's and Con's be of using their binary representations? (010101010, 0010, 010011, 0101000, 01100100)

1
  • 1
    Can you explain the difference between Integers and Binary numbers? And how you convert from the former to the latter? Commented Dec 21, 2015 at 19:14

2 Answers 2

1

Radix sort is all about sorting binary numbers. Luckily for us, integers are binary numbers too (amongst the best binary numbers actually).

Another advantage of using the binary form is that we can group on 10 bits instead of 8 bits if we want. For example, for numbers ranging from 0 - 1000000, 2 x 10 bits could be used for grouping/sorting.

Check this for an interesting read, and this for a cool animation.

Sign up to request clarification or add additional context in comments.

Comments

0

With a Radix sort, when using Binary, it will require you to take more passes however you will use less queues.

When using Integers, you will use less passes, but will require more queues.

I'm not quite sure what this means in terms of Big O.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.