instruction
stringlengths
0
29.8k
⌀
|reference-request|formal-grammars|parsers|
Follow or [lookahead](https://en.wikipedia.org/wiki/LR_parser#Lookahead_Sets) sets are a standard concept in compiler theory. I would expect every textbook on the topic to contain an algorithm for them; as for online source, try [this one](http://plus.kaist.ac.kr/~choe/cs522/cs522/pdf/5par-SLL(k).pdf).
null
Follow or [lookahead](https://en.wikipedia.org/wiki/LR_parser#Lookahead_Sets) sets are a standard concept in compiler theory. I would expect every textbook on the topic to contain an algorithm for them; as for online source, try [this](http://www.larc.usp.br/~pbarreto/LR.pdf) or [that one](http://plus.kaist.ac.kr/~cho...
Let $\emptyset \neq C \subset \mathrm{RE}$ and let $L=\{<\!M\!>|L(M) \in C \}$. suppose that $<\!M_{\text{loopy}}\!>\, \in L$, where $M_{\text{loopy}}$ is a TM that never halts. I wonder if it is possible that $L \in \mathrm{RE}$? $(\mathrm{RE}$ is the set of the recursive enumerable languages$)$. By Rice theorem...
Let $C$ be a non-empty set of recursively enumerable languages ($\emptyset \subsetneq C \subsetneq \mathrm{RE}$) and let $L$ be the set of encodings of Turing machines that recognize some language in $C$: $$L=\{\langle M \rangle \mid L(M) \in C \}$$ Suppose that $\langle M_{loopy}\rangle \in L$, where $M_{loopy}$ is...
Let $C$ be a non-trivial set of recursively enumerable languages ($\emptyset \subsetneq C \subsetneq \mathrm{RE}$) and let $L$ be the set of encodings of Turing machines that recognize some language in $C$: $$L=\{\langle M \rangle \mid L(M) \in C \}$$ Suppose that $\langle M_{loopy}\rangle \in L$, where $M_{loopy}$ ...
No, that is not possible. There is an extended version of Rice's theorem¹ to prove an index set is not recursively enumerable. The theorem states that if your $C$ contains a language $L_1$ which has a proper superset $L_2$ *not* in $C$, then $L \notin \mathrm{RE}$. The intuition is that no algorithm can separate enc...
Can the encodings set of a non-trivial class of languages which contains the empty set be recursively enumerable?
No, that is not possible. There is an extended version of Rice's theorem¹ to prove an index set is not recursively enumerable. In your notation, the theorem states that if a (non-trivial) $C$ contains a language $L_1$ which has a proper superset $L_2$ *not* in $C$, then $L \notin \mathrm{RE}$. The intuition is that ...
null
Let $C$ be a non-trivial set of recursively enumerable languages ($\emptyset \subsetneq C \subsetneq \mathrm{RE}$) and let $L$ be the set of encodings of Turing machines that recognize some language in $C$: $$L=\{\langle M \rangle \mid L(M) \in C \}$$ Suppose that $\langle M_{loopy}\rangle \in L$, where $M_{loopy}$ ...
If the input graph is undirected: -- * If the source vertex $s$ and target vertex $t$ are in different components of the graph, then there are no walks from $s$ to $t$. * If $s$ and $t$ are in the same component, and that component has only one vertex (so in particular, $s=t$), then there is exactly one walk fro...
|algorithms|optimization|greedy-algorithms|
> **Possible Duplicate:** > [How to use greedy algorithm to solve this?](http://cs.stackexchange.com/questions/2188/how-to-use-greedy-algorithm-to-solve-this) <!-- End of automatically inserted text --> You are given $n$ integers $a_1, \ldots, a_n$ all between $0$ and $l$. Under each integer $a_i$ you should writ...
{"OriginalQuestionIds":[2188],"Voters":[{"Id":98,"DisplayName":"Raphael"}]}
Let $C$ be a non-trivial set of recursively enumerable languages ($\emptyset \subsetneq C \subsetneq \mathrm{RE}$) and let $L$ be the set of encodings of Turing machines that recognize some language in $C$: $$L=\{\langle M \rangle \mid L(M) \in C \}$$ Suppose that $\langle M_{loopy}\rangle \in L$, where $M_{loopy}$ ...
Let $f$ and $g$ be two functions and $p$ a number. Consider the following program: Recurs(v,p) : find s < v such that f(s,v) < v/2 and g(s,v-s) < p if no such s exists then return v else if s < v/4 then return v-s U Recurs(s,p) else if s > v/4 then retur...
Follow or [lookahead](https://en.wikipedia.org/wiki/LR_parser#Lookahead_Sets) sets are a standard concept in compiler theory. I would expect every textbook on the topic to contain an algorithm for them; as for online resources, try [this](http://www.larc.usp.br/~pbarreto/LR.pdf) or [that one](http://plus.kaist.ac.kr/~...
How to use a greedy algorithm to find the non-decreasing sequence closest to the given one?
**Teach an algorithms class.** Or perhaps even better: **write an algorithms textbook.**
null
I first asked this question at cstheory, but they suggested to ask my question here, so here it goes ... I'm working on my masters thesis and I need to have theoretical value of the (average) speed gain that a quadcore processor brings compared to a singlecore processor, when they both use the same frequency. So for...
Theoretical speed gain of quad core vs. single core
|computer-architecture|performance|
In short: how are type systems categorised in academic contexts; particularly, where can I find reputable sources that make the distinctions between different sorts of type system clear? In a sense the difficulty with this question is not that I can't find an answer, but rather that I can find too many, and none sta...
Categorisation of type systems (strong/weak, dynamic/static)
|reference-request|type-theory|
In short: how are type systems categorised in academic contexts; particularly, where can I find reputable sources that make the distinctions between different sorts of type system clear? In a sense the difficulty with this question is not that I can't find an answer, but rather that I can find too many, and none sta...
null
null
I am interested in the complexity of the restricted version of the vertex cover problem below: > **Instance:** A bipartite graph $G =(L, R, E)$ and an integer $K$. > **Question:** Is there $S \subset L$, $|S| \leq K$ and every vertex in $R$ has a neighbor in $S$ $( S$ is vertex cover for $R)$ Vertex cover is $...
Restricted version of vertex cover
|complexity-theory|algorithms|graphs|
|reference-request|programming-languages|type-theory|
|formal-languages|reference-request|formal-grammars|parsers|
null
I look for information about grammars which can be described by a non-linear equation such as a quadratic equation: G = G G a | b or G = G G | y G z | z G y | ε While there is lots of material about linear grammars, their connection with regular languages etc. "quadratic grammars" ( a term, which do...
Non-linear grammars
|formal-grammars|
Let A be the set of all languages that is Recursive Let B be the set of all languages that is Recursively Enumerable but not Recursive Let C be the set of all languages that is not Recursively Enumerable It is clear that all Context Free Languages are members of set A. What is a simple example of a member o...
Recursive, Recursively Enumerable and None of the Above
|turing-machines|
First, generate all subsets $A_1$ of $A$. $A_1$ will go in $C$ and $A_2=A\backslash A_1$ in $D$. Likewise, generate all subsets $B_1$ of $B$. You then have to generate all possible ordered combinations of $A_1$ and $B_1$ for $C$ and the same for $A_2$ and $B_2$ in $D$. This amounts to enumerate, given $(a_1,…,a_n)$ ...
I was trying to write some simple code for a "flow layout" manager and what I came up with initially was something like the following (semi-pseudocode): int rowHeight = 0; RECT rect = parent.getClientRect(); POINT pos = rect.position; // Start at top-left corner, row by row foreach (Window child in parent....
"Flow layouts" inside a GUI -- how do I come up with a good algorithm?
|algorithms|greedy-algorithms|
$B_1 = \{\text{Turing Machine Descriptions }T:T(T) \text{ halts}\} \in B$ $C_1 (\in C) = \bar{B_1}$ This is fairly standard material. The proof for $B_1$ not being recursive is the well-known diagonalization. Proving $B_1$ to be RE (recursively enumerable) is a tad tricky, involving interleaved simulation of mu...
To add to David Lewis's answer, I will answer the final part of your question. To show that a language L is in A (this set is usually denoted as R) there are (at least) 3 popular techniques:<br> 1. Show there exists a turing machine M that halts on all input (this means it will always stop) and that accepts a word w...
To add to David Lewis's answer, I will answer the final part of your question. To show that a language L is in A (this set is usually denoted as R) there are (at least) 3 popular techniques:<br> 1. Show there exists a turing machine M that halts on all input (this means it will always stop) and that accepts a word w...
null
To add to David Lewis's answer, I will answer the final part of your question. To show that a language L is in A (this set is usually denoted as R) there are (at least) 3 popular techniques:<br> 1. Show there exists a turing machine M that halts on all input (this means it will always stop) and that accepts a word w...
null
|computability|turing-machines|
I've encountered variations of this problem several times doing GUI layout work. Your question about "What should I optimize?" is key to answering your question. Until you've decided that you really can't create a better algorithm. More than likely you'd like to consider the size-ratios. Each child will have likely ...
There is no absolute value of how much faster a quad-core would be compared to a single-core. As the comments have said, it very much depends on exactly what you are doing whether it will be faster or slower. Even live performance testing may not give a fair answer since it won't model exact runtime behaviour. In an...
Turing machines have a [formal][1] symbol alphabet, state and transition-rules based description of how a computation is done. [The Actor Model][2] is sometimes mentioned as a more powerful computational-model than Turing machines (not in what it can compute, but in other aspects). 1. Is The Actor Model a f...
Turing Machine-Like Formalism for The Actor Model
|turing-machines|
I am aware that for a problem to be considered NP-Hard, any problem in NP must be reduceable to your problem (problem which you are trying to prove is NP-Hard). Let's assume that you have proven that a problem `Y` is NP-Hard, and you have a problem `X` which you know is in NP, and you would like to solve. To solv...
Solve a problem through reduction
|algorithms|complexity-theory|computability|time-complexity|np-hard|
If you're building the components from ground-up, you might never know what the right size is. This is the classic chicken-egg problem. For flow-layout to work, you need to propagate parent changes to the child. That is the definition of flow-layout. When you attach a layout to your component, you take on your c...
What do you mean by "solve"? 1. Do you want to provide an algorithm for the problem? Then you reduce $X$ to $Y$ and use a supposedly known algorithm for $Y$ to solve it. That is, if you have an instance $x$ of $X$ , you use the reduction to convert it to some instance $y$ of $Y$ and then use the algorithm that sol...
I'm looking for some standard terminology, metrics and/or applications of the consideration of density and sequentiality of algorithms. When we measure algorithms we tend to give the big-Oh notation such as $O(n)$ and usually we are measuring time complexity. Somewhat less frequently, though still often, we'll also ...
Complexity of space density and sequentiality
|complexity-theory|space-complexity|
There are a few models that take into account the number of memory transfers an algorithm makes. One of the most successful ones is the cache-ideal model introduced by Frigo et al. It is based on the external memory model introduced by Aggarwal and Vitter. The model assumes no knowledge of the number of levels in the m...
null
In short: how are type systems categorised in academic contexts; particularly, where can I find reputable sources that make the distinctions between different sorts of type system clear? In a sense the difficulty with this question is not that I can't find an answer, but rather that I can find too many, and none sta...
I look for information about grammars which can be described by a non-linear equation such as a quadratic equation: $\qquad \displaystyle G \to G G a \mid b$ or $\qquad \displaystyle G \to G G \mid y G z \mid z G y \mid \varepsilon$ While there is lots of material about linear grammars, their connection w...
|reference-request|formal-grammars|
Let * $A = \mathrm{R}$ be the set of all recursive languages that are recursive, * $B = \mathrm{RE} \setminus \mathrm{R}$ be the set of all languages that are recursively enumerable but not recursive and * $C = \overline{\mathrm{RE}}$ be the set of all languages that are not recursively enumerable. It is cl...
|formal-languages|computability|
To add to David Lewis's answer, I will answer the final part of your question. To show that a language L is in A (this set is usually denoted as R) there are (at least) 3 popular techniques: 1. Show there exists a turing machine M that halts on all input (this means it will always stop) and that accepts a word $w$...
You can choose the language of the halting problem $\qquad \displaystyle B_1 = \{\langle T \rangle \mid T \text{ halts on } \langle T \rangle\} \in B$ and its complement $\qquad \displaystyle C_1 = \overline{B_1} \in C$. This is fairly standard material. The proof for $B_1$ not being recursive is the well-k...
|terminology|proof-techniques|computation-models|
|algorithms|computational-geometry|greedy-algorithms|user-interface|
There are a few models that take into account the number of memory transfers an algorithm makes. One of the most successful ones is the cache-ideal model introduced by [Frigo et al, Cache-oblivious algorithms, 1999](http://userweb.cs.utexas.edu/~pingali/CS395T/2009fa/papers/coAlgorithms.pdf). It is based on the externa...
|algorithms|complexity-theory|reductions|np-hard|
What do you mean by "solve"? 1. Do you want to provide an algorithm for the problem? Then you reduce $X$ to $Y$ and use a supposedly known algorithm $A_Y$ to solve it. That is, if you have an instance $x$ of $X$ , you use the reduction $f$ to convert it to some instance $y=f(x)$ of $Y$ and then use the algorithm t...
|complexity-theory|reference-request|terminology|space-complexity|
There are a few models that take into account the number of memory transfers an algorithm makes. One of the most successful ones is the cache-ideal model introduced by [Frigo et al, Cache-oblivious algorithms, 1999](http://userweb.cs.utexas.edu/~pingali/CS395T/2009fa/papers/coAlgorithms.pdf). It is based on the externa...
|algorithms|graphs|network-flow|
|algorithms|graphs|algorithm-analysis|runtime-analysis|network-flow|
There are a few models that take into account the number of memory transfers an algorithm makes. One of the most successful ones is the cache-ideal model introduced by [Frigo et al, Cache-oblivious algorithms, 1999](http://userweb.cs.utexas.edu/~pingali/CS395T/2009fa/papers/coAlgorithms.pdf). It is based on the externa...
|reference-request|terminology|proof-techniques|computation-models|
What do you mean by "solve"? 1. Do you want to provide an algorithm for the problem? Then you reduce $X$ to $Y$ and use a supposedly known algorithm $A_Y$ to solve it. That is, if you have an instance $x$ of $X$ , you use the reduction $f$ to convert it to some instance $y=f(x)$ of $Y$ and then use the algorithm t...
Here is the document: [More Undecidable Problems][1] Supose we got: $$L_{p} = { L(M_{0}), L(M_{1}), L(M_{2}),..., L(M_{n}) }$$ $$M_{i}\mspace{8mu} is\mspace{8mu} an\mspace{8mu} i-th\mspace{8mu} Turing Machine,\mspace{8mu} i ≤ n. $$ If P is a trivial property, L sub p is a language with property P, and contains...
How can a TM M' have a property P if it only accepts a single string x from langue of P?
|computability|turing-machines|
Here is the document: [More Undecidable Problems][1] Suppose we got: $$L_{p} = { L(M_{0}), L(M_{1}), L(M_{2}),..., L(M_{n}) }$$ $$M_{i}\mspace{8mu} \text{is}\mspace{8mu} \text{an}\mspace{8mu} i\text{th}\mspace{8mu} \text{Turing} \mspace{8mu} \text{machine},\mspace{8mu} i ≤ n. $$ If $P$ is a trivial property, $...
How can a TM M' have a property P if it only accepts a single string x from language of P?
null
my problem is how can i prove that a grammar is unambiguous ? I have the following grammar: S → statement | if expression then S | if expression then S else S and make this to an unambiguous grammar, i think its correct: S-> $S_1$ | $S_2$ $//$ $S_1$ -> if expression then S | if expression then $S_2$ else $S_...
unambiguous grammar
|formal-grammars|context-free|
Let $f$ and $g$ be two functions and $p$ a number. Consider the following program: Recurs(v,p) : find s < v such that f(s,v) < v/2 and g(s,v-s) < p if no such s exists then return v else if s <= v/4 then return v-s U Recurs(s,p) else if s > v/4 then retu...
Is the following recurrence for this program correct?