Persiansort: an alternative to mergesort inspired by persian rug
Parviz Afereidoon
TL;DR
Persiansort addresses the stable sorting problem under constrained auxiliary memory, especially for data that are nearly or partially sorted. It introduces a top-down warping framework with a tunable wp parameter, a jumpinsert weft, and run-exploitation knots inspired by Persian rug weaving. The paper analyzes time and space complexity, showing $O(n)$ best-case behavior, $O(n\log n)$ worst-case, and memory scaling with $n/wp$, while identifying an empirical optimum around $wp=9$. Experimental results against M1, M2, TimSort, and Insertion sort demonstrate competitive performance and memory advantages in run-rich and nearly sorted data regimes, suggesting persiansort as a flexible alternative to mergesort. The approach offers practical impact for stable sorting in data-intensive applications with structured input, where runs and near-sortedness are prevalent.
Abstract
This paper introduces persiansort, new stable sorting algorithm inspired by Persian rug. Persiansort does not have the weaknesses of mergesort under scenarios involving nearly sorted and partially sorted data, also utilizing less auxiliary memory than mergesort and take advantage of runs. Initial experimental showed, this method is flexible, powerful and works better than mergesort in almost all types of data. Persiansort offers several advantages over merge methods make it a potential replacement.
