# Tag Info

There's an opaque magic number here, that reduces portability: putchar(48+(int)(u%10)); I think that was intended to be '0',...
• 74.4k

### Sorting an array of positive integers including 0 much faster than Radix Sort

I think you re-invented counting sort, but with some small differences. Also you probably need to sort your sparse array keys before iterating over them so that's O(k log k) at least unless your ...
• 216
Accepted

### C++ - Radix sort implementation

A vector is usually the best data structure to use unless you have a compelling reason to use something else. Since you know how many buckets you need, one slight improvement you can make to your ...
• 7,666

An important thing about sorting is that it has to be fast and that it does not fill your entire heap space. That's why quicksort often is prefered before merge sort. And I think that your code is ...
• 371
Accepted

### Implement LSD radix sort in python

1. Introduction In this answer I'm just going to look at the function counting_sort. You'll see that there's plenty here for one answer. 2. Review There's no ...
• 49.6k
Accepted

Your code is not finished. I could not say this is a finished bit of code as it simply does not work. A simple test, a random set of integers and comparing it to the result of the standard sort ...
• 21.6k

Nice question.... but, you're not doing a Radix Sort, but instead you're doing a Counting Sort As it happens, a counting sort is probably the best sort algorithm you could choose for this problem, so ...
• 97.3k
Accepted

Post line-oriented timings from a profiling run, please. Where does it actually spend its time? Curly braces {} are good for you, even when your for or ...
• 21.9k
Accepted

Review: ...
• 11.6k

### Radix Sort: A C++ version

In addition to JDługosz's answer: Use std::size_t Use it for index, as the value type of the array ...
• 54k

### Radix Sort: A C++ version

😀 First, it's good to see someone use iterator pairs and (somewhat) generic code, as opposed to the usual hard-coded collections being passed. Your View templates ...
• 11.3k
Accepted

Well, I guarantee that qsort doesn't start with a heap allocation. Benchmark several different sizes of array and graph the results, to see where the lines hit the ...
• 19.3k
Accepted

### MSD radix sort in C++

Use System costants as appropriate This is already defined by the Library: static constexpr size_t BITS_PER_BYTE = 8; The number of bits in a byte is: ...
• 94.6k

### Radix sort (LSD) and counting sort

I found a list a few things that you could improve, but nothing that would significantly change the way your sorts work: At the end of the counting sort, you could use ...
• 19.9k

### Fast portable, parallel MSD radix sort for unsigned keys in C89

Consider using C11 thread support You are making your code compatible with C89, however that is a standard that is more than 30 years old, and we have advanced since then. C11 introduced support for ...
• 54k
Accepted

### Parallel MSD radix sort in Java

Very nice. private static final int THREAD_THRESHOLD = 65536; private static final int MERGESORT_THRESHOLD = 4096; These seem arbitrary. THREAD_THRESHOLD is ...
• 21.9k

I am not JavaScript expert, still working on. Just share some tips. Things to improve I read Testable JavaScript and learned a few thing about choosing good test case for your code. Test case: <...
• 2,396

I never found a code that was simple and easy to understand yet wasn't any slower Note the order. Start readable. Start with What shall this be good for?: (doc)comment your code. No slower than ...
• 6,286

Three comments: You are performing a lot of standard array manipulations for which there are implementations in the standard library. It may be faster to use this implementations; it will certainly ...
• 421
Accepted

### Radix sort implementation in JS (LSD)

Well!! First off I will say that is an impressive amount of work for a sort, lots of research and references. BUT!!! I am not going to sugar coat the rest. The implementation is overly complex and ...
• 21.6k

The actual specifier is MSD (most-significant digit) and not MSB (most-significant bit, I suppose). What comes to performance, years ago I wrote a MSD radix sort that takes a parameter, call it $d$. ...
• 27.6k

### Counting Radix Sort: A C++ version

The assumption that CHAR_BIT is 8 can be avoided. I'm not convinced it's necessary to use the exact-width type std::uint64_t. ...
• 74.4k
Accepted

### Radix sort function in R

Putting these comments into an answer... As pointed out, it will be a tall order to beat or even approach the computation times of the native sort function, as it ...
• 3,525

Not much left after @Toby Speight review. Bug? Code has a mysterious & 0xff. Perhaps % count_size? ...
Accepted

### Fast portable, parallel MSD radix sort for unsigned keys in C89

The function parallel_radix_sort_impl() is over 400 lines of code. There must be some way to break this up into multiple functions. This is way too complex, and too ...
• 23.8k
1 vote
Accepted

### Improving performance of radix sort

Some general review: We're missing an include of <string.h> for memset(). There are some constants that aren't obviously ...
• 74.4k
1 vote

Firstly, please put the headers: #include <vector> #include <algorithm> #include <queue> I wonder if you could may be do this set up in a ...
1 vote

#flattened list, reusing lst to save memory lst = [] That doesn't save memory. The caller of the current helper ...
• 3,134
1 vote

### MSD Radix sort in Place in c++, Object/Pointer Oriented

Note: I wrote this answer in response to your other post, which was deleted just before I posted. However, it nearly all applies to this code too, so here it is: ...
• 11.6k
1 vote
Accepted

### LSD radix sort (force avoid div or idiv compiler instruction) in C++

Avoid macros There is no need to make modpow2 a macro. Make it a function instead: ...
• 54k

Only top scored, non community-wiki answers of a minimum length are eligible