instruction stringlengths 0 29.8k ⌀ |
|---|
Reducing BB to SMR and vice versa |
|distributed-systems| |
Let's say that we have a regular language $L1$ that is described by Right regular grammar. Now, assume we have a Left regular grammar, can we describe the same language $L1$ or the left regular grammar would produce the reverse of all strings present in $L1$?
My understanding is that Left regular language would prod... |
Do Left regular grammar describe a language containing the reverse of the strings described by the right regular grammar for another language? |
|formal-grammars| |
If you look at the definition of NP, every problem in P is obviously in NP. P means “all instances can be solved in polynomial time”, NP means “instances with a yes answer and a useful hint can be solved in polynomial time”.
Since P is a subset of NP, P ≠ NP means some problems in NP cannot be solved in polynomial t... |
We define the set S as $\{(s_1, f_1), (s_2, f_2), ..., (s_i, f_i)\}$, where each $f_i$ is the frequency that $s_i$ is repeated in the multiset T. How many ways can we partition the multiset T into different partitions, where each partition includes distinct part/segments?
For example, given $S = \{(s_1, 1), (s_2, 2)... |
We define the set S as $\{(s_1, f_1), (s_2, f_2), ..., (s_i, f_i)\}$, where each $f_i$ is the frequency that $s_i$ is repeated in the multiset T. How many ways can we partition the multiset T into different partitions, where each partition includes distinct part/segments? A distinct part/segment includes distinct $s_i$... |
In Meijer, Fokkinga and Patersons "Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire" the ∇ operator for sum types is introduced which removes the tags from its argument:
∇ \_|_ = \_|_
∇ (i, x) = x
What is the type of this operator? Something like
A|B -> A U B
seems like it leads to... |
Ambiguous type of triangle operator for sum types |
|type-theory|functional-programming| |
In Meijer, Fokkinga and Patersons "Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire" the ∇ operator for sum types is introduced which removes the tags from its argument:
∇ \_|_ = \_|_
∇ (i, x) = x
What is the type of this operator? Something like
A|B -> A U B
?
As the article is... |
Ambiguous type of "triangle" operator for sum types |
|type-theory|functional-programming|haskell| |
{"Voters":[{"Id":755,"DisplayName":"D.W."}],"SiteSpecificCloseReasonIds":[]} |
I'm reading some old notes from a course on Turing Machines and I've bumped into the following question:
> Is the following language decidable? The language formed by the set of all Turing Machines whose languages can be accepted by a Turing Machine with at most 37 states
My assumption is that the question boils ... |
Decidability of the minimum number of states a Turing Machine needs to accept a language |
|turing-machines|undecidability| |
|type-theory|functional-programming|category-theory|haskell| |
I have just started learning about CSP and NLP, for which I have to write a review paper of some research articles.
The problem is that when a searched for research articles on some trusted digital libraries with the keywords CSP and NLP, there weren't many results that were related to both.
Do you have any idea... |
Constraint satisfaction problems in Natural language processing |
|artificial-intelligence|natural-language-processing|constraint-satisfaction|research| |
Let's say that we have a regular language $L_1$ that is described by a right regular grammar. Now, assume we have a left regular grammar, can we describe the same language $L_1$ or would the left regular grammar produce the reverse of all strings present in $L_1$?
My understanding is that the left regular language w... |
Yes, your understanding is correct:
- Reversing the rules of your right regular grammar for $L_1$ will produce a left regular grammar for $L_2$, the language consisting of the reverses of the strings in $L_1$.
- Every right regular grammar can be reversed in this way to form a left regular grammar, and vice versa... |
The mapping process is highly dynamic. Every process utilizes some part(s) of its virtual address space, which can be mapped to RAM or to disk. Mapping tables are used to establish the connection and are constantly adjusted to optimize memory accessibility (the most "active" pages should reside in RAM).
It is except... |
null |
The mapping process is highly dynamic. Every process utilizes some part(s) of its virtual address space, which can be mapped to RAM or to disk. Mapping tables are used to establish the connection and are constantly adjusted to optimize memory accessibility (the most "active" pages should reside in RAM).
On 32 bits O... |
As mentioned in the comments, this can be solved by [dynamic programming](https://cs.stackexchange.com/tags/dynamic-programming/info). I'm only handling one of the two games, as the other is symmetric. (They can be solved using mutual recursion.)
Your array can be represented, via modulo 2, as simply the number o... |
I was not able to find the exact resource of information to help me answer these problems.
The first problem is deciding whether a graph (which we represent as a flow network) has a single min-cut, or there could be multiple min cuts with the same maximum flow value, I've yet to encounter a well explained algorithm ... |
Deciding whether a flow graph has a single min-cut, and edge-disjoint paths |
|network-flow|path| |
**Procedural/functional programming is in no way weaker than OOP**, even
without going into Turing arguments (my language has Turing power and
can do anything another will do), which do not mean much. **Actually, object oriented techniques were first experimented in languages that did not have them built-in.** In th... |
null |
Say there was a decision problem which was solved optimally in polynomial time on a non-deterministic Turing machine, and verifiable in polynomial time on a deterministic TM, but would not halt when being solved optimally on a DTM. Would that problem be in NP, or is solution decidability on both NDTMs and DTMs a requir... |
Is a problem in NP if it runs in P time on a NDTM, but doesn’t halt on a DTM? |
|complexity-theory|turing-machines|computability|np|halting-problem| |
null |
I disagree with seeing an opposition between procedural programming and object-oriented programming.
Procedural programming means that the program describes explicitly (and implicitly by means of loops and recursion) the sequence of operations to be performed. That form of programming heavily relies on program *stat... |
Is a problem in NP if it runs in P time on a NDTM, verifiable in P on a DTM, but solution doesn’t halt on a DTM? |
I fail to see any difficulty in this exercise.
Scan every row in turn, in any order. In a row, scan every column from left to right (or conversely), start a block and increment the counter when you meet a white and end the block when you meet a black or the end of the row.
Scan every column in turn, in any order.... |
I fail to see any difficulty in this exercise.
Scan every row in turn, in any order. In a row, scan every column from left to right (or conversely), start a block and increment the counter when you meet a white, and end the block when you meet a black or the end of the row.
Scan every column in turn, in any order... |
As DTMs and NDTMs are equivalent, every problem that can be decided by a NDTM can also be decided by a DTM.
Heres a informal explanation for NP:
A deterministic turing machine can run a nonterministic program (in NP) by attempting all of the possible paths of a nondeterministic turing machine successively either u... |
As DTMs and NDTMs are equivalent, every problem that can be decided by a NDTM can also be decided by a DTM.
Heres a informal explanation for NP:
A deterministic turing machine can run a nonterministic program (in NP) by attempting all of the possible paths of a nondeterministic turing machine successively either u... |
As DTMs and NDTMs are equivalent, every problem that can be decided by a NDTM can also be decided by a DTM.
Heres a informal explanation for NP:
A deterministic turing machine can run a nonterministic program (in NP) by attempting all of the possible paths of a nondeterministic turing machine successively either u... |
It means that, given an implementation of SMR, you can implement BB. For this, have each node in BB play both the role of an SMR server and the role of an SMR client. Then use the client interface to emulate broadcasting and delivering messages. |
***Pumping Lemma for Regular Languages***
Pumping Lemma for Regular Languages: If $A$ is a regular language, then there is a number $p$ ( the pumping length ) where if $s$ is any string in $A$ of length atleast $p$, then $s$ may be divided into three pieces, $s=xy$, satisfying the following conditions:
1) $for \ ea... |
When applying pumping lemma for regular languages to prove that a given language is non regular, do we show that pumping fails for all $i$ or one $i$? |
|pumping-lemma| |
The problem is whether a graph (which we represent as a flow network) has a single min-cut, or there could be multiple min cuts with the same maximum flow value, I've yet to encounter a well explained algorithm for solving this problem, let alone a complexity anaylsis or proof.
I was not able to find the exact resou... |
Decide whether a flow graph has a single min-cut |
|algorithms|network-flow|minimum-cuts| |
null |
This is a question in my text book that I cannot understand the solution provided for that:
In each case below, give a simple descreption of the smallest set of languages that contains all the "basic" languages $\varnothing$,$\{\Lambda\}$, and $\{\sigma\}$ (for every $\sigma \in \Sigma$) and is closed under the spec... |
Why these languages are closed under union or concatenation? |
|formal-languages|closure-properties| |
Assuming the rest of the proof is formulated correctly, showing that every $xyz$ division fails to be pumped for at least a single value of $i$ is sufficient. To see this, let's inspect the formal definition of the pumping lemma, which states the following: (note the highlighted quantifiers)
For *every* regular lang... |
Hint:
>! How many states does it take to recognize the language $\Sigma^*$?
A further hint:
>! Is it easy or hard to test whether a given Turing machine accepts $\Sigma^*$? |
I've been struggling with this analysis of algorithms notion for a few hours now in an introductory course. Let us define a function $N(n)$ for positive integer $n$ as the number of times performing $n=log_7(n)$ yields $\leq 1$. So $N(1)=0, N(7)=1, N(7^7)=2$, et cetera.
I'm asked to find a good algorithm for computi... |
Say there was a decision problem which was solved optimally in polynomial time on a non-deterministic Turing machine, and verifiable in polynomial time on a deterministic TM, but would not halt when being solved optimally on a DTM. Would that problem be in NP, or is solution decidability on both NDTMs and DTMs a requir... |
If you're talking about a certain _residual graph_, the cut is unique, but in the flow network, there can be many (exponentially, even) minimum cuts.
Consider a simple path with $n$ vertices, each edge with capacity 1. There are $n-1$ minimum cuts, one for each edge. But in the residual graph, you will always get th... |
Say there was a decision problem which was solved optimally in polynomial time on a non-deterministic Turing machine, and verifiable in polynomial time on a deterministic TM, but would not halt when being solved optimally on a DTM. Would that problem be in NP, or is solution decidability on both NDTMs and DTMs a requir... |
null |
A simple question, but I can't find an answer in quite the form I'm looking for:
Assume $\mathsf{P} \neq \mathsf{NP}$, and thus $\mathsf{P} \subsetneq \mathsf{NP}$. If we have $L \in \mathsf{NP}$ and $L \notin \mathsf{P}$, does that imply that there is no algorithm for $L$ which runs in $O(n^k)$ steps for all inputs... |
null |
We have sets in different levels here: sets of words (languages) and sets of languages.
To avoid confusion I will call the latter a "family" of languages.
A family of languages $\mathcal F$ is closed under an (binary) operation $\star$ if for we apply $\star$ to any pair of languages $K,L\in \mathcal F$ also the re... |
null |
The algorithm used to solve this problem is the simplex algorithm. This is an efficient algorithm which can solve linear programs in polynomial time. The algorithm starts with an initial feasible solution to the problem and then iteratively improves it until a maximum or minimum is found. This can be done by using the ... |
In the book `Artificial Intelligence a Modern Approach 4th edition`, the author claims that the A* algorithm is cost-optimal if the heuristic function is `admissible` (never overestimates the remaining true cost).
Additionally, if the heuristic is `consistent` (obeying the triangle inequality by using a neighboring ... |
Optimality of A* algorithm |
|artificial-intelligence|board-games|a-star-search| |
Note that the number of vectors $v \in \mathbb{Z}^n$ such that $v \ge 0$ and $1^\top v = a$ is (by a stars-and-bars argument) exactly
$${a+n-1 \choose n -1}.$$
The number of such vectors with $v_1=b$ is exactly
$${a-b+n-2 \choose n-2}.$$
Therefore, the probability that $v_1=b$ is exactly
$${{a-b+n-2 \cho... |
null |
Answer these two questions: How many iterations when n = 1 billion? How many iterations when n = -1?
With that you should have no problem answering your question. |
null |
null |
what is your formula for g? From your result it looks like amount of nodes visited.
That cost function will result in more extraneous diagonals. Because going diagonally down left followed by diagonally down right has the exact same cost as going down twice.
However if instead you scale de diagonal distance by (s... |
Let's say that we have a context free grammar G, which is not in chomsky normal form, and we need to convert it to chomsky normal form.
The steps involved in the conversion are as follows:
1) Add a new start variable and point it to the old start variable
2) Remove all of the empty rules, except for the empty rule... |
What should be the order of eliminating empty rules and unit rules when converting context free grammar to chomsky normal form? |
|formal-grammars|normal-forms| |
null |
I know that the offset is based off of the line size for a cache. I have seen the example: "32-btye line size would use the last 5-bits (i.e. $2^5$) off the address as the offset into the line" but I do not understand the process used to determine this. |
The 32 addresses mapped to the cache line could be for instance
0b00100000010111100101100111000000
0b00100000010111100101100111000001
0b00100000010111100101100111000010
0b00100000010111100101100111000011
0b00100000010111100101100111000100
...
0b00100000010111100101100111011101
... |
The idea is simply find a single min-cut $(S, T)$, then increase each one (seperately) of its crossing edges' capacity by a "tiny-tiny" $\epsilon>0$ then run min-cut algorithm again and check if there's any difference.
If there's another (let's a single one W.L.O.G) min-cut $(S', T')$, meaning (inter alia) there exi... |
null |
Here is a simple algorithm that determines whether a flow network $G=(V, E, c)$ with source $s$ and sink $t$ has a single min-cut or not.
1. Find a maximum flow $f$ of $G$. Let $R_f$ be the residual network of $G$ with respect to $f$.
2. Let $X$ be the set of all nodes that are reachable from $s$ in $R_f$.
3. Let ... |
The length of the shortest $s$-$t$ path equals the maximum tension between $s$ and $t$ |
|graphs|optimization|shortest-path|linear-programming| |
null |
I have x and y values to plot the curve and I need to find a tangent line of slope 1 that intersects the curve and the point at which it intersects. I was trying to do polynomial and exponential regression to model the data (>6000 data points) and fit the curve in R but cannot get it to work. It fits a majority of the ... |
How to find tangent line on a curve of unknown function? |
|graphs| |
null |
null |
So in my "Advanced algorithms" course, we were taught about the "self-organizing list" data structure. The professor showed the following three heuristic algorithms: Frequency Count, Move to Front and Transpose.
Looking online, I could not find any other "popular", "common" or "used" heuristic algorithms. Are there ... |
What are common heuristic algorithms of self-organizing list? |
|algorithms|data-structures|linked-lists| |
Here is a simple algorithm that determines whether a flow network $G=(V, E, c)$ with source $s$ and sink $t$ has a single min-cut or not.
1. Find a maximum flow $f$ of $G$. Let $R_f$ be the residual network of $G$ with respect to $f$.
2. Let $X$ be the set of all nodes that are reachable from $s$ in $R_f$.
3. Let ... |
Consider a truncated hexagonal grid, with some hexagons lit up, such as the one shown below:
[![truncated hexagonal grid, with some hexagons lit up][1]][1]
Here the red, green, and blue hexagons are lit up while the desatured gray, gray, and other gray hexagons are not lit up. The distinction between red, green, ... |
Lights-out! on a hex grid with buttons on nodes and lights on faces |
Here is a simple algorithm that determines whether a flow network $G=(V, E, c)$ with source $s$ and sink $t$ has a single min-cut or not.
1. Find a maximum flow $f$ of $G$. Let $R_f$ be the residual network of $G$ with respect to $f$.
2. Let $X$ be the set of all nodes that are reachable from $s$ in $R_f$.
3. Let ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.