## Draw an FSA that recognizes: (A∗ | AB+). (The bar outscopes the other operators, so its equal to: (A∗) | (AB+).) Use as few states possible - dfa

I've attached what I have. My problem is that I don't know if its correct and if I've even used the fewest states possible to answer this question. Really appreciate any help on what I currently did wrong this is what i have currently

I would start by creating two FSAs, one for each of the branches.
For A* you only need one state.
For AB+ you need three states.
Then you merge the two. Assuming it does not have to be deterministic, the total FSA ends up with three states as well, two of which are final states.
As you tagged your question dfa — a deterministic FSA would need 4 states in total:
Start state: 1; Final States: 1,2,3,4
Transitions:
1 - a -> 2
2 - a -> 4
2 - b -> 3
3 - b -> 3
4 - a -> 4
That is a DFA that recognises (a*|ab+):

## Related

### How to check n-puzzle with two blanks is Solvable?

I have modified the question on n-puzzle. In this scenario, the puzzle has two blanks instead of one blank. Initial State 3 5 1 4 6 - 7 2 - Goal State - 1 7 3 2 - 5 6 4 Is there any algorithm that I can use for this?

All existing algorithms that solve the regular sliding tile puzzle (such as A* or IDA*) can solve this variant as well. The puzzle with multiple blanks is equivalent to a pattern database for the sliding-tile puzzle - the exact solution to the puzzle with some pieces replaced with blanks can be used as a heuristic for the original puzzle with only a single blank. (To be precise they are equivalent to additive pattern databases. You can combine several together and add their heuristic values as long as the action cost of swapping two blanks is 0 and none of the tiles are duplicated.)

### TSQL List all the constituent bitwise integers within a larger integer

Firstly, apologies for not using the correct terminology here. I don't actually know the correct terms, and thus have failed miserably to find a solution. Please accept my example as the question, and I'll update the question accordingly if somebody can enlighten me (or delete and read the actual solution where it exists). So far my research has only yielded comparisons of single bits within the whole, rather than showing all. Given a set of integers: ELEMENT ----------- Bricks 1 Plaster 2 Cement 4 Concrete 8 I have a result set that provides how these materials are used: MIXTURE ELEMENTS ---------------------- MixtureFoo 3 MixtureBar 7 MixtureBaz 11 I need to show the final set of mixtures, but with each constituent element listed that is used in the respective mixture: MIXTURE ELEMENTS ELEMENT ------------------------------ MixtureFoo 3 1 MixtureFoo 3 2 MixtureBar 7 1 MixtureBar 7 2 MixtureBar 7 4 MixtureBaz 11 1 MixtureBaz 11 2 MixtureBaz 11 8

You could use bitwise operations: SELECT * FROM t JOIN ELEMENT e ON t.ELEMENTS & e.w = e.w ORDER BY MIXTURE, w; db<>fiddle demo

### pattern recognition - "is this a pattern?"

I have a large vector of numbers, say 500 numbers. I would like a program to detect patterns (reoccurrence in this case) in such vector based on following rules: A sequence of numbers is a pattern if: The size of the sequence is between 3 and 20 numbers. The RELATIVE positions of the numbers in sequence is repeated at least one other time in a vector. So let's say if I have a sequence (1,4,3) and then (3,6,5) somewhere else in the vector then (1,4,3) is a pattern. (as well as (2,5,4), (3,6,5) etc.) The sequences can't intersect. So, a vector (1,2,3,4,5) does not contain patterns (1,2,3) and (3,4,5)(we can't use the same number for both sequences). However, (1,2,3,3,4,5) does contain a pattern (1,2,3) (or (3,4,5)) A subset A of a pattern B is a pattern ONLY IF A appears somewhere else outside B. So, a vector (1,2,3,4,7,8,9,2,3,4,5) would contain patterns (1,2,3,4) and (1,2,3), because (1,2,3,4) is repeated (in a form of (2,3,4,5)) and (1,2,3) is repeated (in a form (7,8,9)). However, if the vector was (1,2,3,4,2,3,4,5) the only pattern will be (1,2,3,4), because (1,2,3) appeares only in context of (1,2,3,4). I'd like to know several things: First of all I hope the rules don't go against each other. I made them myself so there might be a clash somewhere that I didn't notice, please let me know if you do notice it. Secondly, how would one implement such system in the most efficient way? Maybe someone can point out towards some particular literature on the subject? I could go number by number starting with searching a sequence repetition for all subsets of 3, then 4,5 and till 20. But that seems to be not very efficient.. I am interested in implementation of such system in C, but any general guidance is very welcome. Thank you in advance!

Just a couple of observations: If you're interested in relative values, then your first step should be to calculate the differences between adjacent elements of the vector, e.g.: Original numbers: 1 4 3 2 5 1 1 3 6 5 6 2 5 4 4 4 1 4 3 2 ********* ********* ********* ********* Difference values: 3 -1 -1 3 -4 0 2 3 -1 1 4 3 -1 -3 0 -3 3 -1 -1 ****** ****** ****** ****** Once you've done that, you could use an autocorrelation method to look for repeated patterns in the data. This can be computed in O(n log n) time, and possibly even faster if you're only concerned with exact matches.

### Does the position of the blank in an n-puzzle solution affect the set of valid puzzles?

I'm having trouble with my n-puzzle solver. Thought it was working, but it turns out it is solving insoluble puzzles. I've tried to trace it, but that's a lot of tracing and so far I see no cheating. I think I understand the algorithm for determining solubility, and my implementation agrees with the odd/even parity of some examples from the web... that is to say, when I count up the number of tiles after a given tile that are smaller than it, for every tile, and then add the row index of the blank tile, I get the same odd or even number as others have gotten. So a thought that has occurred to me. In my model of, say, the 8-puzzle, my solution state is: _ 1 2 3 4 5 6 7 8 Rather than 1 2 3 8 _ 4 7 6 5 Or 1 2 3 4 5 6 7 8 _ As it is in some other formulations. Could this be affecting which puzzles are soluble and which are not? Thanks! z.

In general, yes: If a configuration is solvable to the standard solution, it will not be solvable to an unsolvable configuration. In particular, it depends on the exact configuration you're using as a solution. You will need to check to see if you can solve from that configuration to the standard one. EDIT: This of it this way: Let A be the standard solution. Let B be your preferred solution. Let C be your starting configuration. If you can get from A to B, and you can get from C to A, then you can get from C to B. But if you can't get from A to B, and you can get from C to A, then you can't get from C to B.

### Taguchi Method Programming Example

I've been asked to research some programming related to the "Taguchi Method", especially as it relates to Multi-variant testing. This is one of the first subjects I've tried to research that I've found zero, nada, zilch, code examples for, especially considering its mathematical basis. I've found some books describing the math involved but it looks like I'm going to be doing some math brush up unless I can find some code examples I can relate to. Is this one of those rare things that once you work out the programming, it's so valuable that no one shares? Or do I just fail at Taguchi + google?

Taguchi designs are the same thing as covering arrays. The basic idea is that if you have F data "fields" and every one can have N different values, it is possible to construct NF different test cases. A covering array is basically a set of test cases that together cover all possible pairwise combinations of two field values, and the idea is to generate as small one as possible. E.g. if F=3 and N=3, you have 27 possible test cases, but it is enough to have nine test cases if you aim for pairwise coverage: Field A | Field B | Field C --------------------------- 1 1 1 1 2 2 1 3 3 2 1 2 2 2 3 2 3 1 3 1 3 3 2 1 3 3 2 In this table, you can choose any two fields and any two values and you can always find a row that contains the chosen values for the chosen fields. Generating Taguchi designs in general is a difficult combinatorial problem. You can generate Taguchi designs by various methods: Branch and bound Stochastic search (e.g. tabu search or simulated annealing) Greedy search Specific mathematical constructions for some specific structures