Published May 1, 2026
| Version v4
Preprint
Open
A Simplified Linear-Time Minimum-Space Algorithm for Stable 0-1 Sorting
Description
Katajainen and Pasanen (1992) proved that stable 0-1 sorting can be done in O(n) time using O(1) extra space. However, the inter-block sorting procedure they rely on (Algorithm B of Munro et al., 1990) is notoriously complex, and the space analysis of Algorithm C leaves the counter packing argument implicit. I present a new algorithm that replaces the complex block-level structure with a simple iterative scheme: block size grows geometrically across two phases (first using a single word for counter packing, then using the extracted buffer), each iteration homogenizing blocks into pure-0 or pure-1 blocks, sorting them by type, and merging. The control flow is straightforward, and all space accounting is explicit and implementable.
Files
A Simplified Linear-Time Minimum-Space Algorithm for Stable 0-1 Sorting.md
Files
(28.1 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:84b1c287fc3420adaebd7864efa97bb7
|
28.1 kB | Preview Download |
Additional details
References
- [1] J. Katajainen, T. Pasanen. Stable minimum space partitioning in linear time. BIT, 1992.
- [2] J.I. Munro, V. Raman, J.S. Salowe. Stable in situ sorting and minimum data movement. BIT, 1990.
- [3] B-C. Huang, M.A. Langston. Fast stable merging and sorting in constant extra space. The Computer Journal, 1992.
- [4] Pok-Son Kim, Arne Kutzner. Ratio based stable in-place merging. TAMC, 2008.