FAQ Database Discussion Community


C++: Sorting strings using LSD radix sort crashing

c++,arrays,string,sorting,radix-sort
I have written some code that is meant to sort an array of strings using the radix sort, starting with the least significant digit. This function assumes all of the strings are the same length and each character is lowercase. I am encountering crashes whenever I get to the loop...

Parallel radix sort with virtual memory and write-combining

algorithm,sorting,caching,radix-sort
I'm attempting to implement the variant of parallel radix sort described in http://arxiv.org/pdf/1008.2849v2.pdf (Algorithm 2), but my C++ implementation (for 4 digits in base 10) contains a bug that I'm unable to locate. For debugging purposes I'm using no parallelism, but the code should still sort correctly. For instance the...

How to sort a variable-length string array with radix sort?

string,algorithm,sorting,radix-sort
I know that radix sort can sort same-length string arrays, but is it possible to do so with variable-length strings. If it is, what is the C-family code or pseudo-code to implement this? It might not a be fast algorithm for variable-length strings, but it is easy to implement radix...

Sort function giving floating point exception for a large input of 0's

c++,sorting,radix-sort,floating-point-exceptions
I have written a code for this problem: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330. Note: The result may be very large, so you need to return...

radix sort (java implementation) complexity

java,sorting,time-complexity,radix-sort
this is my first question so I hope I haven't broken any rules. I have finally just managed to write code for the Radix Sort algorithm but I am wondering if I have done it wrong. What makes me think that is that my algorithm looks of complexity O(n^3) but...

how is the most significant bit radix sort more efficient than the least significant bit radix sort?

c++,algorithm,radix-sort,radix
I was just reading the following question: Radix sort most significant first or least significant, which is faster? And the author of the accepted answer was suggesting that the MSD radix sort is indeed faster. I do not see why however. I have implemented both LSD and MSD (binary based...