1. Introduction
The pattern matching problem on strings is to find all occurrence positions of a pattern string in a text string. Pattern matching algorithms such as the Knuth–Morris–Pratt (KMP) algorithm [
1], the Boyer–Moore algorithm [
2], and the Horspool algorithm [
3] perform pattern matching quickly by preprocessing the pattern. On the other hand, pattern matching can be accelerated by preprocessing the text into some indexing structure such as suffix trees [
4], suffix arrays [
5], or position heaps [
6].
The
permuted pattern matching problem, proposed by Katsura et al. [
7,
8], is a generalization of the pattern matching problem, where we compare tuples of strings. We call a tuple of strings of the same length a
multi-track string. The permuted pattern matching problem is as follows: given two multi-track strings
and
where
, to find all positions
i such that
is a permutation of
. The problem can be solved by constructing indexing structures from the text such as multi-track suffix trees [
7], multi-track position heaps [
8], and filtering multi-set trees [
9], or by preprocessing the pattern such as the AC-automaton-based algorithm [
7].
Multi-track strings can model various types of real data when sequences in the data have the same meaning. For example, data from a three-dimensional accelerometer in a smartphone can be considered a multi-track string. Consider two smartphones with the same position, and rotate one of them several times where each rotation is 90 degrees on the x, y, or z axis. If we perform the same motion on both smartphones, the generated data from three-dimensional accelerometer of one phone is a permutation of the other one. By using permuted pattern matching, we can find occurrences of a pattern on both smartphones without permuting the pattern.
In this paper, we propose several algorithms that solve permuted pattern matching quickly. These algorithms can be classified into three groups. The first group consists of algorithms that are based on the KMP algorithm [
1]. This group includes the
multi-track KMP,
multi-track AC-automaton, and
multi-track permuted matching automaton algorithms. The second group consists of algorithms that are based on the Boyer–Moore algorithm [
2] and the Horspool algorithm [
3]. This group includes the
multi-track Boyer–Moore and
multi-track Horspool algorithms. The third group consists of filtering algorithms. Moreover, we conduct experiments and show that our algorithms perform permuted pattern matching faster than existing algorithms. The worst case running times of the proposed algorithms and existing algorithms are summarized in
Table 1, where
d is the total length of the patterns and
is the size of the alphabet.
Preliminary versions of this work appeared in [
10,
11].
2. Notation and Definition on Multi-Track Strings
Let be a totally-ordered alphabet and be the size of the alphabet. An element of is called a string. For a string , the length of W is denoted by . The empty string, denoted by , is a string of length zero. For a string of length n, denotes the symbol of W, and denotes a substring of W that begins at i and ends at j for . For convenience, we abbreviate to and to ; these terms are known as the prefix and the suffix of W, respectively. Moreover, let if . The reverse string of W is denoted by . For two strings, X and Y, denotes that X is lexicographically smaller than Y, and denotes that either or .
A multi-track symbol is a k-tuple of symbols . A multi-track string (or multi-track for short) is a k-tuple of strings where , and each is called the track of . The length n of strings in is called the length of and denoted by , and the number k of tracks in is called the track count of and is denoted by . For a multi-track symbol , we define . For a multi-track of track count , denotes the multi-track symbol, and denotes for and . Moreover, denotes a substring of that begins at i and ends at j for . Similarly to the notation for strings, and mean and , which are called the prefix and the suffix of , respectively.
Let be a permutation of . For a multi-track , is called a permuted multi-track of . The sorted index of a multi-track is a permutation such that for any , where we assume in the case . The sorted multi-track is defined as . The reverse of a multi-track is is . The sorted index of the reverse multi-track, denoted by , is a permutation such that for any .
Lemma 1 ([
7]).
Let be a two-dimensional array such that for . can be computed in time ffline,
where and . Lemma 2. Let be a two-dimensional array such that for . can be computed in time nline, where and .
Proof. Clearly, can be computed in by using a radix sort algorithm. □
For two multi-tracks and of the same length, we say that permuted-matches if for some permutation , and it is denoted by . □
Lemma 3 ([
7]).
For two multi-tracks and , if and only if . Throughout this paper, we assume that is a pattern with and , and is text with and . The pattern matching problem on multi-tracks is defined as follows.
Definition 1 (Permuted pattern matching ([
7])
. Given a multi-track text and a multi-track pattern , compute all positions i
that satisfy . We call such positions ccurrence position
of in . For example, given a text and a pattern , we can see that the pattern matches at two because . Moreover, the pattern permuted-matches at six, since . Therefore, we should output two and six in this case.
We remark that Katsura et al. [
7] defined a more general problem called the
sub-permuted pattern matching, where we have
, and our task is to find a partial permutation
of
and a position
i for which
holds. However, in this paper, we only consider the case
, which was called
full-permuted pattern matching in [
7].
3. KMP-Based Permuted Pattern Matching Algorithms
In this section, we propose three algorithms for permuted pattern matching based on the KMP algorithm. In
Section 3.1, we introduce our first algorithm, the
multi-track KMP algorithm (MTKMP algorithm) which uses the border array of a multi-track pattern. We remark that this algorithm is a variant of the generalized KMP algorithm proposed by Matsuoka et al. [
12]. They showed that the KMP algorithm can be applied to string classes that satisfy some equality and border properties. In this paper, we show some properties of multi-track strings so that the KMP algorithm can be applied to multi-track strings and give the exact computation time of the algorithm.
In
Section 3.2, we extend it to the multi-track AC-automaton algorithm, which can perform dictionary matching on multi-tracks. Last, in
Section 3.3, we introduce another extension of the MTKMP algorithm, the permuted matching automaton algorithm, which can perform permuted pattern matching faster than the MTKMP algorithm.
3.1. Multi-Track KMP Algorithm
Similar to the original KMP algorithms, the multi-track KMP algorithm uses multi-track border arrays to compute the shift amount when the algorithm finds a mismatch. First, we define borders for multi track strings.
Definition 2 (Borders of multi-tracks)
. A orde
of a multi-track is any multi-track that permuted-matches with a prefix and a suffix of . Moreover, a border of is called rope
if . We can easily confirm the following lemma.
Lemma 4. For any two borders and of , if , then is a border of .
Let
for some
i and
j. If
for some
, then
and
hold, i.e.,
is a proper border of
. Therefore, if
and
, we can safely shift
by
x, where
is the length of the longest proper border of
. We store the length of the longest proper border of
for
as
the border array of
.
Definition 3 (Multi-track border array)
. Given a multi-track of , he border arra
of is an array of length , where the element of is the length of the longest proper border of . Formally, For algorithmic purpose, we define . Algorithm 1 constructs the multi-track border array of an input .
Lemma 5. Given a multi-track of and , Algorithm 1 constructs the border array of in time.
Proof. First, we show the correctness of the algorithm by induction. Assume we have computed the longest proper border of and stored it in for . Let be the longest proper border of . Clearly, is a border of . Using Lemma 4, we can find by finding . Since is the longest proper border of , the algorithm can find by updating from until holds. Therefore, Algorithm 1 computes the border array of correctly.
Next, we show the computation time of the algorithm. Using Lemma 1, can be computed in . Both while loops are called times at most, since , and the value of i always increases each time the outer loop is called, while the value of always increases each time the inner loop is called. Each comparison of and consumes time; hence, Algorithm 1 runs in time. □
Algorithm 2 shows the pseudocode of the MTKMPalgorithm. The MTKMP algorithm performs permuted pattern matching from left to right of the pattern and the text. The sorted pattern and the array save the sorted indices of suffixes of text used to perform permuted-matching between the pattern and a substring of the text. If symbols on the text and the pattern are mismatched, we shift the matching position of the pattern using . If the pattern matches a substring of the text, then the MTKMP algorithm outputs the occurrence position at the text and shifts the pattern according to .
Algorithm 1: Multi-track border array construction algorithm. |
|
Algorithm 2: The multi-track KMP algorithm. |
|
Theorem 1. Given a text and a pattern , the MTKMP algorithm computes all occurrence positions of in in time.
Proof. According to the above arguments, we can shift
by
x, where
is the length of the longest proper border of
if
and
. Since
is the longest proper border of
, the algorithm finds the occurrence position of
in
correctly.
Using Lemma 1, can be computed in . From Lemma 5, constructMTBorderArray runs in . Both while loops are called times at most, since , and the value of i always increases each time the outer loop is called, while the value of always increases each time the inner loop is called. Each comparison of and consumes time. Hence, Algorithm 2 runs in time. □
3.2. Multi-Track AC-Automaton
In this subsection, we introduce a data structure called a multi-track AC-automaton that can perform dictionary matching on multi-tracks, namely
permuted dictionary matching. Let
be a set of patterns of the same track count
k, called a
dictionary, and let
be the total length of the patterns in
D, where
. The multi-track AC-automaton of
D, denoted by
, consists of a set of states and three functions:
goto,
failure, and
output functions.
Figure 1 shows an example of
.
For a dictionary D, the states of are . Each state corresponds to a prefix of for some . Unlike the original AC-automaton, the multi-track AC-automaton uses a multi-track symbol, instead of a single symbol, to define the goto function. The goto, failure, and output functions of are defined as follows.
Definition 4 (Goto function). We define the goto function δ of by iff for a state and a multi-track symbol .
Definition 5 (Failure function). The failure link of a state is defined as , where is the longest proper suffix of such that permuted-matches a prefix of some pattern in D.
Definition 6 (Output function).The output of a state is the set of patterns that permuted-matches for some .
Next, we explain how to construct . We use multi-track symbol tries to implement the goto function.
Definition 7 (Multi-track symbol trie). Let be a set of multi-track symbols. The multi-track symbol trie of is the trie for the set of strings .
For a state , we use the multi-track symbol trie of a set and each leaf of multi-track symbol tries labeled by . Since a child of a node in multi-track symbol tries can be searched in time, can be computed in time. The goto function can be constructed by using Algorithm 3.
Algorithm 3: Multi-track AC-automaton goto function construction algorithm. |
|
Lemma 6. Algorithm 3 constructs the goto function of the multi-track AC-automaton of a dictionary in time.
Proof. The goto function is executed times, and can be computed in time. □
After constructing the goto function, we can construct the failure function of . Algorithm 4 shows a construction algorithm for the failure function of a multi-track AC-automaton. In order to simplify the construction algorithm, we use a special state that reads any multi-track symbol to get to the root state.
Algorithm 4: Multi-track AC-automaton failure function construction algorithm. |
|
Lemma 7. Algorithm 4 constructs the failure function of the multi-track AC-automaton of a dictionary in time.
Proof. We can bound the running time of Algorithm 4 by counting the number of executions of . For each pattern , let be a state such that for . Let be the number of executions of when finding . The maximum value of is bounded by . Because the depth of is, at most, , we get recursively. By solving this formula, we get and . Moreover, each is executed in time. □
Last, by using the goto and failure functions, Algorithm 4 constructs the output function of a multi-track AC-automaton.
Lemma 8. Algorithm 5 constructs the output function of the multi-track AC-automaton of a dictionary in time.
Proof. Updating the output function can be performed in
time by using lists to save the output function and updating it by concatenating the list (see [
13]). The proof is similar to the proofs of Lemmas 3 and 4. □
From Lemmas 6–8, we get the following theorem.
Theorem 2. The multi-track AC-automaton of a dictionary can be constructed in time.
Algorithm 5: Multi-track AC-automaton output function construction algorithm. |
|
By using the multi-track AC-automaton of D, we can perform permuted dictionary matching on a text , as shown in Algorithm 6. Let be the current state of the multi-track AC-automaton. For each position i on , Algorithm 6 uses the sorted index of to determine the permutation of that is used in the goto function.
Algorithm 6: Permuted dictionary matching algorithm by using multi-track AC-automaton. |
|
Theorem 3. Permuted dictionary matching on a multi-track text can be performed in time by using the multi-track AC-automaton of D.
Proof. The running time of Algorithm 6 can be evaluated by counting the number of executions of . First, for each i, is executed at least once on the transition. Next, is executed to check whether the transition is or not. In this case, the number of executions of is the same as that of . The latter is, at most, n, because whenever is executed, the depth of is increased by one, and whenever is executed, the depth of is decreased by at least one. Therefore, the number of executions of is . □
3.3. Multi-Track Permuted Matching Automaton
In this subsection, we describe a data structure called a multi-track permuted matching automaton that can perform permuted pattern matching on a multi-track text
online, by preprocessing a multi-track pattern
. For a multi-track pattern
, the multi-track permuted matching automaton of
, denoted by
, consists of a set of states and two functions, goto and failure functions. In addition, each state of the multi-track permuted matching automaton has a weight in order to determine whether
should be executed or not.
Figure 2 shows an example of a multi-track permuted matching automaton.
Let be the set of states of . Each state of corresponds to a prefix of , i.e., . Each state s has a weight, which is the number of tracks containing s as a prefix. Moreover, a state s is called an accept state if for some i. The goto and failure functions of are defined as follows.
Definition 8 (Goto function).We define the goto function δ as iff for each state and symbol c.
Definition 9 (Failure function). Let be the set of states whose depth is j. The failure link of the state is such that is a proper suffix of and is the longest prefix of that permuted-matches with a proper suffix of . The latter condition is similar to that of the multi-track KMP algorithm.
Next, we explain how to construct . Algorithm 7 constructs the goto function of a multi-track permuted matching automaton. We add a weight on each state each time we visit the state when reading each track.
Lemma 9. Algorithm 7 constructs the goto function of in time.
Proof. For each track, the number of executions of is m, and there are k tracks in a pattern . Moreover, can be executed in time. □
After constructing the goto function, Algorithm 8 constructs the failure function of . For each state s, we use a multi-track border array to determine the depth of .
Lemma 10. Algorithm 8 constructs the failure function of in time.
Proof. Similarly to the proof of Theorem 7, the failure and goto functions are executed times. Moreover, the execution time of the failure function is , and that of the goto function is . □
From Lemmas 9 and 10 we get the following theorem.
Theorem 4. The multi-track permuted matching automaton of a pattern can be constructed in time.
Finally, by using , Algorithm 9 can perform permuted pattern matching on a multi-track text . Algorithm 9 uses k pointers to point to the current states. Note that all always have the same depth. Algorithm 9 uses two conditions to determine whether it should execute the failure function or not. The first condition is when it cannot find the goto transition, and the second condition is when the number of state pointers in the state is more than the weight of the state. If any of the fail, then all of the execute the failure function, otherwise executes the goto function.
Theorem 5. By using , Algorithm 9 performs permuted pattern matching on a multi-track string in time.
Proof. Similarly to the proof of Theorem 3, the number of executions of the failure and goto function is . Since the execution time of the failure function is and the goto function is , Algorithm 9 runs in time. □
Algorithm 7: Multi-track permuted matching automaton goto function construction algorithm. |
|
Algorithm 8: Multi-track permuted matching automaton failure function construction algorithm. |
|
Algorithm 9: Multi-track permuted matching automaton matching algorithm. |
|
4. Multi-Track Boyer–Moore and Horspool Algorithms
In this section, we propose two permuted pattern matching algorithms that are based on the Boyer–Moore algorithm and the Horspool algorithm, which we call MT-BM and MT-H , respectively. The original Boyer–Moore algorithm uses two functions (good suffixes) and (bad symbols), and the Horspool algorithm only uses to determine how much the position of a substring to compare should be shifted when a mismatch is found between the input patten and the substring of the text. For multi-track strings, we use a permuted match to define instead of a complete match, and we use sorted multi-track symbols for instead of symbols. Formally, those functions are defined as follows on multi-tracks.
Definition 10 (Good suffixes function)
. For a multi-track of length , let and . The good suffixes function is defined as and for . Definition 11 (Bad symbols function). For a multi-track of length and a multi-track symbol , is the first occurrence position of in . The function returns m if there is no occurrence of in .
In the implementation, is computed by using an array, while can be computed by using a trie of the multi-track symbols. We perform permuted-match instead of exact matching when computing . We also use another array to compute .
Definition 12 (Suffixes). For a multi-track of length , is the maximum value of l such that for .
Algorithm 10 shows how to construct and . The array is computed by , which uses array computed by . Note that we compute at the beginning (Lines 2 and 26) of the algorithm and will not recompute them when we use the values later.
Algorithm 10: MT-BM and MT-H preprocessing functions. |
|
Lemma 11. The function computes the array in time.
Proof. First, can be computed in time by using radix sort. The for loop is executed times, and the while loop in Line 11 is executed m times at most through the whole run, because k is always reduced in each loop. A comparison of two multi-track symbols of the pattern that was executed in each loop can be computed in time. □
Lemma 12. The function computes in time.
Proof. All the for loops are executed m times at most. The while loop is executed m times at most through the whole execution of the algorithm, since j is always increased and does not exceed m. □
Lemma 13. The function computes in time.
Proof. can be computed in time by using radix sort. Each edge in the trie of can be accessed in time by using a binary search. Since the depth of the trie is, at most, k, each for can be added and accessed in time. □
By using both and , MT-BM outputs the positions of the text that are permuted-matched with the pattern. The matching algorithm of MT-BM is shown in Algorithm 11.
Algorithm 11: Multi-track Boyer–Moore algorithm. |
|
Theorem 6. Given a multi-track text and a pattern , MT-BM outputs all occurrence positions of in in time with preprocessing time.
Proof. From Lemmas 11–13, Algorithm 11 needs time for preprocessing. Next, can be computed in time by using radix sort. In the outer while loop starting at Line 7, the value of j is increased by at least one, so the loop is executed times at most. In each execution of the outer loop, the inner while loop is executed m times at most, where multi-track symbols of the pattern and the text can be compared in time. can be accessed in time, and can be executed in time. □
Similarly to the original Horspool algorithm, the multi-track Horspool algorithm (MT-H) uses to shift the pattern.
Theorem 7. Given a multi-track text and a pattern , MT-H outputs all occurrence positions of in in time with preprocessing time.
Proof. Similar to the proof of Theorem 6. □
Boyer–Moore and Horspool Matching Algorithms with Track Trie
The two algorithms presented in the previous subsections determine if two multi-tracks permuted-match by sorting them. In this subsection, we present another idea for this task using a data structure called a
track trie. The track trie
of a multi-track
stores all the reversed strings of the tracks of
, that is
.
Figure 3a shows the track trie of a multi-track pattern
.
Algorithm 12 is the construction algorithm of . For a node s of and a symbol , the goto function returns the child of s that has an edge labeled c. We naturally extend it to the domain by and for any and . We also associate a weight with each node to find mismatch on a text, as we explain later.
Algorithm 12: Track trie construction algorithm. |
|
Theorem 8. Algorithm 12 constructs in time.
Proof. The function can be calculated in time by binary search. On each execution of the inner for loop (Line 6), Algorithm 12 executes to check the child nodes of . If there is no node with an edge labeled , then a new node is constructed, which can be done in time. On the other hand, if there is a node with an edge labeled , Algorithm 12 accesses the child node and then increases its weight by one. The total number of iterations of the inner loop is . □
For a given multi-track text
and a position
i, Algorithm 13 finds a mismatch position in two cases: (1) when a track cannot find its
destination, and (2) when the number of tracks that have the same string
w is more than the weight of the node that represents the string
. Those mismatch conditions are illustrated in
Figure 3b,c, respectively.
Figure 3b shows that the track trie cannot find a transition for the second symbol
of the third track. On the other hand,
Figure 3c shows that
has two “
” on its track; however, the
has only one “
” on its track, i.e., the node that represents “
” has one on its weight.
Algorithm 13: Track trie matching algorithm. |
|
Theorem 9. Given a multi-track text and a position j, Algorithm 13 finds a mismatch position in the pattern in time.
Proof. For each position on the text, Algorithm 13 executes to check whether has a child node with an edge labeled for . If there is no child node with an edge labeled , then Algorithm 13 considers it a mismatch and returns the mismatch position. On the other hand, if there is such a child node, Algorithm 13 updates to the child node and then checks whether the number of tracks of that contain as a prefix is more than the weight of the child node. If the number of tracks exceeds the weight, then Algorithm 13 treats it as mismatch and returns the mismatch position. The total number of iterations of the inner loop is, at most, . □
Although the worst case time complexity remains the same, by using track trie, both MT-BM and MT-H can match the pattern to the text faster, because we do not need to compute the reverse-sorted index of the text. First, we construct the track trie of the pattern by using . Then, we replace Line 10 of Algorithm 11 by to find a mismatch position.
5. Filtering Algorithm on a Multi-Track String
In this section, we propose filtering algorithms for permuted pattern matching. The filtering algorithm uses a function to transform a multi-track string into another sequence. Then, the algorithm implements a pattern matching algorithm on the transformed pattern and text to get candidate positions where the pattern may permuted-match. Finally, every candidate position is checked for whether the pattern is permuted-matched in each position or not.
The filtering algorithm uses a function
that inputs a multi-track
and outputs a sequence of length
. The function
must have a
false-positive property, that is, for two multi-tracks
and
, if
, then
. We can use any hash function such as the Karp–Rabin fingerprint [
14] and locality-sensitive hashing [
15]. We describe the filtering algorithm by using a simple function
that is defined as follows.
Definition 13 (Bucket function β). For , such that is the number of the symbol in .
For example, for a multi-track
,
is as follows,
can be computed in
time by counting all symbols in
.
Algorithm 14 shows an example of filtering algorithm for permuted pattern matching. This algorithm uses as a hash function, and the KMP algorithm as a patten matching algorithm. First, the algorithm computes and and then constructs the border array using the same procedure as the KMP algorithm. Next, the algorithm performs pattern matching on and . When a mismatch occurs, the pattern is shifted by using . If matches , then the algorithm checks whether the pattern permuted-matches or not, and it outputs the position if true.
Algorithm 14: Filtering algorithm for permuted pattern matching. |
|
Theorem 10. Given a multi-track text and a pattern , Algorithm 14 computes all occurrence positions of in in time, where c is the number of candidates.
Proof. As described above, and can be computed in and , respectively. The border array can be constructed in time, and pattern matching can be performed in time, since the comparison needs time. In addition, the algorithm takes time to check the candidates. □
6. Experiments
We performed some sets of experiments to evaluate the practical performance of the proposed algorithms. We measured the running time of our algorithms and the AC-automaton-based algorithm [
7]. All experiments were performed on a computer with an Intel Xeon CPU E5-2609 8 core, 2.40 GHz, 256 GB memory, and a Debian Wheezy operating system. We set the parameter values as
100,000,
,
1000, and
, and we changed one of the parameters in each experiment to see the relation between the parameters and the running time of the algorithms. We used randomly-generated texts and patterns. The source code of our algorithm is available at
https://github.com/ushitora/permutedpatternmatching.
The first set of experiments compared the running times of KMP-based algorithms, namely the multi-track KMP algorithm, the multi-track AC-automaton algorithm, and the multi-track permuted matching automaton algorithm. The purpose of this experiment was to see the changes in the running time of the multi-track KMP algorithm when extended to the multi-track AC-automaton algorithm and the multi-track permuted matching automaton algorithm. The results of the experiment are shown in
Figure 4. From the results, we can see that the multi-track AC-automaton algorithm was slower than the multi-track KMP algorithm. The reason for this is that the multi-track AC-automaton algorithm uses state transitions instead of comparing multi-track symbols directly. This time difference is not significant considering that the multi-track AC-automaton algorithm focuses on dictionary matching instead of single pattern matching. Next, we can see that the multi-track permuted matching automaton algorithm is faster than the multi-track KMP algorithm. The multi-track permuted matching automaton algorithm can perform matching faster because the multi-track permuted matching automaton algorithm does not need to sort the text.
The next experiment compared the running time of the multi-track Boyer–Moore algorithm and the multi-track Horspool algorithm. We also checked the effectiveness of track tries in reducing the matching times of both algorithms.
Figure 5 shows the result of the experiment. While the multi-track Horspool was slightly faster than the multi-track Boyer–Moore algorithm, there was no significant difference between these algorithms. We can also see that track tries significantly reduced the matching times of both algorithms, since we do not need to sort the text when using track tries.
The third experiment set compared the running times of the filtering algorithms. We used three algorithms, the KMP algorithm, the Boyer–Moore algorithm, and the Horspool algorithm, as filtering algorithms.
Figure 6 shows the running times of the filtering algorithms. There was no significant difference in running time between the filtering algorithms. We can see that the filtering algorithms were fast apart from when the pattern length was
. The algorithms became very slow, because there were many occurrence position candidates when
. The occurrence position candidates will be fewer if the pattern length is longer.
Lastly, we compared the proposed algorithms with the AC-automaton-based algorithm [
7].
Figure 7 shows the running time of the AC-automaton-based algorithm [
7] and the proposed algorithms. We chose the fastest algorithms among the groups. We can see that the proposed algorithms were faster than the AC-automaton-based algorithm overall. The multi-track Boyer–Moore algorithm with track trie was the fastest among the algorithms.
7. Conclusions
We proposed some algorithms for permuted pattern matching on multi-track strings. We primarily focused on the algorithms that preprocess the pattern before performing permuted pattern matching, instead of constructing indexing structures from the text. We showed that our proposed algorithms are faster than the AC-automaton-based algorithm. Moreover, we proposed an algorithm for dictionary matching on multi-track strings, which, to the best of our knowledge, is the first algorithm for this problem. Because of its considerable difficulty owing to a larger number of permutations, only a few algorithms for sub-permuted pattern matching have been proposed. Therefore, developing an algorithm for the sub-permuted pattern matching problem must be addressed in future work.