Permutation Matching Under Parikh Budgets: Linear-Time Detection, Packing, and Disjoint Selection

MD Nazmul Alam Shanto, Md. Tanzeem Rahat, Md. Manzurul Hasan
1/14/2026
cs.DScs.CL

No confident code implementation found for this paper.

Abstract

We study permutation (jumbled/Abelian) pattern matching over a general alphabet $Σ$. Given a pattern P of length m and a text T of length n, the classical task is to decide whether T contains a length-m substring whose Parikh vector equals that of P .

Show full abstract

While this existence problem admits a linear-time sliding-window solution, many practical applications require optimization and packing variants beyond mere detection. We present a unified sliding-window framework based on maintaining the Parikh-vector difference between P and the current window of T , enabling permutation matching in O(n + σ) time and O(σ) space, where σ = |Σ|. Building on this foundation, we introduce a combinatorial-optimization variant that we call Maximum Feasible Substring under Pattern Supply (MFSP): find the longest substring S of T whose symbol counts are component-wise bounded by those of P . We show that MFSP can also be solved in O(n + σ) time via a two-pointer feasibility maintenance algorithm, providing an exact packing interpretation of P as a resource budget. Finally, we address non-overlapping occurrence selection by modeling each permutation match as an equal-length interval and proving that a greedy earliest-finishing strategy yields a maximum-cardinality set of disjoint matches, computable in linear time once all matches are enumerated. Our results provide concise, provably correct algorithms with tight bounds, and connect frequency-based string matching to packing-style optimization primitives.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{shanto2026permutation,
  title  = {Permutation Matching Under Parikh Budgets: Linear-Time Detection, Packing, and Disjoint Selection},
  author = {MD Nazmul Alam Shanto and Md. Tanzeem Rahat and Md. Manzurul Hasan},
  year   = {2026},
  eprint = {2601.09577},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.09577v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2601.09577.svg)](https://codeofpaper.com/paper/2601.09577)

Discussion