Block Merge Sort

(a.k.a. Block Sort)

Algorithm
Block Merge sorts are a class of sorting algorithms that share these qualities: They are Stable, In-Place (sometimes), and $$O(n \log n)$$. They always take the form of a bottom-up merge sort, and extensively use $$O(\sqrt{n})$$ "blocks" and unique buffers. Their merge usually consists of two stages: Merging, where a unique buffer is used to merge individual $$O(\sqrt{n})$$ blocks, and Block Selection, where the blocks are sorted with a variant of Selection Sort that sorts the blocks using their first/last element as the key. Because Selection Sort is not stable, there is also another unique buffer that either "tags" the blocks or imitates their movement to force stability. Cycle Sort can also be used. Some Block Merge sorts use $$O(\sqrt{n})$$ external buffers, making them not In-Place, though they do not have to make sure that elements are unique, as the buffers can be overwritten at will.

Grail Sort
Go to: How To Grailsort: The Definitive Guide