$$\sa{5}\;\sa{2}\;\sa{9}\;\sa{4}\;\sa{3}\ \approx\ \sa{6}\;\sa{1}\;\sa{7}\;\sa{5}\;\sa{2},$$ which shows in particular their central value is the largest in both words.
For example, the word $\sa{5}\;\sa{2}\;\sa{9}\;\sa{4}\;\sa{3}$ appears equivalently at position $1$ on $$\sa{4}\;\underline{\sa{6}\;\sa{1}\;\sa{7}\;\sa{5}\;\sa{2}}\;\sa{9} \;\sa{8}\;\sa{3}$$ but nowhere else. For instance, it does not appear at position $4$ because $5\lt8$, while in the pattern the corresponding values satisfy $5\gt 4$.
Problem 31: Order-Preserving Patterns |
Searching time series or list of values for patterns representing specific fluctuations of the values requires a redefinition of the notion of pattern. The question is to deal with the recognition of peaks, breakdowns, double-dip recessions or more features on expenses, rates or the like.
In the problem we consider words drawn from a linear-sortable alphabet $\Sigma$ of integers. Two words $u$ and $v$ of the same length over $\Sigma$ are said to be order-equivalent written $u \approx v$, if $$u[i] \lt u[j]\Longleftrightarrow v[i] \lt v[j]$$ for all pairs of positions $i,j$ on the words.
The order-preserving pattern-matching problem is naturally defined as follows: given a pattern $x\in\Sigma^*$ and a text $y\in\Sigma^*$, check if $x$ is order-equivalent to some factor of $y$.
For simplicity we assume that letters in each considered word are pairwise distinct (words are permutations of their set of letters).