id int64 1 141k | title stringlengths 15 150 | body stringlengths 45 28.5k | tags stringlengths 1 102 | label int64 1 1 | text stringlengths 128 28.6k | source stringclasses 1
value |
|---|---|---|---|---|---|---|
6,360 | Will this algorithm terminate on any input? | <p>One can compress data with straight-line grammars. An algorithm that employs this technique is called <em>Sequitur</em>. If I understood correctly, Sequitur basically starts with one rule representing the input and then does these three steps till the grammar does not change anymore:</p>

<ol>
<li>For ea... | algorithms algorithm analysis formal grammars data compression correctness proof | 1 | Will this algorithm terminate on any input? -- (algorithms algorithm analysis formal grammars data compression correctness proof)
<p>One can compress data with straight-line grammars. An algorithm that employs this technique is called <em>Sequitur</em>. If I understood correctly, Sequitur basically starts with one rule... | habedi/stack-exchange-dataset |
6,363 | Nim game tree + minimax | <p><img src="https://i.stack.imgur.com/2hUx4.jpg" alt="search tree"></p>

<p><strong>Problem : Two players have in front of
them a single pile of objects, say a stack of 7 pennies. The first player divides the original
stack into two stacks that must be unequal. Each player alternatively thereafter does... | artificial intelligence search trees game theory | 1 | Nim game tree + minimax -- (artificial intelligence search trees game theory)
<p><img src="https://i.stack.imgur.com/2hUx4.jpg" alt="search tree"></p>

<p><strong>Problem : Two players have in front of
them a single pile of objects, say a stack of 7 pennies. The first player divides the original
stack i... | habedi/stack-exchange-dataset |
6,368 | Can you have a binary search tree with O(logn + M) property for the following case | <p>Let $n$ be the number of strings which are sorted in lexicographical order and stored in a balanced binary search tree. You are provided with a prefix $x$ of which $M$ strings have the prefix $x$. I have devised the following algorithm, where I search until I find the first occurence of the prefix $x$ in one of the ... | binary trees search trees | 1 | Can you have a binary search tree with O(logn + M) property for the following case -- (binary trees search trees)
<p>Let $n$ be the number of strings which are sorted in lexicographical order and stored in a balanced binary search tree. You are provided with a prefix $x$ of which $M$ strings have the prefix $x$. I have... | habedi/stack-exchange-dataset |
6,371 | Proving DOUBLE-SAT is NP-complete | <p>The well known SAT problem is defined <a href="http://en.wikipedia.org/wiki/Boolean_satisfiability_problem">here</a> for reference sake. </p>

<p>The DOUBLE-SAT problem is defined as</p>

<p>$\qquad \mathsf{DOUBLE\text{-}SAT} = \{\langle\phi\rangle \mid \phi \text{ has at least two satisfying assignm... | complexity theory np complete satisfiability | 1 | Proving DOUBLE-SAT is NP-complete -- (complexity theory np complete satisfiability)
<p>The well known SAT problem is defined <a href="http://en.wikipedia.org/wiki/Boolean_satisfiability_problem">here</a> for reference sake. </p>

<p>The DOUBLE-SAT problem is defined as</p>

<p>$\qquad \mathsf{DOUBLE\tex... | habedi/stack-exchange-dataset |
6,374 | How to correlate a matrix of values to get a coordinated point? | <p>I got a n*m matrix updated in realtime (i.e. about every 10ms) with values between 0 and 1024, and I want to work out from that matrix a multitouch trackpad behaviour, which is:</p>

<ul>
<li>generate one or more points on the surface given the values on the matrix,</li>
<li>make this or those point ... | algorithms matrices | 1 | How to correlate a matrix of values to get a coordinated point? -- (algorithms matrices)
<p>I got a n*m matrix updated in realtime (i.e. about every 10ms) with values between 0 and 1024, and I want to work out from that matrix a multitouch trackpad behaviour, which is:</p>

<ul>
<li>generate one or more poi... | habedi/stack-exchange-dataset |
6,378 | What is the time complexity of calling successor $n$ times during tree traversal? | <p>According to some <a href="http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/binarySearchTree.htm" rel="nofollow noreferrer">sources</a>, the time complexity of finding the successor of a node in a tree is $O(h)$. So, if the tree is well balanced, the height $h=\log n$, and the successor function takes ... | binary trees search trees | 1 | What is the time complexity of calling successor $n$ times during tree traversal? -- (binary trees search trees)
<p>According to some <a href="http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/binarySearchTree.htm" rel="nofollow noreferrer">sources</a>, the time complexity of finding the successor of a nod... | habedi/stack-exchange-dataset |
6,382 | Graph Closeness - Different result with gephi and NodeXL | <p>I'm writing a JavaScript library for calculating graph measurements such as degree centrality, eccentrality, closeness and betweenness.</p>

<p>In order to validate my library I use two exist applications <a href="http://gephi.org" rel="nofollow">Gephi</a> and <a href="http://nodexl.codeplex.com/" rel="nofol... | graphs terminology | 1 | Graph Closeness - Different result with gephi and NodeXL -- (graphs terminology)
<p>I'm writing a JavaScript library for calculating graph measurements such as degree centrality, eccentrality, closeness and betweenness.</p>

<p>In order to validate my library I use two exist applications <a href="http://gephi.o... | habedi/stack-exchange-dataset |
6,385 | Multitape Turing machines against single tape Turing machines | <p><em>Introduction</em>: I recently learned that a multi-tape Turing Machine $\text{TM}_k$ is no more "powerful" than a single tape Turing machine $\text{TM}$. The proof that $\text{TM}_k \equiv \text{TM}$ is based on the idea that a $\text{TM}$ can simulate a $\text{TM}_k$ by using a unique character to separate th... | time complexity turing machines simulation tape complexity | 1 | Multitape Turing machines against single tape Turing machines -- (time complexity turing machines simulation tape complexity)
<p><em>Introduction</em>: I recently learned that a multi-tape Turing Machine $\text{TM}_k$ is no more "powerful" than a single tape Turing machine $\text{TM}$. The proof that $\text{TM}_k \eq... | habedi/stack-exchange-dataset |
6,391 | How to prove $L \cdot L^{*} = L^{+}$ | <p>How can one formally prove</p>

<p>$L \cdot L^{*} = L^{+}$</p>

<p>It looks obvious to me since with the concatenation you get rid of $\varepsilon$, but I cannot think of a formal proof through induction or something.</p>
 | formal languages regular languages | 1 | How to prove $L \cdot L^{*} = L^{+}$ -- (formal languages regular languages)
<p>How can one formally prove</p>

<p>$L \cdot L^{*} = L^{+}$</p>

<p>It looks obvious to me since with the concatenation you get rid of $\varepsilon$, but I cannot think of a formal proof through induction or something.</p>&#x... | habedi/stack-exchange-dataset |
6,393 | When are 2 decision/optimization problems equivalent? | <p>Does anybody know a good definition of 2 decision / optimization problems being equivalent? </p>

<p>I am asking since for example allowing polynomial time computations any 2 problems in NP could be considered equivalent.</p>
 | complexity theory terminology undecidability | 1 | When are 2 decision/optimization problems equivalent? -- (complexity theory terminology undecidability)
<p>Does anybody know a good definition of 2 decision / optimization problems being equivalent? </p>

<p>I am asking since for example allowing polynomial time computations any 2 problems in NP could be consid... | habedi/stack-exchange-dataset |
6,405 | Maximum number of nodes with height h | <p>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 <code>build_heap</code> function in the book, but I don't get it.</p>
 | data structures binary trees | 1 | Maximum number of nodes with height h -- (data structures binary trees)
<p>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 <code>build_heap</code> function in the book, but I don't get it.</p>
 | habedi/stack-exchange-dataset |
6,406 | Can $f$ be not computable even if $L$ is decidable? | <p>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</p>

<p>$$
L = \{s\#^j\sigma : s\in A^*, \sigma \in A, \text{ th... | formal languages computability undecidability | 1 | Can $f$ be not computable even if $L$ is decidable? -- (formal languages computability undecidability)
<p>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 c... | habedi/stack-exchange-dataset |
6,410 | Solving a recurrence relation with √n as parameter | <p>Consider the recurrence </p>

<p>$\qquad\displaystyle T(n) = \sqrt{n} \cdot T\bigl(\sqrt{n}\bigr) + c\,n$ </p>

<p>for $n \gt 2$ with some positive constant $c$, and $T(2) = 1$.</p>

<p>I know the Master theorem for solving recurrences, but I'm not sure as to how we could solve this relation ... | asymptotics recurrence relation master theorem | 1 | Solving a recurrence relation with √n as parameter -- (asymptotics recurrence relation master theorem)
<p>Consider the recurrence </p>

<p>$\qquad\displaystyle T(n) = \sqrt{n} \cdot T\bigl(\sqrt{n}\bigr) + c\,n$ </p>

<p>for $n \gt 2$ with some positive constant $c$, and $T(2) = 1$.</p>

<p>I kn... | habedi/stack-exchange-dataset |
6,414 | To prove Turing-completeness, is it enough to prove capability of producing arbitrary output? | <p>Turing completness is being typically proved via reduction to already proved Turing-complete machine.</p>

<p>Can the same be obtained by showing, that the machine in question is capable of generating arbitrary output – if proper input is given?</p>
 | simulation turing completeness | 1 | To prove Turing-completeness, is it enough to prove capability of producing arbitrary output? -- (simulation turing completeness)
<p>Turing completness is being typically proved via reduction to already proved Turing-complete machine.</p>

<p>Can the same be obtained by showing, that the machine in question is ... | habedi/stack-exchange-dataset |
6,415 | Context Free Grammar for language | <p>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:</p>

<p>$S \rightarrow AT_{1} \;|\; AT_{2} \;|\; AT_{3} \;|\; AB \;|\; AC$</p>

<p>$A \rightarrow aA \;|\; \varepsilon$ </p>

<p>$B \rightarrow bB \;|\; \vareps... | formal languages formal grammars context free | 1 | Context Free Grammar for language -- (formal languages formal grammars context free)
<p>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:</p>

<p>$S \rightarrow AT_{1} \;|\; AT_{2} \;|\; AT_{3} \;|\; AB \;|\; AC$</p>

<p>... | habedi/stack-exchange-dataset |
6,418 | Find non-regular $L$ such that $L \cup L^R$ is regular? | <p>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:</p>

<blockquote>
 <p>Give a non-regular language $L$ such that $L \cup L^R$ is regular.</p>
</blockquote>

<p>I've been sitting here and thinking a... | formal languages regular languages | 1 | Find non-regular $L$ such that $L \cup L^R$ is regular? -- (formal languages regular languages)
<p>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:</p>

<blockquote>
 <p>Give a non-regular language $L$ such that ... | habedi/stack-exchange-dataset |
6,419 | Proving the language of words with equal numbers of symbols non-context-free | <blockquote>
 <p><strong>Possible Duplicate:</strong><br>
 <a href="https://cs.stackexchange.com/questions/265/how-to-prove-that-a-language-is-not-context-free">How to prove that a language is not context-free?</a> </p>
</blockquote>



<p>I'm having a hard time figuring this out, any hel... | formal languages context free | 1 | Proving the language of words with equal numbers of symbols non-context-free -- (formal languages context free)
<blockquote>
 <p><strong>Possible Duplicate:</strong><br>
 <a href="https://cs.stackexchange.com/questions/265/how-to-prove-that-a-language-is-not-context-free">How to prove that a language is not c... | habedi/stack-exchange-dataset |
6,420 | Is it more effective to vote for a woman? | <p>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 a... | game theory voting | 1 | Is it more effective to vote for a woman? -- (game theory voting)
<p>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 o... | habedi/stack-exchange-dataset |
6,423 | What are the different types of databases? | <p>Is there is a study or classification available on different types of databases? (Examples include structured, unstructured, semi structured relational, object oriented, folksonomies, etc.) </p>
 | terminology reference request databases | 1 | What are the different types of databases? -- (terminology reference request databases)
<p>Is there is a study or classification available on different types of databases? (Examples include structured, unstructured, semi structured relational, object oriented, folksonomies, etc.) </p>
 | habedi/stack-exchange-dataset |
6,435 | Base of logarithm in runtime of Prim's and Kruskal's algorithms | <p>For Prim's and Kruskal's Algorithm there are many implementations which will give different running times. However suppose our implementation of Prim's algorithm has runtime $O(|E| + |V|\cdot \log(|V|))$ and Kruskals's algorithm has runtime $O(|E|\cdot \log(|V|))$.</p>

<p>What is the base of the $\log$?</p>... | algorithms time complexity graphs algorithm analysis runtime analysis | 1 | Base of logarithm in runtime of Prim's and Kruskal's algorithms -- (algorithms time complexity graphs algorithm analysis runtime analysis)
<p>For Prim's and Kruskal's Algorithm there are many implementations which will give different running times. However suppose our implementation of Prim's algorithm has runtime $O(|... | habedi/stack-exchange-dataset |
6,443 | Simplification of regular expression and conversion into finite automata | <p>This is a beginners question. I and reading the book "Introduction to Computer Theory" by Daniel Cohen. But I end up with confusion regarding simplification of regular expressions and finite automata. I want to create an FA for the regular expression</p>

<p>$\qquad \displaystyle (a+b)^* (ab+ba)^+a^+\;.$</p>... | formal languages automata finite automata regular expressions | 1 | Simplification of regular expression and conversion into finite automata -- (formal languages automata finite automata regular expressions)
<p>This is a beginners question. I and reading the book "Introduction to Computer Theory" by Daniel Cohen. But I end up with confusion regarding simplification of regular expressio... | habedi/stack-exchange-dataset |
6,446 | Modification of Hamilton Path | <p>Although I know that the <a href="http://en.wikipedia.org/wiki/Hamiltonian_path_problem" rel="nofollow noreferrer">Hamilton Path problem</a> is ${\sf NP}$-complete, I think the following variant can be solved in polynomial time:</p>

<blockquote>
 <p>Given a planar graph with vertex set $V$, edge set $E... | algorithms complexity theory graphs np hard | 1 | Modification of Hamilton Path -- (algorithms complexity theory graphs np hard)
<p>Although I know that the <a href="http://en.wikipedia.org/wiki/Hamiltonian_path_problem" rel="nofollow noreferrer">Hamilton Path problem</a> is ${\sf NP}$-complete, I think the following variant can be solved in polynomial time:</p>
&... | habedi/stack-exchange-dataset |
6,456 | How many different max-heaps exist for a list of n integers? | <p>How many different max-heaps exist for a list of <span class="math-container">$n$</span> integers?</p>

<p>Example: list <code>[1, 2, 3, 4]</code></p>

<p>The max-heap can be either <code>4 3 2 1</code>:</p>

<pre><code> 4
 / \
 3 2
 /
1
</code></pre>

<p>o... | data structures combinatorics heaps | 1 | How many different max-heaps exist for a list of n integers? -- (data structures combinatorics heaps)
<p>How many different max-heaps exist for a list of <span class="math-container">$n$</span> integers?</p>

<p>Example: list <code>[1, 2, 3, 4]</code></p>

<p>The max-heap can be either <code>4 3 2 1</co... | habedi/stack-exchange-dataset |
6,463 | Hardness of ambiguity/non-ambiguity for context-free grammars | <p>A <a href="http://en.wikipedia.org/wiki/Formal_grammar" rel="nofollow">grammar</a> is <em><a href="http://en.wikipedia.org/wiki/Ambiguous_grammar" rel="nofollow">ambiguous</a></em> if at least one of the words in the
language it defines can be parsed in more than one way. A simple example of an ambiguous grammar... | computability formal grammars context free undecidability ambiguity | 1 | Hardness of ambiguity/non-ambiguity for context-free grammars -- (computability formal grammars context free undecidability ambiguity)
<p>A <a href="http://en.wikipedia.org/wiki/Formal_grammar" rel="nofollow">grammar</a> is <em><a href="http://en.wikipedia.org/wiki/Ambiguous_grammar" rel="nofollow">ambiguous</a></em> i... | habedi/stack-exchange-dataset |
6,470 | Iterative binary search analysis | <p>I'm a little bit confused about the analysis of <a href="http://en.wikipedia.org/wiki/Binary_search" rel="nofollow">binary search</a>.
In almost every paper, the writer assumes that the array size $n$ is always $2^k$.
Well I truly understand that the time complexity becomes $\log(n)$ (worst case) under this ... | algorithms time complexity algorithm analysis runtime analysis search algorithms | 1 | Iterative binary search analysis -- (algorithms time complexity algorithm analysis runtime analysis search algorithms)
<p>I'm a little bit confused about the analysis of <a href="http://en.wikipedia.org/wiki/Binary_search" rel="nofollow">binary search</a>.
In almost every paper, the writer assumes that the array si... | habedi/stack-exchange-dataset |
6,473 | Why is $\sum_{j=0}^{\lfloor\log (n-1)\rfloor}2^j$ in $\Theta (n)$? | <p>I am trying to understand summation for amortization analysis of a hash-table from a <a href="http://videolectures.net/mit6046jf05_leiserson_lec13/" rel="nofollow noreferrer">MIT lecture video</a> (at time 16:09). </p>

<p>Although you guys don't have to go and look at the video, I feel that the summation he... | algorithms data structures algorithm analysis mathematical analysis discrete mathematics | 1 | Why is $\sum_{j=0}^{\lfloor\log (n-1)\rfloor}2^j$ in $\Theta (n)$? -- (algorithms data structures algorithm analysis mathematical analysis discrete mathematics)
<p>I am trying to understand summation for amortization analysis of a hash-table from a <a href="http://videolectures.net/mit6046jf05_leiserson_lec13/" rel="no... | habedi/stack-exchange-dataset |
6,476 | Minimum s-t cut in weighted directed acyclic graphs with possibly negative weights | <p>I ran into the following problem:</p>

<p>Given a directed acyclic graph with real-valued edge weights, and two vertices s and t, compute the minimum s-t cut.</p>

<p>For general graphs this is NP-hard, since one can trivially reduce max-cut to it by simply reversing the edge weights (correct me if I... | algorithms complexity theory graphs weighted graphs | 1 | Minimum s-t cut in weighted directed acyclic graphs with possibly negative weights -- (algorithms complexity theory graphs weighted graphs)
<p>I ran into the following problem:</p>

<p>Given a directed acyclic graph with real-valued edge weights, and two vertices s and t, compute the minimum s-t cut.</p>
&#... | habedi/stack-exchange-dataset |
6,480 | Commonly used Error Correcting Codes | <p>We know error correcting codes are parameterized as (n,k,d) codes. I wanted to know the values of these parameters for some commonly used error correcting codes in computer memories or in DRAMs, etc.</p>

<p>I just wanted to see some values for these parameters, used in real life applications.</p>
 | computer architecture error correcting codes | 1 | Commonly used Error Correcting Codes -- (computer architecture error correcting codes)
<p>We know error correcting codes are parameterized as (n,k,d) codes. I wanted to know the values of these parameters for some commonly used error correcting codes in computer memories or in DRAMs, etc.</p>

<p>I just wanted ... | habedi/stack-exchange-dataset |
6,488 | First-order logic arity defines decidability? | <p>I've read first-order logic is in general undecidable, and that could be decidable only when working with unary operators. (I think that's propositional logic, correct me if I am wrong)</p>

<p>The question is <strong>why arity leads to undecidable problems?</strong></p>

<p>I would like to see some ... | reference request logic undecidability satisfiability first order logic | 1 | First-order logic arity defines decidability? -- (reference request logic undecidability satisfiability first order logic)
<p>I've read first-order logic is in general undecidable, and that could be decidable only when working with unary operators. (I think that's propositional logic, correct me if I am wrong)</p>
... | habedi/stack-exchange-dataset |
6,491 | Resolution and incomplete Knowledge Base | <p>Assume I have an incomplete knowledge base, for example:</p>

<pre><code>(rich(dave), poor(dave)) // dave is either poor or rich

(not rich(dave), not poor(dave)) // dave is not poor and rich at the same time.
</code></pre>

<p>My questions are:
1. If I do resolution on the above cl... | logic knowledge representation reasoning | 1 | Resolution and incomplete Knowledge Base -- (logic knowledge representation reasoning)
<p>Assume I have an incomplete knowledge base, for example:</p>

<pre><code>(rich(dave), poor(dave)) // dave is either poor or rich

(not rich(dave), not poor(dave)) // dave is not poor and rich at the same time.&#x... | habedi/stack-exchange-dataset |
6,500 | Can a graph have a cycle containing all nodes but not Hamiltonian? | <p>Is it possible for a graph to have a cycle that goes through all the nodes, but it does not have a Hamiltonian cycle (i.e. the cycle goes through some nodes more than once)? If yes, can anyone prove it? If not, can anyone give a counterexample?</p>
 | graphs | 1 | Can a graph have a cycle containing all nodes but not Hamiltonian? -- (graphs)
<p>Is it possible for a graph to have a cycle that goes through all the nodes, but it does not have a Hamiltonian cycle (i.e. the cycle goes through some nodes more than once)? If yes, can anyone prove it? If not, can anyone give a counterex... | habedi/stack-exchange-dataset |
6,503 | BPP search: what does boosting correctness entail? | <p>It is not really clear to me, how and if I can do boosting for correctness (or error reduction) on a <a href="http://en.wikipedia.org/wiki/BPP_%28complexity%29" rel="nofollow">BPP</a> (bounded-error probabilistic polynomial-time) search problem. Can anyone of you explain me how it works?</p>

<p>With BPP sea... | probabilistic algorithms search problem | 1 | BPP search: what does boosting correctness entail? -- (probabilistic algorithms search problem)
<p>It is not really clear to me, how and if I can do boosting for correctness (or error reduction) on a <a href="http://en.wikipedia.org/wiki/BPP_%28complexity%29" rel="nofollow">BPP</a> (bounded-error probabilistic polynomi... | habedi/stack-exchange-dataset |
6,504 | How can I convert the Turing machine the recognizes language $L$ into an unrestricted grammar? | <p>According to <a href="http://en.wikipedia.org/wiki/Unrestricted_grammar">this Wikipedia article</a>, unrestricted grammars are equivalent to Turing machines. The article notes that I can convert any Turing machine into an unrestricted grammar, but it only shows how to convert a grammar to a Turing machine.</p>
&... | formal grammars turing machines simulation | 1 | How can I convert the Turing machine the recognizes language $L$ into an unrestricted grammar? -- (formal grammars turing machines simulation)
<p>According to <a href="http://en.wikipedia.org/wiki/Unrestricted_grammar">this Wikipedia article</a>, unrestricted grammars are equivalent to Turing machines. The article note... | habedi/stack-exchange-dataset |
6,506 | Some questions regarding compilers and assemblers | <p>Lots of basic questions are there in my mind. I need to clear them.</p>

<p><strong>Statement 1:</strong> A compiler converts a human-readable codes to object codes, and those are converted to a machine code (executable) by linker.</p>

<p>Am I right here?</p>

<p>At <a href="http://en.wikipe... | terminology compilers code generation | 1 | Some questions regarding compilers and assemblers -- (terminology compilers code generation)
<p>Lots of basic questions are there in my mind. I need to clear them.</p>

<p><strong>Statement 1:</strong> A compiler converts a human-readable codes to object codes, and those are converted to a machine code (executa... | habedi/stack-exchange-dataset |
6,507 | Stochastical algorithm | <p>We have a stochastic random source. This gives the bit $0$ (or $1$) with probability $1/2$. 
We want to generate a uniform distribution on the set S = $\{0, 1,..., n-1\}$. </p>

<p>Which algorithm gives with probability $1/n$ the value $i\in S$. And how many bits are needed.</p>
 | algorithms randomness sampling | 1 | Stochastical algorithm -- (algorithms randomness sampling)
<p>We have a stochastic random source. This gives the bit $0$ (or $1$) with probability $1/2$. 
We want to generate a uniform distribution on the set S = $\{0, 1,..., n-1\}$. </p>

<p>Which algorithm gives with probability $1/n$ the value $i\in S$. ... | habedi/stack-exchange-dataset |
6,514 | Breadth First Search with cost | <p>Looking for some tutorials / references that discuss Breadth First Search that takes into consideration the cost of paths, but could not find much information.</p>

<p>Could someone refer a tutorial?</p>
 | algorithms reference request graphs search algorithms | 1 | Breadth First Search with cost -- (algorithms reference request graphs search algorithms)
<p>Looking for some tutorials / references that discuss Breadth First Search that takes into consideration the cost of paths, but could not find much information.</p>

<p>Could someone refer a tutorial?</p>
 | habedi/stack-exchange-dataset |
6,515 | Reduction of A_LBA to E_LBA | <p>I have a rather interesting one to ponder and would love if I could get an answer for it. We were discussing the topic of mapping reduction today in my Computing theory course and I was wondering why this reduction can't exist, $A_{LBA} \leq_{m} E_{LBA}$, since both of them are linear bound automata (LBAs). I do rea... | computability turing machines reductions undecidability | 1 | Reduction of A_LBA to E_LBA -- (computability turing machines reductions undecidability)
<p>I have a rather interesting one to ponder and would love if I could get an answer for it. We were discussing the topic of mapping reduction today in my Computing theory course and I was wondering why this reduction can't exist, ... | habedi/stack-exchange-dataset |
6,517 | what is semantics? | <p>There are many popular languages. But, computer scientists tell us that in order to understand the behaviour of programs in those languages definitely and unambiguously argue upon program behavior (e.g. prove their identity), we need to translate them into another, well understood language. They call such language "... | formal languages semantics | 1 | what is semantics? -- (formal languages semantics)
<p>There are many popular languages. But, computer scientists tell us that in order to understand the behaviour of programs in those languages definitely and unambiguously argue upon program behavior (e.g. prove their identity), we need to translate them into another, ... | habedi/stack-exchange-dataset |
6,519 | How asymptotically bad is naive shuffling? | <p>It's well-known that this 'naive' algorithm for shuffling an array by swapping each item with another randomly-chosen one doesn't work correctly:</p>

<pre><code>for (i=0..n-1)
 swap(A[i], A[random(n)]);
</code></pre>

<p>Specifically, since at each of $n$ iterations, one of $n$ choices is m... | algorithms algorithm analysis asymptotics probability theory randomness | 1 | How asymptotically bad is naive shuffling? -- (algorithms algorithm analysis asymptotics probability theory randomness)
<p>It's well-known that this 'naive' algorithm for shuffling an array by swapping each item with another randomly-chosen one doesn't work correctly:</p>

<pre><code>for (i=0..n-1)
 swap(A... | habedi/stack-exchange-dataset |
6,521 | Reduce the following problem to SAT | <p>Here is the problem. Given $k, n, T_1, \ldots, T_m$, where each $T_i \subseteq \{1, \ldots, n\}$. Is there a subset $S \subseteq \{1, \ldots, n\}$ with size at most $k$ such that $S \cap T_i \neq \emptyset$ for all $i$? I am trying to reduce this problem to SAT. My idea of a solution would be to have a variable $x_i... | complexity theory reductions np hard | 1 | Reduce the following problem to SAT -- (complexity theory reductions np hard)
<p>Here is the problem. Given $k, n, T_1, \ldots, T_m$, where each $T_i \subseteq \{1, \ldots, n\}$. Is there a subset $S \subseteq \{1, \ldots, n\}$ with size at most $k$ such that $S \cap T_i \neq \emptyset$ for all $i$? I am trying to redu... | habedi/stack-exchange-dataset |
6,525 | NP-Completeness - Proof by Restriction | <p>I'm reading Garey & Johnsons <em>"Computers and Intractability"</em> and I'm at the part <em>"Some techniques for solving NP-Completeness"</em>. Here's the text about Proof by Restriction:</p>

<blockquote>
 <p>Proof by restriction is the simplest, and perhaps most frequently
 applicable, of ou... | complexity theory np complete proof techniques | 1 | NP-Completeness - Proof by Restriction -- (complexity theory np complete proof techniques)
<p>I'm reading Garey & Johnsons <em>"Computers and Intractability"</em> and I'm at the part <em>"Some techniques for solving NP-Completeness"</em>. Here's the text about Proof by Restriction:</p>

<blockquote>
 <... | habedi/stack-exchange-dataset |
6,528 | Mathematical model on which current computers are built | <p>It is said that "The Turing machine is not intended as practical computing technology, but rather as a hypothetical device representing a computing machine. Turing machines help computer scientists understand the limits of mechanical computation." [Wikipedia]</p>

<p>So on which model current machines are bu... | turing machines computer architecture machine models | 1 | Mathematical model on which current computers are built -- (turing machines computer architecture machine models)
<p>It is said that "The Turing machine is not intended as practical computing technology, but rather as a hypothetical device representing a computing machine. Turing machines help computer scientists under... | habedi/stack-exchange-dataset |
6,532 | Equivalence of GFp and Gp in LTL | <p>In linear time logic, is $\mathbf{GF}p$ equivalent to $ \mathbf{G}p$ ?</p>

<p><em>$\mathbf{GF}p$ means that it is always the case that p is true eventually.</em></p>

<p>Let $\mathbf{G} p$ be defined as: $\forall j \ge0,\ p$ holds in the suffix $q_j, q_{j+1}, q_{j+2},\ldots$</p>

<p>and sin... | logic linear temporal logic | 1 | Equivalence of GFp and Gp in LTL -- (logic linear temporal logic)
<p>In linear time logic, is $\mathbf{GF}p$ equivalent to $ \mathbf{G}p$ ?</p>

<p><em>$\mathbf{GF}p$ means that it is always the case that p is true eventually.</em></p>

<p>Let $\mathbf{G} p$ be defined as: $\forall j \ge0,\ p$ holds in... | habedi/stack-exchange-dataset |
6,541 | Why does $A_\text{TM} \le_m \text{HALTING} \le_m \text{HALTING}^\varepsilon$? | <p>I have a book that proves the halting problem with this simple statement:</p>

<p>$$
A_\text{TM} \le_m \text{HALTING} \le_m \text{HALTING}^\varepsilon
$$</p>

<p>It states that halting problem reduces to the language consisting of $\langle M, \omega \rangle$ for which a Turing machine $M$ ac... | turing machines reductions undecidability halting problem | 1 | Why does $A_\text{TM} \le_m \text{HALTING} \le_m \text{HALTING}^\varepsilon$? -- (turing machines reductions undecidability halting problem)
<p>I have a book that proves the halting problem with this simple statement:</p>

<p>$$
A_\text{TM} \le_m \text{HALTING} \le_m \text{HALTING}^\varepsilon
$$</p>&#... | habedi/stack-exchange-dataset |
6,549 | Call by value-result vs. call by reference? | <p>From my Googling, it appears that call by value-result is similar to call by reference in that it changes values in the caller, but it's different in that the changes don't take place until the callee exits, and that if the same variable is passed as more than one argument, it'll be treated as separate values in the... | terminology programming languages semantics evaluation strategies | 1 | Call by value-result vs. call by reference? -- (terminology programming languages semantics evaluation strategies)
<p>From my Googling, it appears that call by value-result is similar to call by reference in that it changes values in the caller, but it's different in that the changes don't take place until the callee e... | habedi/stack-exchange-dataset |
6,552 | When can a greedy algorithm solve the coin change problem? | <p>Given a set of coins with different denominations $c1, ... , cn$ and a value v you want to find the least number of coins needed to represent the value v.</p>

<p>E.g. for the coinset 1,5,10,20 this gives 2 coins for the sum 6 and 6 coins for the sum 19. </p>

<p>My main question is: when can a greed... | algorithms combinatorics greedy algorithms | 1 | When can a greedy algorithm solve the coin change problem? -- (algorithms combinatorics greedy algorithms)
<p>Given a set of coins with different denominations $c1, ... , cn$ and a value v you want to find the least number of coins needed to represent the value v.</p>

<p>E.g. for the coinset 1,5,10,20 this giv... | habedi/stack-exchange-dataset |
6,568 | Inherent ambiguity of the language $L_2 = \{a^nb^mc^m \;|\; m,n \geq 1\}\cup \{a^nb^nc^m \;|\; m,n \geq 1\}$ | <p>I went through a question asking me to choose the inherently ambiguous language among a set of options.</p>

<p>$$L_1 = \{a^nb^mc^md^n \;|\; m,n \geq 1\}\cup \{a^nb^nc^md^m \;|\; m,n \geq 1\}$$
$$and$$
$$L_2 = \{a^nb^mc^m \;|\; m,n \geq 1\}\cup \{a^nb^nc^m \;|\; m,n \geq 1\}$$</p>

<p>The sol... | formal languages formal grammars context free ambiguity | 1 | Inherent ambiguity of the language $L_2 = \{a^nb^mc^m \;|\; m,n \geq 1\}\cup \{a^nb^nc^m \;|\; m,n \geq 1\}$ -- (formal languages formal grammars context free ambiguity)
<p>I went through a question asking me to choose the inherently ambiguous language among a set of options.</p>

<p>$$L_1 = \{a^nb^mc^md^n \;|\... | habedi/stack-exchange-dataset |
6,588 | Reducing the integer factorization problem to an NP-Complete problem | <p>I'm struggling to understand the relationship between NP-Intermediate and NP-Complete. I know that if P != NP based on Ladner's Theorem there exists a class of languages in NP but not in P or in NP-Complete. Every problem in NP can be reduced to an NP-Complete problem, however I haven't seen any examples for reducin... | np complete reductions factoring | 1 | Reducing the integer factorization problem to an NP-Complete problem -- (np complete reductions factoring)
<p>I'm struggling to understand the relationship between NP-Intermediate and NP-Complete. I know that if P != NP based on Ladner's Theorem there exists a class of languages in NP but not in P or in NP-Complete. Ev... | habedi/stack-exchange-dataset |
6,589 | Does Max-SNP hard imply NP-hard | <p>I have difficulties understanding the definition of the class <a href="http://en.wikipedia.org/wiki/SNP_%28complexity%29">Max-SNP</a> (optimization variant of <strong>strict NP</strong>), thus I have to following basic question:</p>

<pre><code>If a problem is known to be Max-SNP hard, does this imply NP-har... | complexity theory np hard | 1 | Does Max-SNP hard imply NP-hard -- (complexity theory np hard)
<p>I have difficulties understanding the definition of the class <a href="http://en.wikipedia.org/wiki/SNP_%28complexity%29">Max-SNP</a> (optimization variant of <strong>strict NP</strong>), thus I have to following basic question:</p>

<pre><code>I... | habedi/stack-exchange-dataset |
6,590 | Language acceptance by DFA | <p>I have some questions regarding acceptance of a language by DFA</p>

<ol>
<li>Whether more that one dfa accept a language </li>
<li>Whether a dfa can accept more than one language</li>
</ol>
 | automata regular languages finite automata | 1 | Language acceptance by DFA -- (automata regular languages finite automata)
<p>I have some questions regarding acceptance of a language by DFA</p>

<ol>
<li>Whether more that one dfa accept a language </li>
<li>Whether a dfa can accept more than one language</li>
</ol>
 | habedi/stack-exchange-dataset |
6,604 | How to modify semantic actions when removing left-recursion from a grammer | <p>Is there any algorithm that tells us how to modify semantic actions associated with a left-recursive grammar? For example, we have the following grammar, and its associated semantic actions:</p>

<p>$ S \rightarrow id = expr $ { S.s = expr.size }</p>

<p>S $\rightarrow$ if expr then $S_1$ else $S_2$... | formal grammars compilers semantics left recursion | 1 | How to modify semantic actions when removing left-recursion from a grammer -- (formal grammars compilers semantics left recursion)
<p>Is there any algorithm that tells us how to modify semantic actions associated with a left-recursive grammar? For example, we have the following grammar, and its associated semantic acti... | habedi/stack-exchange-dataset |
6,611 | Functions between sets? | <p>I recently took a practice exam for the Computer Science GRE and this was one of the questions: </p>

<blockquote>
 <p>Assume that set $A$ has 5 elements and set $B$ has 4 elements, how many functions exist from set $A$ to set $B$?</p>
</blockquote>

<p>I had no idea what this means, I don't... | combinatorics sets | 1 | Functions between sets? -- (combinatorics sets)
<p>I recently took a practice exam for the Computer Science GRE and this was one of the questions: </p>

<blockquote>
 <p>Assume that set $A$ has 5 elements and set $B$ has 4 elements, how many functions exist from set $A$ to set $B$?</p>
</blockquote>&#x... | habedi/stack-exchange-dataset |
6,616 | Need a practical solution for creating pattern database(5-5-5) for 15-Puzzle | <p>I have asked this exact question on <a href="https://stackoverflow.com/questions/13229722/need-a-practical-solution-for-creating-pattern-database5-5-5-for-15-puzzle">StackOverflow</a>. I did not get the answer that I was looking for. Please read this question fully before answering. Thank You.<br><br>
For static... | algorithms artificial intelligence recursion | 1 | Need a practical solution for creating pattern database(5-5-5) for 15-Puzzle -- (algorithms artificial intelligence recursion)
<p>I have asked this exact question on <a href="https://stackoverflow.com/questions/13229722/need-a-practical-solution-for-creating-pattern-database5-5-5-for-15-puzzle">StackOverflow</a>. I did... | habedi/stack-exchange-dataset |
6,618 | How to implement a prolog interpreter in a purely functional language? | <p>Is there a clear reference, with pseudo-code, on how to go about implementing a Prolog interpreter in a purely functional language? That which I have found so far seems to deal only with imperative languages, is merely a demonstration of Prolog implemented in itself, or offers no concrete algorithm to use for interp... | functional programming prolog logic programming | 1 | How to implement a prolog interpreter in a purely functional language? -- (functional programming prolog logic programming)
<p>Is there a clear reference, with pseudo-code, on how to go about implementing a Prolog interpreter in a purely functional language? That which I have found so far seems to deal only with impera... | habedi/stack-exchange-dataset |
6,626 | How do I show that whether a PDA accepts some string $\{ w!w \mid w \in \{ 0, 1 \}^*\}$ is undecidable? | <p>How do I show that the problem of deciding whether a PDA accepts some string of the form $\{ w!w \mid w \in \{ 0, 1 \}^*\}$ is undecidable?</p>

<p>I have tried to reduce this problem to another undecidable one such as whether two context-free grammars accept the same language. However, I'm not sure how to u... | formal languages automata context free undecidability pushdown automata | 1 | How do I show that whether a PDA accepts some string $\{ w!w \mid w \in \{ 0, 1 \}^*\}$ is undecidable? -- (formal languages automata context free undecidability pushdown automata)
<p>How do I show that the problem of deciding whether a PDA accepts some string of the form $\{ w!w \mid w \in \{ 0, 1 \}^*\}$ is undecidab... | habedi/stack-exchange-dataset |
6,627 | Implementing addition for a binary counter | <p>A binary counter is represented by an infinite array of 0 and 1.</p>

<p>I need to implement the action $\text{add}(k)$ which adds $k$ to the value represented in the array.</p>

<p>The obvious way is to add 1, k times. Is there a more efficient way?</p>
 | algorithms data structures efficiency | 1 | Implementing addition for a binary counter -- (algorithms data structures efficiency)
<p>A binary counter is represented by an infinite array of 0 and 1.</p>

<p>I need to implement the action $\text{add}(k)$ which adds $k$ to the value represented in the array.</p>

<p>The obvious way is to add 1, k ti... | habedi/stack-exchange-dataset |
6,634 | Greedy algorithms tutorial | <p>Could anyone point me to simple tutorial on greedy algorithm for Minimum Spanning tree - Kruskal's and Prims' Method</p>

<p>I am looking for a tutorial which </p>

<ul>
<li>does not include all the mathematical notation </li>
<li>explains algorithm along with the analysis of the running ti... | algorithm analysis greedy algorithms | 1 | Greedy algorithms tutorial -- (algorithm analysis greedy algorithms)
<p>Could anyone point me to simple tutorial on greedy algorithm for Minimum Spanning tree - Kruskal's and Prims' Method</p>

<p>I am looking for a tutorial which </p>

<ul>
<li>does not include all the mathematical notation </li>... | habedi/stack-exchange-dataset |
6,637 | Memoized Palindrome Subsequence | <p>I am trying to find the maximum palindrome sub-sequence and after going through some tutorials, I came up with a memoized version.But I am not sure about the runtime.I want to know if the following algorithm will work.Could also someone explain what the runtime will be?</p>

<pre><code>Memoized-Palindrome(A,... | algorithm analysis dynamic programming memoization | 1 | Memoized Palindrome Subsequence -- (algorithm analysis dynamic programming memoization)
<p>I am trying to find the maximum palindrome sub-sequence and after going through some tutorials, I came up with a memoized version.But I am not sure about the runtime.I want to know if the following algorithm will work.Could also ... | habedi/stack-exchange-dataset |
6,640 | Don Knuth and MMIXAL vs. Chuck Moore and Forth -- Algorithms and Ideal Machines -- was there any cross-pollination / influence in their ideas / work? | <p><strong>Question:</strong></p>

<p><strong>To what extent is it known (or believed) that Chuck Moore and Don Knuth had influence on each other's thoughts on ideal machines, or their work on algorithms?</strong></p>

<p>I'm interested in citations, interviews, articles, links, or any other sort of evi... | programming languages history | 1 | Don Knuth and MMIXAL vs. Chuck Moore and Forth -- Algorithms and Ideal Machines -- was there any cross-pollination / influence in their ideas / work? -- (programming languages history)
<p><strong>Question:</strong></p>

<p><strong>To what extent is it known (or believed) that Chuck Moore and Don Knuth had influ... | habedi/stack-exchange-dataset |
6,641 | Counting sort on non-integers - why not possible? | <p>What is it about the structure of <a href="http://en.wikipedia.org/wiki/Counting_sort">counting sort</a> that only makes it work on integers?</p>

<p>Surely strings can be counted?</p>

<pre><code>''' allocate an array Count[0..k] ; initialize each array cell to zero ; THEN '''
for each input ite... | algorithms sorting | 1 | Counting sort on non-integers - why not possible? -- (algorithms sorting)
<p>What is it about the structure of <a href="http://en.wikipedia.org/wiki/Counting_sort">counting sort</a> that only makes it work on integers?</p>

<p>Surely strings can be counted?</p>

<pre><code>''' allocate an array Count[0.... | habedi/stack-exchange-dataset |
6,649 | Proving that NPSPACE $\subseteq$ EXPTIME | <p>I am following <strong>"Introduction to the theory of computation" by Sipser</strong>.</p>

<p>My question is about relationship of different classes which is present in <strong>Chapter 8.2. The Class PSPACE</strong>.</p>

<p>$P \subseteq NP \subseteq PSPACE = NPSPACE \subseteq EXPTIME$</p>

... | complexity theory time complexity space complexity | 1 | Proving that NPSPACE $\subseteq$ EXPTIME -- (complexity theory time complexity space complexity)
<p>I am following <strong>"Introduction to the theory of computation" by Sipser</strong>.</p>

<p>My question is about relationship of different classes which is present in <strong>Chapter 8.2. The Class PSPACE</str... | habedi/stack-exchange-dataset |
6,650 | How can P =? NP enhance integer factorization | <p>If ${\sf P}$ does in fact equal ${\sf NP}$, how would this enhance our algorithms to factor integers faster. In other words, what kind of insight would this fact give us in understanding integer factorization better?</p>
 | complexity theory computability np complete p vs np factoring | 1 | How can P =? NP enhance integer factorization -- (complexity theory computability np complete p vs np factoring)
<p>If ${\sf P}$ does in fact equal ${\sf NP}$, how would this enhance our algorithms to factor integers faster. In other words, what kind of insight would this fact give us in understanding integer factoriza... | habedi/stack-exchange-dataset |
6,655 | How can I prove that a build max heap's amortized cost is $O(n)$? | <p>Suppose a <strong>build</strong> max-heap operation runs bubble down over a heap. How does its amortized cost equal $O(n)$?</p>
 | data structures runtime analysis heaps | 1 | How can I prove that a build max heap's amortized cost is $O(n)$? -- (data structures runtime analysis heaps)
<p>Suppose a <strong>build</strong> max-heap operation runs bubble down over a heap. How does its amortized cost equal $O(n)$?</p>
 | habedi/stack-exchange-dataset |
6,665 | Intuition behind Relativization | <p>I take course on Computational Complexity. My problem is I don't understand <strong>Relativization method</strong>. I tried to find a bit of intuition in many textbooks, unfortunately, so far with no success. I will appreciate if someone could shed the light on this topic so that I will be able to continue by myself... | complexity theory np complete complexity classes relativization np | 1 | Intuition behind Relativization -- (complexity theory np complete complexity classes relativization np)
<p>I take course on Computational Complexity. My problem is I don't understand <strong>Relativization method</strong>. I tried to find a bit of intuition in many textbooks, unfortunately, so far with no success. I wi... | habedi/stack-exchange-dataset |
6,672 | Prove multiple cell move instructions don't increase power of Turing Machines | <p>How can you prove that multiple-cell-move instructions, for example (X, Y, 5R) and (X, Y, 17L), do not increase the power of a Turing Machine? </p>
 | turing machines | 1 | Prove multiple cell move instructions don't increase power of Turing Machines -- (turing machines)
<p>How can you prove that multiple-cell-move instructions, for example (X, Y, 5R) and (X, Y, 17L), do not increase the power of a Turing Machine? </p>
 | habedi/stack-exchange-dataset |
6,676 | Confusion about big-O notation comparison of two functions | <p>On page 16 of this <a href="http://www.cs.berkeley.edu/~vazirani/algorithms/all.pdf" rel="noreferrer">algorithms book</a>, it states:</p>

<blockquote>
 <p>For example, suppose we are choosing between two algorithms for a particular computational task. One takes $f_1(n) = n^2$ steps, while the other tak... | asymptotics landau notation | 1 | Confusion about big-O notation comparison of two functions -- (asymptotics landau notation)
<p>On page 16 of this <a href="http://www.cs.berkeley.edu/~vazirani/algorithms/all.pdf" rel="noreferrer">algorithms book</a>, it states:</p>

<blockquote>
 <p>For example, suppose we are choosing between two algorit... | habedi/stack-exchange-dataset |
6,678 | What is the difference between abstract and concrete data structures? | <p>I thought associative array (i.e. map, or dictionary) and hashing table were the same concept, until I saw in <a href="http://en.wikipedia.org/wiki/Abstract_data_type#Implementation" rel="nofollow noreferrer">Wikipedia</a> that</p>

<blockquote>
 <p>For dictionaries with very small numbers of bindings, ... | data structures abstract data types | 1 | What is the difference between abstract and concrete data structures? -- (data structures abstract data types)
<p>I thought associative array (i.e. map, or dictionary) and hashing table were the same concept, until I saw in <a href="http://en.wikipedia.org/wiki/Abstract_data_type#Implementation" rel="nofollow noreferre... | habedi/stack-exchange-dataset |
6,680 | Is the codomain/range of a hash function always $\mathbb{Z}$ or $\mathbb{N}$? | <p>From <a href="http://en.wikipedia.org/wiki/Hash_function#Universal_hashing" rel="nofollow">Wikipedia</a></p>

<blockquote>
 <p>A hash function is any algorithm or subroutine that maps <strong>large data
 sets of variable length</strong>, called keys, to <strong>smaller data sets of a
 fixed le... | terminology hash | 1 | Is the codomain/range of a hash function always $\mathbb{Z}$ or $\mathbb{N}$? -- (terminology hash)
<p>From <a href="http://en.wikipedia.org/wiki/Hash_function#Universal_hashing" rel="nofollow">Wikipedia</a></p>

<blockquote>
 <p>A hash function is any algorithm or subroutine that maps <strong>large data&#... | habedi/stack-exchange-dataset |
6,690 | How to quickly find a few bisimulations on a given labelled digraph? | <p>We are given a labelled directed graph, where both vertices (or states) and edges (or transitions) have labels. Informally, two states are bisimilar when they have the same label and they can simulate each other's transitions. On the states the two states evolve to, the same again is true.</p>

<p>More forma... | algorithms graphs process algebras | 1 | How to quickly find a few bisimulations on a given labelled digraph? -- (algorithms graphs process algebras)
<p>We are given a labelled directed graph, where both vertices (or states) and edges (or transitions) have labels. Informally, two states are bisimilar when they have the same label and they can simulate each ot... | habedi/stack-exchange-dataset |
6,695 | Proving that if $\mathrm{NTime}(n^{100}) \subseteq \mathrm{DTime}(n^{1000})$ then $\mathrm{P}=\mathrm{NP}$ | <p>I'd really like your help with proving the following.</p>

<p>If $\mathrm{NTime}(n^{100}) \subseteq \mathrm{DTime}(n^{1000})$ then $\mathrm{P}=\mathrm{NP}$.</p>

<p>Here, $\mathrm{NTime}(n^{100})$ is the class of all languages which can be decided by nondeterministic Turing machine in polynomial time... | time complexity complexity classes p vs np | 1 | Proving that if $\mathrm{NTime}(n^{100}) \subseteq \mathrm{DTime}(n^{1000})$ then $\mathrm{P}=\mathrm{NP}$ -- (time complexity complexity classes p vs np)
<p>I'd really like your help with proving the following.</p>

<p>If $\mathrm{NTime}(n^{100}) \subseteq \mathrm{DTime}(n^{1000})$ then $\mathrm{P}=\mathrm{NP}... | habedi/stack-exchange-dataset |
6,698 | Extract Max for a max-heap in $\log n + \log\log n$ comparisons | <p>Given a <strong>max heap</strong> with <strong>extract-max</strong> operation.</p>

<p>The basic version takes $2 \log n$ comparisons.
How can I make the running time just $\log n + \log\log n$ comparisons?
How about $\log n + \log\log\log n $ comparisons?</p>

<p>I thought of putting $-\inft... | data structures heaps | 1 | Extract Max for a max-heap in $\log n + \log\log n$ comparisons -- (data structures heaps)
<p>Given a <strong>max heap</strong> with <strong>extract-max</strong> operation.</p>

<p>The basic version takes $2 \log n$ comparisons.
How can I make the running time just $\log n + \log\log n$ comparisons?
How... | habedi/stack-exchange-dataset |
6,700 | Finding $c$ and $n_0$ for a big-O bound | <p>A book I am reading demonstrates how $5n^3 + 2n^2 + 22n + 6 = O(n^3)$, which I believe is true. After all, there exists a value $c$ for which $cn^3$ is always greater than $5n^3 + 2n^2 + 22n + 6$ for all $n$ greater than or equal to some value $n_0$.</p>

<p>However, the book then casually notes that $c = 5$... | asymptotics landau notation | 1 | Finding $c$ and $n_0$ for a big-O bound -- (asymptotics landau notation)
<p>A book I am reading demonstrates how $5n^3 + 2n^2 + 22n + 6 = O(n^3)$, which I believe is true. After all, there exists a value $c$ for which $cn^3$ is always greater than $5n^3 + 2n^2 + 22n + 6$ for all $n$ greater than or equal to some value ... | habedi/stack-exchange-dataset |
6,704 | Finite State Automata for recognising consecutive characters | <p>I'm currently working on this question as part of some homework, it has me stumped.</p>

<p><img src="https://i.stack.imgur.com/taFpH.png" alt="FSA Question"></p>

<p>I'm familiar with finite state automata (FSA), I know how they work and I've read everything I can find on Google, but nothing's helpe... | formal languages finite automata | 1 | Finite State Automata for recognising consecutive characters -- (formal languages finite automata)
<p>I'm currently working on this question as part of some homework, it has me stumped.</p>

<p><img src="https://i.stack.imgur.com/taFpH.png" alt="FSA Question"></p>

<p>I'm familiar with finite state auto... | habedi/stack-exchange-dataset |
6,711 | When does $1.00001^n$ exceed $n^{100001}$? | <p>I have been told than $n^{1000001} = O(1.000001^n)$. If that's the case, there must be some value $n$ at which $1.000001^n$ exceeds $n^{1000001}$.</p>

<p>However, when I consult Wolfram Alpha, I get a negative value for when that occurs.
<a href="http://www.wolframalpha.com/input/?i=1.000001%5Ex+%3D+x%5... | asymptotics landau notation | 1 | When does $1.00001^n$ exceed $n^{100001}$? -- (asymptotics landau notation)
<p>I have been told than $n^{1000001} = O(1.000001^n)$. If that's the case, there must be some value $n$ at which $1.000001^n$ exceeds $n^{1000001}$.</p>

<p>However, when I consult Wolfram Alpha, I get a negative value for when that oc... | habedi/stack-exchange-dataset |
6,717 | Formalization of the shortest path algorithm to a linear program | <p>I'm trying to understand a formalization of the shortest path algorithm to a linear programming problem:</p>

<p>For a graph $G=(E,V)$, we defined $F(v)=\{e \in E \mid t(e)=v \}$ and $B(v)=\{ e \in E \mid h(e)=v\}$ where $t(e)$ is a tail of a node, and $h(e)$ is a head of a node.</p>

<p>Also the s... | algorithms graphs shortest path linear programming | 1 | Formalization of the shortest path algorithm to a linear program -- (algorithms graphs shortest path linear programming)
<p>I'm trying to understand a formalization of the shortest path algorithm to a linear programming problem:</p>

<p>For a graph $G=(E,V)$, we defined $F(v)=\{e \in E \mid t(e)=v \}$ and $B(v... | habedi/stack-exchange-dataset |
6,720 | Minimum weight triangulation | <p>I'm just curious about the pseudocode (or real source code, doesn't matter) of the recursive version of this algorithm. In almost every book chapter/paper when describing this topic, they mention that the recursive version takes exponential time and then they give the code for the dynamic programming approach. I und... | algorithms computational geometry recursion | 1 | Minimum weight triangulation -- (algorithms computational geometry recursion)
<p>I'm just curious about the pseudocode (or real source code, doesn't matter) of the recursive version of this algorithm. In almost every book chapter/paper when describing this topic, they mention that the recursive version takes exponentia... | habedi/stack-exchange-dataset |
6,741 | probability wheel, redistribution of probabilities | <p>I have a contiguous ordered data structure (0 based index): </p>

<pre><code>x= [1/3, 1/3, 1/3]
</code></pre>

<p>Let's say I selected index 1 and increased the probability by 1/3. Rest of the probabilities each decrease by 1/6 and the total probability remains P = 1.</p>

<pre><code>x= [... | data structures probability theory | 1 | probability wheel, redistribution of probabilities -- (data structures probability theory)
<p>I have a contiguous ordered data structure (0 based index): </p>

<pre><code>x= [1/3, 1/3, 1/3]
</code></pre>

<p>Let's say I selected index 1 and increased the probability by 1/3. Rest of the probabilities... | habedi/stack-exchange-dataset |
6,744 | Algorithms for graph generation using given properties | <p>There may be a large number of algorithms proposed for generating graphs satisfying some common properties (e.g., clustering coefficient, average shortest path length, degree distribution, etc).</p>

<p>My question concerns a specific case: I want to generate a few <em>undirected regular</em> graphs (i.e., e... | algorithms graphs sampling | 1 | Algorithms for graph generation using given properties -- (algorithms graphs sampling)
<p>There may be a large number of algorithms proposed for generating graphs satisfying some common properties (e.g., clustering coefficient, average shortest path length, degree distribution, etc).</p>

<p>My question concern... | habedi/stack-exchange-dataset |
6,753 | Cantor's diagonal method in simple terms? | <p>Could anyone please explain Cantor's diagonalization principle in simple terms?</p>
 | complexity theory sets uncountability | 1 | Cantor's diagonal method in simple terms? -- (complexity theory sets uncountability)
<p>Could anyone please explain Cantor's diagonalization principle in simple terms?</p>
 | habedi/stack-exchange-dataset |
6,755 | Voronoi diagram with given number of vertices and sites | <p>I want to draw a Voronoi diagram with 9 sites and with </p>

<ol>
<li>no vertex, </li>
<li>1 vertex, </li>
<li>4 vertices, and</li>
<li>7 vertices.</li>
</ol>

<p>How do I approach this question. The one with no vertex is easy, it can be done by collinear points. What about the ot... | computational geometry | 1 | Voronoi diagram with given number of vertices and sites -- (computational geometry)
<p>I want to draw a Voronoi diagram with 9 sites and with </p>

<ol>
<li>no vertex, </li>
<li>1 vertex, </li>
<li>4 vertices, and</li>
<li>7 vertices.</li>
</ol>

<p>How do I approach this question. T... | habedi/stack-exchange-dataset |
6,768 | How is this grammar LL(1)? | <p>This is a question from the Dragon Book. This is the grammar:</p>

<blockquote>
 <p>$S \to AaAb \mid BbBa $<br>
 $A \to \varepsilon$<br>
 $B \to \varepsilon$ </p>
</blockquote>

<p>The question asks how to show that it is LL(1) but not SLR(1). </p>

<p>To prove that it is... | formal grammars compilers parsers | 1 | How is this grammar LL(1)? -- (formal grammars compilers parsers)
<p>This is a question from the Dragon Book. This is the grammar:</p>

<blockquote>
 <p>$S \to AaAb \mid BbBa $<br>
 $A \to \varepsilon$<br>
 $B \to \varepsilon$ </p>
</blockquote>

<p>The question asks how to show tha... | habedi/stack-exchange-dataset |
6,771 | LR(1) - Items, Look Ahead | <p>I am having diffuculties understanding the principle of lookahead in LR(1) - items. How do I compute the lookahead sets ? </p>

<p>Say for an example that I have the following grammar:</p>

<p>S -> AB
A -> aAb | b
B -> d</p>

<p>Then the first state will look like this:</p>

<... | formal languages formal grammars context free parsing | 1 | LR(1) - Items, Look Ahead -- (formal languages formal grammars context free parsing)
<p>I am having diffuculties understanding the principle of lookahead in LR(1) - items. How do I compute the lookahead sets ? </p>

<p>Say for an example that I have the following grammar:</p>

<p>S -> AB
A -> aAb | ... | habedi/stack-exchange-dataset |
6,773 | Finding negative cycles for cycle-canceling algorithm | <p>I am implementing the cycle-canceling algorithm to find an optimal solution for the min-cost flow problem. By finding and removing negative cost cycles in the residual network, the total cost is lowered in each round. To find a negative cycle I am using the bellman-ford algorithm.</p>

<p>My Problem is:
... | algorithms graphs shortest path network flow | 1 | Finding negative cycles for cycle-canceling algorithm -- (algorithms graphs shortest path network flow)
<p>I am implementing the cycle-canceling algorithm to find an optimal solution for the min-cost flow problem. By finding and removing negative cost cycles in the residual network, the total cost is lowered in each ro... | habedi/stack-exchange-dataset |
6,791 | Lambda calculus outside functional programming? | <p>I'm a university student, and we're currently studying Lambda Calculus. However, I still have a hard time understanding exactly why this is useful for me. I realize if you do loads of functional programming it might be useful, however I reckon that it's not really needed for learning functional programming, what do ... | lambda calculus functional programming | 1 | Lambda calculus outside functional programming? -- (lambda calculus functional programming)
<p>I'm a university student, and we're currently studying Lambda Calculus. However, I still have a hard time understanding exactly why this is useful for me. I realize if you do loads of functional programming it might be useful... | habedi/stack-exchange-dataset |
6,797 | Modifying Dijkstra's algorithm for edge weights drawn from range $[1,…,K]$ | <p>Suppose I have a directed graph with edge weights drawn from range $[1,\dots, K]$ where $K$ is constant. If I'm trying to find the shortest path using <a href="http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm">Dijkstra's algorithm</a>, how can I modify the algorithm / data structure and improve the time complexit... | algorithms data structures shortest path weighted graphs | 1 | Modifying Dijkstra's algorithm for edge weights drawn from range $[1,…,K]$ -- (algorithms data structures shortest path weighted graphs)
<p>Suppose I have a directed graph with edge weights drawn from range $[1,\dots, K]$ where $K$ is constant. If I'm trying to find the shortest path using <a href="http://en.wikipedia.... | habedi/stack-exchange-dataset |
6,801 | Every simple undirected graph with more than $(n-1)(n-2)/2$ edges is connected | <p>If a graph with $n$ vertices has more than $\frac{(n-1)(n-2)}{2}$ edges then it is connected.</p>

<p>I am a bit confused about this question, since I can always prove that for a graph to connected you need more than $|E|>n-1$ edges.</p>
 | graphs | 1 | Every simple undirected graph with more than $(n-1)(n-2)/2$ edges is connected -- (graphs)
<p>If a graph with $n$ vertices has more than $\frac{(n-1)(n-2)}{2}$ edges then it is connected.</p>

<p>I am a bit confused about this question, since I can always prove that for a graph to connected you need more than $... | habedi/stack-exchange-dataset |
6,807 | Matching girls with boys without mutual attraction (variant of maximum bipartite matching) | <p>Let us say you have a group of guys and and a group of girls. Each girl is either attracted to a guy or not, and vice versa. You want to match as many people as possible to a partner they like.</p>

<p>Does this problem have a name? Is it feasibly solvable? Sounds hard to me...</p>

<p>Ps. note that ... | algorithms graphs bipartite matching | 1 | Matching girls with boys without mutual attraction (variant of maximum bipartite matching) -- (algorithms graphs bipartite matching)
<p>Let us say you have a group of guys and and a group of girls. Each girl is either attracted to a guy or not, and vice versa. You want to match as many people as possible to a partner t... | habedi/stack-exchange-dataset |
6,809 | LL grammars and left-recursiviity | <p>Why LL(k) and LL(∞) are incompatible with left-recursion? I understand that a LL(k) language can support left-recursivity provided that with k-overahead tokens can be resolved any ambiguity. But, with a LL(∞) grammar, which type of ambiguities can't be solved?</p>
 | formal grammars parsers left recursion | 1 | LL grammars and left-recursiviity -- (formal grammars parsers left recursion)
<p>Why LL(k) and LL(∞) are incompatible with left-recursion? I understand that a LL(k) language can support left-recursivity provided that with k-overahead tokens can be resolved any ambiguity. But, with a LL(∞) grammar, which type of ambigui... | habedi/stack-exchange-dataset |
6,812 | Who (and when) first defined interval graphs? | <p>I've been searching google scholar for references and narrowed down the first mention to somewhere around <a href="http://books.google.com/ngrams/graph?content=interval%20graph&year_start=1800&year_end=2000&corpus=15&smoothing=0&share=">1963</a> with a very weird jitter in 1949.</p>

<p>S... | graphs reference request history | 1 | Who (and when) first defined interval graphs? -- (graphs reference request history)
<p>I've been searching google scholar for references and narrowed down the first mention to somewhere around <a href="http://books.google.com/ngrams/graph?content=interval%20graph&year_start=1800&year_end=2000&corpus=15&... | habedi/stack-exchange-dataset |
6,813 | How does increasing the page size affect the number of page faults? | <p>If we let the physical memory size remain constant,</p>

<ul>
<li>What effect does the size of the page have on the number of frames? </li>
<li>What effect does the number of frames have on the number of page faults?</li>
</ul>

<p>Also, please provide reference strings as an example. </... | operating systems memory management virtual memory paging | 1 | How does increasing the page size affect the number of page faults? -- (operating systems memory management virtual memory paging)
<p>If we let the physical memory size remain constant,</p>

<ul>
<li>What effect does the size of the page have on the number of frames? </li>
<li>What effect does the numbe... | habedi/stack-exchange-dataset |
6,815 | What is the TAK function for? | <p>We covered this in class today. I understand the mechanics of it, but aside from being a nice example of recursion does it serve any purpose? </p>

<p><img src="https://i.stack.imgur.com/DOcD0.png" alt="enter image description here"></p>

<p>Searching the web reveals lots of pages with the formula an... | algorithms recursion | 1 | What is the TAK function for? -- (algorithms recursion)
<p>We covered this in class today. I understand the mechanics of it, but aside from being a nice example of recursion does it serve any purpose? </p>

<p><img src="https://i.stack.imgur.com/DOcD0.png" alt="enter image description here"></p>

<p>Sea... | habedi/stack-exchange-dataset |
6,823 | Why is this $f(n) \leq 6n^3 + n^2 \log n \in O(n^3)$ for all $n \geq 1$? | <p>I'm currently studying for an algorithms midterm in about 2 days and am reading from the beginning of the course, and stumbled upon this when I actually looked at the examples.</p>

<p>The question equation: $f(n) = 6n^3 + n^2\log n$</p>

<p>The exact line written for the answer is: $f(n) \leq 6n^3 +... | asymptotics landau notation | 1 | Why is this $f(n) \leq 6n^3 + n^2 \log n \in O(n^3)$ for all $n \geq 1$? -- (asymptotics landau notation)
<p>I'm currently studying for an algorithms midterm in about 2 days and am reading from the beginning of the course, and stumbled upon this when I actually looked at the examples.</p>

<p>The question equat... | habedi/stack-exchange-dataset |
6,833 | Solving recurrence with logarithm squared $T(n)=2T(n/2) + n \log^2n$ | <p>$T(n)=2T(n/2) + n\log^2(n)$.</p>

<p>If I try to substitute $m = \log(n)$ I end up with </p>

<p>$T(2^m)=2 T(2^{m-1}) + 2^m\log^{2}(2^m)$.</p>

<p>Which isn't helpful to me. Any clues?</p>

<p>PS. hope this isn't too localized. I specified that the problem was a squared logarithm whic... | asymptotics proof techniques recurrence relation | 1 | Solving recurrence with logarithm squared $T(n)=2T(n/2) + n \log^2n$ -- (asymptotics proof techniques recurrence relation)
<p>$T(n)=2T(n/2) + n\log^2(n)$.</p>

<p>If I try to substitute $m = \log(n)$ I end up with </p>

<p>$T(2^m)=2 T(2^{m-1}) + 2^m\log^{2}(2^m)$.</p>

<p>Which isn't helpful to ... | habedi/stack-exchange-dataset |
6,839 | Minimum cost subset of sensors covering targets | <p>I have a dynamic programming problem: </p>

<blockquote>
 <p>If I have a set of sensors covering targets (a target might be
 covered by mutiple sensors) how can I find the minimum cost subset of
 sensors covering all targets given each sensor has a cost?</p>
</blockquote>

<p>I hav... | algorithms dynamic programming | 1 | Minimum cost subset of sensors covering targets -- (algorithms dynamic programming)
<p>I have a dynamic programming problem: </p>

<blockquote>
 <p>If I have a set of sensors covering targets (a target might be
 covered by mutiple sensors) how can I find the minimum cost subset of
 sensors coveri... | habedi/stack-exchange-dataset |
6,840 | A programming language that can only implement computable bijective functions? | <p>Are there programming languages(or logic) that can implement(or express) a function $f:\mathbb{N}\to \mathbb{N}$ if and only if $f$ is a computable bijective functions?</p>
 | reference request programming languages logic reversible computing | 1 | A programming language that can only implement computable bijective functions? -- (reference request programming languages logic reversible computing)
<p>Are there programming languages(or logic) that can implement(or express) a function $f:\mathbb{N}\to \mathbb{N}$ if and only if $f$ is a computable bijective function... | habedi/stack-exchange-dataset |
6,843 | How can repeated addition/multiplication be done in polynomial time? | <p>I can see how adding 2 unsigned $n$-bit values is $O(n)$. We just go from the rightmost digits to the leftmost digits and add the digits up sequentially. We can also perform multiplication in polynomial time ($O(n^2)$) via the algorithm we all learned in grade school.</p>

<p>However, how can we add up or mu... | time complexity arithmetic integers | 1 | How can repeated addition/multiplication be done in polynomial time? -- (time complexity arithmetic integers)
<p>I can see how adding 2 unsigned $n$-bit values is $O(n)$. We just go from the rightmost digits to the leftmost digits and add the digits up sequentially. We can also perform multiplication in polynomial time... | habedi/stack-exchange-dataset |
6,846 | is there an example of an algorithm that has O(1/n)? | <blockquote>
 <p><strong>Possible Duplicate:</strong><br>
 <a href="https://cs.stackexchange.com/questions/3495/complexity-inversely-propotional-to-n">Complexity inversely propotional to $n$</a> </p>
</blockquote>



<p>I'm curious if anyone's come up with a problem or method as n => infi... | time complexity | 1 | is there an example of an algorithm that has O(1/n)? -- (time complexity)
<blockquote>
 <p><strong>Possible Duplicate:</strong><br>
 <a href="https://cs.stackexchange.com/questions/3495/complexity-inversely-propotional-to-n">Complexity inversely propotional to $n$</a> </p>
</blockquote>


&#x... | habedi/stack-exchange-dataset |
6,847 | Is the k-clique problem NP-complete? | <p>In this Wikipedia article about the <a href="http://en.wikipedia.org/wiki/Clique_%28graph_theory%29">Clique problem in graph theory</a> it states in the beginning that the problem of finding a clique of size K, in a graph G is NP-complete:</p>

<blockquote>
 <p>Cliques have also been studied in computer... | complexity theory graphs np complete complexity classes | 1 | Is the k-clique problem NP-complete? -- (complexity theory graphs np complete complexity classes)
<p>In this Wikipedia article about the <a href="http://en.wikipedia.org/wiki/Clique_%28graph_theory%29">Clique problem in graph theory</a> it states in the beginning that the problem of finding a clique of size K, in a gra... | habedi/stack-exchange-dataset |
6,858 | Are monoids useful in optimization? | <p>Many common operations are <a href="http://en.wikipedia.org/wiki/Monoid">monoids</a>. Haskell has leveraged this observation to make many higher-order functions more generic (<code>Foldable</code> being one example).</p>

<p>There is one obvious way in which using monoids can be used to improve performance: ... | optimization compilers category theory | 1 | Are monoids useful in optimization? -- (optimization compilers category theory)
<p>Many common operations are <a href="http://en.wikipedia.org/wiki/Monoid">monoids</a>. Haskell has leveraged this observation to make many higher-order functions more generic (<code>Foldable</code> being one example).</p>

<p>Ther... | habedi/stack-exchange-dataset |
6,859 | Increasing entropy of random walk | <p>Let $P$ be a transition matrix of a random walk in an undirected <strong>(may not regular)</strong> graph $G$. Let $\pi$ be a distribution on $V(G)$. The Shannon entropy of $\pi$ is defined by </p>

<p>$$H(\pi)=-\sum_{v \in V(G)}\pi_v\cdot\log(\pi_v).$$</p>

<p>How do we prove that $H(P\pi)\ge H(\pi)... | entropy random walks | 1 | Increasing entropy of random walk -- (entropy random walks)
<p>Let $P$ be a transition matrix of a random walk in an undirected <strong>(may not regular)</strong> graph $G$. Let $\pi$ be a distribution on $V(G)$. The Shannon entropy of $\pi$ is defined by </p>

<p>$$H(\pi)=-\sum_{v \in V(G)}\pi_v\cdot\log(\pi_v... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.