Table of Contents
Fetching ...

Permutation Match Puzzles: How Young Tanvi Learned About Computational Complexity

Kshitij Gajjar, Neeldhara Misra

TL;DR

A complete characterization of solvable puzzles is provided: a puzzle admits a solution if and only if its associated constraint graph is acyclic, which translates to a simple"at most one switch"condition on the A/D labels.

Abstract

We study a family of sorting match puzzles on grids, which we call permutation match puzzles. In this puzzle, each row and column of a $n \times n$ grid is labeled with an ordering constraint -- ascending (A) or descending (D) -- and the goal is to fill the grid with the numbers 1 through $n^2$ such that each row and column respects its constraint. We provide a complete characterization of solvable puzzles: a puzzle admits a solution if and only if its associated constraint graph is acyclic, which translates to a simple "at most one switch" condition on the A/D labels. When solutions exist, we show that their count is given by a hook length formula. For unsolvable puzzles, we present an $O(n)$ algorithm to compute the minimum number of label flips required to reach a solvable configuration. Finally, we consider a generalization where rows and columns may specify arbitrary permutations rather than simple orderings, and establish that finding minimal repairs in this setting is NP-complete by a reduction from feedback arc set.

Permutation Match Puzzles: How Young Tanvi Learned About Computational Complexity

TL;DR

A complete characterization of solvable puzzles is provided: a puzzle admits a solution if and only if its associated constraint graph is acyclic, which translates to a simple"at most one switch"condition on the A/D labels.

Abstract

We study a family of sorting match puzzles on grids, which we call permutation match puzzles. In this puzzle, each row and column of a grid is labeled with an ordering constraint -- ascending (A) or descending (D) -- and the goal is to fill the grid with the numbers 1 through such that each row and column respects its constraint. We provide a complete characterization of solvable puzzles: a puzzle admits a solution if and only if its associated constraint graph is acyclic, which translates to a simple "at most one switch" condition on the A/D labels. When solutions exist, we show that their count is given by a hook length formula. For unsolvable puzzles, we present an algorithm to compute the minimum number of label flips required to reach a solvable configuration. Finally, we consider a generalization where rows and columns may specify arbitrary permutations rather than simple orderings, and establish that finding minimal repairs in this setting is NP-complete by a reduction from feedback arc set.
Paper Structure (7 sections, 8 theorems, 7 equations, 9 figures)

This paper contains 7 sections, 8 theorems, 7 equations, 9 figures.

Key Result

Corollary 5

There are sorting match puzzles of order $n$.

Figures (9)

  • Figure 1: A 3 × 3 sorting match puzzle: the physical edition that inspired this work
  • Figure 2: Examples of 3 × 3 ascending-descending grid puzzles with valid solutions.
  • Figure 3: Four examples of 3 × 3 ascending-descending grid puzzles with no solution.
  • Figure 4: Two illustrations of circular constraints in unsolvable configurations. Left: rows labeled D,A with columns A,D, creating the cycle $a < b < d < c < a$. Right: rows labeled A,D with columns D,A, creating the cycle $a < c < d < b < a$. Both cycles are impossible to satisfy with distinct values.
  • Figure 5: A generalized sorting match puzzle with row permutations $\rho_1 = \rho_2 = \rho_3 = (1,2,3)$ (all ascending) and column permutations $\gamma_1 = \gamma_3 = (1,2,3)$ (ascending) but $\gamma_2 = (2,1,3)$. Left: The constraint graph where an arrow $P \to Q$ indicates $P > Q$ (blue for rows, red for columns); arrows implied by transitivity are omitted for clarity. For column 2, the permutation $(2,1,3)$ requires: middle entry $<$ top entry $<$ bottom entry. Right: A valid solution where column 2 has $3 < 5 < 7$.
  • ...and 4 more figures

Theorems & Definitions (11)

  • Definition 1: Sorting Match Puzzles
  • Definition 2: Uniform Sorting Match puzzles
  • Definition 3: Permutation Match Puzzles
  • Corollary 5
  • Theorem 6
  • Lemma 7
  • Theorem 8
  • Theorem 9
  • Theorem 10
  • Theorem 11
  • ...and 1 more