Logsort

Logsort is an $$O(n\log n)$$ stable quick sort using only $$O(\log n)$$ extra space. It uses a novel yet simple $$O(n)$$ stable partitioning technique that uses only $$O(\log n)$$ space instead of $$O(n)$$. However, like $$O(n)$$ in-place merging, Logsort's partition performs much more data moves and is more complicated than a regular $$O(n)$$ space partition.

Algorithm
Stable partitioning can be thought of stably sorting an array with 0's and 1's (which indicates an element is greater than the pivot or not) and is accomplished in two phases. The blocking phase first groups elements into blocks containing elements of only 0's or 1's which is a common strategy among in-place stable partitioning algorithms. Then the sorting phase stably sorts those blocks within the time bounds.

Grouping into blocks
As seen with the Aeos Stable Quicksort algorithm, there exists a trivial $$O(n)$$ method of grouping blocks size $$b$$ using $$O(b)$$ extra space. Since Logsort forms blocks of size $$O(\log n)$$, the algorithm needs $$O(\log n)$$ extra space.

Stably sorting the blocks
Once the blocking phase is complete, the partitioned data is divided into $$n/b=O(n/\log n)$$ blocks of size $$b=O(\log n)$$. Logsort's block sorting algorithm is unique and stably sorts them in $$O(m\log m)$$ comparisons and $$O(bm)$$ moves (where $$m$$ is the amount of blocks). Since $$m=O(n/\log n)$$ and $$b=O(\log n)$$, Logsort's block sorting phase yields $$O(n/\log n \cdot \log(n/\log n))=O(n)$$ comparisons and $$O(n/\log n\cdot\log n)=O(n)$$ moves therefore Logsort's partition is $$O(n)$$ time.

Bit encoding
Since elements are either 0's or 1's in a partition, elements from each block can be used as bits to encode an index of size $$O(2^b)=O(n)$$ which is enough to encode all $$O(m)=O(n/\log n)$$ blocks. Each bit in an index can be found by comparing the block element against the pivot therefore reading an index takes $$O(b)$$ comparisons.