instruction stringlengths 0 29.8k ⌀ |
|---|
null |
I am using a Genetic Algorithm framework to solve a path-finding problem. Specifically, given the following 32x32 maze:
```
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X | X
X | X
X | X
X | G X
X ... |
So in my attempt to convert the following DFA into a regular expression, I ended up with ```(ba)*(ab(ab)*)*(aa(ba)*a)*```. The exercise I'm following wants me to convert the DFA into a regular expression then describe its language in plain English, however, I can't seem to come up with anything for the converted expres... |
Describing the Language of a DFA |
|automata|finite-automata|regular-expressions| |
null |
null |
It is for me unclear how I can derive from a npda whether the lambda-transition means “I don’t care which symbol I read” or “I have read all the symbols”.
For example, see the following automata:
[![enter image description here][1]][1]
If I am correct, the red ones have the first meaning, and the green one the sec... |
Meaning of lambda-transitions in npda |
|automata|context-free|nondeterminism| |
Usually, the first symbol means what you expect to read from the input (1), the second what is the symbol of the top os the stack (2) and the third what you happen with the stack (3).
1. $\lambda$ or $\varepsilon$ means the empty string, so this transition can be used without consuming any symbol from the input, i.... |
Usually, the first symbol means what you expect to read from the input (1), the second what is the symbol of the top os the stack (2) and the third what you happen with the stack (3).
1. $\lambda$ or $\varepsilon$ means the empty string, so this transition can be used without consuming any symbol from the input, i.... |
My problem is to build a machine that decide this language:
{〈A, w〉| A is a DFA and w is the longest word in L(A)}
I know that DFA has finite states and eventually for every word that i simulate on A ,i would get an answer (yes/no) and know if w is in L(A).
I order to know if w is biggest can i build a TM that... |
how to decide this language |
|turing-machines| |
My problem is to build a machine that decide this language:
{〈A, w〉| A is a DFA and w is the longest word in L(A)}
I know that DFA has finite states and eventually for every word that i simulate on A ,i would get an answer (yes/no) and know if w is in L(A).
In order to know if w is biggest can i build a TM tha... |
My problem is to build a machine that decide this language:
{〈A, w〉| A is a DFA and w is the longest word in L(A)}
I know that DFA has finite states and eventually for every word that i simulate on A ,i would get an answer (yes/no) and know if w is in L(A).
In order to know if w is biggest can i build a TM M t... |
Detect whether there is a cycle in the DFA containing a state $q$ such that $q$ is reachable from the initial state and $q$ can reach a final state (this can be done by deleting all states of $A$ that do not satisfy these requirements and looking for a cycle in the resulting graph).
If the answer is affirmative then... |
Detect whether there is a cycle in the DFA containing a state $q$ such that $q$ is reachable from the initial state and $q$ can reach a final state (this can be done by deleting all states of $A$ that do not satisfy these requirements and looking for a cycle in the resulting graph).
If the answer is affirmative then... |
null |
If we let SR be the reverse of a reference string $S$, then the page-fault
rate for the OPT algorithm on S is the same as the page-fault rate for the OPT
algorithm on $S^r$. Similarly, the page-fault rate for the LRU algorithm on $S$ is the
same as the page-fault rate for the LRU algorithm on $S^r$. [Operating Syste... |
If we let $S^r$ be the reverse of a reference string $S$, then the page-fault
rate for the OPT algorithm on S is the same as the page-fault rate for the OPT
algorithm on $S^r$. Similarly, the page-fault rate for the LRU algorithm on $S$ is the
same as the page-fault rate for the LRU algorithm on $S^r$. [Operating Sy... |
As the title says, I've developed my own algorithm that can do so, however mine would take 1-2 seconds searching through an array with 1 million length, however I am very curious if this can be made so much faster like 0.01s or even 0.001 is this mathematically impossible? I've used C++ with vectors and jsons to create... |
Are there algorithms that can find the most repeated values in a very large array in a millisecond? |
|algorithms| |
If we let $S^r$ be the reverse of a reference string $S$, then the page-fault
rate for the OPT algorithm on $S$ is the same as the page-fault rate for the OPT
algorithm on $S^r$. Similarly, the page-fault rate for the LRU algorithm on $S$ is the
same as the page-fault rate for the LRU algorithm on $S^r$. [Operating ... |
As the title says, I've developed my own algorithm that can do so, however mine would take 1-2 seconds searching through an array with 1 million length, however I am very curious if this can be made so much faster like 0.01s or even 0.001 is this mathematically impossible? I've used C++ with vectors and jsons to create... |
One approach is to sort the list, which brings duplicated together. Then you can count the number of duplicates of each item with a simple linear scan. Good sorting algorithms should be extremely fast.
Another approach is to use a hashtable: store each item in a hashtable, along with a count, and when you see an i... |
null |
So in my attempt to convert the following DFA into a regular expression, I ended up with ```((ba)*(ab(ab)*)*(aa(ba)*a)*)*```. The exercise I'm following wants me to convert the DFA into a regular expression then describe its language in plain English, however, I can't seem to come up with anything for the converted exp... |
Here is one possible approach. Introduce boolean variables $x_\ell,y_\ell,z_{\ell,p,r}$, where $\ell$ ranges over locations in the grid, $p$ ranges over polyominoes, and $r$ over rotation amounts (0, 90, 180, 270), with the following meaning:
- $x_\ell$ is true means that $\ell$ is part of the interior region that ... |
If you can define by yourself what “most repeated” values means, then you can use the Space Saving algorithm. See the paper available [here][1] for the details.
The Space Saving algorithm allows you to determine all of the frequent items, also known as heavy hitters, without incurring in false negative (i.e. it’s re... |
If you can define by yourself what “most repeated” values means, then you can use the Space Saving algorithm. See the paper available [here][1] for the details.
The Space Saving algorithm allows you to determine all of the frequent items, also known as heavy hitters, without incurring in false negative (i.e. it’s re... |
Assume that I have a program `Login.c` that I have compiled with `cc` and generated the executable `a.out`. Now, along the questions posed from "Reflections of Trusting Trust", I want to check that `a.out` is the intended executable and nothing else, e.g. that there is no malfunction injected by the build system. There... |
Comparing source code and compiled code for ("topological") equivalence |
|undecidability|compilers|security| |
Here is one possible approach. Introduce boolean variables $x_\ell,y_\ell,z_{\ell,p,r}$, where $\ell$ ranges over locations in the grid, $p$ ranges over polyominoes, and $r$ over rotation amounts (0, 90, 180, 270), with the following meaning:
- $x_\ell$ is true means that $\ell$ is part of the interior region that ... |
(Hope this is correct, I still have to double check it.)
To accept a string, you must start in $q_0$ and end in $q_0$ or in $q_3$.
A path from $q_0$ to $q_0$ can make a cycle throught $q_5$ (so you can have $(ba)^*$) or throught $q_1,q_2,q_3,q_4$ (and so $a(ba)^*a(ba)^*a$), and then you can put these togeter to obt... |
null |
In case anyone is interested, this is the solution implemented with https://github.com/afish/MilpManager
It's inspired by https://cs.stackexchange.com/a/153823/79175 (including the discussions we had in the comments).
Source code:
var integerWidth = 15;
var epsilon = 0.001;
var storeDebugExpression... |
For each 16 TB ssd, you have 40 GB of RAM. I don't know the prices of server-grade hardware, but with consumer-grade one, 40 GB RAM is about \$100, while 16 TB SSD is about \$1000.
Maybe you just need to make a more balanced system instead of spending money on developers in order to make a small economy on hardware? |
For this example: $x^7 + x^5 +1$
1. Look at the degree of the polynomial. In the case of the above example it is 7.
2. Write down all numbers from the degree of the polynomial down to 0. These will correspond to the exponents of $x$ in the polynomial. In our case:
7 6 5 4 3 2 1 0
3. And, finally w... |
null |
"Comparing source code and compiled code for equivalence is an undecidable problem". What does that statement mean?
It means there is no algorithm that, given arbitrary (source) code in programming language $A$ and arbitrary (compiled) code in another programming language $B$, can decide whether both code always be... |
null |
The following statement seems trivial, but how can it be formally proven/argumented?
[![enter image description here][1]][1]
In words: taking the union of the states when reading a symbol ‘a’ from all the possible states in a NFA having read the string ‘w’ from the start state, is the same as taking all the possible ... |
Extended transition function in NFA |
|formal-languages|regular-languages|finite-automata|transition-systems| |
You can show that all states in the set on the left hand side are included in the set on the right hand side, and vice-versa.
In particular, if $q$ is in the left hand union then there is some state $s \in \delta^*_N(q_0, w)$ such that $q \in \delta^*_N(s,a)$. By definition of $\delta^*_N$, we have that $q \in \de... |
The following statement seems trivial, but how can it be formally proven/argumented?
[![enter image description here][1]][1]
In words: taking the union of the states when reading a symbol ‘a’ from all the possible states in a NFA having read the string ‘w’ from the start state, is the same as taking all the possible ... |
null |
You can show that all states in the set on the left hand side are included in the set on the right hand side, and vice-versa.
$s \in \delta_N^*(q, w)$ if and only if there is some path $\pi(q,s,w)$ from state $q$ to state $s$ in $N$ such that the concatenation of the edge labels (which might be $\varepsilon$) is equ... |
The following statement seems trivial, but how can it be formally proven/argued?
$$\bigcup_{s \in \delta_{N}^{*}\left(q_{0}, w\right)} \delta_{N}^{*}(s, a) \;\equiv\; \delta_{N}^{*}\left(q_{0}, w a\right)$$
In words: taking the union of the states when reading a symbol ‘a’ from all the possible states in a NFA ha... |
**Statement:**
Given any dfa $M$, application of the procedure 'reduce' (see below) yields another dfa $\hat{M}$ such that $M$ and $\hat{M}$ are equivalent. Furthermore $\hat{M}$ is minimal in the sense that there is no other dfa with a smaller number of states that also accepts $L(M)$
**First some background inf... |
minimal DFA transition function clearification |
|formal-languages|regular-languages|finite-automata| |
I was wondering if there is an approach to sort the sums of k integers in a set of n integers; which would be a generalization of the x + y sorting problem.
Or even without generating the whole set of k sums, would it be possible to generate de m largest k sums in a set of n non negative integers? |
X + Y sorting in n dimension |
|algorithms|sorting| |
All British citizens are provided with a National Health Service (NHS) number either at birth or when they first register with an NHS doctor. According to the [NHS Number wikipedia page](https://en.wikipedia.org/wiki/NHS_number), the 10 digit number contains a checksum digit, which is calculated using the following alg... |
What is the advantage of this checksum method in NHS numbers? |
|algorithms| |
New here,
So I am well aware that recursively enumerable sets (which are subsets of $\mathbb N$) are closed under intersection. What is more interesting is whether or not the cardinality of the intersection is computable/decidable?
That is, given two recursively enumerable sets $A$, $B$, construct an algorithm ... |
Cardinality of Intersection of two recursively enumerable sets? |
|computability|undecidability|decidability| |
**Statement:**
Given any dfa $M$, application of the procedure 'reduce' (see below) yields another dfa $\hat{M}$ such that $M$ and $\hat{M}$ are equivalent. Furthermore $\hat{M}$ is minimal in the sense that there is no other dfa with a smaller number of states that also accepts $L(M)$
**First some background inf... |
**Statement:**
Given any dfa $M$, application of the procedure 'reduce' (see below) yields another dfa $\hat{M}$ such that $M$ and $\hat{M}$ are equivalent. Furthermore $\hat{M}$ is minimal in the sense that there is no other dfa with a smaller number of states that also accepts $L(M)$
**First some background inf... |
New here,
So I am well aware that recursively enumerable sets (which are subsets of $\mathbb N$) are closed under intersection. What is more interesting is whether or not the cardinality of the intersection is computable/decidable?
That is, given two recursively enumerable sets $A$, $B$, is $|A \cap B|$ always ... |
In his Quantum Computing Since Democritus, Scott Aaronson outlined a proof sketch of Blum's Speedup Theorem which roughly looks like the following.
Given an enumeration of Turing Machines $\{M\}_{i \in \mathbb{N}}$. Let $S_i = \{M_1, ..., M_i\}$. We can construct a computable function $f(n)$ such that if $f(n)$ can ... |
Proof sketch of Blum's Speedup Theorem |
|complexity-theory|time-complexity| |
How can I prove this: f(n) = o(g(n)) if and only if f(n) = O(g(n)), but f(n) ≠ Θ(g(n)) ? |
Prove f(n) = o(g(n)) if and only if f(n) = O(g(n)), but f(n) ≠ Θ(g(n)) |
|complexity-theory|asymptotics|big-o-notation| |
The general purpose of checksums is to allow errors in transcription to be detected by means of a simple algorithm applied to the number itself, and without access to any other information (such as access to central records).
Error-detection methods require a certain amount of redundancy in the data, and there is ge... |
I have lived my academic career thinking these two terms were interchangeable but something arose in me that said they're distinct. Are there any logical, formal definitions distinguishing between the two? |
What's the difference between computation and symbolic manipulation? |
|definitions| |
Interesting question.
Claim: A finite recursively-enumerable set is decidable.
Proof: In fact, a finite set is decidable.
Claim: It is computable to find $|A\cap B|$ given two finite sets $A$ and $B$.
Proof: List all elements in $A$. For each one of them, check whether it is in $B$. Return the number of a... |
I am well aware that recursively enumerable sets (which are subsets of $\mathbb N$) are closed under intersection. What is more interesting is whether or not the cardinality of the intersection is computable/decidable?
That is, given two recursively enumerable sets $A$, $B$, is $|A \cap B|$ always decidable/computa... |
Is it computable to find the cardinality of intersection of two recursively enumerable sets? |
null |
Here is one possible approach. Introduce boolean variables $x_\ell,y_\ell,z_{\ell,p,r}$, where $\ell$ ranges over locations in the grid, $p$ ranges over polyominoes, and $r$ over rotation amounts (0, 90, 180, 270), with the following meaning:
- $x_\ell$ is true means that $\ell$ is part of the interior region that ... |
null |
I am not familiar with yotastore or how NVMEs work. However, let's assume the following (correct me if I am wrong):
You have:
- 64 bit pointer
- 32 bit of metadata
You don need the hash, I assume.
Instead of a normal btree you could use a [critbit tree][1].
Critbit trees are like btree but the key (= ... |
The result is false. For example, consider the following functions:
- $f(n) = \left\{\begin{array}{rr}n&\text{if }n\text{ is even}\\
n^2&\text{otherwise}\end{array}\right.$;
- $g(n) = n^2$.
Then $f \in \mathcal{O}(g)$ and $f\notin \Theta(g)$, but $f\notin o(g)$ either. |
I am not familiar with yottastore or how NVMEs work. However, let's assume the following (correct me if I am wrong):
You have:
- 64 bit pointer
- 32 bit of metadata
You don't need the hash, I assume, that was only part of your proposed solution?
Instead of a normal btree you could use a [critbit tree][1]... |
The result is false. For example, consider the following functions:
- $f(n) = \left\{\begin{array}{ll}n&\text{if }n\text{ is even}\\
n^2&\text{otherwise}\end{array}\right.$;
- $g(n) = n^2$.
Then $f \in \mathcal{O}(g)$ and $f\notin \Theta(g)$, but $f\notin o(g)$ either. |
You cannot "cache all the results" because your program (or description of Turing machine) would need to be infinite. You can only cache a fixed number of results. In your example $i$ needs to be fixed. You cannot pick, e.g., $i=\frac{n}{2}$ and lower the complexity from $O(n^2 2^n)$ to $O(n^2 2^{n/2})$.
On an unre... |
You cannot "cache all the results" because your program (or description of Turing machine) would need to be infinite. You can only cache a fixed number of results. In your example $i$ needs to be fixed. You cannot pick, e.g., $i=\frac{n}{2}$ and lower the complexity from $O(n^2 2^n)$ to $O(n^2 2^{n/2})$.
On an unre... |
null |
I am going through the book "Network Flows" by Ahuja et al. In chapter 19.2 "MAXIMUM WEIGHT CLOSURE OF A GRAPH", I find this example of turning a vertex-weighted (positive or negative) digraph into a flow network. The min-cut in the flow network is supposed to correspond to a max-weight closure in the original graph.
... |
Finding maximum weight closure of a graph using min-cut |
|algorithms|graphs|combinatorics|network-flow| |
Given a turing machine with some states, how can I recognize all halting states of that machine?
I think that I should go over each state and check if there is a transition that is not defined for that state with one (or more) of the tape alphabet symbols (also containing the blank symbol).
Would this be a good ... |
How to recognize all halting states of a turing machine? |
|formal-languages|turing-machines|automata| |
Usually, the first symbol means what you expect to read from the input (1), the second what is the symbol of the top os the stack (2) and the third what you happen with the stack (3).
1. $\lambda$ or $\varepsilon$ means the empty string, so this transition can be used without consuming any symbol from the input, i.... |
null |
null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.