Abstract 1 Introduction 2 Preliminaries 3 Monotone patterns 4 Lower bounds for non-monotone patterns 5 Algorithms for size-3 patterns 6 Conclusion References

Permutation Patterns in Streams

Benjamin Aram Berendsohn ORCID Max Planck Institute for Informatics, Saarbrücken, Germany
Abstract

Permutation patterns and pattern avoidance are central, well-studied concepts in combinatorics and computer science. Given two permutations τ and π, the pattern matching problem (PPM) asks whether τ contains π. This problem arises in various contexts in computer science and statistics and has been studied extensively in exact-, parameterized-, approximate-, property-testing- and other formulations.

In this paper, we study pattern matching in a streaming setting, when the input τ is revealed sequentially, one element at a time. There is extensive work on the space complexity of various statistics in streams of integers. The novelty of our setting is that the input stream is a permutation, which allows inferring some information about future inputs. Our algorithms crucially take advantage of this fact, while existing lower bound techniques become difficult to apply.

We show that the complexity of the problem changes dramatically depending on the pattern π. The space requirement is:

  • Θ(klogn) for the monotone patterns π=12k, or π=k21,

  • 𝒪(nlogn) for π{312,132},

  • 𝒪(nlogn) for π{231,213},

  • Θ~π(n) for all other π.

If τ is an arbitrary sequence of integers (not necessary a permutation), we show that the complexity is Θ~π(n) in all except the first (monotone) cases.

Keywords and phrases:
permutations, pattern matching, streaming
Category:
Track A: Algorithms, Complexity and Games
Copyright and License:
[Uncaptioned image] © Benjamin Aram Berendsohn; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Permutations and combinations
; Theory of computation Streaming, sublinear and near linear time algorithms
Related Version:
Full Version: https://arxiv.org/abs/2507.11291
Acknowledgements:
Many thanks to László Kozma, who initially suggested the topic for the author’s Master’s thesis [8], and contributed many of the initial ideas. Additional thanks to Paweł Gawrychowski for suggesting the logn-factor improvement to the 312-PPM algorithm, and to Michal Opler, Marek Sokołowski, and Or Zamir for useful discussions around this topic throughout the years.
Editors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele Puppis

1 Introduction

Given a permutation τ of [n], the “text”, and a permutation π of [k], the “pattern”, we say that τ contains π if there are indices i1<<ik, such that τ(ij)<τ(i) if and only if π(j)<π(), for all j,[k], i.e., the subsequence τ(i1)τ(ik) of τ is order-isomorphic to π. Otherwise we say that τ avoids π. Note that the subsequence in question need not appear contiguously in τ.

Permutation patterns are a central concept in combinatorics, whose origins lie partly in computer science, e.g., Knuth [23] characterized stack-sortable permutations as those that avoid the pattern 231.111As common in the literature, we often use a compact notation for patterns, i.e., 231 instead of (2,3,1). For an entry point on the extensive literature on permutation patterns, we refer to textbooks [22, 10], a survey [32], and the yearly conference Permutation Patterns [1].

From an algorithmic point of view, perhaps the most natural question is permutation patterm matching (PPM). This problem asks, given τ and π, whether τ contains π. The study of the complexity of the problem was initiated by Bose, Buss, and Lubiw [13] who showed it to be NP-complete. A breakthrough result of Guillemot and Marx showed that the problem is fixed-parameter-tractable in terms of the pattern length k, i.e., can be solved in running time of the form f(k)n. This has led to the development of the concept of twin-width, with important generalizations from permutations to graphs, and to other structures [11, 12]. For larger patterns, the trivial algorithms with running time 𝒪(2n) or 𝒪(nk) have been improved to O(1.414n) [19], resp., n0.25k+o(1) [9].

The problem has also been extensively studied for various special cases, e.g., for patterns of bounded treewidth [3, 9, 21].

Until now, most studies of the PPM problem assumed that we can, on demand, access arbitrary elements of the input permutation. Given the inherently sequential nature of the problem and the possibility of extremely large inputs, it is natural to assume that the elements of the permutation arrive one-by-one, and that the algorithm cannot revisit earlier elements (unless explicitly storing them).

This is known as the streaming model, and we initiate the study of the PPM problem in this model. As typical in streaming, the task is to solve PPM with as little space as possible (running time is a secondary concern). In this paper, we study deterministic algorithms for the streaming version of PPM. We show that Θ~π(n) bits of space222𝒪~, Θ~, and Ω~ hide polylogarithmic factors, and the subscript π hides constant factors depending on π. are required for almost all patterns π. The only exception are monotone patterns, where Θ(klogn) bits of space suffice (using the textbook algorithm for longest increasing subsequence), and non-monotone patterns of size three (312, 132, 213, and 231), where we show that the space complexity lies between Ω(logn) and 𝒪~(n).

The definition of pattern containment easily extends to the case where τ is an arbitrary sequence of distinct comparable elements (typically, integers). In many settings, this makes no difference, since the elements of τ can be reduced to an order-isomorphic permutation of [n] by sorting them using Θ(nlogn) time and space. In the streaming setting, it turns out that even this moderate relaxation has a large effect. We show that PPM requires Ω(n) bits of space even for non-monotone patterns of size three, when the input τ is a sequence of distinct integers from [n]. Contrast this with the 𝒪~(n) upper bound when τ is a permutation of [n].

This stark separation between the two models can be explained by the fact that when the elements of τ are known to be exactly [n], both the presence and the non-presence of a value at a certain location in the stream gives us some information. Our 𝒪~(n)-space algorithms crucially exploit this idea. On the other hand, proving lower bounds in this model is hard: Reductions from standard communication complexity problems are complicated by the fact that each half of the input is strongly correlated with the other half. We overcome this problem for non-monotone patterns of size at least four with several individual reductions, but we were not able to prove any non-trivial lower bound for any of the patterns 312, 132, 213, 231, and we leave this as an intriguing open question.

We now review some related work on algorithmic problems tied to permutation patterns. Then, we state our results formally.

Related work.

The sequence variant of PPM has been considered in the non-deterministic model by Jelínek, Opler, and Valtr [21], who applied it to the problem of recognizing merges of permutations.

Another important recent line of work that is close to ours studies PPM in a property-testing framework. Here, the input sequence is assumed to either avoid the pattern π, or be ε-far from avoiding π, i.e., differ in εn elements from any π-avoiding sequence. The task is to solve PPM by querying only a sublinear number of elements (with random access). Both adaptive and nonadaptive variants have been studied [27, 5, 6, 28, 34], and other distance models were also considered [17]. The special case of π=21 is also known as monotonicity testing (see, e.g., Fischer [16]).

Another, more difficult problem related to PPM is pattern counting, where the number of occurrences of π in τ must be determined. In the usual non-streaming setting, fixed-parameter tractability, or even a runtime of the form no(k/logk) would contradict standard complexity assumptions [20, 9] but the above exponential runtimes for PPM largely transfer.

Counting smaller concrete patterns is important in non-parametric statistics: Even-Zohar and Leng [15] observed that Kendall’s τ, Spearman’s ρ, the Bergsma–Dassios–Yanagimoto test, and Hoeffding’s independence test can be inferred from counting patterns of size 2, 3, 4, and 5, respectively. Accordingly, counting concrete small patterns has been the subject of study in both the exact and approximate sense [15, 14, 7].

Counting the simplest possible pattern π=21 yields the number of inversions, a natural measure of sortedness of a sequence. In the streaming setting, counting 21 already requires Ω(n) space [4], even when the input sequence is a permutation.

Our results.

Let us repeat the definition of the two problems we study in this paper (we define the model formally in Section 2.1). The first problem, called π-PPMn, consists of determining whether the pattern π is contained in an input permutation τ on [n] that arrives one value at the time. We treat this as a non-uniform problem, that is, an algorithm may hard-code the input size n. This makes our lower bounds stronger and simplifies our algorithms somewhat.

The second problem, π-SequencePPMn is similar, except the input now is a sequence of at most n distinct values out of [n]. Our lower bounds still work when the input size mn is known to the algorithm, though we do not study all possible combinations of parameters m,n.

Note that we can store the whole input using 𝒪(nlogn) bits, which is therefore a trivial upper bound for the space complexity. It is also not hard to show the following weak lower bound (Section 4).

Theorem 1.1.

The space complexity of π-PPMn and π-SequencePPMn for a pattern π of length at least two is Ω(logn) bits.

We now present our main results. For monotone patterns, a simple modification of the standard longest increasing subsequence algorithm allows us to solve both problems with 𝒪(klogn) bits of space, and we prove that this is tight up to a constant independent of k.

Theorem 1.2.

The space complexity of the problems π-PPMn and π-SequencePPMn for each monotone pattern π of length k2 is Θ(klogn) bits if n>k2.

We prove Theorem 1.2 in Section 3. For non-monotone patterns, both problems are hard in almost all cases (Section 4). For SequencePPM, we give a short proof using our machinery.333Jelínek, Opler, and Valtr [21] gave another proof based on a preliminary version of this paper.

Theorem 1.3.

The space complexity of π-SequencePPMn for each non-monotone pattern π is Ωπ(n) bits.

Hardness of PPM (for almost all patterns) is one of our main new results, and significantly harder to prove.

Theorem 1.4.

The space complexity of π-PPMn for each non-monotone pattern π of length at least four is Ωπ(n) bits.

Finally, we show that π-PPMn can be solved using sublinear space for non-monotone patterns of size three, which implies a separation between SequencePPM and PPM (Section 5).

Theorem 1.5.

The space complexity of π-PPMn is

  • 𝒪(nlogn) bits if π{312,132}, and

  • 𝒪(nlogn) bits if π{231,213}.

Note that all bounds are tight up to a 𝒪(logn) factor, except Theorem 1.5, where a Θ~(n) gap remains. Our lower bounds in Theorems 1.3 and 1.4 extend to a multi-pass variant: When the algorithm can take p passes over the input, we obtain lower bounds of Ω(n/p) bits in both cases. Moreover, Theorems 1.3 and 1.4 hold even when randomized or nondeterministic streaming algorithms are allowed (cf. Jelínek, Opler, Valtr [21]).

We conclude the paper with some open questions (Section 6).

2 Preliminaries

We start with some basic notation around sequences and permutations. Let σ be a sequence. We write |σ| for the length of the sequence, and Val(σ) for the set of values occurring in σ. For an integer k with 1k|σ|, we let σ(k) denote the k-the element of σ. If σ,τ are sequences, then στ denotes their concatenation. Sequences are usually written as concatenations of characters x1x2, but also sometimes as tuples (x1,x2,) when needed for clarity.

A sequence π is a permutation of [n] if each element of [n] occurs exactly once. A permutation pattern π is contained in an integer sequence τ if τ has a subsequence σ that is order-isomorphic to π. Formally, π and σ are order-isomorphic if |π|=k=|σ| and π(i)<π(j)σ(i)<σ(j) for all i,j[k]. We sometimes call σ an occurrence of π in τ. An occurrence of 12 is called an increasing pair, and an occurrence of 21 is called a decreasing pair.

2.1 Streaming problems

A streaming problem (Σ,D,P) consists of an alphabet Σ (the set of possible elements appearing in the stream), a finite domain DΣ (the set of possible input streams) and a set PD of YES-instances.

Let Sn denote the set of permutations of [n] and let SnSn denote the set of sequences with pairwise distinct elements of [n]. Let

π-PPMn=([n],Sn,{τSnτ contains π}); and
π-SequencePPMn=([n],Sn,{τSnτ contains π}).

We formally model a streaming algorithm 𝔸 for the problem (Σ,D,P) as a state machine 𝔸=(Q,q0,F,t), where Q is the set of states, q0Q is the initial state, FQ is the set of accepting states, and t:Q×ΣQ is the transition function. Running the streaming algorithm on an input τ=x1x2xnD means computing q1=t(q0,x1), then q2=t(q1,x2), and so on.

The algorithm is correct if for each input τD, the final state q satisfies qF if and only if τP. Note that the algorithm may behave arbitrarily if τD. The space usage of 𝔸 is log|Q|, i.e., the number of bits required to encode its states.

Observe that this definition allows for arbitrary computation, and is only restricted by space usage between two input elements. Our lower bounds in this model thus hold for a wide range of computational models. On the other hand, the algorithms in Sections 3 and 5 can be implemented in the standard Word-RAM model444Space usage is still measured in bits, not in words., and run in polynomial time.

Most of our lower bounds also hold for algorithms that make multiple passes. Formally, a k-pass streaming algorithm receives k copies of τ in sequence (instead of only one), and has to decide τP only after receiving all of them.

2.2 Communication complexity

To prove our lower bounds, we will use tools from Communication Complexity [33, 26, 25, 29]. We now give some necessary background.

Let A and B be finite sets, and let QA×B. Suppose we have two players, Alice, who knows some aA, and Bob, who knows some bB. Alice and Bob each want to decide whether (a,b)Q. We are interested in how much information they have to send to each other to determine whether (a,b)Q. On the other hand, we do not care how much time they need, and assume both may compute arbitrary functions. The minimal number of bits Alice and Bob have to exchange in the worst case is called the deterministic communication complexity of Q, and denoted by DCC(Q). For more details, we refer to the textbook by Kushilevitz and Nisan [25].

The concrete problem we consider is called disjointness. Here, Alice and Bob each receive a set S,T[n], and need to determine whether S and T are disjoint. Formally, let A=B=2[n], and let Disjn={(S,T)A×BST=}.

Theorem 2.1 (Kushilevitz and Nisan [25, Example 1.21]).

DCC(Disjn)=n+1.

The randomized (and even nondeterministic) communication complexity of Disjn is also known to be at least n [25]. This is the reason that most of our lower bounds extend to these models; we omit further details.

Let (Σ,D,P) be a streaming problem and QA×B be a two-party communication complexity problem. We say P is k-Q-hard if there exists functions f1,f2,,fk:AΣ and g1,g2,,gk:BΣ such that, for each input (a,b)A×B, the sequence

σ=f1(a)g1(b)f2(a)g(b)fk(a)gk(b)

is contained in D and we have σP if and only if (a,b)Q.

Lemma 2.2.

If a streaming problem is k-Q-hard, then every algorithm solving it with p+ passes requires at least DCC(Q)/(2kp) bits of space.

Proof.

Let 𝔸 be a correct algorithm with p passes. We construct a communication complexity protocol for Q as follows. Recall that Alice receives aA and Bob receives bB. Alice initializes 𝔸, runs it on f1(a), and passes the internal state of the algorithm to Bob. Bob continues running the algorithm on g1(b), and passes the resulting state to Alice. Alice and Bob continue this until they have cycled through the functions f1,f2,,fk and g1,g2,,gk p times. After that, 𝔸 outputs (a,b)Q by definition, so both Alice and Bob know the result.

Suppose 𝔸 requires s bits of space. Then at most s bits are sent in every step. Since there are 2kp steps, the total number of exchanged bits is 2kps. By definition of the deterministic communication complexity, we have 2kpsDCC(Q), which implies the statement.

2.3 Complement and reverse

We now show some basic facts about how our two problems behave under taking the complement or reverse of the pattern. If π is a sequence of distinct values in [n], the complement πc of π is obtained by replacing each value i by n+1i.

Lemma 2.3.

Let π be a permutation. Then, for each n+, the space complexities of π-PPMn and πc-PPMn are equal, and the space complexities of π-SequencePPMn and πc-SequencePPMn are equal.

Proof.

We can easily compute the complement of the input sequence by complementing each individual value. Thus, an algorithm that finds π in an input τ can be made to find π in τc, which is equivalent to finding πc in τ.

Note that equality in Lemma 2.3 holds in our model (Section 2.1). If we measure space usage while processing a single input element, we may incur an 𝒪(logn) overhead needed to compute the complement, depending on the exact model. However, an additive 𝒪(logn) term does not matter for any of our results.

We do not know whether an analog of Lemma 2.3 holds for taking the reverse of a permutation. However, our main lower bound technique, using communication complexity, is easily seen to be invariant under taking the reverse:

Observation 2.4.

Let π be a permutation and let ρ be the reverse of π. If π-PPMn is k-Q-hard for some communication complexity problem Q, then ρ-PPMn is also k-Q-hard.

3 Monotone patterns

In this section, we discuss the complexity of π-PPMn and π-SequencePPMn when π is an increasing pattern 12k. The same results hold for decreasing patterns k(k1)1, by Lemma 2.3.

To prove the upper bound, we use the well-known longest increasing subsequence algorithm [31, 24, 18] with an early stopping condition. Suppose we want to detect the increasing pattern of length k. The algorithm works as follows: For each i[k], maintain the smallest value xi seen so far that is the last value in an increasing subsequence of length exactly i. Let xi= as long as no such element exists. Updating each xi when a new value y arrives is simple: For each i[k], if xi<y and y<xi+1 or xi+1=, set xi+1y. Accept as soon as xk. Since the algorithm stores at most k input values at any time, we have:

Lemma 3.1.

If π is a monotone permutation of length k, then π-SequencePPMn (and thus π-PPMn) can be solved with klogn bits of space.

We now show a tight lower bound for all k4 that holds even if the input is a permutation.

Lemma 3.2.

If π is the increasing or decreasing permutation of length k4, then solving the π-PPMn problem requires Ω(klogn) bits of space if n>k2.

Proof.

We give a direct communication complexity proof. Assume π is increaseing, n is even, and nk2. Let Alice have the first half of the input permutation, which will consist of the odd integers in [n], and let Bob have the latter half, containing the even integers of [n]. We will construct a set of 2Ω(klogn) possible inputs for Alice such that Bob must be able to distinguish between any two of them. This means that Alice has to send Ω(klogn) bits of information, implying the stated lower bound.

Let ρ=r1r2rk2[n]k2 be an increasing sequence of odd integers with r1=1. Observe that there are

(n/21k3)(nk)Ω(k)(n)Ω(k)=2Ω(klogn)

such sequences. We claim that we can construct a permutation α for Alice so that ρ describes the state of the algorithm given at the start of the section; that is, we have that ri is the lowest value that is the last element of an increasing sequence of length i. Indeed, let α start with a decreasing sequence of all odd integers not contained in ρ, and end with ρ.

Figure 1: Constructions α1β (left) and α2β (right) for Lemma 3.2 with k=6, n=20, ρ=(1,5,7,13), and σ=(1,5,9,11). Observe that α1β contains an increasing subsequence of length 6 (marked in blue), but α2β does not.

Now let α1,α2 be constructed in this way from distinct integer sequences ρ=r1r2rk1 and σ=s1s2sk1. We show that there exists a permutation β of the even values in [n] so that out of α1β and α2β, exactly one contains π. That means that Bob, when given β, must be able to distinguish between α1 and α2, as desired. (See Figure 1.)

Let i[k1] be minimal such that risi, and assume ri<si without loss of generality. Let now β=β1β2β3 be the following sequence. Start with the decreasing subsequence β1=(n,n2,,ri+2(ki)+1), continue with increasing β2=(ri+1,ri+3,,ri+2(ki)1) and finish with β3=(ri1,ri3,,2). Observe that α1β contains an increasing subsequence of length k. Indeed, recall that ri is the last element of an increasing subsequence of length i, which can be concatenated with β2 to obtain one of length k.

We finish the proof by arguing that α2β does not contain a increasing subsequence of length k. Suppose for the sake of contradiction that such a subsequence γ=γ1γ2 exists, with γ1 being part of α2 and γ2 being part of β. Write j=|γ1|, so kj=|γ2|. The longest increasing subsequence in β has length ki, implying ji. Further, since the longest increasing subsequence in α2 has length k2, we have kj2.

Note that γ1 ends with a value at least sjsi+2(ji)>ri+1+2(ji), and γ2 starts with a value at most ri+2(ji+1)1<sj, which means γ1γ2 is not increasing, a contradiction.

For patterns of smaller size k3, we can still show a Ω(logn)=Ω(klogn) bound. Note that this is easy for π-SequencePPMn, even if π=12 and the input sequence consists of only two values x,y: By a simple adversarial argument, a correct algorithm must be able to distinguish between any two odd values for x. For π-PPM, the proof is a little more involved.

Lemma 3.3.

Solving the π-PPMn problem for monotone π of length at least 2 requires Ω(logn) space.

Proof.

Set π=21 for now. Let 𝔸 be a streaming algorithm 𝔸 for PPMn with m states. In the following, we show that m>n4, implying that logn2 bits of space are necessary.

Let Q=(q0,q1,,qn) be the sequence of states 𝔸 takes when the input is the increasing permutation 12n. Observe that states may repeat. However, we claim that pairs of consecutive states must be pairwise distinct. Indeed, suppose we have qi1=qj1 and qi=qj for two distinct i,j[n]. Then swapping i and j in the input will not change the behavior of 𝔸, even though the sequence is no longer monotone.

Our claim in particular implies that a state cannot be repeated three times consecutively. However, a state may appear twice consecutively. Construct a new state sequence Q by deleting one element from each of these consecutive appearances. We clearly have |Q|12|Q|=n+12. moreover, Q is a so-called Davenport-Schinzel sequence of order two [2]. It is well known that if such a sequence consists of m distinct symbols (corresponding to states here), then its length is at most 2m1. Thus, we have n+122m1, implying that m>n4, as desired.

The case π=321 reduces to 21 by simply adding the value n+1 at the start. The cases π{12,123} are symmetric.

Overall, since π-PPM cannot be harder than π-SequencePPM, we have: See 1.2

4 Lower bounds for non-monotone patterns

In this section, we prove Theorems 1.1, 1.4, and 1.3. We first prove a useful reduction, essentially showing that appending or prepending a value to the pattern cannot only make our pattern matching problems (much) easier.

Lemma 4.1.

Let π be a pattern of length k1 and let π be a pattern of length k+1 such that π=σx or π=xσ for some x[n] and a sequence σ that is order-isomorphic to π.

Fix a number p+ of passes. Suppose that π-SequencePPMn (π-PPMn) can be solved with f(n) bits of space and p passes for every n. Then, π-SequencePPMn (π-PPMn) can be solved with f(2n)+𝒪(logn) bits of space and p passes for every n.

Proof.

Let π=σx; the other case is similar. Take an algorithm 𝔸 that solves π-PPM2n with f(2n) bits of space. We now give an algorithm for π-PPMn. Without loss of generality, assume that π(k1)>π(k).

Let τ be the input. Compute τ by first taking every value in τ, in order, and doubling it; and then append the sequence 1,3,5,,2n1. Observe that τ is a permutation on [2n] and can be constructed one value at the time as τ arrives, using 𝒪(logn) space. The algorithm for π-PPMn consists of feeding τ into 𝔸. The algorithm clearly requires f(2n)+𝒪(logn) space. We now show correctness.

If τ contains π, then clearly τ also contains π. On the other hand, if τ contains π, then either the occurrence of π is within the first n elements of τ (which implies τ contains π, and thus π), or, since π(k1)>π(k), only the last element of π is mapped to the second half of τ (which implies that τ contains π). Thus, our algorithm is correct.

The proof for SequencePPM is essentially the same.

It seems likely that the space complexity of π-SequencePPMn and π-PPMn is, in fact, monotone under taking sub-patterns (say, for large enough n); however, this seems more difficult to prove and is not needed to show our bounds.

Combining Lemma 4.1 with Lemma 3.3 already yields a Ω(logn) bound for every pattern π, thus proving Theorem 1.1. We now move on to the lower bound for SequencePPM.

Theorem 1.3. [Restated, see original statement.]

The space complexity of π-SequencePPMn for each non-monotone pattern π is Ωπ(n) bits.

By Lemma 4.1, it suffices to show a lower bound for non-monotone patterns of length 3. We show the stronger lower bound in the multi-pass model, as mentioned in the introduction.

Figure 2: Construction of τ=f1(S)g1(S) for Lemma 4.2 with S={1,3,5,6} and T={2,3,5}.
Lemma 4.2.

The space complexity of π-SequencePPMn with p passes is Ω(n/p) bits for each non-monotone pattern π of length three.

Proof.

We show that 312-SequencePPM3n is 1-Disjn hard, which suffices to prove our claim by Lemmas 2.2, 2.3, and 2.4. Let (S,T) be an input for Disjn. Construct the sequence f1(S) as follows (see Figure 2). For each iS, in ascending order, add the values 3i,3i2. Further, construct the sequence g1(T) by adding 3i1 for each iT, in descending order. We now show that τ=f1(S)g1(T) contains 312 if and only if there is some iST.

First suppose that iST; then τ contains the subsequence 3i,3i2,3i1, which is an occurrence of 312. Second, suppose τ contains an occurrence (a,b,c) of 312. Since g1(T) is descending, we cannot have b,cg1(T), implying a,bf1(S). Since a>b, and all descending pairs in f1(S) are of the form (3i,3i2), we have a=3i and b=3i2 for some i[n], implying iS. Now we must have c=3i1, which implies that iT, and we are done.

We now formally prove the following, which includes Theorem 1.3 as the special case p=1.

Theorem 4.3.

The space complexity of π-SequencePPMn with p passes for each non-monotone pattern π is Ωπ(n/plogn) bits.

Proof.

Observe that for each non-monotone pattern π of length at least four, we can remove either the first or last element and the pattern stays non-monotone. Thus, every pattern π of length k3 can be reduced to a non-monotone pattern ρ of length 3 in k3 such steps. By Lemma 4.1, if π-SequencePPMn can be solved with f(n) space and p passes, then ρ-SequencePPMn can be solved with f(2k3n)+𝒪k(logn) space and p passes. Our claim thus follows from Lemma 4.2.

4.1 Disj-hardness of PPM

In this section, we show that for each non-monotone pattern π of size four, π-PPMm is 2-Disjn-hard for some m𝒪(n). By Lemma 2.2, this implies the Ω(n/p) lower bound for these patterns (with p passes), and, as in the last section, we obtain the following, which includes Theorem 1.4 as a special case:

Theorem 4.4.

The space complexity of π-PPMn with p passes for each non-monotone pattern π of length at least four is Ωπ(n/p) bits.

We show Disjn-hardness for the concrete patterns 4231, 4213, 4132, 4123, 4312, 3142, and 2143. By Lemmas 2.3 and 2.4, this covers all other non-monotone patterns of length four as well.

Lemma 4.5.

Let π{4231,4213,4132,4123}. Then π-PPMm is 1-Disjn-hard for each n and m=4n.

Proof.

Figure 3 shows examples of our construction. Let S,T[n]. We define f1(S)=(a1,a2,,a2n), where for i[n],

(a2i1,2i)={(4(i1)+π(1),4(i1)+π(2)), if iS,(4(i1)+π(2),4(i1)+π(1)), otherwise.

For i[n], let d(i)=i if π=4231, and let d(i)=n+1i otherwise. Note that always d(d(i))=i. We define g1(T)=(b1,b2,,bn), where for i[n],

(b2i1,b2i)={(4(d(i)1)+π(3),4(d(i)1)+π(4)), if d(i)T,(4(d(i)1)+π(4),4(d(i)1)+π(3)), otherwise.

Observe that the sequence τ=f1(S)g1(T) contains each value in [4n] exactly once, i.e. τ is a 4n-permutation. We need to prove that τ contains π if and only if ST. Suppose there is some iST. As d(d(i))=iT, the sequence

(a2i1,a2i,b2d(i)1,b2d(i))=(4(i1)+π(1),(4(i1)+π(2),(4(i1)+π(3),(4(i1)+π(4))

is a subsequence of τ, implying that τ contains π.

Figure 3: Construction of τ=f1(S)g1(S) for π=4231 (left) and for π=4132 (right) with n=4, S={1,3} and T={2,3}.

Now suppose τ contains π, so there are indices i1<i2<i3<i4 such that the subsequence τ(i1)τ(i2)τ(i3)τ(i4) is order-isomorphic to π. We need to show that ST.

We first show that i3>2n, i.e., τ(i3) appears in g1(T). Suppose that is not the case. Then, by definition of f1(S), there is at most one index i<i3 such that τ(i)>τ(i3), namely i=i31. As π(1)>π(3), this implies i1=i1, so i1=i1<i2<i3=i, a contradiction.

Second, we show that i22n. Assume this is not the case and π=4231. As d(i)=i, there is at most one index i>i2 with τ(i)<τ(i2), namely i=i2+1. As above, this is a contradiction. In the case that π4231, we have π(2)<π(4) and d(i) is decreasing, which similarly implies a contradiction.

We now have i1<i22n<i3<i4. As π(1)>π(2), we know that τ(i1)>τ(i2). This means i1=2i1 and i2=2i for some iS, as f1(S) contains no other decreasing pairs. Consequently, we have τ(ij)=4(i1)+π(j) for j[1,2].

To conclude the proof, we show that τ(ij)=4(i1)+π(j) for j[3,4], which implies iT and thus iST. We distinguish three cases.

  • Let π=4231. We have π(2)<π(3)<π(1), thus

    4(i1)+2=τ(i2)<τ(i3)<τ(i1)=4(i1)+4,

    implying that indeed τ(i3)=4(i1)+3. Now τ(i3),τ(i4) must be a decreasing pair, which leaves only 4(i1)+1 as a possible value for τ(i4), since d(i) is increasing.

  • Let π=4213. By a similar argument as above, π(2)<π(4)<π(1) implies that τ(i4)=4(i1)+3. Now τ(i3),τ(i4) must be an increasing pair, and d(i) is decreasing, so τ(i3)=4(i1)+1.

  • Finally, let π{4132,4123}. Now π(2)<π(3)<π(1) and π(2)<π(4)<π(1), so τ(i3),τ(i4){τ(i4)=4(i1)+π(3),τ(i4)=4(i1)+π(4)}={b2i1,b2i}. Since i3<i4, we have i3=2i1 and i4=2i, implying iT.

Figure 4: Construction of τ=f1(S)g1(S)f2(T) for π=4312 (left) and for π=3142 (right) with n=4, S={1,3} and T={2,3}.
Lemma 4.6.

4312-PPMm is 2-Disjn-hard for all n and m=3n+1.

Proof.

Figure 4 (left) shows an example of the construction. Let S,T[n]. Let f1(S) consist of the values 3(i1)+2 for iS in ascending order, and the value 3n+1 at the end. Let g1(T)=b1b2,b2n, where

(b2i1,b2i)={(3(i1)+3,3(i1)+1), if iT,(3(i1)+1,3(i1)+3), otherwise.

Finally, let f2(S) contain the values 3(i1)+2 for iS, in descending order, and let g2(T) be empty. The sequence τ=f1(S)g1(T)f2(S) is clearly a (3n+1)-permutation. We claim that τ contains 4231 if and only if ST.

Suppose iST. Then b2i1=3(i1)+3, b2i=3(i1)+1 and the value 3(i1)+2 occurs in f2(S). The value 3n+1 always occurs in f1(S). These four values together form an occurrence of 4312 in τ.

Now suppose 4312 occurs in τ, so there are indices i1<i2<i3<i4 such that the subsequence τ(i1)τ(i2)τ(i3)τ(i4) is order-isomorphic to 4312. Let k1=|f1(S)| and k2=|g1(T)|. First, as f1(S) is increasing and f2(S) is decreasing, we know k1<i2 and i3k1+k2. Second, we claim that i1k1. Assume this is not the case. Then k1<i1<i2<i3<k2, so the decreasing sequence τ(i1)τ(i2)τ(i3) is a subsequence of g1(T). However, g1(S) does not contain 321, a contradiction. Third, k1+k2<i4, as g1(T) does not contain the pattern 312. In conclusion, we have i1k1<i2<i3k1+k2<i4.

By definition of g1(T) and using τ(i2)>τ(i3), we know that there is some iT such that τ(i2)=3(i1)+3 and τ(i3)=3(i1)+1. Thus τ(i4)=3(i1)+2. This value occurring in f2(S) implies that iS.

Lemma 4.7.

3142-PPMm and 2143-PPMm are 2-Disjn-hard for all n and m=4n.

Proof.

Figure 4 (right) shows an example of the construction. Let S,T[n]. Let f1(S)=a1a2an and f2(S)=c1c2cn, where for i[n],

ai={4(i1)+π(1), if iS,4(i1)+π(4), otherwise.
ci={4(i1)+π(4), if iS,4(i1)+π(1), otherwise.

Let g1(S)=b1b2b2n where for i[n],

(b2i1,b2i)={(4(ni)+1,4(ni)+4), if iT,(4(ni)+4,4(ni)+1), otherwise.

Let g2(T) be empty. The sequence τ=f1(S)g1(T)f2(S) is clearly a 4n-permutation. We show that τ contains π if and only if ST.

First, suppose there is some iST. Then (ai,b2i1,b2i,ci) is an occurrence of π in τ.

Now suppose τ contains π, so there are indices i1<i2<i3<i4 such that the subsequence τ(i1)τ(i2)τ(i3)τ(i4) is order-isomorphic to π. Both f1(S) and f2(S) are increasing. As π(1)>π(2) and π(3)>π(4), we have n<i2i33n. Moreover, since π(2)<π(3), we know that (i2,i3)=(n+2i1,n+2i) for some iT, as there are no other increasing pairs in g1(T). This means τ(i2)=4(i1)+1 and τ(i3)=4(i1)+4. Now, as π(1) and π(4) are between π(2)=1 ad π(3)=4, we have τ(i1)=4(i1)+π(1) and τ(i4)=4(i1)+π(4), which is only possible if iS.

5 Algorithms for size-3 patterns

In this section, we show that the complexity of π-PPMn is 𝒪~(n) if π{312,132,231,213}. See 1.5

We give an algorithm for 312 (which also holds for 132 by Lemma 2.3) in Section 5.1, and a different algorithm for 231 (which also holds for 213) in Section 5.2. Besides the 𝒪(logn) gap in space complexity, there is another interesting difference. The algorithm for 312 actually finds and reports the three values of the occurrence of 312, if any. On the other hand, the algorithm for 231 may not be able to report all values, and instead only reports whether an occurrence exists or not.

5.1 An algorithm for 312-PPM

In this section, we give a 𝒪(nlogn)-space algorithm for 312-PPMn. Let m=nlogn. Throughout the algorithm, we maintain the following data.

  • The highest value h[n] encountered so far.

  • A set D of value pairs (a,b) with a>b, each representing a decreasing pair encountered before.

  • A set A with all values in {hm+1,hm+2,,h} encountered so far.

At the start, we read the first value v and set h=v, D, and A={v}. Algorithm 1 shows pseudocode for one step of the algorithm, were we read a value v and either update our data structures or report an occurrence of the pattern 312.

Algorithm 1 One step of the 312-detection algorithm.

We now show that the following invariants hold until the algorithm stops. Let τ be the input permutation, and let σ be the prefix of τ read so far.

  1. (i)

    h is the highest value in σ.

  2. (ii)

    A=Val(σ)[hm].

  3. (iii)

    For each decreasing pair (a,b) in σ with a>b>hm, there is no value c in τ such that a,b,c is an occurrence of 312 in τ.

  4. (iv)

    For each (a,b)D, we have abm, and (a,b) is a decreasing pair in σ.

  5. (v)

    For each (a,b),(a,b)D, we have [b,a][b,a]=.

  6. (vi)

    For each occurrence a,b,c of 312 in τ, where a and b occur in σ, there is a pair (a,b)D such that aa>bb.

Lemma 5.1.

The above invariants are true at the start and after every step of the algorithm, except after a step where the algorithm reports an occurrence of 312.

Proof.

At the beginning, after reading the first value v and setting h=v, D, and A={v}, all invariants trivially hold.

Now consider a step of the algorithm. Let σ be the sequence read before the step, h,A,D be the stored data before the step, let v be the value read in the step, let σ=σv, and let h,A,D be the stored data after the step. We assume all invariants hold for h,A,D, and the algorithm does not report an occurrence of 312 in the step.

(i).

Clearly, h is updated correctly by line 7.

(ii).

If v>h, then h=v and lines 5 and 6 set A={v}(A[vk])=Val(σ)[hk].

If vh, then h=h, and line 12 ensures that the invariant continues to hold.

(iii).

Suppose there is an occurrence a,b,c of 312 in τ such that a>b>hk and a, b are in σ. If a,b are already in σ, then (iii) was violated previously, since a>b>hkhk, a contradiction. Thus, we have b=v.

Since ha>b>hk=hk, the condition in line 8 is true. Since (ii) holds in the previous step, we have aA. We also clearly have cA, and since a>c>b, the algorithm reports a occurrence of 312, a contradiction.

(iv).

The only time a new pair is inserted into D is when (h,v) is inserted in line 15. Here, we have hv+k, and h must have occurred in σ (and thus before v in τ) since (i) holds for h.

(v).

Say we insert (h,v) in line 15 and let (a,b)D with [b,a][v,h]. Since ah, this implies a>v. If b<v, then we would have stopped already in line 3. If b>v, then (a,b) is removed in line 14.

(vi).

​Let a,b,c be an occurrence of 312 in τ such that a,b are in σ. Define 𝒟=(a,b)D[b,a], and 𝒟=(a,b)D[b,a]. By (v), it suffices to show that [b,a]𝒟.

First note that 𝒟𝒟, since if we remove a pair (a,b) from D in line 14, then we have ha>b>v and (h,v)D.

If bv, then a,b is in σ and [b,a]𝒟𝒟 since (vi) holds in the previous step.

Now suppose b=v. Note that ha>v. If v>hk, then also a>hk, so aA and cA by (ii), and we report an occurrence of 312 in line 10 (so we do not need to maintain the invariants after this step). If vhk, then 𝒟=𝒟[b,h][b,a].

Space usage.

We now show that the algorithm requires 𝒪(nlogn) bits of space. Clearly, storing h requires 𝒪(logn) space. We can store A as a bit-array of size k, using 𝒪(k) space. By (v), there are at most n/k pairs in D, so D requires 𝒪(nklogn) bits of space. The total space is thus 𝒪(k+nklogn)=𝒪(nlogn).

Correctness.

We show that if the algorithm reports an occurrence, then τ contains the pattern 312. Let σ be the prefix of τ read so far, and let v be the value currently read. First, suppose the algorithm reports an occurrence (a,b,v) in line 3. By (iv), (a,b) is a decreasing pair in σ, and we have a>v>b from line 2. Thus, a,b,v is an occurrence of 312 in τ.

Second, suppose the algorithm reports an occurrence (a,v,c) in line 10. By (ii), we know that a occurs in σ, and c does not occur in σ. That means that c must occur in τ somewhere after v, implying that a,v,c is an occurrence of 312 in τ.

Completeness.

We now show that if τ contains the pattern 312, then the algorithm reports an occurrence. Let a,b,c be the values of an occurrence of 312 in τ. Consider the step where c is read, and suppose no occurrence of 312 was found yet. Let h,A,D be the stored data at the beginning of the step. By invariant (vi), there is a pair (a,b)D such that aa>c>bb. Then the algorithm reports the occurrence (a,b,c) in line 3.

5.2 An algorithm for 213-PPM

We now give a 𝒪(nlogn)-space algorithm for 231-PPMn. Note that this algorithm needs a factor of 𝒪(logn) more space than the algorithm from Section 5.1, and it does not return an occurrence when it accepts.

Let τ be the input permutation, and n=|τ|. In the following, we assume that instead of receiving a value v, we receive a point (i,v)[n]2, where i is the index of x in τ. This can be easily simulated by keeping a counter of the number of elements read so far, with 𝒪(logn) additive space overhead. When p=(i,v), we write p.x=i and p.y=v. Let S be the set of all points induced by τ this way.

Algorithm.

We partition the input into at most n contiguous subsequences of size at most n. We call these subsequences strips, and denote the set of points of the i-th strip by Si. We always store all points in the current strip at once, as well as some 𝒪(logn)-bit data about each of the previous strips. We consider four different types of occurrences of 213, each differing by how the three points are distributed over one or more strips. The algorithm has four parts that run in parallel, each of which detects one specific type of occurrence.

  1. (1)

    When we finished reading a strip Si, we first search for 213 in Si by brute force. This finds all occurrences within a any single strip.

  2. (2)

    To find occurrences (p,q,r) of 213 where p,qSi and rSi, we maintain a single value L[n], initially set to n. After we finished reading Si, we find the lowest point pSi such that p,q are a decreasing pair for some qSi, i.e. p.x<q.x and q.y<p.y. If there is such a p and p.y<L, we update Lp.y. Whenever we read a point p, if p.y>L, we accept immediately.

  3. (3)

    To find occurrences (p,q,r) with q,rSi for some i, we use a more sophisticated technique. We will need to store two points i,hi[n]2{} and a counter ki{0,1,,hii1} for each strip Si.

    Suppose we just finished reading Si. We first define (but do not store) the set Ii of increasing pairs in Si where some point in a different strip lies vertically between the two points. Formally:

    Ii={(p,q)Si2p.x<q.x,rSSi:p.y<r.y<q.y},

    Observe that we can check if (p,q)Ii using only Si, as we know exactly which values occur in Si, and, therefore, which occur in the other strips. We can also enumerate the pairs in Ii one-by-one using 𝒪(logn) additional space.

    If Ii=, we set i=hi=ki= and are done with this strip. Otherwise, we set i to be the lowest point such that there is a pair (i,q)Ii and set hi to be the highest point such that there is a pair (p,hi)Ii. We initialize ki to be the number of points pSi where i.y<p.y<hi.y. From now on, whenever we read a point p with i.y<p.y<hi.y in a later strip, we increment ki by one. Finally, after reading the whole input, we accept if ki<hii1 (recall that we do this for each i[n]).

  4. (4)

    Finally, we consider occurrences where all three points are in different strips. We use a “counter” technique similar to (3). After reading Si, we compute the lowest point i. Then, we initialize hi to be the highest point in Si to the right of i and initialize the counter ki to be the number points in Si above and to the right of i. In subsequent strips, whenever we read a point p with i.y<p.y, we increment ki by one. Then, if hi.y<p.y, we set hip. Finally, after reading the whole input, we accept if ki<hi.yi.y.

If, at the end of the input, we have not accepted yet due to (1-4), we reject.

Space complexity.

For each strip Si, we need to store the points i, hi, i and hi and the values ki,ki[n]. Additionally, we store L[n] and the 𝒪(n) points in Si. The other operations such as the enumeration of increasing/decreasing pairs only need 𝒪(logn) space. Thus, the algorithm requires 𝒪(nlogn) space.

For the proofs of correctness and completeness, we write L(i) for the value of L after processing strip Si. On the other hand, we only consider the final values of ki and hi.

Correctness.

We show that if the algorithm accepts, then τ contains 213.

Suppose the algorithm accepts the input τ. If this was due to finding 213 in a single strip via part (1), then τ clearly contains 213. If part (2) finds a point rSi with r.y>L(i1), then, for some j<i, the strip Sj contains a decreasing pair of points (p,q) with p.y=L(i1)<r.y, thus p,q,r form an occurrence of 213 in τ.

Now consider the case that (3) accepts, i.e. we have ki<hii1 for some i[n] in the end. Then ki is the number of points q in the strips Si,Si+1,,Sn with i.y<q.y<hi.y. As there are hi.yi.y1 such points in the input, and ki<hi.yi.y1, there must be at least one such point pSj for some j<i.

By definition, there are q,phSi such that (i,q),(ph,hi)Ii. If i.x<hi.x, then p,i,hi form an occurrence of 213 in τ (see Figure 5, left). Otherwise, we have ph.x<hi.x<i.x. By definition of Ii, there is some input point sSi with ph.y<s.y<hi.y (see Figure 5, right). If sSj with j<i, then s,ph,hi form an occurrence of 213. On the other hand, if sSj for some i<j, then ph,i,s form an occurrence of 213, as i.y<ph.y by minimality of i.y.

Figure 5: Illustration of the correctness of part (3) of the algorithm.

Finally, suppose (4) accepts, i.e. ki<hi.yi.y holds for some i[n] in the end. ki is the number of points to the right and above i (including hi). There are exactly hi.yi.y1 input points p with i.y<p.y<hi.y, but only ki1 such points that are also to the right of i, so there must be at least one point q with q.x<i.x<hi.x and i.y<q.y<hi.y. Thus (q,i,hi) form an occurrence of 213 in τ.

Completeness.

We show that if τ contains 213, then the algorithm accepts.

Suppose that the input contains three points p,q,r that form an occurrence of 213. If there is some i such that p,q,rSi, part (1) will find (p,q,r).

Suppose p,qSi and rSi for some i. We show that then (2) accepts. Let (p,q) be a decreasing pair in Si such that p.y is minimal. Let rSj. As i(j1), by definition of L and minimality of p.y, we know L(j1)p.yp.y<r.y. As such, (2) accepts when the algorithm reads r and notices L<r.y.

Suppose pSi and q,rSi for some i. We show that then (3) accepts. We have i.yq.y<p.y<r.yhi.y. As pSj for some j<i, the number ki of points s with i.y<s.y<hi.y to the right of Si is less than the hi.yi.y1 (the total number of such input points). Thus, (3) accepts.

Finally, suppose p, q and r are in different strips. We show that then (4) accepts. Let qSi. Then i.y<q.y<p.y<r.y<hi.y. As pSj for some j<i, there the number ki of points s to the right of i which satisfy i.y<s.y (and, by definition, s.yhi.y) is at most hi.yi.y1. Thus, we accept.

5.3 Two-party communication complexity

We now show that any non-constant lower bound for π-PPMn with π{312,132,213,231} is impossible to prove with a straight-forward reduction from two-party communication complexity. Define the one-way two-party π-PPMn problem as follows. The input is a permutation τ of [n], as usual. We have two players, Alice and Bob. Alice receives a prefix of τ (of any length), and Bob receives the remaining suffix. The communication complexity of one-way two-party π-PPMn is the minimum number of bits of information that Alice needs to send to Bob so that Bob can decide whether π is contained in τ.

Clearly, this provides a lower bound for the space complexity of π-PPMn, and potentially a stronger one than the two-way communication complexity used in the rest of the paper. Unfortunately:

Proposition 5.2.

The communication complexity of one-way two-party π-PPMn is one bit if |π|3.

Proof.

Let α,β be the two parts of the input received by Alice and Bob. Alice can detect occurrences of π that are fully contained in α, and, since she knows Val(β), she can also detect occurrences of π where all but the last value are contained in α. Similarly, Bob can detect all occurrences where all values or all but the first value are contained in β. If |π|3, this encompasses all possible occurrences, and hence Alice only needs to send one bit indicating whether she found an occurrence.

6 Conclusion

In this paper we initiated the study of pattern matching in permutation streams. We showed hardness of the problem for almost all non-monotone patterns, but our 𝒪~(n)-space algorithms for the patterns 312, 132, 213, and 231 show a separation from the previously studied sequence variant, where a Ω(n) lower bound holds. We conjecture that our upper bound is tight, which would imply a surprising trichotomy of complexities Θ(logn), Θ~(n), and Θ~(n).

Conjecture 6.1.

The space complexity of π-PPMn is Θ~(n) for π{312,132,213,231}.

As discussed in Section 5.3, such a lower bound likely requires some more sophisticated techniques.

It is also interesting that the two algorithms for detecting 312/132 and 213/231 are quite different, even though the patterns are the reverses of each other. Both essentially rely on the fact that each element is known to occur exactly once, in order to circumvent the Ω(n) bound for SequencePPM. In the first algorithm, this is exploited “early”: At a certain point (line 10 in Algorithm 1), the algorithm may deduce that a certain element must appear later, and stop right before its internal storage is overwhelmed by the complexity of the input. The second algorithm instead counts elements in certain ranges, and at the end deduces that some values must have occurred before the counting started. This means the second algorithm cannot always return an actual occurrence, but only decide whether such an occurrence exists. We do not know if an occurrence of 213 (or 231) can be found with Θ~(n) space; this is another interesting open question.

As mentioned in the introduction, counting patterns is already hard for the pattern π=21 (i.e., counting inversions) [4]. However, this is not known for counting modulo 2; in the case π=21, this means computing the parity of the input. Reductions from communication complexity are faced with a similar problem as for PPM with length-3 patterns (Section 5.3): Two players can compute the parity of a permutation with only one bit of communication.555This was observed by Dömötör Pálvölgyi at https://cstheory.stackexchange.com/a/27912 (accessed 2025/7/14).

Note that counting inversions modulo 3 can be shown to be hard with a simple modification of the Ajtai–Jayram–Kumar–Sivakumar lower bound666The disjointness problem in the proof needs to be replaced by the unique disjointness problem [30]. [4]. Also, computing the parity is hard in the sequence setting, as can be shown by a simple reduction from the Index problem.

Our proofs imply that counting some larger patterns is hard even modulo 2: The Disj-reductions for size-4 patterns (Section 4.1) all have the property that precisely one occurrence appears for each element in the intersection of the two input sets. Thus, by reducing from the unique disjointness problem [30] instead, we can show that distinguishing between zero and one occurrence is hard.

Finally, it is known how to approximately count inversions efficiently [4]; we do not know whether this is possible for larger patterns.

References

  • [1] The International Conference on Permutation Patterns. Accessed: 2025/07/01. URL: https://permutationpatterns.com.
  • [2] Pankaj K. Agarwal and Micha Sharir. Davenport–Schinzel Sequences and Their Geometric Applications. In J.-R. Sack and J. Urrutia, editors, Handbook of Computational Geometry, pages 1–47. North-Holland, Amsterdam, 2000. doi:10.1016/B978-044482537-7/50002-4.
  • [3] Shlomo Ahal and Yuri Rabinovich. On complexity of the subpattern problem. SIAM Journal on Discrete Mathematics, 22(2):629–649, 2008. doi:10.1137/S0895480104444776.
  • [4] Miklós Ajtai, T. S. Jayram, Ravi Kumar, and D. Sivakumar. Approximate Counting of Inversions in a Data Stream. In Proceedings on 34th Annual ACM Symposium on Theory of Computing, May 19-21, 2002, Montréal, Québec, Canada, STOC ’02, pages 370–379, New York, NY, USA, 2002. Association for Computing Machinery. doi:10.1145/509907.509964.
  • [5] Omri Ben-Eliezer and Clément L. Canonne. Improved bounds for testing forbidden order patterns. In Artur Czumaj, editor, Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 2093–2112. SIAM, 2018. doi:10.1137/1.9781611975031.137.
  • [6] Omri Ben-Eliezer, Shoham Letzter, and Erik Waingarten. Finding Monotone Patterns in Sublinear Time, Adaptively. In Mikołaj Bojańczyk, Emanuela Merelli, and David P. Woodruff, editors, 49th International Colloquium on Automata, Languages, and Programming (ICALP 2022), volume 229 of Leibniz International Proceedings in Informatics (LIPIcs), pages 17:1–17:19, Dagstuhl, Germany, 2022. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.ICALP.2022.17.
  • [7] Omri Ben-Eliezer, Slobodan Mitrovic, and Pranjal Srivastava. Approximate counting of permutation patterns. doi:10.48550/arXiv.2411.04718.
  • [8] Benjamin Aram Berendsohn. Complexity of permutation pattern matching. Master’s thesis, Freie Universität Berlin, 2019. URL: https://www.mi.fu-berlin.de/inf/groups/ag-ti/theses/download/Berendsohn19.pdf.
  • [9] Benjamin Aram Berendsohn, László Kozma, and Dániel Marx. Finding and Counting Permutations via CSPs. Algorithmica, 83:2552–2577, 2021. doi:10.1007/s00453-021-00812-z.
  • [10] Miklós Bóna. Combinatorics of permutations. CRC Press, 2022.
  • [11] Édouard Bonnet, Eun Jung Kim, Stéphan Thomassé, and Rémi Watrigant. Twin-width I: tractable FO model checking. ACM Journal of the ACM (JACM), 69(1):1–46, 2021. doi:10.1145/3486655.
  • [12] Édouard Bonnet, Jaroslav Nešetřil, Patrice Ossona de Mendez, Sebastian Siebertz, and Stéphan Thomassé. Twin-width and permutations, 2021. arXiv:2102.06880.
  • [13] Prosenjit Bose, Jonathan F. Buss, and Anna Lubiw. Pattern matching for permutations. Inf. Process. Lett., 65(5):277–283, 1998. doi:10.1016/S0020-0190(97)00209-3.
  • [14] Bartłomiej Dudek and Paweł Gawrychowski. Counting 4-patterns in permutations is equivalent to counting 4-cycles in graphs, 2020. arXiv:2010.00348.
  • [15] Chaim Even-Zohar and Calvin Leng. Counting small permutation patterns. In Dániel Marx, editor, Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms, SODA 2021, Virtual Conference, January 10 - 13, 2021, pages 2288–2302. SIAM, 2021. doi:10.1137/1.9781611976465.136.
  • [16] Eldar Fischer. On the strength of comparisons in property testing. Inf. Comput., 189(1):107–116, 2004. doi:10.1016/J.IC.2003.09.003.
  • [17] Jacob Fox and Fan Wei. Fast property testing and metrics for permutations. Comb. Probab. Comput., 27(4):539–579, 2018. doi:10.1017/S096354831800024X.
  • [18] Michael L. Fredman. On computing the length of longest increasing subsequences. Discrete Mathematics, 11(1):29–35, 1975. doi:10.1016/0012-365X(75)90103-X.
  • [19] Pawel Gawrychowski and Mateusz Rzepecki. Faster exponential algorithm for permutation pattern matching. In Karl Bringmann and Timothy M. Chan, editors, 5th Symposium on Simplicity in Algorithms, SOSA@SODA 2022, Virtual Conference, January 10-11, 2022, pages 279–284. SIAM, 2022. doi:10.1137/1.9781611977066.21.
  • [20] Sylvain Guillemot and Dániel Marx. Finding Small Patterns in Permutations in Linear Time. In Proceedings of the Twenty-fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’14, pages 82–101, Philadelphia, PA, USA, 2014. Society for Industrial and Applied Mathematics. doi:10.1137/1.9781611973402.7.
  • [21] Vít Jelínek, Michal Opler, and Pavel Valtr. Generalized coloring of permutations. Algorithmica, 86(7):2174–2210, 2024. doi:10.1007/S00453-024-01220-9.
  • [22] Sergey Kitaev. Patterns in permutations and words, volume 1. Springer, 2011. doi:10.1007/978-3-642-17333-2.
  • [23] Donald E. Knuth. The Art of Computer Programming, Volume 1: Fundamental Algorithms. Addison-Wesley, 1968.
  • [24] Donald E. Knuth. The Art of Computer Programming, Volume 3: Sorting and Searching. Addison-Wesley, 1973.
  • [25] Eval Kushilevitz and Noam Nisan. Communication complexity. Cambridge Univ. Press, Cambridge, 1. publ. edition, 1997.
  • [26] László Lovász. Communication Complexity: a survey. In B. Korte, L. Lovász, H.J. Prömel, and A. Schrijver, editors, Paths, flows and VLSI layout, pages 235–265. Springer, 1990.
  • [27] Ilan Newman, Yuri Rabinovich, Deepak Rajendraprasad, and Christian Sohler. Testing for forbidden order patterns in an array. Random Structures & Algorithms, 55(2):402–426, 2019. doi:10.1002/rsa.20840.
  • [28] Ilan Newman and Nithin Varma. Strongly Sublinear Algorithms for Testing Pattern Freeness. TheoretiCS, January 2024. doi:10.46298/theoretics.24.1.
  • [29] Anup Rao and Amir Yehudayoff. Communication complexity and applications. Cambridge University Press, 2020.
  • [30] Alexander A. Razborov. On the distributional complexity of disjontness. In Mike Paterson, editor, Automata, Languages and Programming, 17th International Colloquium, ICALP90, Warwick University, England, UK, July 16-20, 1990, Proceedings, volume 443 of Lecture Notes in Computer Science, pages 249–253. Springer, 1990. doi:10.1007/BFB0032036.
  • [31] C. Schensted. Longest increasing and decreasing subsequences. Canadian Journal of Mathematics, 13:179–191, 1961. doi:10.4153/cjm-1961-015-3.
  • [32] Vincent Vatter. Permutation classes, 2014. arXiv:1409.5159.
  • [33] Andrew Chi-Chih Yao. Some complexity questions related to distributive computing (preliminary report). In Michael J. Fischer, Richard A. DeMillo, Nancy A. Lynch, Walter A. Burkhard, and Alfred V. Aho, editors, Proceedings of the 11h Annual ACM Symposium on Theory of Computing, April 30 - May 2, 1979, Atlanta, Georgia, USA, pages 209–213. ACM, 1979. doi:10.1145/800135.804414.
  • [34] Xiaojin Zhang. Improved algorithm for permutation testing. Theor. Comput. Sci., 986:114316, 2024. doi:10.1016/J.TCS.2023.114316.