A permutation π is a merge of a permutation σ and a permutation τ , if we can color the elements of π red and blue so that the red elements have the same relative order as σ and the blue ones as τ . We consider, for fixed hereditary permutation classes C and D, the complexity of determining whether a given permutation π is a merge of an element of C with an element of D.We develop general algorithmic approaches for identifying polynomially tractable cases of merge recognition. Our tools include a version of nondeterministic logspace streaming recognizability of permutations, which we introduce, and a concept of bounded width decomposition, inspired by the work of Ahal and Rabinovich.As a consequence of the general results, we can provide nontrivial examples of tractable permutation merges involving commonly studied permutation classes, such as the class of layered permutations, the class of separable permutations, or the class of permutations avoiding a decreasing sequence of a given length.On the negative side, we obtain a general hardness result which implies, for example, that it is NP-complete to recognize the permutations that can be merged from two subpermutations avoiding the pattern 2413.
ACM Subject ClassificationMathematics of computing → Permutations and combinations, Mathematics of computing → Combinatorial algorithms, Theory of computation → Problems, reductions and completeness