Questions tagged [pattern-matching]

For questions about pattern matching in computer science, which is the act of checking a given sequence of tokens for the presence of the constituents of some pattern.

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

last occurrence of a pattern, string matching algorithm

Implement an algorithm in pseudocode with a linear time complexity, which for a pattern $P = b_0,b_1,b_2,...,b_{m-1}$ returns the first index of the last occurrence of P in a text $T = a_0,a_1,a_2,...,...
1
vote
0answers
43 views

How to find the pattern in this data?

The unit covers Big-O notation. However, this may be irrelevant to the question. This is the Professor’s prompt: For the following $T(n)$, find values of $n_0$ and $c$ such that $cn3$ is larger than $...
0
votes
0answers
19 views

Probability of corners and the postage stamp patterns is bingo game.

I am very new to this bingo game and want to know how to calculate probability of a particular pattern in bingo game. Here each column has number in range of 1-15, 16-30, 31-45, 46-60 ,and 61-75. ...
1
vote
0answers
36 views

How can I enumerate the transformation rules on lists of lists?

This is a question about pattern matching and list transformation rules. (I may have the notation a bit wrong). Basically I'm thinking of rules which transform a set of balls with a letter on them, ...
2
votes
1answer
110 views

How do we find the number of sub-intervals whose intersection with the subset of the entire interval is non-empty?

Suppose we have set $A=\left\{\frac{1}{k}:k\in\mathbb{N}\right\}$ and we divide interval $[0,1]$ into $n$ sub-intervals of equal length. How do we find the exact forumula (or approximation) of the ...
2
votes
1answer
84 views

Distributing Series/Patterns

I'm going to do my best to explain this question, but it's complicated. Please bear with me. I'm trying to solve a practical problem and I know that the answer involves some math, but I can't for the ...
1
vote
1answer
77 views

Matchsticks Problem : Finding Maximum Squares Formed by $n$ Sticks

Given $n$ sticks, what is the formula for how many squares that can form with the sticks, where the square's sides each one matchstick? No breaking the matchsticks or allowing them to intersect. ...
2
votes
2answers
124 views

Pattern in Sequence of Polynomials

I generate these polynomials from a counting experiment. There are some obvious patterns i.e the order of $f(n)$ is $n(n+1)/2$. Also, each $f(n)$ has repeated binomial coefficeints corresponding to ${(...
-1
votes
1answer
32 views

Set up a rule from a pattern [closed]

I have to set up a recursive formula for a sequence that gives the number of ways to take out and arrange lego bricks to a wall with the length of 2n knobs. Some lego bricks have 6-knobs and some ...
0
votes
0answers
23 views

Methods for finding similar 2D point patterns in a map

I have a rather clustered and sparse 2D point cloud map and I want to develop a method for finding similar groups of points (comparable to star patterns) in the map under a given similarity threshold. ...
0
votes
0answers
37 views

How to recognize pattern in a sequence (array)

How do I recognize a know pattern in a sequence of numbers? I have two known pattern like this: 1, 2, 3 and 1, 3, 2 I have a ...
0
votes
1answer
54 views

What is the term of the concept to find the minimum vertex cover which covers all of the vertices (not edges) of an undirected graph only once?

I am actually looking for a term, I have googled for like past couple of hours and I had no luck so far. So there exists a thing called, minimum vertex cover which implies " a set of vertices such ...
0
votes
0answers
19 views

KMP-algorithm by hand differs from actual answer

I have a problem finding the correct failure links for the pattern P = abacaaba using Knuth-Morris-Pratt. This is what i have got so far: How I derived it: The first one is always 0 Now we have $k(...
1
vote
1answer
42 views

Average number of moves to have a specific 3-bit pattern

I would like to know how to have the average number of moves to have a specific 3-bit pattern. It is a random test where the chance of having 0 or 1 is the same: 0.5 (like having a coin toss). We drag ...
0
votes
0answers
30 views

Matching individual points in two different sets of coordinates

I have to match some 2d sets of points to an another 2d set of points (as ground truth) and find the outliers. In other word I have to match each single point to (maximum) one of the points in the ...
1
vote
3answers
33 views

Finding the equation pattern of a known set

I have the numbers 1 - 100, when they are put into a box (an abstracted code function I do not know the details of), they come out as ...
1
vote
3answers
67 views

Ceiling and Floor Formula for Sequence of Numbers

I am trying to find a formula for a sequence of the following numbers: $$4,5,8,9,12,13,16,17,\dots$$ Can anyone help me or give me a hint on how to derive a formula?
-1
votes
2answers
43 views

Formula for sequence of numbers

I am trying to find a somewhat nice general formula for the following sequence. $2,2,6,6,10,10,14,14,\dots$ I found one on wolfram alpha, however I am not sure how to derive it; I am also wondering ...
0
votes
0answers
24 views

Encryption and Decryption of Alpahabets to Integers

I'll explain my case with an example. Say, I've 2 words, FOOTBALL FOOD Let f(FOOTBALL) = 845614, f(FOOD) = 74312 and f(FO) = 132 Is there any method to get f'(845614, 2) = 132 and f'(...
0
votes
0answers
184 views

How can I find the sequence of moves which will end the chess-game(only consisting of pawns)? [closed]

The value of (N) for this problem is between [1,100]. There is a chessboard with N rows (numbered 1 through N) and N columns (numbered 1 through N) . Let's denote a cell in row r and column c of the ...
3
votes
2answers
149 views

Finding a pattern, I'm stuck

I have a friend who knows how much I love math, (I imagine new problems just to do the math behind them and to see if I can expand my understanding) and so he brings me the stuff that stumps him. ...
-1
votes
2answers
39 views

Find the number pattern [closed]

Goal: find 1 equation to generate -4,2,10,6,3 on looping Output -4 on 1st iteration Output 2...
2
votes
1answer
43 views

Number of possible unique patterns of $5$ points on an $8\times 8$ grid.

I'm after a specific answer and workings/formula for the number of possible unique patterns that $5$ points can have on an $8\times 8$ grid. The pattern must be unique and not match another pattern ...
1
vote
0answers
127 views

Cross correlation coefficient for 2 matrices (two 2d arrays)

I'm trying to manually calculate cross correlation coefficient for 2 matrices. But I'm not sure how to apply the formula and how it works. Here are my example matrices: Matrix 1 Matrix 2 Any help ...
0
votes
0answers
15 views

Determining the importance of items across sets?

There's a better term for it. Let's say i have a suite of sets - A, B, C, D. Each set contains any number, in a non-important order, of items - 1,2,3,4,5,6 The items may occur any number (0 or more) ...
1
vote
2answers
45 views

Split a list of 24 items into four parts, so you need three out of the four parts to recover the entire list

Imagine you have an ordered list of 24 words, and you want to split the list of words into four parts. You want to set it up so that three out of the four parts are needed in order to recover the ...
0
votes
0answers
26 views

What will be the logic of the answer?

I have this reasoning question (image) So, what I did is I found the number of dots in this, which came out to be: 2 5 11 7 13 19 5 ? 17 And I can't really find what's the pattern in this. ...
1
vote
1answer
531 views

NON-martingale approach to ABRACADABRA problem

The well-known ABRACADABRA problem states (see D. Williams, "Probability with martingales", for example): a monkey is typing letters A-Z randomly and independently of each other, each letter ...
8
votes
1answer
226 views

Avoiding exactly one permutation pattern

Let $n \geq k$. We say that a permutation $\sigma \in S_n$ contains a permutation (or "pattern") $\tau \in S_k$ if there is a substring of $k$ (not necessarily consecutive) elements of $\sigma$ ...
2
votes
1answer
65 views

Getting a specific element of a non-recursive sequence

I have a sequence, starting with $1$. You store the current sequence as a list, then duplicate it. In this copy, you invert it, turning $1$s into $0$s, and $0$s into $1$s. Then, you join it on to the ...
2
votes
0answers
36 views

Probability of matrix equality under modulo (pattern matching)

Probabilistic pattern matching with matrices works like this: For two given strings, $x,y$ where $x\in\{0,1\}^n$ and $y\in\{0,1\}^m$ and $n\ge m$, we want to find the occurrences of $y$ in $x$. ...
1
vote
1answer
125 views

Placing letters in three mailboxes

A mailman has 7 letters that are all the same. He can put them in three mailboxes in any order he wants. How many ways are there to put the letters in the mailboxes? Something different about this ...
0
votes
0answers
21 views

Building an equation (inverse combinatorics?), then identifying the optimal pattern

I have identified an equation, but now I am wanting to know if there is a means of identifying the most efficient pattern to provide the numbers that meet the requirements. Here is the problem: A ...
0
votes
0answers
66 views

Completing sequence pattern

My kid is class 5 He has got a question of patterns The pattern goes on as 13 15 27 42 ..... and have to find the next number with the rule pattern I am unable to decode, thought question is ...
1
vote
1answer
80 views

Distance between patterns of points

I was thinking of the following problem: Imagine I am given two lists of points on a 2D plane. These lists have the same size, i.e. both lists have the same number of points. Now, I want to be able ...
4
votes
4answers
107 views

Special palindromic pattern of $(\frac{10^n-1}{9})^2$

I noticed a repetitive, palindromic pattern when I've performed exponentiation with $10$. That is: $$(\frac{10^n-1}{9})^2 \text{ has a palindromic pattern, }\forall\:n\in [1;9]\:(n\in \mathbb{N})$$ We ...
0
votes
1answer
88 views

How can I create an equation for a pattern?

How can I generally create an equation from a pattern? Take for example this pattern: {X = 15, Y = 0}, {X = 16, Y = 1}, {X = 16, Y = 2}, {X = 17, Y = 3}, {X = 17, Y = 4} This pattern could be ...
2
votes
0answers
166 views

Matching the position of points in 2D space

Considering there is a 2-dimensional array $A$ consisting of point coordinates in two dimension space (as shown in image). There is another array 2-dimension array $B$ also representing the position ...
1
vote
1answer
40 views

Can I Compare Symbol to String

I'm a student majoring in computer science. I'm not sure if I can use the equality sign (=) for a string value. (I can definitely do that in computer code...) So please check the mathematical ...
1
vote
2answers
81 views

How to explain the difference between the following time series?

I am conducting an empirical study for understanding the behavior of different people in a collaborative environment. There are two types of events in my study: A and B. Let's assume A means ...
1
vote
1answer
177 views

Is haskell style pattern matching allowed in conventional mathematics and if not, how do you work out the numerator of an arbitrary rational number?

Is it possible to define a function "Numerator" in the following way? $$N(a/b) = a$$ Or likewise is it possible to define a function "Denominator" like this? $$D(a/b) = b$$ These functions take a ...
0
votes
1answer
84 views

28 dominoes lying in one direction what is the last one? [duplicate]

Peter with a standard double six set lays 28 dominoes in one direction - what will be the last number on the end on then of the last domino? Suppose he plays in both directions and discovers that he ...
3
votes
1answer
177 views

Quantify the similarity between two patterns formed by two sets of spatial locations

Suppose I have two sets of spatial locations $X$ and $Y$ on the plane, each with $n$ locations. The coordinates are $X=\{(x_1, y_1), \dots, (x_n, y_n)\}$ and $Y=\{(u_1, v_1), \dots, (u_n, v_n)\}$. I ...
0
votes
2answers
499 views

How to compute the distance between two vector with different sizes?

I think it's better to start with an example. I have the following vectors: ...
1
vote
0answers
20 views

Count of matching lines in compared patterns - distribution and significance?

Imagine a number of lines of varying thickness, perpendicular to, and distributed over, a fixed distance, d (in many ways similar to those of a standard barcode). Imagine that one such pattern (lets ...
1
vote
0answers
175 views

Matching vertices between two graphs

I have a situation where I have two graphs that are supposed to represent the same underlying topology but represent the underlying topology at different resolutions. My goal is to match vertices ...
-1
votes
1answer
103 views

How to find a pattern

I have a list of objects. Each object has $3$ values that will have a value from $0$ to $100$. I want to know how iI be able to find the pattern that is most common in that list. Object 1: 1-2-3 ...
0
votes
1answer
702 views

Pattern finding algorithms

I am working on a server that will update a list each day. The list will look like the following example. ...
1
vote
1answer
87 views

What is the Right Context of a Word in Formal Langauge Theory?

I am reading this paper and am unable to understand this notation in section 2.2 - The right context of a word $u$ according to a language $W$ is the language {$u^{-1}w$ | $w \in W$}. The ...
0
votes
1answer
57 views

Max number of patterns when extending unique vector?

I'm not sure how to explain this correctly, so I hope the example at the end helps. I have unique vectors of different lengths, and I want to find the maximum number of variations possible of keeping ...