instruction
stringlengths
0
29.8k
⌀
**Hello I am doing self study from MIT OCW exercises and I could not understand this question. Can anyone explain me,** * First, why does this state machine assume it halves the $(max(a,b))$ at every two transitions beacuse we can follow steps 4 and 7 and one extra step to halve the $(max(a,b))$, which is more than ...
The binary-GCD algorithm state machine
|algorithms|proof-techniques|
Normally in graphics, you interpolate values across a line like so: ![enter image description here][1] [1]: https://i.stack.imgur.com/BG8De.png Point $A$ has value $V_A$ and point $B$ has value $V_B$, then you want to blend the value/color linearly between them as $C$ moves between $A$ and $B$. To do this, y...
Use a dynamic programming algorithm to compute an $n \times n$ table, the $(j,k)$ entry of which answers the question: suppose you wish to schedule $j$ out of the first $k$ jobs. What is the earliest time you can complete processing these?
null
Normally in graphics, you interpolate values across a line like so: ![enter image description here][1] [1]: https://i.stack.imgur.com/BG8De.png Point $A$ has value $V_A$ and point $B$ has value $V_B$, then you want to blend the value/color linearly between them as $C$ moves between $A$ and $B$. To do this, y...
**Hello I am doing self study from MIT OCW exercises and I could not understand this question. ,** **Question:** The binary-GCD state machine computes the GCD of a and b using only division by 2 and subtraction, which makes it run very efficiently on hardware that uses binary representation of numbers. In pra...
The binary-GCD state machine and algorithm invariants and state machines
|algorithms|finite-automata|proof-techniques|
Use a dynamic programming algorithm to compute an $n \times n$ table $T$, where the entry $T(j,k)$ answers the question: suppose you wish to schedule $j$ out of the first $k$ jobs. What is the earliest time you can complete processing these? How do we compute $T(j,k+1)$? Either the job $k+1$ is included in the bes...
|time-complexity|turing-machines|simulation|tape-complexity|
Saw this as proof to asymptotically bound the build heap function in the book, so wanted some help? THanks
How is n/2^(h+1) the maximum possible number of nodes at height h for a binary search tree or heap tree
|binary-trees|
I am trying to teach myself computability theory with a textbook. According to my book, a function $f$ over an alphabet $A=\{a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z\}$ is only computable iff the language $$ L = \{s\#^j\sigma : s\in A^*, \sigma \in A, \text{ the }j\text{'th symbo...
Can $f$ be not computable even if $L$ is decidable?
|formal-languages|
If $L$ is decidable then you can use it's decider to compute $f$: for the first symbol of $f(s)$ run the decider on the input $s\#x$ for any $x\in A$. for **one** of them, the decider will answer yes--this is the first letter in $f(s)$. Continue doing this, and reveal $f(s)$ letter-by-letter until the time where th...
As far as I understand, you receive an output from a quantum computer for an algorithm in the form of an amplitude, which is one of the many states your qubits may be in, however this amplitude is a complex number. I understand that you have to square the amplitude to find the probability of finding that amplitude, ...
Quantum computing 'amplitudes'
|quantum-computing|
If $L$ is decidable then you can use it's decider to compute $f$: for the first symbol of $f(s)$ run the decider on the input $s\#x$ for any $x\in A$. For **one** of them, the decider will answer *YES*--this is the first letter in $f(s)$. Continue doing this (e.g., for the second letter, decide if $s\#\#x \in L$, e...
|formal-languages|computability|undecidability|
As far as I understand, you receive an output from a quantum computer for an algorithm in the form of an amplitude, which is one of the many states your qubits may be in, however this amplitude is a complex number. I understand that you have to square the amplitude to find the probability of finding that amplitude, ...
|quantum-computing|computation-models|
Let me answer by an example that might be helpful to understand this issue, without formally answering your question. Assume that you put "15" as an input into a quantum-algorithm that factors numbers. Now, the output is a 3-qubit state (representing an integer in [1,8] in the computational basis), which has the ...
T(n) = √ nT( √ n) + cn for n > 2 and some positive constant c, T(2) = 1 I know the master theorem , but Im not sure as to how we could solve the relation using master theorem. Any insight would be helpful.
How do I go about solving this recurrence relation?
|untagged|
$T(n) = \sqrt{n} T(\sqrt{n}) + c\,n$ for $n \gt 2$ and some positive constant $c$ $T(2) = 1$ I know the master theorem, but I'm not sure as to how we could solve this relation using the master theorem. Any insight would be helpful.
Recurrence relation for time complexity: T(n) = sqrt(n)*T(sqrt(n)) + c*n
|time-complexity|recurrence-relation|master-theorem|
How is $\frac{n}{2^{h+1}}$ the maximum possible number of nodes at height $h$ for a binary search tree or heap tree? I saw this as proof to asymptotically bound the `build_heap` function in the book, but I don't get it.
Maximum number of nodes with height h
|data-structures|binary-trees|
Let $T(n) = \sqrt{n} T(\sqrt{n}) + c\,n$ for $n \gt 2$ and some positive constant $c$ and $T(2) = 1$. I know the Master theorem, but I'm not sure as to how we could solve this relation using it. Any insight would be helpful.
Solving a recurrence relation with $\sqrt{n}$ as parameter
|asymptotics|recurrence-relation|master-theorem|
Let me answer by an example that might be helpful for understanding this issue (without formally answering your question). Assume that you put "15" as an input into a quantum-algorithm that factors numbers. Now, the output $\lvert \phi \rangle \in (\mathbb{C^2})^{\otimes3}$ is a 3-qubit state (representing an int...
I am doing self study from [MIT OCW exercises](http://www.myoops.org/twocw/mit/NR/rdonlyres/Electrical-Engineering-and-Computer-Science/6-042JFall-2005/3970D151-BFD3-4181-81CD-804F109B3AC2/0/ln7.pdf) and I could not understand this question. > The following rules define the *binary-GCD state machine* working on stat...
Runtime of the binary-GCD state machine
> **Possible Duplicate:** > [Runtime of the binary-GCD state machine](http://cs.stackexchange.com/questions/6404/runtime-of-the-binary-gcd-state-machine) <!-- End of automatically inserted text --> **Hello I am doing self study from MIT OCW exercises and I could not understand this question. Can anyone explain me...
{"OriginalQuestionIds":[6404],"Voters":[{"Id":98,"DisplayName":"Raphael"}]}
[{"Id":98,"DisplayName":"Raphael"}]
[{"Id":98,"DisplayName":"Raphael"}]
{"Voters":[{"Id":98,"DisplayName":"Raphael"}]}
Unless I've done this example wrong, this question is asking you to prove something that isn't true. Consider $(x,y) = (3\cdot 127,3\cdot 64)$. What happens when you run the algorithm? > $(3\cdot127,3\cdot 64,1) \rightarrow (3\cdot127,3\cdot 32,1) \rightarrow \ldots \rightarrow (3\cdot 127,3,1)$ > $ (3\cdot 127,...
null
I actually touched upon this in response to your previous [question][1], but the general idea is that there are $n$ nodes in a binary tree, and starting from the root, at each depth there is: 1, 2, 4, 8, 16 ... maximum nodes. We see that at the greatest depth, there is (at most) half of all nodes ($n/2$). Remember that...
The method you propose is, as far as I know, the historically first one for "perfect" hashing, in which lookup takes $O(1)$ time in the worst-case. (Recall that in most simple hash tables, lookup takes $O(1)$ time only in expectation.) The idea is to use chaining (rather than open addressing), but make each chain a ...
Turing completness is being typically proved via reduction to already proved Turing-complete machine. Can the same be obtained by showing, that the machine in question is capable of generating arbitrary output – if proper input is given?
To prove Turing-completeness, is it enough to prove capability of producing arbitrary output?
|turing-completeness|church-turing-thesis|
Unless I've done this example wrong, this question is asking you to prove something that isn't true. Consider $(x,y) = (381,192) = (3\cdot 127,3\cdot 64)$. What happens when you run the algorithm? > $(3\cdot127,3\cdot 64,1) \rightarrow (3\cdot127,3\cdot 32,1) \rightarrow \ldots \rightarrow (3\cdot 127,3,1)$ > $ ...
The language a^i b^j c^k, where k isn't equal to 2j, i'm trying to write a grammar for this language, what I have so far is: S -> AT1 | AT2 | AT3 | AB | AC A -> aA | epsilon B -> bB | epsilon C -> cC | epsilon T1 -> bbB'T1c (for 2j > k)(1) B' -> bB' | b T2 -> bT2ccC' (for 2j < k) C' -> cC' |...
Context Free Grammer for language
|formal-languages|formal-grammars|context-free|
The language is $L = \{a^{i} b^{j} c^{k} \;|\; k \neq 2j\}$. I'm trying to write a grammar for this language, what I have so far is: $S \rightarrow AT_{1} \;|\; AT_{2} \;|\; AT_{3} \;|\; AB \;|\; AC$ $A \rightarrow aA \;|\; \varepsilon$ $B \rightarrow bB \;|\; \varepsilon$ $C \rightarrow cC \;|\; \varepsil...
Turing-completeness means that the machine model in question can compute everything that is computable. That means that for every computable function $f$, there is a corresponding program for your model which behaves "like" $f$, where I put the quotes since the input and output may look differently. Showing that the...
The language is $L = \{a^{i} b^{j} c^{k} \;|\; k \neq 2j\}$. I'm trying to write a grammar for this language, what I have so far is: $S \rightarrow AT_{1} \;|\; AT_{2} \;|\; AT_{3} \;|\; AB \;|\; AC$ $A \rightarrow aA \;|\; \varepsilon$ $B \rightarrow bB \;|\; \varepsilon$ $C \rightarrow cC \;|\; \varepsil...
Let's follow Raphael's suggestion, for $n = 2^{2^k}$: $$ \begin{align*} T(n) = T(2^{2^k}) &= 2^{2^{k-1}} T(2^{2^{k-1}}) + c2^{2^k} \\ &= 2^{2^{k-1}+2^{k-2}} T(2^{2^{k-2}}) + c(2^{2^k} + 2^{2^{k-1}}) \\ &= \cdots \\ &= 2^{2^{k-1}+2^{k-2}+\cdots+2^0} T(2^{2^0}) + c(2^{2^k} + 2^{2^{k-1}} + \cdots + 2^{2^1}) \\ &= 2...
I've been studying for an exam I have tomorrow, and I was looking through some previous sample exam questions, when I came across this problem: >Give a non-regular language $L$ such that $L \cup L^R$ is regular. I've been sitting here and thinking and thinking, and I can't seem to come up with a situation where t...
Find non-regular $L$ such that $L \cup L^R$ is regular?
|regular-languages|
I'm having a hard time figuring this out, any help is appreciated. Let EQUAL be the language of all words over $\Sigma = \{a,b,c\}$ that have the same number of *a’s*, *b’s* and *c’s* $EQUAL = \{ abc, acb, bac, bca, cab, cba, aabbcc, aabcbc . . . \}$ The order of the letters doesn't matter. How can you prove...
Non-context-free question
|context-free|
A certain political party wants to encourage women to participate in their primary elections, so they decide, that the 4th position is reserved for a woman. That is, if there is no woman in the top 4 positions, then the woman with the largest number of votes will be promoted to the 4th position, and the candidates at p...
Is it more effective to vote for a woman?
|game-theory|voting|
Hint: try to come up with a language $L$, such that $L \cup L^R = \Sigma^*$. Hint2: >! Try to think on complements of known non-regular languages. Solution: >! Let $C = \{a^nb^n \mid n>0\}$, and define $L$ to be all the languages EXCEPT for those that in $C$. That is, $L = \Sigma^*\setminus C$. It is easy to s...
null
Consider the following cases when you are the marginal voter (i.e. you decide the election): - Two men $m_1$ and $m_2$ have $>n$ votes, two other men $m_3$ and $m_4$ have $n$ votes, and one woman $w_1$ has $<n$ votes. If you support $m_3$ and $w_1$ equally and support $m_4$ less, then you should vote for $m_3$, suc...
Is there is a study or classification available on different types of databases for example structured, unstructured, semi structured relational, object oriented, folksonomies etc
What are the different types of databases?
|untagged|
|databases|
Another quick solution: use two letters ($\Sigma = \{a,b\}$) and use $b$ only as a separator, then make $L$ irregular using a counting argument ... Solution: >! $L = \{a^nba^m | n \geq m \} $ and $L \cup L^R = \{a^*ba^*\}$
Another quick solution: use two letters ($\Sigma = \{a,b\}$) and use $b$ only as a separator, then make $L$ irregular using a counting argument in such a way that in $L \cup L^R$ the counting argument "disappears" ... Solution: >! if $L = \{a^nba^m | n \geq m \}\;$, then $L^R =\{a^nba^m | n < m \} $<br> and ther...
Another quick solution: use two letters ($\Sigma = \{a,b\}$) and use $b$ only as a separator, then make $L$ irregular using a counting argument in such a way that in $L \cup L^R$ the counting argument "disappears" ... Solution: >! if $L = \{a^nba^m | n \geq m \}\;$, then $L^R =\{a^nba^m | n < m \} $<br> and ther...
Using Raphael's suggestion, we get $$ \begin{align*} T(n) &= n^{1/2} T(n^{1/2}) + cn \\ &= n^{3/4} T(n^{1/4}) + n^{1/2} c n^{1/2} + cn\\ &= n^{7/8} T(n^{1/8}) + n^{3/4} c n^{1/4} + 2cn\\ &= n^{15/16} T(n^{1/16}) + n^{7/8} c n^{1/8} + 3cn \\ &= \ldots \end{align*} $$ You have to take the square root $\log \l...
Hint: try to come up with a language $L$, such that $L \cup L^R = \Sigma^*$. Hint2: >! Try to think on complements of known non-regular languages. Solution: >! Let $C = \{a^nb^n \mid n>0\}$, and define $L$ to be all the strings EXCEPT for those in $C$. That is, $L = \Sigma^*\setminus C$. It is easy to see that...
null
null
Let's follow Raphael's suggestion, for $n = 2^{2^k}$: $$ \begin{align*} T(n) = T(2^{2^k}) &= 2^{2^{k-1}} T(2^{2^{k-1}}) + c2^{2^k} \\ &= 2^{2^{k-1}+2^{k-2}} T(2^{2^{k-2}}) + c(2^{2^k} + 2^{2^k}) \\ &= \cdots \\ &= 2^{2^{k-1}+2^{k-2}+\cdots+2^0} T(2^{2^0}) + c(2^{2^k} + 2^{2^k} + \cdots + 2^{2^k}) \\ &= 2^{2^k-1}...
It is known that the intersection of a context-free language with a regular language is context-free. If EQUAL were context-free, so would be its intersection with $a^*b^*c^*$, which is the well-known non-context-free $\{a^nb^nc^n : n \in \mathbb{N}\}$.
|simulation|turing-completeness|
|terminology|reference-request|databases|
|formal-languages|regular-languages|
|formal-languages|context-free|
I'm having a hard time figuring this out, any help is appreciated. Let EQUAL be the language of all words over $\Sigma = \{a,b,c\}$ that have the same number of $a$’s, $b$’s and $c$’s $\qquad \text{EQUAL} = \{ w \in \Sigma^* \mid |w|_a = |w|_b = |w|_c \}$ The order of the letters doesn't matter. How can you p...
Proving the language of words with equal numbers of symbols non-context-free
> **Possible Duplicate:** > [How to prove that a language is not context-free?](http://cs.stackexchange.com/questions/265/how-to-prove-that-a-language-is-not-context-free) <!-- End of automatically inserted text --> I'm having a hard time figuring this out, any help is appreciated. Let EQUAL be the language o...
{"OriginalQuestionIds":[265],"Voters":[{"Id":98,"DisplayName":"Raphael"}]}
We will use Raphael's suggestion and unfold the recurrence. In the following, all logarithms are base 2. We get $$ \begin{align*} T(n) &= n^{1/2} T(n^{1/2}) + cn \\ &= n^{3/4} T(n^{1/4}) + n^{1/2} c n^{1/2} + cn\\ &= n^{7/8} T(n^{1/8}) + n^{3/4} c n^{1/4} + 2cn\\ &= n^{15/16} T(n^{1/16}) + n^{7/8} c n^{1/8} + 3...
If you write $m=\log n \space$ you have $T(m) = {m \over 2}\cdot T({m\over 2}) + c\cdot 2^m\space$. Now you know the recursion tree has hight of order $O(\log m)$, and again it's not hard to see it's $O(2^m)\space$ in each level, so total running time is in: $O((\log m) \cdot 2^m)\space$, which concludes $O(n \cdot ...
Wikipedia has a list of database models: http://en.wikipedia.org/wiki/Database_model