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 |
|---|---|---|---|---|---|---|
32,421 | Is it possible to obtain a total function by composition of partial functions? | <p>This statement is Theorem 1.1 (page 39) of <em>Computability, Complexity and languages</em> by Martin Davis:</p>

<blockquote>
 <p>If function $h$ is obtained from the (partially) computable functions $f$, $g_1$, $g_2$, ..., $g_k$ by composition then $h$ is (partially) computable.</p>
</blockquote>&... | terminology computability semi decidability | 1 | Is it possible to obtain a total function by composition of partial functions? -- (terminology computability semi decidability)
<p>This statement is Theorem 1.1 (page 39) of <em>Computability, Complexity and languages</em> by Martin Davis:</p>

<blockquote>
 <p>If function $h$ is obtained from the (partial... | habedi/stack-exchange-dataset |
32,435 | Is Binary Search Related to Binary Search Tree? | <p>I was reading binary search and suddenly realized that it would be very difficult for a binary search tree to find the middle value and then split in two. Are these related at all?</p>
 | search algorithms | 1 | Is Binary Search Related to Binary Search Tree? -- (search algorithms)
<p>I was reading binary search and suddenly realized that it would be very difficult for a binary search tree to find the middle value and then split in two. Are these related at all?</p>
 | habedi/stack-exchange-dataset |
32,439 | Pumping lemma for 0^n and n>0 | <p>When applying the pumping lemma to $L = \{ 0^n \mid n>0\}$ I do the following:</p>

<p>$S = 0^p$<br>
$x = \varepsilon$<br>
$y = 0^p$<br>
$z = \varepsilon$</p>

<p>so $S = xyz = (\varepsilon)0^p(\varepsilon)$</p>

<p>For $x y^i z$ if i choose $i = 0$ (pumping down)
i get $S ... | formal languages regular languages pumping lemma | 1 | Pumping lemma for 0^n and n>0 -- (formal languages regular languages pumping lemma)
<p>When applying the pumping lemma to $L = \{ 0^n \mid n>0\}$ I do the following:</p>

<p>$S = 0^p$<br>
$x = \varepsilon$<br>
$y = 0^p$<br>
$z = \varepsilon$</p>

<p>so $S = xyz = (\varepsilon)0^p(\varepsi... | habedi/stack-exchange-dataset |
32,452 | Difference between a lambda term and a lambda expression | <p>Is there any difference between a $\lambda$-term and a $\lambda$-expression? </p>

<p>Looking at the recursive definitions on Wikipedia of 
<a href="http://en.wikipedia.org/wiki/Lambda_calculus#Lambda_terms" rel="nofollow">$\lambda$-term</a> and <a href="http://en.wikipedia.org/wiki/Lambda_calculus#Defin... | terminology lambda calculus | 1 | Difference between a lambda term and a lambda expression -- (terminology lambda calculus)
<p>Is there any difference between a $\lambda$-term and a $\lambda$-expression? </p>

<p>Looking at the recursive definitions on Wikipedia of 
<a href="http://en.wikipedia.org/wiki/Lambda_calculus#Lambda_terms" rel="no... | habedi/stack-exchange-dataset |
32,462 | Do Karnaugh maps yield the simplest solution possible? | <p>I'm learning to use a Karnaugh map, but I'm not sure if I obtained the simplest expression possible. Have a look at this example:</p>

<p>Truth table (inputs are A B C; output is F):</p>

<pre><code>A B C | F
0 0 0 | 1
0 0 1 | 0
0 1 0 | 1
1 0 0 | ... | logic boolean algebra digital circuits karnaugh map | 1 | Do Karnaugh maps yield the simplest solution possible? -- (logic boolean algebra digital circuits karnaugh map)
<p>I'm learning to use a Karnaugh map, but I'm not sure if I obtained the simplest expression possible. Have a look at this example:</p>

<p>Truth table (inputs are A B C; output is F):</p>

<... | habedi/stack-exchange-dataset |
32,466 | compressing a set of binary strings with fixed length | <p>I'm looking for a data structure / algorithm to store an unordered set <code>S</code> of binary strings of a fixed length <code>n</code> (i.e. all matching the following regular expression: <code>[01]{n}</code>).</p>

<p>Insertion and lookup ("Is element <code>x</code> in the <code>S</code>?") should maximal... | data structures strings sets | 1 | compressing a set of binary strings with fixed length -- (data structures strings sets)
<p>I'm looking for a data structure / algorithm to store an unordered set <code>S</code> of binary strings of a fixed length <code>n</code> (i.e. all matching the following regular expression: <code>[01]{n}</code>).</p>

<p>... | habedi/stack-exchange-dataset |
32,470 | Ambiguous Grammar to Unambiguous Grammar | <p>I'm wondering if somebody can please help me to understand how I go about converting this grammar to an unambiguous grammar. If you can point me in the right direction, I would greatly appreciate it.</p>

<p>S -> AB | aaB</p>

<p>A -> a | Aa</p>

<p>B -> b</p>
 | formal grammars ambiguity | 1 | Ambiguous Grammar to Unambiguous Grammar -- (formal grammars ambiguity)
<p>I'm wondering if somebody can please help me to understand how I go about converting this grammar to an unambiguous grammar. If you can point me in the right direction, I would greatly appreciate it.</p>

<p>S -> AB | aaB</p>

<p... | habedi/stack-exchange-dataset |
32,479 | Is $AlwaysHalt$ recursively enumerable? | <p>I was doing some complexity theory exercices and I came over this one:</p>

<p>$AlwaysHalt = \{R(M) | M$ halts with all $x \in \{0,1\}^*\}$</p>

<p>Is $AlwaysHalt$ recursively enumerable?</p>

<p>I would say YES and construct the following TM that accepts this language:</p>

<p>Enumer... | computability halting problem semi decidability | 1 | Is $AlwaysHalt$ recursively enumerable? -- (computability halting problem semi decidability)
<p>I was doing some complexity theory exercices and I came over this one:</p>

<p>$AlwaysHalt = \{R(M) | M$ halts with all $x \in \{0,1\}^*\}$</p>

<p>Is $AlwaysHalt$ recursively enumerable?</p>

<p>I wo... | habedi/stack-exchange-dataset |
32,482 | Given two sequences of the same size, how many longest common subsequences can they have? | <p>For simplicity assume that both have the same size N.</p>

<p>the lengh of this subsequence can be at most N, so maybe it's</p>

<p><code>max(C(N,1), C(N,2), ... , C(N,N))</code>?</p>
 | combinatorics | 1 | Given two sequences of the same size, how many longest common subsequences can they have? -- (combinatorics)
<p>For simplicity assume that both have the same size N.</p>

<p>the lengh of this subsequence can be at most N, so maybe it's</p>

<p><code>max(C(N,1), C(N,2), ... , C(N,N))</code>?</p>
 | habedi/stack-exchange-dataset |
32,495 | Why having a simple multiplication loop and very good avalanche isn't enough to produce well-distributed hash values? | <p>Modern non-cryptographic 32- and 64-bit valued hash functions, for example, lookup3, MurmurHash3 and CityHash, have quite sophisticated loops, each iteration of which include many multiplications, XORs and rotates. Why this is needed, since there are good avalanche procedures (32 -> 32 and 64 -> 64 bits), which mix ... | hash | 1 | Why having a simple multiplication loop and very good avalanche isn't enough to produce well-distributed hash values? -- (hash)
<p>Modern non-cryptographic 32- and 64-bit valued hash functions, for example, lookup3, MurmurHash3 and CityHash, have quite sophisticated loops, each iteration of which include many multiplic... | habedi/stack-exchange-dataset |
32,497 | Does the Y combinator contradict the Curry-Howard correspondence? | <p>The Y combinator has the type $(a \rightarrow a) \rightarrow a$. By the Curry-Howard Correspondence, because the type $(a \rightarrow a) \rightarrow a$ is inhabited, it must correspond to a true theorem. However $a \rightarrow a$ is always true, so it appears as if the Y combinator's type corresponds to the theorem ... | logic recursion type theory combinatory logic curry howard | 1 | Does the Y combinator contradict the Curry-Howard correspondence? -- (logic recursion type theory combinatory logic curry howard)
<p>The Y combinator has the type $(a \rightarrow a) \rightarrow a$. By the Curry-Howard Correspondence, because the type $(a \rightarrow a) \rightarrow a$ is inhabited, it must correspond to... | habedi/stack-exchange-dataset |
32,506 | Is a secondary TM sufficient to detect all loops? | <p>Procedure: Start a secondary TM in parallel with the first, but have the second perform exactly 1 step each 2 steps the first TM performs (i.e. it runs at half speed). If the second machine ever reaches the same configuration as the first, a loop was detected (obviously). </p>

<p>Claim: <em>All</em> infinit... | computability turing machines busy beaver | 1 | Is a secondary TM sufficient to detect all loops? -- (computability turing machines busy beaver)
<p>Procedure: Start a secondary TM in parallel with the first, but have the second perform exactly 1 step each 2 steps the first TM performs (i.e. it runs at half speed). If the second machine ever reaches the same configur... | habedi/stack-exchange-dataset |
32,509 | Kleene positive closure - help in proofing this claim | <p>I just started a course called 'Automata and Formal Languages'. 
I'm having difficulty in proofing\disproofing this equality. </p>

<p>$ (L_{1} \circ L_{2})^{+} = L_{1}^{+} \circ L_{2}^{+}
 $</p>

<p>Where:</p>

<p>$ L_{1} $, $L_{2}$ are Languages.</p>

<p>$\circ$ is the conca... | formal languages closure properties | 1 | Kleene positive closure - help in proofing this claim -- (formal languages closure properties)
<p>I just started a course called 'Automata and Formal Languages'. 
I'm having difficulty in proofing\disproofing this equality. </p>

<p>$ (L_{1} \circ L_{2})^{+} = L_{1}^{+} \circ L_{2}^{+}
 $</p>

<... | habedi/stack-exchange-dataset |
32,510 | Recursive methods with stacks | <p>I'm doing some practice papers for revision for my finals and I came across this question:</p>

<blockquote>
 <p>"This question is about recursion. A recursive method can always be implemented by an iterative method that uses a stack to keep track of intermediate values. Could the stack be replaced by, ... | computation models recursion stacks | 1 | Recursive methods with stacks -- (computation models recursion stacks)
<p>I'm doing some practice papers for revision for my finals and I came across this question:</p>

<blockquote>
 <p>"This question is about recursion. A recursive method can always be implemented by an iterative method that uses a stack... | habedi/stack-exchange-dataset |
32,514 | How is a Turing Test defined? | <p>Turing Test definition taken from <a href="http://en.wikipedia.org/wiki/Turing_test" rel="noreferrer">wikipedia</a>:</p>

<blockquote>
 <p>The Turing test is a test of a machine's ability to exhibit
 intelligent behavior equivalent to, or indistinguishable from, that of
 a human. In the origin... | artificial intelligence turing test | 1 | How is a Turing Test defined? -- (artificial intelligence turing test)
<p>Turing Test definition taken from <a href="http://en.wikipedia.org/wiki/Turing_test" rel="noreferrer">wikipedia</a>:</p>

<blockquote>
 <p>The Turing test is a test of a machine's ability to exhibit
 intelligent behavior equival... | habedi/stack-exchange-dataset |
32,522 | Why can't we search lexicographicaly ordered programs to compute Kolmogrov complexity? | <p>Kolmogrov complexity is known to be uncomputable. Why can't we enumerate all programs of size i = 0 in lexicographical order - if any produce string s, that is the Kolmogrov complexity; if not, increment i and iterate? Won't that prove that no program of length < i generates string s?</p>
 | computability kolmogorov complexity | 1 | Why can't we search lexicographicaly ordered programs to compute Kolmogrov complexity? -- (computability kolmogorov complexity)
<p>Kolmogrov complexity is known to be uncomputable. Why can't we enumerate all programs of size i = 0 in lexicographical order - if any produce string s, that is the Kolmogrov complexity; if... | habedi/stack-exchange-dataset |
32,534 | Find a collection of sets where each number from a given list is contained in a different set | <p>I have a set of numbers S of cardinality N, and a collection of sets each containing some subset of S. The cardinality of each of these sets can be anywhere from 1 to N. The number of sets is variable, but is necessarily at least N.</p>

<p>e.g.</p>

<p>$S = \{1, 2, 3, 4, 5, 6, 7, 8, 9\}$</p>
&... | algorithms sets | 1 | Find a collection of sets where each number from a given list is contained in a different set -- (algorithms sets)
<p>I have a set of numbers S of cardinality N, and a collection of sets each containing some subset of S. The cardinality of each of these sets can be anywhere from 1 to N. The number of sets is variable... | habedi/stack-exchange-dataset |
32,550 | Find all $k$ local maximums in an array of length $n$ in $O(n \log k)$ time | <p>Given a sequence of numbers $a_1, a_2, ..., a_n$, a number $a_i$ is called the $k$ local maximum $\iff i > k$ and $a_i$ is the largest number among the $(k+1)$ numbers $a_{i-k}, a_{i-k+1}, ..., a_i$. Given a sequence of $n$ numbers $a_1, a_2, ..., a_n$, and an integer $k$, I am requested to find all $k$ local max... | algorithms algorithm analysis runtime analysis search algorithms | 1 | Find all $k$ local maximums in an array of length $n$ in $O(n \log k)$ time -- (algorithms algorithm analysis runtime analysis search algorithms)
<p>Given a sequence of numbers $a_1, a_2, ..., a_n$, a number $a_i$ is called the $k$ local maximum $\iff i > k$ and $a_i$ is the largest number among the $(k+1)$ numbers ... | habedi/stack-exchange-dataset |
32,554 | Is Differential Evolution a genetic algorithm? | <p>I am trying to classify the Differential Evolution algorithm according to the framework <a href="http://rads.stackoverflow.com/amzn/click/3540401849" rel="noreferrer">in the book</a>:</p>

<blockquote>
 <p>Introduction to Evolutionary Computing</p>
</blockquote>

<p>The authors classify the ... | optimization genetic algorithms evolutionary computing | 1 | Is Differential Evolution a genetic algorithm? -- (optimization genetic algorithms evolutionary computing)
<p>I am trying to classify the Differential Evolution algorithm according to the framework <a href="http://rads.stackoverflow.com/amzn/click/3540401849" rel="noreferrer">in the book</a>:</p>

<blockquote>&... | habedi/stack-exchange-dataset |
32,557 | Calculating the runtime for a recursive algorithm | <p>If the runtime of a recursive algorithm could be expressed as </p>

<p>$T(n) = \begin{cases}O(1) & n \leq c \\ k * T\left(\frac{n}{k}\right) + \left(k + n * k \right)\end{cases}$</p>

<p>what would be the result of the asymptotic analysis (the Landau class)? $k \in \mathbb{N}, k \neq 0 $ is a con... | algorithm analysis runtime analysis landau notation | 1 | Calculating the runtime for a recursive algorithm -- (algorithm analysis runtime analysis landau notation)
<p>If the runtime of a recursive algorithm could be expressed as </p>

<p>$T(n) = \begin{cases}O(1) & n \leq c \\ k * T\left(\frac{n}{k}\right) + \left(k + n * k \right)\end{cases}$</p>

<p>wha... | habedi/stack-exchange-dataset |
32,558 | Algorithm to find smallest difference in array | <p>We want an algorithm that, given an array of length $n$ of integers, find the minimum difference between two integers in the array.</p>

<p>One such algorithm is to sort the array and check adjacent pairs of numbers. This takes time $O(n\log n)$.</p>

<p>Is there a faster way, e.g., an $O(n)$ algorit... | algorithms arrays | 1 | Algorithm to find smallest difference in array -- (algorithms arrays)
<p>We want an algorithm that, given an array of length $n$ of integers, find the minimum difference between two integers in the array.</p>

<p>One such algorithm is to sort the array and check adjacent pairs of numbers. This takes time $O(n\l... | habedi/stack-exchange-dataset |
32,563 | Generating all factorials up to $n$: faster than naive approach? | <p>I'm aware of prime decomposition and parallel approaches to calculating one factorial; however, if I want the factorials of all numbers up to $n$, is there anything more efficient than the naive approach? As far as I can tell, at least the prime decomposition algorithms aren't any more useful here than the naive app... | complexity theory enumeration factorial | 1 | Generating all factorials up to $n$: faster than naive approach? -- (complexity theory enumeration factorial)
<p>I'm aware of prime decomposition and parallel approaches to calculating one factorial; however, if I want the factorials of all numbers up to $n$, is there anything more efficient than the naive approach? As... | habedi/stack-exchange-dataset |
32,565 | Algorithm to maximize $j-i$ subject to $A[j]>A[i]$ | <p>We want an algorithm that, given an array $A$ of length $n$ of integers (indexed by $A[0],A[1],\ldots,A[n-1]$, determine values $i<j$ that maximizes $j-i $ subject to $A[j]>A[i]$ (if such values $i,j$ exist.)</p>

<p>One possibility is as follows: First check whether the array is non-increasing. If so,... | algorithms arrays | 1 | Algorithm to maximize $j-i$ subject to $A[j]>A[i]$ -- (algorithms arrays)
<p>We want an algorithm that, given an array $A$ of length $n$ of integers (indexed by $A[0],A[1],\ldots,A[n-1]$, determine values $i<j$ that maximizes $j-i $ subject to $A[j]>A[i]$ (if such values $i,j$ exist.)</p>

<p>One possibil... | habedi/stack-exchange-dataset |
32,566 | Average Case runtime for random choice search | <p>Assuming we have an array with $n$ Elements and want to find an unique element by randomly (uniformly) choosing. What would be the average case runtime?</p>

<p><strong>My thoughts so far:</strong></p>

<p>The chance to find the element is $\frac{1}{n}$ in every step. Thus, to find the element after ... | algorithms algorithm analysis runtime analysis randomized algorithms | 1 | Average Case runtime for random choice search -- (algorithms algorithm analysis runtime analysis randomized algorithms)
<p>Assuming we have an array with $n$ Elements and want to find an unique element by randomly (uniformly) choosing. What would be the average case runtime?</p>

<p><strong>My thoughts so far:<... | habedi/stack-exchange-dataset |
32,594 | Prove the upper bound on $T\left(n\right)=T\left(\log_{2}n\right)+O\left(\sqrt{n}\right)$ | <p>I need some help with the following recursion:</p>

<p>$T\left(n\right)=T\left(\log_{2}n\right)+O\left(\sqrt{n}\right)$</p>

<p>More specifically I wish to find and prove the upper bound on it.</p>

<p>I have a hunch it is $O\left(\sqrt{n}\right)$ but have gotten stuck proving it really is th... | asymptotics recurrence relation | 1 | Prove the upper bound on $T\left(n\right)=T\left(\log_{2}n\right)+O\left(\sqrt{n}\right)$ -- (asymptotics recurrence relation)
<p>I need some help with the following recursion:</p>

<p>$T\left(n\right)=T\left(\log_{2}n\right)+O\left(\sqrt{n}\right)$</p>

<p>More specifically I wish to find and prove the... | habedi/stack-exchange-dataset |
32,598 | What is the lower bound for finding the third largest in a set of $n$ distinct elements? | <blockquote>
 <p>What is the lower bound for finding the third largest in a set of $n$ distinct elements? </p>
</blockquote>

<p>For the case of finding the second largest, we have the tight lower bound of $n + \lceil \lg n \rceil -2$. The adversary argument can be found <a href="http://www.cs... | complexity theory reference request time complexity lower bounds search problem | 1 | What is the lower bound for finding the third largest in a set of $n$ distinct elements? -- (complexity theory reference request time complexity lower bounds search problem)
<blockquote>
 <p>What is the lower bound for finding the third largest in a set of $n$ distinct elements? </p>
</blockquote>
... | habedi/stack-exchange-dataset |
32,599 | difference between lzw and huffman coding technique | <p>What is the difference between the LZW and Huffman's coding of text compression ?</p>

<p>I've read <a href="http://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch" rel="nofollow">this</a> and
<a href="http://en.wikipedia.org/wiki/Huffman_coding" rel="nofollow">this</a> , but I'm not able to disti... | data compression | 1 | difference between lzw and huffman coding technique -- (data compression)
<p>What is the difference between the LZW and Huffman's coding of text compression ?</p>

<p>I've read <a href="http://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch" rel="nofollow">this</a> and
<a href="http://en.wikipedia.or... | habedi/stack-exchange-dataset |
32,618 | Show that a regular language L contains only palindromes if and only if all words of length at most 3n are palindromes | <p>This is an extension of a <a href="https://cs.stackexchange.com/q/32583/98">previous question asked by a different user</a> earlier:</p>
<blockquote>
<p>Let <span class="math-container">$x, u, v, w, y, x', u', v', w', y'$</span> be words satisfying</p>
<ol>
<li><span class="math-container">$y'x' = xy... | formal languages regular languages | 1 | Show that a regular language L contains only palindromes if and only if all words of length at most 3n are palindromes -- (formal languages regular languages)
<p>This is an extension of a <a href="https://cs.stackexchange.com/q/32583/98">previous question asked by a different user</a> earlier:</p>
<blockquote>
... | habedi/stack-exchange-dataset |
32,627 | If L is context-free, must FH(L) be context-free? | <blockquote>
<p>Define <span class="math-container">$FH(L) = \{x \in \Sigma^* : \exists y \in \Sigma^* \text{ with } |x| = |y| \text{ such that } xy \in L\}$</span>. In other words, <span class="math-container">$FH(L)$</span> is the set of first halves of even length strings in <span class="math-container">$L$</s... | formal languages context free closure properties | 1 | If L is context-free, must FH(L) be context-free? -- (formal languages context free closure properties)
<blockquote>
<p>Define <span class="math-container">$FH(L) = \{x \in \Sigma^* : \exists y \in \Sigma^* \text{ with } |x| = |y| \text{ such that } xy \in L\}$</span>. In other words, <span class="math-container"... | habedi/stack-exchange-dataset |
32,629 | A Black Box Algorithm | <p>I'm taking an introductory quantum computations class and I am attempting to solve the following question(s), but we haven't touched on black box algorithms like this in class, and I honestly don't know how to solve the question at all. Would it be possible to help me through the steps?</p>

<p><strong>Ques... | algorithms quantum computing | 1 | A Black Box Algorithm -- (algorithms quantum computing)
<p>I'm taking an introductory quantum computations class and I am attempting to solve the following question(s), but we haven't touched on black box algorithms like this in class, and I honestly don't know how to solve the question at all. Would it be possible to... | habedi/stack-exchange-dataset |
32,633 | What is the complexity of finding the two prime numbers a composite number (used in RSA Protocol) is made of? | <p>I am aware that as the number increases in Digits the process of locating the two prime numbers that when multiplied produce the given number is increased as well. </p>

<p>I also know that is it somewhat exponential or even more and with current machines it is rendered impossible to do in less than a year t... | time complexity cryptography integers factoring | 1 | What is the complexity of finding the two prime numbers a composite number (used in RSA Protocol) is made of? -- (time complexity cryptography integers factoring)
<p>I am aware that as the number increases in Digits the process of locating the two prime numbers that when multiplied produce the given number is increased... | habedi/stack-exchange-dataset |
32,635 | Semantic information collections on the web. (Semantic Wikipedia) | <p>There are lots of technologies supporting semantic information markup even as wiki software.</p>

<p>I am wondering if there is any kind of broad information collection project like Wikipedia which features semantic markup of those information.</p>

<p>Google didn't bring up a project like this (only... | reference request semantics data sets knowledge representation ontologies | 1 | Semantic information collections on the web. (Semantic Wikipedia) -- (reference request semantics data sets knowledge representation ontologies)
<p>There are lots of technologies supporting semantic information markup even as wiki software.</p>

<p>I am wondering if there is any kind of broad information collec... | habedi/stack-exchange-dataset |
32,637 | Understanding a proof in the sweep line algorithm when finding all line segment intersections | <p>You have a set of line segments and you want to find all intersections.</p>

<p><strong>First sweep line approach:</strong></p>

<p>Use a priority queue <code>Q</code> for the events as they come, where each event is just an end point of a line segment.</p>

<p>Use an unordered list <code>L<... | algorithms proof techniques correctness proof | 1 | Understanding a proof in the sweep line algorithm when finding all line segment intersections -- (algorithms proof techniques correctness proof)
<p>You have a set of line segments and you want to find all intersections.</p>

<p><strong>First sweep line approach:</strong></p>

<p>Use a priority queue <c... | habedi/stack-exchange-dataset |
32,643 | Finding vertices of a maximum clique in polynomial time | <p>Say you were given a black box that solves a clique problem in constant time.</p>

<p>You give the black box an undirected graph G with a bound k and it outputs either "Yes" or "No" that the graph G has a clique with at least k vertices.</p>

<p>How would you use this black box to find the vertices o... | np complete clique | 1 | Finding vertices of a maximum clique in polynomial time -- (np complete clique)
<p>Say you were given a black box that solves a clique problem in constant time.</p>

<p>You give the black box an undirected graph G with a bound k and it outputs either "Yes" or "No" that the graph G has a clique with at least k v... | habedi/stack-exchange-dataset |
32,651 | Prove the existence of a proposition logical formula so that following conditions are fulfilled | <p>For two proposition logical formulas $\phi$ and $\chi$ so that $\phi\implies\chi$ is generally valid. How can I prove that there is a formular $\psi$ with $var(\psi )\subseteq var(\phi )\cap var(\chi )$ so that $\phi\implies\psi$ and $\psi\implies\chi$ are generally valid?</p>
 | logic propositional logic | 1 | Prove the existence of a proposition logical formula so that following conditions are fulfilled -- (logic propositional logic)
<p>For two proposition logical formulas $\phi$ and $\chi$ so that $\phi\implies\chi$ is generally valid. How can I prove that there is a formular $\psi$ with $var(\psi )\subseteq var(\phi )\cap... | habedi/stack-exchange-dataset |
32,659 | Is the maximum coverage variant of Vertex Cover also NP-hard? | <p>In Chapter 3 of "Approximation Algorithms for NP Hard Problems" edited by Prof. Dorit S. Hochbaum, there is such a sentence that "Maximum Coverage Problem is clearly NP-hard, as Set Cover is reducible to it" in p.135.</p>

<blockquote>
 <p>Given a set system G and a parameter k, Maximum Coverage Problem... | complexity theory graphs reductions np hard | 1 | Is the maximum coverage variant of Vertex Cover also NP-hard? -- (complexity theory graphs reductions np hard)
<p>In Chapter 3 of "Approximation Algorithms for NP Hard Problems" edited by Prof. Dorit S. Hochbaum, there is such a sentence that "Maximum Coverage Problem is clearly NP-hard, as Set Cover is reducible to it... | habedi/stack-exchange-dataset |
32,668 | Could two decidable languages ever not have a mapping reduction? | <p>Is it ever the case that two decidable languages $L_1$ and $L_2$ that cannot be reduced to one another (in either or both directions)? Intuitively, I would not expect there to be, but rigorously, are there extreme examples that prove otherwise? </p>
 | computability reductions | 1 | Could two decidable languages ever not have a mapping reduction? -- (computability reductions)
<p>Is it ever the case that two decidable languages $L_1$ and $L_2$ that cannot be reduced to one another (in either or both directions)? Intuitively, I would not expect there to be, but rigorously, are there extreme examples... | habedi/stack-exchange-dataset |
32,678 | Is the Weighted Maximum Coverage Problem with frequency weights NP-hard? | <p>I want to prove the following case of Weighted Maximum Coverage problem with special weights is NP-hard. But I have no idea. So I am here seeking for help.</p>

<p>The Weighted Maximum Coverage problem is formulated as follows (known to be NP-hard): </p>

<p>Given a set <em>I</em> of <em>m</em> eleme... | complexity theory np hard | 1 | Is the Weighted Maximum Coverage Problem with frequency weights NP-hard? -- (complexity theory np hard)
<p>I want to prove the following case of Weighted Maximum Coverage problem with special weights is NP-hard. But I have no idea. So I am here seeking for help.</p>

<p>The Weighted Maximum Coverage problem is ... | habedi/stack-exchange-dataset |
32,679 | Is the Source Coding Theorem straightforward for uniformly distributed random variables? | <p>Shannon's source coding theorem states the following:</p>

<blockquote>
 <p>$n$ i.i.d. random variables $X_1,\dots,X_n$ each with entropy H(x) can be compressed into more than n⋅H(x) bits with negligible risk of information loss, as n→∞; conversely if they are compressed into fewer than n⋅H(x) bits it i... | probability theory information theory coding theory | 1 | Is the Source Coding Theorem straightforward for uniformly distributed random variables? -- (probability theory information theory coding theory)
<p>Shannon's source coding theorem states the following:</p>

<blockquote>
 <p>$n$ i.i.d. random variables $X_1,\dots,X_n$ each with entropy H(x) can be compress... | habedi/stack-exchange-dataset |
32,688 | Which permutations can not be obtained by moving elements through two stacks? | <p>I have a Stack1 which has the entries a,b,c ( with a on the Top) and Stack2 which is empty.The condition is.</p>

<blockquote>
 <p>An entry pooped out of the stack1 can be printed immediatly or pushed to stack2. An Entry popped out of the stack2 can only be printed. </p>
</blockquote>

<p>... | data structures combinatorics stacks | 1 | Which permutations can not be obtained by moving elements through two stacks? -- (data structures combinatorics stacks)
<p>I have a Stack1 which has the entries a,b,c ( with a on the Top) and Stack2 which is empty.The condition is.</p>

<blockquote>
 <p>An entry pooped out of the stack1 can be printed im... | habedi/stack-exchange-dataset |
32,703 | Is Bin-Packing with only 2 types of objects polynomial? | <p><strong>Is the following problem polynomial ? Or NP-Complete ?</strong></p>

<p><strong>Problem:</strong> Bin packing with 2 types of objects.</p>

<p><strong>Input:</strong> $C$, the capacity of each bin, $N_a, N_b$ the numbers of objects $a$ and $b$, $w_a,w_b$ the weight of the objects, $k$, the ma... | complexity theory np complete | 1 | Is Bin-Packing with only 2 types of objects polynomial? -- (complexity theory np complete)
<p><strong>Is the following problem polynomial ? Or NP-Complete ?</strong></p>

<p><strong>Problem:</strong> Bin packing with 2 types of objects.</p>

<p><strong>Input:</strong> $C$, the capacity of each bin, $N_a... | habedi/stack-exchange-dataset |
32,713 | Black box with O(n) calls | <p>Let's say a procedure called 'decision(x,q)' is available as a 'black box' 
X is the input set and Q is a real number Q.</p>

<p>I need to design an algorithm that reports "yes" if there exists a subset of X whose total sum is = Q
otherwise, it reports "no". </p>

<p>Running time is not an is... | algorithms dynamic programming | 1 | Black box with O(n) calls -- (algorithms dynamic programming)
<p>Let's say a procedure called 'decision(x,q)' is available as a 'black box' 
X is the input set and Q is a real number Q.</p>

<p>I need to design an algorithm that reports "yes" if there exists a subset of X whose total sum is = Q
otherwis... | habedi/stack-exchange-dataset |
32,723 | Unlimited Knapsack Problem | <p>How would I solve the unbounded knapsack problem, only this time aiming to maximize the weight instead of the value?</p>
 | knapsack problems | 1 | Unlimited Knapsack Problem -- (knapsack problems)
<p>How would I solve the unbounded knapsack problem, only this time aiming to maximize the weight instead of the value?</p>
 | habedi/stack-exchange-dataset |
32,726 | Prove Σ* is decidable | <p>I see that Σ* is claimed to be decidable in many documents, but I have never seen an example or easy demostration that it is decidable.</p>

<p>What is the proof that Σ* is decidable?</p>
 | computability | 1 | Prove Σ* is decidable -- (computability)
<p>I see that Σ* is claimed to be decidable in many documents, but I have never seen an example or easy demostration that it is decidable.</p>

<p>What is the proof that Σ* is decidable?</p>
 | habedi/stack-exchange-dataset |
32,727 | Simulate a regular Turing Machine with one that cannot write blanks | <p>Consider a Turing machine that cannot write blanks. How does one show that such a machine can simulate a standard Turing machine? </p>
 | turing machines computation models simulation | 1 | Simulate a regular Turing Machine with one that cannot write blanks -- (turing machines computation models simulation)
<p>Consider a Turing machine that cannot write blanks. How does one show that such a machine can simulate a standard Turing machine? </p>
 | habedi/stack-exchange-dataset |
32,728 | Are the complements of $NP$-languages with only $n$ words of length $n$ also in $NP$? | <p>Assuming $\Sigma = \{ 0, 1\}$..</p>

<p>Given a language $L$, such that for each $n\in \mathbb{N}$ we have $n$ words of length $n$ in $L$ and assuming $L\in NP$, can we prove also that $L\in Co-NP$?</p>

<p>So it is the same as showing that $\overline{L}\in NP$, but I'm not really sure on how to pr... | complexity theory closure properties np | 1 | Are the complements of $NP$-languages with only $n$ words of length $n$ also in $NP$? -- (complexity theory closure properties np)
<p>Assuming $\Sigma = \{ 0, 1\}$..</p>

<p>Given a language $L$, such that for each $n\in \mathbb{N}$ we have $n$ words of length $n$ in $L$ and assuming $L\in NP$, can we prove a... | habedi/stack-exchange-dataset |
32,730 | Designing a prefix code for integers? | <p>trying to figure out how to approach this problem.</p>

<blockquote>
 <p>Suppose a sender in a network wanted to communicate the length n of the block it will be using in a subsequent transmission. If there were not limits on the value of n, there would be a problem to simply send the number in binary, ... | algorithms data compression encoding scheme | 1 | Designing a prefix code for integers? -- (algorithms data compression encoding scheme)
<p>trying to figure out how to approach this problem.</p>

<blockquote>
 <p>Suppose a sender in a network wanted to communicate the length n of the block it will be using in a subsequent transmission. If there were not l... | habedi/stack-exchange-dataset |
32,736 | Shouldn't complexity theory consider the time taken for different operations? | <p>I have read the answer found <a href="https://cs.stackexchange.com/questions/1643/how-can-we-assume-that-basic-operations-on-numbers-take-constant-time">here</a> which considers the size of integers when doing comparisons and how that affects on the basic cost of comparison.</p>

<p>I am trying to understand... | complexity theory time complexity | 1 | Shouldn't complexity theory consider the time taken for different operations? -- (complexity theory time complexity)
<p>I have read the answer found <a href="https://cs.stackexchange.com/questions/1643/how-can-we-assume-that-basic-operations-on-numbers-take-constant-time">here</a> which considers the size of integers w... | habedi/stack-exchange-dataset |
32,749 | Recursive descent parser with backtracking for the grammar $S \rightarrow aSa\ |\ aa$ | <p>Can someone enlighten me why a recursive descent parser with backtracking that tries the productions $S \rightarrow aSa$ and $S \rightarrow aa$ (in that order) does not recognize the language formed by the grammar $S \rightarrow aSa\ |\ aa$.</p>

<p>It appears to only parse words from the language $\{a^{2^n}... | context free formal grammars compilers parsers | 1 | Recursive descent parser with backtracking for the grammar $S \rightarrow aSa\ |\ aa$ -- (context free formal grammars compilers parsers)
<p>Can someone enlighten me why a recursive descent parser with backtracking that tries the productions $S \rightarrow aSa$ and $S \rightarrow aa$ (in that order) does not recognize ... | habedi/stack-exchange-dataset |
32,766 | Is the identity function a many-one reduction from a language to super-set? | <p>I need help with a question.</p>

<p>Prove or disprove the following claim:</p>

<blockquote>
 <p>Let $f\colon \Sigma^* \to \Sigma^*$ be the identity function, i.e., $f(w) = w$ for all $w \in \Sigma^*$. Let $L_1$ and $L_2$ be two languages such that $L_1 \subseteq L_2$. Then $f$ is a many-to-one... | computability reductions | 1 | Is the identity function a many-one reduction from a language to super-set? -- (computability reductions)
<p>I need help with a question.</p>

<p>Prove or disprove the following claim:</p>

<blockquote>
 <p>Let $f\colon \Sigma^* \to \Sigma^*$ be the identity function, i.e., $f(w) = w$ for all $w \i... | habedi/stack-exchange-dataset |
32,773 | Proving equivelance of a multijump turing machine and a turing machine | <p>I'm having trouble getting started on this proof, and I was hoping you guys could give me a couple hints/point me in the direction of where to start? Here's the problem:</p>

<p>Consider a multijump Turing machine, which is like an ordinary Turing machine except the transition function is
δ : Q × Γ → Q ×... | turing machines computation models simulation | 1 | Proving equivelance of a multijump turing machine and a turing machine -- (turing machines computation models simulation)
<p>I'm having trouble getting started on this proof, and I was hoping you guys could give me a couple hints/point me in the direction of where to start? Here's the problem:</p>

<p>Consider ... | habedi/stack-exchange-dataset |
32,781 | Why does lower integer represent higher priority in scheduling literature? | <p>I'm studying Real Time Systems, and in the textbook most of the focus is on scheduling algorithms. (Textbook: Real-Time Systems by Jane W. S. Liu)</p>

<p>In the algorithms that involve priorities, it is said that smaller integer represents higher priority (e.g. a process with priority 1 has more priority th... | algorithms scheduling | 1 | Why does lower integer represent higher priority in scheduling literature? -- (algorithms scheduling)
<p>I'm studying Real Time Systems, and in the textbook most of the focus is on scheduling algorithms. (Textbook: Real-Time Systems by Jane W. S. Liu)</p>

<p>In the algorithms that involve priorities, it is sai... | habedi/stack-exchange-dataset |
32,800 | Product with floating point | <p>I was studying the product with floating point and I saw this example. I made the translation, sorry if something is not grammatically correct.</p>

<p>![enter image description here][1]</p>
 | floating point | 1 | Product with floating point -- (floating point)
<p>I was studying the product with floating point and I saw this example. I made the translation, sorry if something is not grammatically correct.</p>

<p>![enter image description here][1]</p>
 | habedi/stack-exchange-dataset |
32,804 | What's the big deal with the knapsack problem? | <p>In my CS course, we are covering things from one topic to another in sort of a sensible manner. For example, binary search tree -> 234-tree -> red-black tree -> heap -> greedy algorithms -> dynamic programming.</p>

<p>And all the sudden, bam, there is this whole chapter on the knapsack problem. How is this ... | complexity theory education knapsack problems didactics | 1 | What's the big deal with the knapsack problem? -- (complexity theory education knapsack problems didactics)
<p>In my CS course, we are covering things from one topic to another in sort of a sensible manner. For example, binary search tree -> 234-tree -> red-black tree -> heap -> greedy algorithms -> dynamic programming... | habedi/stack-exchange-dataset |
32,808 | Which algorithms have runtime recurrences like $T(n) = \sqrt{n}\,T(\sqrt{n}) + O(n)$? | <p>The algorithms using the <a href="https://en.wikipedia.org/wiki/Divide_and_conquer_algorithms" rel="nofollow">"divide and conquer" (wiki)</a> design strategy often have the time complexity of the form $T(n) = aT(n/b) + f(n)$, where $n$ is the problem size. Classic examples are binary search ($T(n) = T(n/2) + O(1)$) ... | algorithms algorithm analysis reference request runtime analysis recurrence relation | 1 | Which algorithms have runtime recurrences like $T(n) = \sqrt{n}\,T(\sqrt{n}) + O(n)$? -- (algorithms algorithm analysis reference request runtime analysis recurrence relation)
<p>The algorithms using the <a href="https://en.wikipedia.org/wiki/Divide_and_conquer_algorithms" rel="nofollow">"divide and conquer" (wiki)</a>... | habedi/stack-exchange-dataset |
32,814 | When using the Pumping lemma, how do I deal with different cases of y? | <p>I want to prove L is not regular:$$L={\{www|w \in \Sigma^*\}}$$ $$\Sigma=\{a,b\}$$</p>

<p>I am sure I can do so using pumping lemma. I used $$ab^pab^pab^p$$as my chosen string but I am stuck. I do not know how to handle different cases of y in pumping lemma.</p>
 | formal languages regular languages pumping lemma | 1 | When using the Pumping lemma, how do I deal with different cases of y? -- (formal languages regular languages pumping lemma)
<p>I want to prove L is not regular:$$L={\{www|w \in \Sigma^*\}}$$ $$\Sigma=\{a,b\}$$</p>

<p>I am sure I can do so using pumping lemma. I used $$ab^pab^pab^p$$as my chosen string but I ... | habedi/stack-exchange-dataset |
32,818 | Aggregate Rate and Poisson Process in Aloha | <p>I'm having a hard time understanding what is mean't by the aggregrate rate $\lambda$ and what it means for throughput in unslotted and slotted Aloha protocols. The more I seem to read about poission process the more confused I get.</p>

<p>I understand that the probability a packet is transmitted in a time i... | computer networks communication protocols | 1 | Aggregate Rate and Poisson Process in Aloha -- (computer networks communication protocols)
<p>I'm having a hard time understanding what is mean't by the aggregrate rate $\lambda$ and what it means for throughput in unslotted and slotted Aloha protocols. The more I seem to read about poission process the more confused I... | habedi/stack-exchange-dataset |
32,826 | Characterizing cycles in a directed graph with optional edges | <p>Consider a directed graph in which some edges are marked as "optional". A graph with $N$ optional edges induces a family of $2^N$ graphs depending on which edges are removed. In some cases, some of these graphs may be acyclic while others contain cycles.</p>

<p>For example, consider the graph with vertices ... | graphs | 1 | Characterizing cycles in a directed graph with optional edges -- (graphs)
<p>Consider a directed graph in which some edges are marked as "optional". A graph with $N$ optional edges induces a family of $2^N$ graphs depending on which edges are removed. In some cases, some of these graphs may be acyclic while others cont... | habedi/stack-exchange-dataset |
32,828 | Bakery algorithm: what is the choosing[] boolean array for? | <p>I'm studying the <a href="http://en.wikipedia.org/wiki/Lamport's_bakery_algorithm" rel="nofollow">bakery algorithm</a>.</p>

<pre><code>do { 
 choosing[i] = true; 
 number[i] = max(number[0], number[1], …, number [n – 1])+1; 
 choosing[i] = false; 
 for (j = 0; j < n; j... | algorithms concurrency synchronization | 1 | Bakery algorithm: what is the choosing[] boolean array for? -- (algorithms concurrency synchronization)
<p>I'm studying the <a href="http://en.wikipedia.org/wiki/Lamport's_bakery_algorithm" rel="nofollow">bakery algorithm</a>.</p>

<pre><code>do { 
 choosing[i] = true; 
 number[i] = max(numb... | habedi/stack-exchange-dataset |
32,831 | Shannon-Fano puzzle | <p>I was playing around with Shannon-Fano (SF) entropy encoding when I ran into this issue. </p>

<p>I am aware that the compression that can be achieved with SF is sometimes inferior to that of Huffman encoding, but I just though it meant that code lengths were sometimes sub-optimal in the sense that an encodi... | data compression | 1 | Shannon-Fano puzzle -- (data compression)
<p>I was playing around with Shannon-Fano (SF) entropy encoding when I ran into this issue. </p>

<p>I am aware that the compression that can be achieved with SF is sometimes inferior to that of Huffman encoding, but I just though it meant that code lengths were sometim... | habedi/stack-exchange-dataset |
32,837 | Proof that a node N balanced binary search tree has $2^i - 1$ children where $i$ is the position of the first 1-bit in N, starting from 0 | <p>I was binary indexed trees and I came across this <a href="http://codinghighway.com/?p=1312" rel="nofollow">article</a>. One part of the justification was the following:</p>

<blockquote>
 <p>Given that the (binary search tree) tree is perfectly balanced, a node N will have exactly
 $2^{i}-1$ child... | proof techniques binary trees search trees | 1 | Proof that a node N balanced binary search tree has $2^i - 1$ children where $i$ is the position of the first 1-bit in N, starting from 0 -- (proof techniques binary trees search trees)
<p>I was binary indexed trees and I came across this <a href="http://codinghighway.com/?p=1312" rel="nofollow">article</a>. One part o... | habedi/stack-exchange-dataset |
32,839 | Solving a Variation of knapsack | <p>I'm working on a problem which to me, seems very similar to a knapsack problem:</p>
<blockquote>
<p>A furniture store is having sale: Purchase two items at the price of the more expensive one. David went to the store and bought <span class="math-container">$2k$</span> items: <span class="math-container">$f_1... | algorithms complexity theory knapsack problems | 1 | Solving a Variation of knapsack -- (algorithms complexity theory knapsack problems)
<p>I'm working on a problem which to me, seems very similar to a knapsack problem:</p>
<blockquote>
<p>A furniture store is having sale: Purchase two items at the price of the more expensive one. David went to the store and boug... | habedi/stack-exchange-dataset |
32,845 | Why, really, is the Halting Problem so important? | <p>I don't understand why the <a href="https://en.wikipedia.org/wiki/Halting_problem" rel="nofollow noreferrer">Halting Problem</a> is so often used to dismiss the possibility of determining whether a program halts. The <a href="https://en.wikipedia.org/wiki/Halting_problem" rel="nofollow noreferrer">Wikipedia article<... | computability halting problem | 1 | Why, really, is the Halting Problem so important? -- (computability halting problem)
<p>I don't understand why the <a href="https://en.wikipedia.org/wiki/Halting_problem" rel="nofollow noreferrer">Halting Problem</a> is so often used to dismiss the possibility of determining whether a program halts. The <a href="https:... | habedi/stack-exchange-dataset |
32,861 | How do deal with the following situations using Prim's algorithm? | <p>Consider the following Graph</p>

<p>We want to generate the MST using Prim's algorithm. </p>

<p>Starting from node A, suppose we pick B as our next node, we see a self-loop that has less weight than the two other alternatives.</p>

<ol>
<li>Do we ever take the self loop? Why not?</li>&#... | graphs minimum spanning tree spanning trees | 1 | How do deal with the following situations using Prim's algorithm? -- (graphs minimum spanning tree spanning trees)
<p>Consider the following Graph</p>

<p>We want to generate the MST using Prim's algorithm. </p>

<p>Starting from node A, suppose we pick B as our next node, we see a self-loop that has le... | habedi/stack-exchange-dataset |
32,863 | Given $T(n) = \sum_{i = 0}^{\log n} i 2^i$, what is $O(T(n))$? | <p>I'm trying to perform an asymptotic analysis on a function:</p>

<p>$T(n) = \sum_{i = 0}^{\log n} i 2^i$</p>

<p>The above expression came about when I began with:</p>

<p>$T(n) = \sum_{i = 0}^{\log n} 2^i \log (2^i)$</p>

<p>Is there a tight, closed-form expression for $O(T(n))$?</p>... | asymptotics | 1 | Given $T(n) = \sum_{i = 0}^{\log n} i 2^i$, what is $O(T(n))$? -- (asymptotics)
<p>I'm trying to perform an asymptotic analysis on a function:</p>

<p>$T(n) = \sum_{i = 0}^{\log n} i 2^i$</p>

<p>The above expression came about when I began with:</p>

<p>$T(n) = \sum_{i = 0}^{\log n} 2^i \log (2... | habedi/stack-exchange-dataset |
32,866 | Inferring Shannon Capacity of pentagon | <p>Can we infer from the fact that the number of independent sets in product of $5$-cycle two times is $5$ and in product of $5$-cycle four times is $25$, that the capacity of pentagon is $\sqrt{5}$? That is does $\alpha(C_5 \boxtimes C_5)=5$ and $\alpha(C_5 \boxtimes C_5\boxtimes C_5 \boxtimes C_5)=25$ imply $\theta(C... | information theory | 1 | Inferring Shannon Capacity of pentagon -- (information theory)
<p>Can we infer from the fact that the number of independent sets in product of $5$-cycle two times is $5$ and in product of $5$-cycle four times is $25$, that the capacity of pentagon is $\sqrt{5}$? That is does $\alpha(C_5 \boxtimes C_5)=5$ and $\alpha(C_... | habedi/stack-exchange-dataset |
32,867 | How can I make sense of amortized accounting method? | <p>Amortized accounting method has to be one of the most abstract analysis technique I have ever seen in my life (maybe aside from the potential method which I haven't read).</p>

<p>In the example of the Stack with Multiple Pops (From CLRS, for reference: <a href="http://chuck.ferzle.com/Notes/Notes/AlgorithmA... | algorithm analysis proof techniques amortized analysis | 1 | How can I make sense of amortized accounting method? -- (algorithm analysis proof techniques amortized analysis)
<p>Amortized accounting method has to be one of the most abstract analysis technique I have ever seen in my life (maybe aside from the potential method which I haven't read).</p>

<p>In the example o... | habedi/stack-exchange-dataset |
32,875 | How do I use induction to show that the language of a grammar is contained in a given set? | <p>Given that I have the grammar</p>

<p>$\qquad\displaystyle G_1 = (\{a, b, c, d\}, \{S, X, Y \}, S, \{S → XY, X → aXb, X → ab, Y → cYd, Y → cd\})$,</p>

<p>how am I supposed to prove that</p>

<p>$\qquad\displaystyle S(G1) ⊆ \{a^{n+1} b^{n+1} c^{m+1} d^{m+1} \mid n, m ≥ 0\}$</p>

<p>by... | formal grammars proof techniques induction | 1 | How do I use induction to show that the language of a grammar is contained in a given set? -- (formal grammars proof techniques induction)
<p>Given that I have the grammar</p>

<p>$\qquad\displaystyle G_1 = (\{a, b, c, d\}, \{S, X, Y \}, S, \{S → XY, X → aXb, X → ab, Y → cYd, Y → cd\})$,</p>

<p>how am ... | habedi/stack-exchange-dataset |
32,876 | Minimizing total distance to a point from a set of points | <p>I've read about a problem:</p>

<blockquote>
 <p>There are $n$ houses that are placed randomly. Place a parking lot so that the (straight-line) distance to all houses is minimal.</p>
</blockquote>

<p>I've written a Monte-Carlo algorithm, but that can't be the optimal approach.</p>

... | computational geometry shortest path monte carlo | 1 | Minimizing total distance to a point from a set of points -- (computational geometry shortest path monte carlo)
<p>I've read about a problem:</p>

<blockquote>
 <p>There are $n$ houses that are placed randomly. Place a parking lot so that the (straight-line) distance to all houses is minimal.</p>
</blo... | habedi/stack-exchange-dataset |
32,882 | Complexity of variation of partition problem | <p>I want to know whats the complexity of the following variant of the partition problem:</p>

<p>Partition problem:</p>

<p><a href="http://en.wikipedia.org/wiki/Partition_problem" rel="nofollow">http://en.wikipedia.org/wiki/Partition_problem</a></p>

<p>Suppose we have one set formed by intege... | complexity theory np partitions | 1 | Complexity of variation of partition problem -- (complexity theory np partitions)
<p>I want to know whats the complexity of the following variant of the partition problem:</p>

<p>Partition problem:</p>

<p><a href="http://en.wikipedia.org/wiki/Partition_problem" rel="nofollow">http://en.wikipedia.org/w... | habedi/stack-exchange-dataset |
32,883 | Loop invariant: decreasing a variable and swapping it | <p>As an example exercise, we were asked to find the loop invariant for this bit of code. </p>

<pre><code>def mystery(a,b):
 # Precondition: a >= 0 and b >= 0
 while a >= 0 and b >= 0:
 if a < b:
 a, b = b, a
 else:
 a = a - 1&#x... | algorithm analysis loops loop invariants imperative programming | 1 | Loop invariant: decreasing a variable and swapping it -- (algorithm analysis loops loop invariants imperative programming)
<p>As an example exercise, we were asked to find the loop invariant for this bit of code. </p>

<pre><code>def mystery(a,b):
 # Precondition: a >= 0 and b >= 0
 while a... | habedi/stack-exchange-dataset |
32,892 | How was counted one second in computers | <p>I would like to know how was counted 1 second in computers. I mean how machine can understand period of 1 second. Who and when resolved this problem, and more important how ?</p>
 | computer architecture clocks | 1 | How was counted one second in computers -- (computer architecture clocks)
<p>I would like to know how was counted 1 second in computers. I mean how machine can understand period of 1 second. Who and when resolved this problem, and more important how ?</p>
 | habedi/stack-exchange-dataset |
32,897 | What to expect in a Computer Science and Mathematics course? | <p>I'm a high school student. I'm really into programming and mathematics and planning to study CS and mathematics when finished with high school.</p>

<p>I have a couple of questions concerning this issue:</p>

<p>Firstly, from maths point of view, what are the prerequisites and what subjects do I get ... | education books | 1 | What to expect in a Computer Science and Mathematics course? -- (education books)
<p>I'm a high school student. I'm really into programming and mathematics and planning to study CS and mathematics when finished with high school.</p>

<p>I have a couple of questions concerning this issue:</p>

<p>Firstly... | habedi/stack-exchange-dataset |
32,904 | Is complexity of $GI_{di}$ same as $GI_{un}$? | <p>Does the graph isomorphism problem for directed graphs($GI_{di}$) reduce to the graph isomorphism problem for directed graphs($GI_{un}$)?</p>

<p>It is clear $$GI_{un}\leq GI_{di}$$ since the set of undirected graphs is subset of set of directed graphs. Does the converse hold true? That is, can an algorithm ... | complexity theory reductions graph isomorphism | 1 | Is complexity of $GI_{di}$ same as $GI_{un}$? -- (complexity theory reductions graph isomorphism)
<p>Does the graph isomorphism problem for directed graphs($GI_{di}$) reduce to the graph isomorphism problem for directed graphs($GI_{un}$)?</p>

<p>It is clear $$GI_{un}\leq GI_{di}$$ since the set of undirected g... | habedi/stack-exchange-dataset |
32,906 | Binary Indexed Trees: Why does i & -i work? | <p>I already read <a href="https://cs.stackexchange.com/questions/10538/bit-what-is-the-intuition-behind-a-binary-indexed-tree-and-how-was-it-thought-a">this</a> related question on the intuition behind binary indexed trees, and while the answer explains how the tree structure works, it does not really explain how this... | data structures binary trees correctness proof arithmetic | 1 | Binary Indexed Trees: Why does i & -i work? -- (data structures binary trees correctness proof arithmetic)
<p>I already read <a href="https://cs.stackexchange.com/questions/10538/bit-what-is-the-intuition-behind-a-binary-indexed-tree-and-how-was-it-thought-a">this</a> related question on the intuition behind binary ind... | habedi/stack-exchange-dataset |
32,912 | Dynamic programming to find the least possible balance of a full binary tree | <p>I am given $n$ positive integers $x_1,x_2,\cdots,x_n$ as input. These are the weights of the leaves in a full binary tree, $x_1$ being the leftmost leaf and $x_n$ the rightmost leaf. The weight of an internal node $v$ is defined as the sum of weights of the leaves in the subtree rooted at $v$. The balance of an inte... | algorithms dynamic programming binary trees | 1 | Dynamic programming to find the least possible balance of a full binary tree -- (algorithms dynamic programming binary trees)
<p>I am given $n$ positive integers $x_1,x_2,\cdots,x_n$ as input. These are the weights of the leaves in a full binary tree, $x_1$ being the leftmost leaf and $x_n$ the rightmost leaf. The weig... | habedi/stack-exchange-dataset |
32,929 | Efficient simulation of an NFA, while preserving the paths to the accept states | <p>The standard way of simulating an NFA on a computer (for implementing regex engines etc) is to construct a DFA that accepts the same language. Otherwise you get problems like exponential blowup.</p>

<p>However, for my purpose I need to know which paths the NFA went through for accepted words. This is obviou... | automata finite automata simulation | 1 | Efficient simulation of an NFA, while preserving the paths to the accept states -- (automata finite automata simulation)
<p>The standard way of simulating an NFA on a computer (for implementing regex engines etc) is to construct a DFA that accepts the same language. Otherwise you get problems like exponential blowup.</... | habedi/stack-exchange-dataset |
32,939 | Balancing a Binary Search Tree | <p>I was reading about binary search trees on it's Wikipedia <a href="http://en.wikipedia.org/wiki/Binary_search_tree" rel="nofollow">article</a>. I was a little confused by this <a href="http://en.wikipedia.org/wiki/File:Binary_search_tree.svg" rel="nofollow">image</a>. Why is it that the right branch to the head node... | data structures search trees balanced search trees | 1 | Balancing a Binary Search Tree -- (data structures search trees balanced search trees)
<p>I was reading about binary search trees on it's Wikipedia <a href="http://en.wikipedia.org/wiki/Binary_search_tree" rel="nofollow">article</a>. I was a little confused by this <a href="http://en.wikipedia.org/wiki/File:Binary_sear... | habedi/stack-exchange-dataset |
32,941 | Composition for Functional Depedencies | <p>Suppose I have the following Functional Dependencies for a Relational Model:</p>
<blockquote>
<p><span class="math-container">$A \to C$</span></p>
<p><span class="math-container">$B \to C$</span></p>
</blockquote>
<p>According to the composition rule for functional dependencies we have:</p>
<... | database theory | 1 | Composition for Functional Depedencies -- (database theory)
<p>Suppose I have the following Functional Dependencies for a Relational Model:</p>
<blockquote>
<p><span class="math-container">$A \to C$</span></p>
<p><span class="math-container">$B \to C$</span></p>
</blockquote>
<p>According to the com... | habedi/stack-exchange-dataset |
32,944 | Does a coin tossing algorithm terminate? | <p>Suppose we have an algorithm like:</p>

<pre><code>n = 0
REPEAT
 c = randomInt(0,1)
 n = n + 1
UNTIL (c == 0)
RETURN n
</code></pre>

<p>(Assumuing the random number generator produces "good" random numbers in the mathematical sense.)</p>

<p>I understand that there ... | algorithms randomized algorithms | 1 | Does a coin tossing algorithm terminate? -- (algorithms randomized algorithms)
<p>Suppose we have an algorithm like:</p>

<pre><code>n = 0
REPEAT
 c = randomInt(0,1)
 n = n + 1
UNTIL (c == 0)
RETURN n
</code></pre>

<p>(Assumuing the random number generator produces "good" rand... | habedi/stack-exchange-dataset |
32,950 | If P = NP, then is NP = FNP? | <p>I read</p>

<blockquote>
 <p>FP = FNP iff P = NP</p>
</blockquote>

<p>which makes sense.</p>

<p>But if P = NP, does it mean FNP = NP?</p>

<p>Intuitively, I think no because P = NP would mean that decision problems in NP would become decision problems in P. But I don't see ... | complexity theory complexity classes np | 1 | If P = NP, then is NP = FNP? -- (complexity theory complexity classes np)
<p>I read</p>

<blockquote>
 <p>FP = FNP iff P = NP</p>
</blockquote>

<p>which makes sense.</p>

<p>But if P = NP, does it mean FNP = NP?</p>

<p>Intuitively, I think no because P = NP would mean that dec... | habedi/stack-exchange-dataset |
32,952 | If all infinite r.e. languages have an infinite recursive subset, then do co-r.e. languages not have such subsets? | <p>If all infinite r.e. languages have an infinite recursive subset, then can we logically take co-r.e. languages to not have such subsets by complemence?</p>
 | computability | 1 | If all infinite r.e. languages have an infinite recursive subset, then do co-r.e. languages not have such subsets? -- (computability)
<p>If all infinite r.e. languages have an infinite recursive subset, then can we logically take co-r.e. languages to not have such subsets by complemence?</p>
 | habedi/stack-exchange-dataset |
32,957 | Where does the terminology of open addressing resp. closed hashing come from? | <p>One of the basic methods of hashing is called "Open addressing, or closed hashing" according to <a href="http://en.wikipedia.org/wiki/Open_addressing" rel="nofollow">wikipadia</a> (and several books).</p>

<p>Why the names "open" and "closed", and why these seemingly contradictory names for the same method?<... | terminology data structures reference request hash tables | 1 | Where does the terminology of open addressing resp. closed hashing come from? -- (terminology data structures reference request hash tables)
<p>One of the basic methods of hashing is called "Open addressing, or closed hashing" according to <a href="http://en.wikipedia.org/wiki/Open_addressing" rel="nofollow">wikipadia<... | habedi/stack-exchange-dataset |
32,990 | Type checking relation to logic | <p>I am learning <strong>logic and functional programming</strong> and there is a topic called <strong>Type checking and their relationship to logic</strong> , I am unable to find any source that can help me in understanding this topic. Please help .</p>
 | logic type checking | 1 | Type checking relation to logic -- (logic type checking)
<p>I am learning <strong>logic and functional programming</strong> and there is a topic called <strong>Type checking and their relationship to logic</strong> , I am unable to find any source that can help me in understanding this topic. Please help .</p>
 | habedi/stack-exchange-dataset |
32,998 | Is the infinite union of computable sets computable? | <p>My intuition is telling me that this is untrue. But I am having trouble formulating a proof for this. Can anyone point me in the right direction? I've seen a proof by contradiction involving the union of all singletons in an infinite language but I am needing a to look at this from a different angle. </p>

<... | computability | 1 | Is the infinite union of computable sets computable? -- (computability)
<p>My intuition is telling me that this is untrue. But I am having trouble formulating a proof for this. Can anyone point me in the right direction? I've seen a proof by contradiction involving the union of all singletons in an infinite language bu... | habedi/stack-exchange-dataset |
33,002 | Applying Brewer's theorem (CAP) to a single node | <p>I'm going through Brewer's theorem and its proof by Nancy Lynch and Seth Gilbert. But the paper left me with one question. What prevents the theorem from being applicable to a single node?</p>

<p>I haven’t encountered any explicit definition of network partition that restricts its applicability to a network... | computer networks database theory | 1 | Applying Brewer's theorem (CAP) to a single node -- (computer networks database theory)
<p>I'm going through Brewer's theorem and its proof by Nancy Lynch and Seth Gilbert. But the paper left me with one question. What prevents the theorem from being applicable to a single node?</p>

<p>I haven’t encountered an... | habedi/stack-exchange-dataset |
33,014 | Range update + range query with binary indexed trees | <p>I am trying to understand how binary indexed trees (fenwick trees) can be modified to handle both range queries and range updates.</p>

<p>I found the following sources:</p>

<p><a href="http://kartikkukreja.wordpress.com/2013/12/02/range-updates-with-bit-fenwick-tree/" rel="noreferrer">http://kartik... | data structures binary trees search trees | 1 | Range update + range query with binary indexed trees -- (data structures binary trees search trees)
<p>I am trying to understand how binary indexed trees (fenwick trees) can be modified to handle both range queries and range updates.</p>

<p>I found the following sources:</p>

<p><a href="http://kartikk... | habedi/stack-exchange-dataset |
33,018 | How to XOR automata? | <p>Say we have 3 DFAs. We know how to OR, AND, or NOT them. But how does one XOR them? There is not one single mention of this online.</p>

<p>$x\; \mathrm{XOR} \;y\; \mathrm{XOR} \;z = ((x|y)(\neg x|y)|z) (\neg ((x|y)(\neg x|y))|z)$. This is way too complicated and time consuming to draw. Isn't there another w... | automata finite automata closure properties | 1 | How to XOR automata? -- (automata finite automata closure properties)
<p>Say we have 3 DFAs. We know how to OR, AND, or NOT them. But how does one XOR them? There is not one single mention of this online.</p>

<p>$x\; \mathrm{XOR} \;y\; \mathrm{XOR} \;z = ((x|y)(\neg x|y)|z) (\neg ((x|y)(\neg x|y))|z)$. This is... | habedi/stack-exchange-dataset |
33,031 | Why is the consensus number for test-and-set, 2? | <p>According to <a href="https://en.wikipedia.org/wiki/Test-and-set">Wikipedia</a>,</p>

<blockquote>
 <p>The test-and-set operation can solve the wait-free consensus problem for no more than two concurrent processes.</p>
</blockquote>

<p>Why can't it solve the problem for more than two proces... | concurrency consensus | 1 | Why is the consensus number for test-and-set, 2? -- (concurrency consensus)
<p>According to <a href="https://en.wikipedia.org/wiki/Test-and-set">Wikipedia</a>,</p>

<blockquote>
 <p>The test-and-set operation can solve the wait-free consensus problem for no more than two concurrent processes.</p>
</blo... | habedi/stack-exchange-dataset |
33,034 | Concatenation of languages in NP | <p>I have a hard time to understand why the concatenation of two languages over an alphabet (concatenation is in NP), doesn't imply that each of the languages for themselves are in NP. I talked with my Prof about the problem today, but I can't wrap my head around it. Can you help me out? </p>
 | complexity theory closure properties np | 1 | Concatenation of languages in NP -- (complexity theory closure properties np)
<p>I have a hard time to understand why the concatenation of two languages over an alphabet (concatenation is in NP), doesn't imply that each of the languages for themselves are in NP. I talked with my Prof about the problem today, but I can'... | habedi/stack-exchange-dataset |
33,036 | Dividing large numbers modulo m | <p>I have numbers $a$, $b$ and $m$, and I need to get the result of $\ \dfrac{a}{b} \mod m$. </p>

<p>The catch is that while $m \leq 10^9$, $a$ and $b$ can get extremely large ($2^{100,000}$), so I'm keeping them as a multiset of their prime factors.</p>

<p>I read about <a href="http://en.wikipedia.or... | modular arithmetic | 1 | Dividing large numbers modulo m -- (modular arithmetic)
<p>I have numbers $a$, $b$ and $m$, and I need to get the result of $\ \dfrac{a}{b} \mod m$. </p>

<p>The catch is that while $m \leq 10^9$, $a$ and $b$ can get extremely large ($2^{100,000}$), so I'm keeping them as a multiset of their prime factors.</p>&... | habedi/stack-exchange-dataset |
33,037 | Can we prove that all CFLs can be recognized by a Turing Machine in polynomial time? | <p>This question came up while a group of students at my school were studying for our qualifying exams. The question on an old exam was,</p>

<blockquote>
 <p>Consider the following six classes of languages: Context free (CFL), Regular(REG), P, NP, Recursive(R), and Recursively enumerable(RE). (1) indicat... | formal languages context free parsing | 1 | Can we prove that all CFLs can be recognized by a Turing Machine in polynomial time? -- (formal languages context free parsing)
<p>This question came up while a group of students at my school were studying for our qualifying exams. The question on an old exam was,</p>

<blockquote>
 <p>Consider the follow... | habedi/stack-exchange-dataset |
33,050 | Can a DPDA be created for a Language which includes the null string? | <p>Can a DPDA be created for a Language which includes the null string?</p>

<p>The way I understand it, in a DPDA, you can have at most 1 move from any instantaneous description Delta(q,a,Z) where q is a state, a is some input, and Z is a stack-character.</p>

<p>Also, if you have a transition Delta(q,... | automata pushdown automata | 1 | Can a DPDA be created for a Language which includes the null string? -- (automata pushdown automata)
<p>Can a DPDA be created for a Language which includes the null string?</p>

<p>The way I understand it, in a DPDA, you can have at most 1 move from any instantaneous description Delta(q,a,Z) where q is a state,... | habedi/stack-exchange-dataset |
33,052 | Is it necessary to traverse every letter in the tape of a Turing Machine? | <p>Say I want to make a very simple Turing Machine that accepts only strings that contain one or more a's. Can I simply send have the machine move a HALT state once it reads one <em>a</em>, even if there are many letters after that first a? Or would this be bad practice or unacceptable for a Turing Machine?</p>
 | turing machines | 1 | Is it necessary to traverse every letter in the tape of a Turing Machine? -- (turing machines)
<p>Say I want to make a very simple Turing Machine that accepts only strings that contain one or more a's. Can I simply send have the machine move a HALT state once it reads one <em>a</em>, even if there are many letters afte... | habedi/stack-exchange-dataset |
33,053 | Turing-recognizable languages closed under star operation | <p>I'm tasked with demonstrating that the class of Turing-recognizable languages is closed under the operation of star, but I'm confused about how this is true. For example, I have a TM to recognize a language A = { a<sup>2<sup>n</sup></sup>: <em>n</em> >= 0 }, all strings of a's which length is a power of 2. So here's... | turing machines closure properties | 1 | Turing-recognizable languages closed under star operation -- (turing machines closure properties)
<p>I'm tasked with demonstrating that the class of Turing-recognizable languages is closed under the operation of star, but I'm confused about how this is true. For example, I have a TM to recognize a language A = { a<sup>... | habedi/stack-exchange-dataset |
33,056 | Dijkstra's Algorithm with different color nodes | <p>You are given a directed graph G = (V, E) and nodes s, t. Nodes are colored red, white, and blue. A path from s to t is called colorful if it contains both a red node and a blue node. The task is to determine if a colorful path exists, and if so, find one that contains a minimum number of white nodes.</p>

<... | algorithms shortest path | 1 | Dijkstra's Algorithm with different color nodes -- (algorithms shortest path)
<p>You are given a directed graph G = (V, E) and nodes s, t. Nodes are colored red, white, and blue. A path from s to t is called colorful if it contains both a red node and a blue node. The task is to determine if a colorful path exists, and... | habedi/stack-exchange-dataset |
33,063 | Conversion from Decimal form to BCD | <p>I have seen a way how to convert a decimal number to BCD (packed & unpacked) using 8,4,2,1 weighing forms but how to do it using 4,2,2,1 and 7,4,2,1 ? Any method please.Suggestions</p>
 | computer architecture digital circuits | 1 | Conversion from Decimal form to BCD -- (computer architecture digital circuits)
<p>I have seen a way how to convert a decimal number to BCD (packed & unpacked) using 8,4,2,1 weighing forms but how to do it using 4,2,2,1 and 7,4,2,1 ? Any method please.Suggestions</p>
 | habedi/stack-exchange-dataset |
33,067 | Simulate NPDAs with DTMs using only polynomial overhead | <p>We know by polynomial-time parsing algorithms like the classical <a href="https://en.wikipedia.org/wiki/Cyk_algorithm" rel="nofollow noreferrer">CYK algorithm</a> that $\mathrm{CFL} \subseteq \mathrm{P}$.</p>

<p>Furthermore, it is easy to show by direct simulation that $\mathrm{DCFL} \subseteq \mathrm{P}$ a... | turing machines automata pushdown automata polynomial time simulation | 1 | Simulate NPDAs with DTMs using only polynomial overhead -- (turing machines automata pushdown automata polynomial time simulation)
<p>We know by polynomial-time parsing algorithms like the classical <a href="https://en.wikipedia.org/wiki/Cyk_algorithm" rel="nofollow noreferrer">CYK algorithm</a> that $\mathrm{CFL} \sub... | habedi/stack-exchange-dataset |
33,074 | Can subtracting o(1) from the parameter of a function change its Θ-class? | <p>I would like to know if it is possible that two functions $f(n), g(n)$ can exist such that both of the following conditions are met:</p>

<ol>
<li><p>$g(n) = o(1)$ </p></li>
<li><p>$f(n-g(n)) \neq \Theta (f(n))$</p></li>
</ol>

<p>I though I found $1/n$ and $1/n^2$ but I think I got it al... | asymptotics | 1 | Can subtracting o(1) from the parameter of a function change its Θ-class? -- (asymptotics)
<p>I would like to know if it is possible that two functions $f(n), g(n)$ can exist such that both of the following conditions are met:</p>

<ol>
<li><p>$g(n) = o(1)$ </p></li>
<li><p>$f(n-g(n)) \neq \Theta (f(n))... | habedi/stack-exchange-dataset |
33,078 | Simple Pushdown Automaton | <p>I'm currently learning about PDAs and their power when constructing them from Context-Free Grammars, however I'm still unsure of how to properly construct a CFG, and then a PDA from that CFG.</p>

<p>In the book, Formal Languages, Automata, and Complexity, by J. Glenn Brookshear, there are a few exercises re... | automata pushdown automata | 1 | Simple Pushdown Automaton -- (automata pushdown automata)
<p>I'm currently learning about PDAs and their power when constructing them from Context-Free Grammars, however I'm still unsure of how to properly construct a CFG, and then a PDA from that CFG.</p>

<p>In the book, Formal Languages, Automata, and Comple... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.