instruction stringlengths 0 29.8k ⌀ |
|---|
null |
{"OriginalQuestionIds":[10399],"Voters":[{"Id":98,"DisplayName":"Raphael"}]} |
|data-structures|hash-tables|hash| |
Consider the following variant of the FACTORING problem (given N,M decide whether N has a prime factor less than M):
<blockquote>
MULTIPLE-FACTORING: Given three integers $1 \leq K \leq M \leq N$ decide if there are at least $K$ prime factors of $N$ less than $M$
</blockquote>
FACTORING $\leq_m$ MULTIPLE-FACTORIN... |
$$\begin{align*}
T[1] &= 1 \\
T[2] &= 2 \\
T[i] &= T[i-1] + T[i-3] + T[i-4] & \text{for \(i \gt 2\)} \\
\end{align*}$$
I have to calculate $T[N]$, but $N$ is too big ($\approx 10^9$), how can I optimize it? |
null |
null |
I've read this part like 3-4 times and I'm not understanding what is going on.
Let G6 be the following CFG and convert it to Chomsky normal form by using the conversion procedure just given. The series of grammars presented illustrates the steps in the conversion. Rules show in bold have just been added. Rules show... |
CFG to Chomsky normal form |
|untagged| |
null |
Removing $\epsilon$ transitions:
Consider the rule $B\to \epsilon$. We want to remove it. To do so, we look for occurrences of $B$ in the grammar, and whenever we see on (e.g. in $S\to aB$), we add the option of choosing $B\to \epsilon$. So the rule $S\to aB$ becomes $S\to a$. Similarly, $A\to B$ becomes $A\to \epsi... |
|formal-grammars|context-free|normal-forms| |
I am looking for good resources which have classified and solved typical large scale data processing in MapReduce framework (like graph algorithms, statistics, numerical algorithms ...). Any help is appreciated! |
Problem Solving in MapReduce Framework |
|algorithms|reference-request| |
null |
null |
{"OriginalQuestionIds":[7160],"Voters":[{"Id":157,"DisplayName":"Ran G."},{"Id":1636,"DisplayName":"Luke Mathieson"},{"Id":472,"DisplayName":"Juho"},{"Id":4249,"DisplayName":"Pål GD"},{"Id":742,"DisplayName":"Saeed Amiri"}]} |
Yes the number of b's is at least 3 times the number of a's except when n=0 in which case you get the empty string. Your language is equivalent to $\{(aa)^n(bbb)^n:n=0,1,\dots\}$. So if you can find a PDA for $\{a^nb^n\}$, then you can find one for your language. Here is the transition function $\delta$ (the stack init... |
They don't need to have a shared clock but this can be solved if they can see each other's clocks, even with a delay. Consider the following:
A's clock $C_a$ shows 5 sec since startup.
B's clock $C_b$ shows 3 sec since startup. Both robots start the game now.
1:
A sends his clock while measuring the round-tri... |
{"Voters":[{"Id":7230,"DisplayName":"rath"}]} |
null |
null |
Complementing an NFA may involve an exponential blowup.
While there are concrete examples for this, it can also be deduced (in a way) by the fact that NFA universality is PSPACE complete. Indeed, if complementing an NFA could be done in polynomial time, then universality would also be possible in polynomial time.
... |
Given a regular language $L$, can we say anything about its inverse $\bar L$? One thing that is trivial to say is that the DFA's for both languages are equal in size as inversing the language is simply a matter of changing all accepting states into rejecting states and vice-versa. Are there any other things to conclude... |
Can we say anything about the inverse of a regular language? |
|untagged| |
null |
You must be aware of the interval scheduling problem (http://en.wikipedia.org/wiki/Interval_scheduling, or http://www.phailed.me/2012/08/interval-scheduling-problem/).
In order to schedule the $n$ job requests over one resource, you sort the requests in order of finish time, choose the request with earliest finish ... |
Interval Scheduling Problem with more than One Resource |
|algorithms|scheduling| |
Complementing an NFA may involve an exponential blowup.
While there are concrete examples for this, it can also be deduced (in a way) by the fact that NFA universality is PSPACE complete. Indeed, if complementing an NFA could be done in polynomial time, then universality would also be possible in polynomial time.
... |
I'm having a little bit of an issue with a pumping lemma problem. I've successfully completely all my other problems but this is the last one and I'm a little confused I must say. If anyone can help me out, it'd be much appreciated.
\begin{equation}
A_2 = {a^n b^m c^l | n<=m OR m<=l}
\end{equation} |
Proving a language is not regular with pumping lemma |
|automata|pumping-lemma| |
Given a regular language $L$, can we say anything about its complement $\overline L$? One thing that is trivial to say is that the DFA's for both languages are equal in size as complementing the language is simply a matter of changing all accepting states into rejecting states and vice-versa. Are there any other things... |
Can we say anything about the complement of a regular language? |
|regular-languages|finite-automata| |
null |
I'm having a little bit of an issue with a pumping lemma problem. I've successfully completely all my other problems but this is the last one and I'm a little confused I must say. If anyone can help me out, it'd be much appreciated.
\begin{equation}
A = \{a^n b^m c^l \mid n\leq m \vee m\leq l\}
\end{equ... |
To expand a little on Ran G.'s comment, given a pumping length of $p$, we can take the string $s=a^{p}b^{p} \in A$, then splitting into $s=xyz$, the $y$ section (the part that can be pumped) must be all $a$s, so pumping up leaves us with a string $s'=a^{p+k}b^{p} \notin A$. |
I am trying to calculate the amortized cost of a dynamic array, that's size becomes 4 times the size when the array is filled. (when you re-size, you create a new one and copy the elements there).
[Here][1] is what I am reading from. (starts at pg. 30)
This example has the array doubling when it is filled.
This ... |
Potential function in amortized analysis |
|algorithms|algorithm-analysis|proof-techniques|amortized-analysis| |
I think your particular structure does not have amortized $O(1)$ cost, and you identified the problem.
Your general approach is salvageable, but you either need to grow less aggressively or shrink less aggressively. The standard solution is to grow from capacity & size $n$ to capacity $2n$ and to shrink from capacit... |
null |
$L$ is not context free. You can use the [Ogden's lemma](http://en.wikipedia.org/wiki/Ogden%27s_lemma,"Ogden's lemma") to show it.
I'll use the Wikipedia notation linked above.
For every $p$ take the word $a^pb^pc^p$. For a the marking where only c are marked whatever the decomposition $uxyzv$ you take, $ux^iyz... |
Is L = { a^nb^nc^j | n ≤ j} a context-free language? I'm getting really stuck generating a grammar for it. Any help would be appreciated. |
Is the following language context free? |
|untagged| |
null |
null |
Is $L = \{ a^nb^nc^j \mid n \le j\}$ a context-free language? I'm getting really stuck generating a grammar for it. Any help would be appreciated. |
|formal-languages|formal-grammars|context-free| |
I understand that Context Free Grammars can be used to represent Context Free Languages. And also it my produce ambiguities. Also we have normal forms like Chomsky and Griebach. I couldn't understand the need of that. Why they are important in the theory of languages? All the text book I referred tells about these norm... |
The importance of normal forms like Chomsky normal form for Context Free Languages |
|computability|automata|context-free|normal-forms| |
Complementing an NFA may involve an exponential blowup.
While there are concrete examples for this, it can also be deduced (in a way) by the fact that NFA universality is PSPACE complete. Indeed, if complementing an NFA could be done in polynomial time, then universality would also be possible in polynomial time.
... |
null |
Would it be correct to characterize loop invariants as a type of tautology? I ask since the invariant must basically always be true, before the loop starts, before each iteration and after the loop terminates. I realize that there is the possibility that the invariant could become false during the body of the loop. ... |
Loop Invariants as Tautologies |
|logic|loop-invariants| |
How do those matrices work? Do I need to multiple every single pixel? How about the upperleft, upperright, bottomleft and bottomleft pixels where there's no surrounding pixel? And does the matrix work from left to right and from up to bottom or from up to bottom first and then left to right?
Why does this kernel (... |
How do convolution matrices work? |
|matrices| |
A Tautology is a formula (in a certain logic) that is true under *every* model of that logic. That is, it is equivalent to the formula "$True$".
A loop invariant, however, is a certain claim that is usually true under some models, and false under others (a model in this case is an algorithm). Then, you prove that th... |
A Tautology is a formula (in a certain logic) that is true under *every* model of that logic. That is, it is equivalent to the formula "$True$".
A loop invariant, however, is a certain claim that is usually true under some models, and false under others (a model in this case is an algorithm). Then, you prove that th... |
How do those matrices work? Do I need to multiple every single pixel? How about the upperleft, upperright, bottomleft and bottomleft pixels where there's no surrounding pixel? And does the matrix work from left to right and from up to bottom or from up to bottom first and then left to right?
Why does this kernel (... |
|matrices|image-processing| |
From the point of view of asymptotic behavior, what is considered an "efficient" algorithm? What is the standard / reason for drawing the line at that point? Personally, I would think that anything which is what I might naively call "sub-polynomial", such that $f(n) = o(n^2)$ such as $n^{1+\epsilon}$ would be efficie... |
What is an Efficient Algoritm? |
|asymptotics|landau-notation| |
Convolution matrix are mean to change your image so you have to treat all the pixels.
For pixels without surrounding pixels there are different way to treat than dependently of the result you expect. You can ignore them and get a smaller image. Put an arbitrary value for their surrounding. Or consider the surroundin... |
What is an Efficient Algorithm? |
{"OriginalQuestionIds":[10399],"Voters":[{"Id":98,"DisplayName":"Raphael"}]} |
|regular-languages|finite-automata|closure-properties| |
null |
$L$ is not context free. You can use the [Ogden's lemma](http://en.wikipedia.org/wiki/Ogden%27s_lemma) to show it.
I'll use the Wikipedia notation linked above.
For every $p$ take the word $a^pb^pc^p$. For a the marking where only c are marked whatever the decomposition $uxyzv$ you take, $ux^iyz^iv$ will not be... |
I understand that context-free grammars can be used to represent context-free languages.It might have ambiguities. We also have normal forms like Chomsky and Greibach. I couldn't understand the need of that.
Why they are important in the theory of languages? All the textbooks I referred to tell about these normal f... |
The importance of normal forms like Chomsky normal form for CFGs |
|formal-languages|context-free|formal-grammars|normal-forms| |
Sheila Greibach invented the Greibach normal form to prove that every CFG can be recognized by a PDA that works in real time (i.e., without $\epsilon$-transitions). |
The reasoning behind is that, from the asymptotic behavior perspective, a polynomial rate of growth is trivially less than a super-polynomial rate of growth. In practice, a polynomial time algorithm runs much faster than a super-polynomial time algorithm when the input size grows.
Of course, no one would say that a... |
That depends on context. In theoretical computer science, usually every polynomial time algorithm is considered 'efficient'. In approximation algorithms for example a runtime of $n^{1/\epsilon^2}$ would be considered efficient, even though it won't be usable in practice for any reasonable value of $\epsilon$.
In cla... |
There are at least two relevant uses.
1. **Simplicity of proofs**
There are plenty of proofs around context-free grammars, including reducability and equivalence to automata. Those are the simpler the more restricted the set of grammars you have to deal with is. Therefore, normal forms can be helpful there.
... |
I understand that context-free grammars can be used to represent context-free languages.It might have ambiguities. We also have normal forms like [Chomsky](https://de.wikipedia.org/wiki/Chomsky-Normalform) and [Greibach](https://de.wikipedia.org/wiki/Greibach-Normalform) normal form. I couldn't understand the need of t... |
That depends on context. In theoretical computer science, usually every polynomial time algorithm is considered 'efficient'. In approximation algorithms for example a runtime of $n^{1/\epsilon^2}$ would be considered efficient, even though it won't be usable in practice for any reasonable value of $\epsilon$. An algori... |
The word tautology is a technical word. The following is a tautology of classical propositional logic.
> $\vdash p \lor \neg p$
When interpreted over the natural numbers, the following is a theorem.
> $ (\mathbb{N},<)\vdash \forall x. \exists y. x < y$
But we do not say it is a tautology in the strict lo... |
In theory, an algorithm is said to be efficient if its worst-case running time is bounded by a polynomial in it's input length. The reasoning being that polynomials have nice closure properties. Adding, multiplying, composing polynomials are operations that yield polynomials and these are good if you reducing problems ... |
In theory, an algorithm is said to be efficient if its worst-case running time is bounded by a polynomial in it's input length. The reasoning being that polynomials have nice closure properties. Adding, multiplying, composing polynomials are operations that yield polynomials and these are good if you are reducing probl... |
null |
Suppose that there is some graph, with $n$ vertexes. We wish to find the hamiltonian path, but we make the graph being searched a little different. There is a person A that travels each (undirected) edge that connects one vertex to the other vertex. But after the person crosses the edge, how edges connect pairs of vert... |
The name of "finding the path of a graph that is a variant of hamiltonian path" |
|complexity-theory|graphs| |
|algorithm-analysis|logic|correctness-proof|loop-invariants|program-correctness| |
|algorithms|terminology|asymptotics|landau-notation| |
My 2 cents from the angle of distributed algorithms: When looking at large-scale networks (P2P, social networks, etc.) a distributed algorithm is considered to be *efficient* if its running time is $O(\log^c n)$ for some constant $c>0$ **and** the algorithm uses messages of $O(\log n)$ bits. Note that the requirement o... |
I think it is impossible to figure out one-way latency just by comparing stopwatches.
A sends B his clock $C_A1$, let's say its value is 5.
B acknowledges the message at time $C_B1=1$
A sends his clock again, $C_A2=9$ (initial + round-trip latency).
B receives at time $C_B2=5$.
And so on. Neither A or B... |
{"Voters":[{"Id":7230,"DisplayName":"rath"}]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.