Exact small-budget repair polynomials for binary lex-sorted arrays
How many binary arrays can be made lexicographically sorted by incrementing at most one or two cells? Let \(F_b(n,w)\) count the \(n\)-row, \(w\)-column binary arrays \(X\), with \(n,w\ge 1\), for which some binary array \(Y\) of the same shape, with at most \(b\) ones, makes \(X+Y\) weakly increasing in lexicographic order along both axes. Rows are compared from left to right, and columns from top to bottom, using \(0<1<2\). Addition is entrywise over the integers, so an increment can change \(0\) to \(1\) or \(1\) to \(2\). Each input array contributes once, even when several choices of \(Y\) work. With budget two, both increments may occur in one row at distinct cells. For every fixed width \(w\), both counts are eventually polynomial in the height \(n\). Put \(d=2^w\), the number of binary row types, and set \[S_1=w2^{w-1},\qquad S_2=w(w+1)2^{w-2}. \] The one-increment polynomial has degree \(d\) and leading coefficient \(S_1/d!\). The two-increment polynomial has degree \(d+1\) and leading coefficient \((S_1^2+S_2)/(2(d+1)!)\). Thus at fixed width the ratio \(F_2(n,w)/F_1(n,w)\) grows asymptotically as \(\tfrac14(w+1/(d+1))n\). For one increment, Hardin's catalogue records empirical polynomial degrees through width six and gives specific identities to check. The stated polynomials agree with the counts at every positive height for widths one to six, including the three wider identities at widths four, five and six. The width-one count is \(1+n+\binom n2\), and the width-two and width-three identities are prior results. Hardin's A225900, with the width-four to width-six identities A225896–A225898 · Prior width-two identity A225894 · Prior width-three identity A225895 For two increments, Hardin's catalogue also records where the polynomials start. At widths four and five, the stated polynomials are exact from height three. At heights one and two the count is smaller than the polynomial by one at width four and larger by three at width five. In the prior narrow range, the width-two polynomial holds at every positive height, and the width-three polynomial holds from height two, with the count smaller by one at height one. At width one the count is \(1+n+\binom n2+\binom n3\) for every positive height. The general degree and leading-coefficient results give eventual agreement at every fixed width. The exact starting heights here concern the listed widths. Hardin's A225982, polynomial degrees and starting heights through width five · Width-four polynomial A225978 · Width-five polynomial A225979 · Prior width-two identity A225976 · Prior width-three identity A225977 The native polynomials have an exact finite-difference form. Let \(P_{b,w}\) be the polynomial, \(D\) its degree given above and \(s\) its first height of agreement from which it holds at all later heights. Take \(s=1\) for every listed one-increment width. For two increments at widths one through five, take \(s=1,1,2,3,3\), respectively. Then \[P_{b,w}(n)=\sum_{j=0}^{D}\binom{n-s}{j} \sum_{i=0}^{j}(-1)^{j-i}\binom ji F_b(s+i,w). \] Here \(\binom tj=t(t-1)\cdots(t-j+1)/j!\) for \(j\ge 1\), and \(\binom t0=1\). This formula evaluates the polynomial even at the exceptional positive heights, where the corrections above give the array count. To compute the integer inputs \(F_b(s+i,w)\), process the array one row at a time. For each prefix of input rows, retain the possible triples \((r,U,c)\), where \(r\) is the base-three rank of the last repaired row with its leftmost digit most significant, \(U\) is the set of adjacent column pairs still tied, and \(c\) is the number of increments used. Start with a sentinel rank below every row, all adjacent pairs tied and cost zero. For each next binary row \(x\), try every binary row mask \(e\) whose number of ones keeps the total cost at most \(b\). Keep \(y=x+e\) if its rank is at least \(r\) and \(y_j\le y_{j+1}\) for every pair \((j,j+1)\) in \(U\). Keep tied pairs for the next row and remove those with \(y_j<y_{j+1}\), because their first difference has settled their order. For each resulting rank and set of ties, retain the least cost. The resulting collection is a single state for the whole input prefix. Start with count one at the initial state, add the current state's count once for each binary row symbol with a non-empty successor, and sum the counts after the desired number of rows. Any remaining tied columns are equal and are accepted. This also computes the exact count directly at any positive height and width, with the chosen budget. The leading terms come from consecutive runs of identical input rows. With one increment, the highest-degree configurations have \(d+1\) runs whose lengths can vary, each of length at least two. One binary row type \(x\) has its run split by a single row obtained by changing one of its ones to zero. With two increments, the highest-degree configurations have \(d+2\) variable-length runs, each of length at least three. Two such single rows split either two row types once each or the same row type twice. Repairing the single rows restores the full ordered list of binary row types, whose adjacent columns have their first differences in increasing order. If \(p(x)\) is the number of ones in \(x\), then \(S_1=\sum_x p(x)\) counts the one-split choices and \(S_2=\sum_x p(x)^2\), with both sums over all binary row types. The two-split choices number \((S_1^2+S_2)/2\), accounting for the two ordered choices of a bit when the same row type is split twice. Varying the run lengths at fixed total height contributes \(1/d!\) per one-split configuration and \(1/(d+1)!\) per two-split configuration to the respective leading coefficients. All other configurations contribute lower-degree terms.
Authors
- Zixuan He
Institutions
- University of Glasgow (GB)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-03
- DOI
- https://doi.org/10.5281/zenodo.24798664
- Primary Topic
- Advanced Combinatorial Mathematics
- Type
- preprint