instruction
stringlengths
0
29.8k
⌀
null
Turing machines and unrestricted grammars are two different formalisms that define the RE languages. Some RE languages are decidable, but not all are. We can define the decidable languages with Turing machines by saying that a language is decidable iff there is a TM for the language that halts and accepts all strin...
There can not be a useful class of grammars for $\mathrm{R}$ (the set of recursive languages), since * every useful class of grammars is enumerable, and * $\mathrm{R}$ is not semi-decidable or, equivalently, not enumerable. The first is obviously not a rigorous theorem (and can't be), it's just judgemental con...
I suggest you to start reading this [Wikipedia][1] page for an explanation, and then select from [Rosetta code][2] an implementation in one of the programming languages you know and to study it. Many algorithms are either based on caching or detecting the loop 4, 16, 37, 58, 89, 145, 42, 20, 4, ... [1]:...
|terminology|compilers|functional-programming|
I suggest you to start reading this [Wikipedia][1] page for an explanation, and then select from [Rosetta code][2] an implementation in one of the programming languages you know and to study it. Many algorithms are either based on caching or detecting the loop 4, 16, 37, 58, 89, 145, 42, 20, 4, ... A dynamic progra...
I suggest you to start reading this [Wikipedia][1] page for an explanation, and then select from [Rosetta code][2] an implementation in one of the programming languages you know and to study it. Many algorithms are either based on caching or detecting the loop 4, 16, 37, 58, 89, 145, 42, 20, 4, ... A dynamic progra...
Constructing right-linear grammar
Because sum of square of digits of 18 digit number is smaller than or equal to $18\times 9^2 = 1458$, it's enough to enumerate first $1458$ numbers and find list of happy numbers out of them (we say it $happy-list$), then for a given range $[lo,hi]$ check each number's square digit sum is in our happy list or not, so t...
null
I suggest you to start reading this [Wikipedia][1] page for an explanation, and then select from [Rosetta code][2] an implementation in one of the programming languages you know and to study it. Many algorithms are either based on caching or detecting the loop 4, 16, 37, 58, 89, 145, 42, 20, 4, ... A dynamic progra...
I suggest you to start reading this [Wikipedia][1] page for an explanation, and then select from [Rosetta code][2] an implementation in one of the programming languages you know and to study it. Many algorithms are either based on caching or detecting the loop 4, 16, 37, 58, 89, 145, 42, 20, 4, ... A dynamic progra...
null
In a recitation video for [MIT OCW 6.006][1] at 43:30, Given an *m x n* matrix *a* with *m* columns and *n* rows, the 2-D peaking finding algorithm, where a peak is any value greater than or equal to it's adjacent neighbors, was described as: *Note: If there is confusion in describing columns via n, I apologize,...
2-D peak finding complexity (MIT OCW 6.006)
|algorithm-analysis|
From my recitation class - > $EXP = \text{0 | 1 | b EXP | EXP a | EXP m EXP} $ > > The above grammar is ambiguous. > > Make unequivocal grammar which produce same language as the above . > > At the new grammar , $a$ has priority over $b$ and $b$ has priority over $m$ . > Also $m$ is associative ....
Priority in grammar
|formal-grammars|
Priority in formal grammar
null
From my recitation class - > $EXP = \text{0 | 1 | b EXP | EXP a | EXP m EXP} $ > > The above grammar is ambiguous. > > Make unequivocal grammar which produce same language as the above . > > At the new grammar , $a$ has priority over $b$ and $b$ has priority over $m$ . > Also $m$ is associative ....
|formal-languages|formal-grammars|
1. I'm going to guess that, in the case of your example grammar, that "$a$ has priority over $b$, and $b$ has priority over $m$" means that once a $b$ is generated, no more $a$s can be generated, and likewise, once an $m$ is generated, no more $b$s can be generated in any derivation using this grammar. 2. The gene...
I could think of this approach analogous to Bentley Ottmann sweep that runs in O((n+k)logn) time. I could reduce the problem of circle intersection to line segment intersection. I will consider the vertical diameter parallel to Y-axis for each of the circles. The algorithm shall use a horizontal line that sweeps the...
In a recitation video for [MIT OCW 6.006][1] at 43:30, Given an $m \times n$ matrix $A$ with $m$ columns and $n$ rows, the 2-D peak finding algorithm, where a peak is any value greater than or equal to it's adjacent neighbors, was described as: *Note: If there is confusion in describing columns via $n$, I apolog...
|algorithms|algorithm-analysis|asymptotics|matrices|
null
Let L1 and L2 be 2 languages over the same alphabet Σ. An image to the definition of A(L1,L2): https://i.stack.imgur.com/GPAdR.jpg Assume that L1 is regular and L2 is context-free. The language A(L1,L2): 1. is always a regular language 2. is always not a regular language 3. can sometimes be a regular langua...
Is The Following Language Regular?
|formal-languages|regular-languages|automata|context-free|finite-automata|
Let L1 and L2 be 2 languages over the same alphabet Σ. $$A(L_1,L_2)=\{x\in \Sigma^*|\exists y,z\in L_2\text{ such that } yxz\in L_1\}$$ Assume that L1 is regular and L2 is context-free. The language A(L1,L2): 1. is always a regular language 2. is always not a regular language 3. can sometimes be a regular ...
null
Let $L_{1}$ and $L_{2}$ be 2 languages over the same alphabet $\Sigma$. $$A(L_1,L_2)=\{x\in \Sigma^*|\exists y,z\in L_2\text{ such that } yxz\in L_1\}$$ Assume that $L_{1}$ is regular and $L_{2}$ is context-free. The language $A(L_{1},L_{2})$: 1. is always a regular language 2. is always not a regular langu...
null
null
Is there a general method to solve the recurrence of the form: $T(n) = T(n-n^c) + T(n^c) + f(n)$ for $c < 1$, or more generally $T(n) = T(n-g(n)) + T(r(n)) + f(n)$ where $g(n),r(n)$ are some sub-linear functions of $n$. **Update**: I have gone through the links the provided below and also sifted through ...
null
From my recitation class, I have the following exercise: > $\mathrm{EXP} = 0 \mid 1 \mid b \mathrm{EXP} \mid \mathrm{EXP} a \mid \mathrm{EXP} m \mathrm{EXP}$ > > The above grammar is ambiguous. > > Make an unequivocal grammar which produce same language as the above. > > In the new grammar, $a$ has priority...
|formal-languages|formal-grammars|parsing|ambiguity|
null
From my recitation class, I have the following exercise: > $\mathrm{EXP} = 0 \mid 1 \mid b \mathrm{EXP} \mid \mathrm{EXP} a \mid \mathrm{EXP} m \mathrm{EXP}$ > > The above grammar is ambiguous. > > Make an unambiguous grammar which produce same language as the above. > > In the new grammar, $a$ has priority...
null
It's a bit confusing, but deforestation is applied (at compile time) to eliminate intermediate trees (at run time). Deforestation doesn't involve hacking away parts of the abstract syntax tree (that's dead branch elimination :-) Another thing that may have thrown you off is that lists *are* trees, just very unbalanc...
When we talk about operators in descriptive complexity, are they something like this: for example, if transitive closure operator $TR$ is available, we can use variable $y$ that we define as $TR(x)$ where $x$ is input? or is it something else?
Operators in descriptive complexity
|complexity-theory|descriptive-complexity|
When we talk about operators in descriptive complexity, are they something like this: for example, if transitive closure operator $TR$ is available, we can use variable $y$ that we define as $TR(x)$ where $x$ is input? or is it something else? Also, when we say $FO(t(n))$, what does quantifier block being iterated ...
`b0a` has two subtly different productions (Note: I always expand the leftmost non-terminal): - `EXP --> bEXP --> bEXPa --> b0a` and - `EXP --> EXPa --> bEXPa --> b0a`, so that's an example of an ambiguous string. To give `a` priority over `b` means that if you have `b0a` it will always be parsed as `b(0...
Is it true, that when I expand a node, I have guaranteed that the path I found to this node is optimal? Look at this pseudocode from wikipedia: function A*(start,goal) closedset := the empty set // The set of nodes already evaluated. openset := {start} // The set of tentative nodes to be eva...
A* optimality of the expanded node
|algorithms|
This would depend on the heuristic. Consider a graph where $start\to a\to d\to end$ and also $start\to b\to c\to d\to end$. Now assume you have a bad heuristic that prefers that gives $b,c,d$ much higher scores than $a$, then you would reach $end$ in a non-optimal path. In particular, when you open $d$, you are in a...
Suppose I have a admissible and consistent heuristic. Is it true, that when I expand a node, I have guaranteed that the path I found to this node is optimal? Look at this pseudocode from wikipedia: function A*(start,goal) closedset := the empty set // The set of nodes already evaluated. open...
Yatima2975 seems to have covered your first two questions, I'll try to cover the third. To do this I'll treat an unrealistically simple case, but I'm sure you'll be able to imagine something more realistic. Imagine you want to compute the depth of the *full* binary tree of order $n$. The type of (unlabeled) binary t...
Let's first define the TR operator (Why do you use $TR$ and not $TC$?) Given a formula $\phi$ with free variables $x_{i_1},\dots,x_{i_{2k}}$ than the string $\psi =TR(x_{i_1},\dots,x_{i_{2k}},\phi)(y_{i_1},\dots,x_{i_{yk}})$ is also a formula. If you now consider an interpretation $\mathcal{I}$ than $\psi$ is true un...
null
Assuming you can find the centers of the eyes... 1. **Rotate** - Find the difference of the angle between the actual eyes and your desired angle. Rotate image accordingly. 2. **Scale** - Find the distance between eyes. Scale according to the desired distance. 3. **Translate** - Move the image so that one eye li...
Let's first define the TR operator (Why do you use $TR$ and not $TC$?) Given a formula $\phi$ with free variables $x_{i_1},\dots,x_{i_{2k}}$ than the string $\psi =TR(x_{i_1},\dots,x_{i_{2k}},\phi)(y_{i_1},\dots,x_{i_{yk}})$ is also a formula. If you now consider an interpretation $\mathcal{I}$ than $\psi$ is true un...
It's a bit confusing, but deforestation is applied (at compile time) to eliminate intermediate trees that would be created (at run time). Deforestation doesn't involve hacking away parts of the abstract syntax tree (that's dead branch elimination :-) Another thing that may have thrown you off is that lists *are* tre...
Let's first define the TR operator (Why do you use $TR$ and not $TC$?) Given a formula $\phi$ with free variables $x_{i_1},\dots,x_{i_{2k}}$ than the string $\psi =TR(x_{i_1},\dots,x_{i_{2k}},\phi)(y_{i_1},\dots,x_{i_{yk}})$ is also a formula. If you now consider an interpretation $\mathcal{I}$ than $\psi$ is true un...
the analysis you outline appears to be incorrect. the correct complexity is $O(m)$ where $m$ is the larger dimension of the matrix (either rows or columns). see this other [correct analysis](http://courses.csail.mit.edu/6.006/spring11/rec/rec02.pdf) for more/better detail. part of the mistake is not defining the recurr...
Let's first define the TR operator (Why do you use $TR$ and not $TC$?) Given a formula $\phi$ with free variables $x_{i_1},\dots,x_{i_{2k}}$ than the string $\psi =TR(x_{i_1},\dots,x_{i_{2k}},\phi)(y_{i_1},\dots,x_{i_{yk}})$ is also a formula. If you now consider an interpretation $\mathcal{I}$ than $\psi$ is true un...
null
null
First Part: Let's first define the TR operator (Why do you use $TR$ and not $TC$?) Given a formula $\phi$ with free variables $x_{i_1},\dots,x_{i_{2k}}$ than the string $\psi =TR(x_{i_1},\dots,x_{i_{2k}},\phi)(y_{i_1},\dots,x_{i_{yk}})$ is also a formula. If you now consider an interpretation $\mathcal{I}$ than $\psi...
null
First Part: Let's first define the TR operator (Why do you use $TR$ and not $TC$?) Given a formula $\phi$ with free variables $x_{i_1},\dots,x_{i_{2k}}$ than the string $\psi =TR(x_{i_1},\dots,x_{i_{2k}},\phi)(y_{i_1},\dots,x_{i_{yk}})$ is also a formula. If you now consider an interpretation $\mathcal{I}$ than $\psi...
I've taken an introductory database course where like many good database courses, they taught relational algebra, including $\theta$-joins. However, I've recently read E. F. Codd's 1970 paper, [*A Relational Model of Data for Large Shared Databanks*][1], and the concept of $\theta$-joins is nowhere to be found. He does...
Origin of theta-joins
|reference-request|history|relational-algebra|
By "number of gates", I am wondering whether these gates include AND/OR gates that can receive several inputs or they just include AND/OR gates that receive two inputs.
Questions regarding circuit complexity
|complexity-theory|circuits|
The number of inputs to a gate is an independent restriction or allowance on the circuit. The number of gates in a circuit is simply the number of gates.
null
> Definition A family of circuits (C1, C2, ...) is uniform if some log > space transducer T outputs <Cn> where T's input is 1n. (from http://en.wikipedia.org/wiki/Boolean_circuit#Uniform_Boolean_Circuits) Can anyone exlain this? I know what boolean circuits are, so only explanation needed is what <Cn> and transd...
Definition of uniform boolean circuit
|complexity-theory|circuits|
The number of inputs to a gate is an independent restriction or allowance on the circuit. The number of gates in a circuit is simply the number of gates. Of course you can always measure the two separately. For example the $W$-hierarchy in Parameterized Complexity can be defined in terms of the *large-gate depth* (c...
> Definition A family of circuits $(C_{1}, C_{2}, \ldots)$ is uniform if some log > space transducer $T$ outputs $\langle C_{n}\rangle$ where $T$'s input is $1^{n}$. (from http://en.wikipedia.org/wiki/Boolean_circuit#Uniform_Boolean_Circuits) Can anyone exlain this? I know what boolean circuits are, so only expl...
A transducer is a finite state automata that (in effect) has both an input tape and an output tape. So instead of the normal DFA/NFA computation where the automaton has an input that it recognises (or equivalently, no input at all, and an output that it generates), a transducer reads from the input and writes to the ou...
Hint: Take a DFA for $L_1$. Check which states are reachable from the initial state via a word in $L_2$. Check from which states a final state can be reached via a word in $L_2$.
|complexity-theory|finite-automata|circuits|
null
It means that there is deterministic Turing machine running in logarithmic space $\mathsf{L}$ that generates the description of the $n$th circuit from the unary encoding of $n$. The definition is good for large classes like $\mathsf{P}$ but it doesn't work for small complexity classes. For those classes we use deter...
Uniformity definition means that there is a deterministic Turing machine running in logarithmic space $\mathsf{L}$ that generates the description of the $n$th circuit from the unary encoding of $n$. To have a better idea of what this is talking about, assume that we have a Turing machine $M$ in $\mathsf{P}$. Then fo...
In the general sense Luke is right, there is no relation between the number of gates and fa-in. But in the literature what authors mean depends on the context. Note that by itself the number of gates is not a robust notion. What kind of circuits are we talking about? If we are talking about unbounded fan-in circu...
Wikipedia gives great information about the complexity of various [elementary operations](http://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations). Multiplication takes $n^2$ time by the "school-book" algorithm, and thus it is in $\mathsf{FTIME}(n^2)$ and in $\mathsf{FL}$. Better solutions e...
From http://rjlipton.wordpress.com/2009/05/27/arithmetic-hierarchy-and-pnp/, > Define, $M_{[x,c]}$ as the deterministic Turing machine that operates > as follows on an input $y$. The machine treats $x$ as a deterministic > program, and simulates $x$ on input $y$. At the same time the machine > runs a counter that...
How to relate size of circuit to the running time of turing machine - updated
|complexity-theory|circuits|
From http://rjlipton.wordpress.com/2009/05/27/arithmetic-hierarchy-and-pnp/, > Define, $M_{[x,c]}$ as the deterministic Turing machine that operates > as follows on an input $y$. The machine treats $x$ as a deterministic > program, and simulates $x$ on input $y$. At the same time the machine > runs a counter that...
null
The way to show that circuits are equivalent to TMs is as follows: for a TM, you encode it in binary (i.e states, transitions, etc.) Then, you construct a circuit whose gates represent the transitions between each configuration of the TM. Since configuration transitions are local, then you only need local gates (i.e...
{"OriginalQuestionIds":[1547],"Voters":[{"Id":1636,"DisplayName":"Luke Mathieson"},{"Id":6447,"DisplayName":"vonbrand"},{"Id":41,"DisplayName":"Kaveh"},{"Id":72,"DisplayName":"JeffE"},{"Id":4249,"DisplayName":"Pål GD"}]}
null
I am reading chapter 32 -String Matching from the book ["Introduction to Algorithms" 3rd edition Cormen et al][1]. The Rabin-Karp Algorithm is not clear despite reading several times. Specifically, when the authors start proposing about some modulo operations for solving some problem, I am unable to understand. To be...
Rabin-Karp Searching Algorithm
|searching|