- Today
- Total
Running Deeper C/C++/Java
Radix sort uses a length based type of comparison, and has a time complexity of O(wn), where w is the length of the data. For cases where w is constant, and n is very large, the complexity O(wn) can be even faster than O(nlogn) algorithms (w>logn), and is a very useful tool to know. It is used where there is basically nothing more to optimize, but is an interesting idea. The following is a source code from StackOverflow, a recursive implementation.
There are many different variations, such as the Least Significant Digit Radix sort, which is a very stable sorting mechanism.
There is a visualization on the website
https://www.cs.usfca.edu/~galles/visualization/RadixSort.html
Overall, I see myself using this algorithm often.
Radix sort uses a length based type of comparison, and has a time complexity of O(wn), where w is the length of the data. For cases where w is constant, and n is very large, the complexity O(wn) can be even faster than O(nlogn) algorithms (w>logn), and is a very useful tool to know. It is used where there is basically nothing more to optimize, but is an interesting idea. The following is a source code from StackOverflow, a recursive implementation.
There are many different variations, such as the Least Significant Digit Radix sort, which is a very stable sorting mechanism.
There is a visualization on the website
https://www.cs.usfca.edu/~galles/visualization/RadixSort.html
Overall, I see myself using this algorithm often.