paper

When More Generators Hurt: Shellsort on Full Product Grids

arXiv:2608.10696

Abstract

Shellsort repeatedly runs insertion sort with decreasing gaps, so its worst-case cost depends on the gap sequence. Pratt's sequence, one of the few systematic constructions with a proven bound, includes every product below of two base numbers, or generators. We ask whether adding more base numbers, and thus more intermediate gaps, can improve this full product grid. We show that it cannot when every product is retained and each base is at most a fixed power of the smallest. With independent bases (different exponent choices give different products) and gaps, the best possible worst-case cost is . Thus two bases give the exponent , whereas three give : more bases are worse. With a budget of gaps, matching bounds give the factor beyond linear cost. The reason is simple. Few products force the smallest base to be large, and fullness makes the next-to-last gap. An input built from reversed blocks is already sorted for every earlier gap, forcing work in the final pass. Powers of distinct primes give a matching construction. For arbitrary gaps, we count current-gap multiples that earlier gaps cannot form. This gives upper and lower bounds for individual passes. A Fourier argument gives necessary conditions for small total cost, while short nonnegative sums give sufficient conditions. In both settings, useful distances must be available before they are needed.

When More Generators Hurt: Shellsort on Full Product Grids · wovepaper