Sorting algorithms that don’t hate you
Let n be a non-negative integer.<p>A number n is <i>bit reversed</i> if it is written was written in binary (base 2) and then the bits were written in reverse order.<p>Last time I looked at Shell sort, when sorting n records on keys in bit reversed order, the iterations of Shell sort did nothing until the last iteration at which time Shell sort was just bubble sort or some such and, whatever, ran in time O(n^2)   where the <i>O()</i> is some obscure but now common notation.  The article claims something smaller than O(n^2). Okay, but to get something smaller, have to tweak what used to be a standard version of Shell sort.<p>For another point, the article wants a <i>stable</i> sort -- if two records (the data being sorted) A and B have equal keys and before the sort record A is before record B, then after the sort record A will still be before record B.  But, if want a stable sort, then for one approach, before the sort, number the records and use these numbers as part of the keys. Right this extra step runs in time O(n) and uses extra <i>temporary, working</i> storage proportional to n. For current computing, is this extra storage a meaningful issue?