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 |
|---|---|---|---|---|---|---|
10,944 | Reconstructing files from binary | <p>Popular view tells us that any kind of information is just a collection of bits, that is zeroes and ones placed in a particular order. I was thus having this thought.</p>

<p>Suppose that I have some kind of file such as a text document, a PDF or anything else and that I also have a memory so perfect that I ... | encoding scheme | 1 | Reconstructing files from binary -- (encoding scheme)
<p>Popular view tells us that any kind of information is just a collection of bits, that is zeroes and ones placed in a particular order. I was thus having this thought.</p>

<p>Suppose that I have some kind of file such as a text document, a PDF or anything... | habedi/stack-exchange-dataset |
10,949 | All paths of less than a given length in a directed graph between couple of nodes | <p>Counting all possible paths, or all possible paths with a given length, between a couple of nodes in a directed or undirected graph is a classical problem. Attention should be given to what <em>all</em> means, due to the possibles cycles.</p>

<p>This question is slightly different, or at least I think.</p>&... | algorithms graphs search algorithms shortest path | 1 | All paths of less than a given length in a directed graph between couple of nodes -- (algorithms graphs search algorithms shortest path)
<p>Counting all possible paths, or all possible paths with a given length, between a couple of nodes in a directed or undirected graph is a classical problem. Attention should be give... | habedi/stack-exchange-dataset |
10,955 | Time complexity based on two variables | <p>Suppose we have a function based on two inputs of length $m,n$. Therefore the time complexity of the function is calculated by $T(m,n)$. Suppose that we have:</p>

<ul>
<li>$T(m,c)\in O(m^2)$ for any constant $c$.</li>
<li>$T(c',n)\in O(n^2)$ for any constant $c'$.</li>
</ul>

<p>What can... | asymptotics landau notation | 1 | Time complexity based on two variables -- (asymptotics landau notation)
<p>Suppose we have a function based on two inputs of length $m,n$. Therefore the time complexity of the function is calculated by $T(m,n)$. Suppose that we have:</p>

<ul>
<li>$T(m,c)\in O(m^2)$ for any constant $c$.</li>
<li>$T(c',... | habedi/stack-exchange-dataset |
10,960 | Sort array of 5 integers with a max of 7 compares | <p>How can I sort a list of 5 integers such that in the worst case it takes 7 compares? I don't care about how many other operations are performed. I don't know anything particular about the integers.</p>

<p>I've tried a few different divide and conquer approaches which get me down to 8 compares, such as fol... | algorithms sorting | 1 | Sort array of 5 integers with a max of 7 compares -- (algorithms sorting)
<p>How can I sort a list of 5 integers such that in the worst case it takes 7 compares? I don't care about how many other operations are performed. I don't know anything particular about the integers.</p>

<p>I've tried a few different ... | habedi/stack-exchange-dataset |
10,971 | Is every regular language Turing-decidable, and how can we prove this? | <p>I know every regular language is Turing-acceptable, but does that imply it is Turing-decidable?</p>
 | terminology computability regular languages decision problem | 1 | Is every regular language Turing-decidable, and how can we prove this? -- (terminology computability regular languages decision problem)
<p>I know every regular language is Turing-acceptable, but does that imply it is Turing-decidable?</p>
 | habedi/stack-exchange-dataset |
10,974 | A pumping lemma for deterministic context-free languages? | <p>The pumping lemma for regular languages can be used to prove that certain languages are not regular, and the pumping lemma for context-free languages (along with Ogden's lemma) can be used to prove that certain languages are not context-free.</p>

<p>Is there a pumping lemma for <em>deterministic</em> contex... | context free proof techniques pumping lemma | 1 | A pumping lemma for deterministic context-free languages? -- (context free proof techniques pumping lemma)
<p>The pumping lemma for regular languages can be used to prove that certain languages are not regular, and the pumping lemma for context-free languages (along with Ogden's lemma) can be used to prove that certain... | habedi/stack-exchange-dataset |
10,977 | Finding recurrence when Master Theorem fails | <p>Following method is explained by my senior. I want to know whether I can use it in all cases or not. When I solve it manually, I come to same answer. </p>

<p>$T(n)= 4T(n/2) + \frac{n^2}{\lg n}$</p>

<p>In above recurrence master theorem fails. But he gave me this solution, when </p>

<p>for ... | asymptotics recurrence relation master theorem | 1 | Finding recurrence when Master Theorem fails -- (asymptotics recurrence relation master theorem)
<p>Following method is explained by my senior. I want to know whether I can use it in all cases or not. When I solve it manually, I come to same answer. </p>

<p>$T(n)= 4T(n/2) + \frac{n^2}{\lg n}$</p>

<p>I... | habedi/stack-exchange-dataset |
10,979 | Given a chordal graph $G$, what is the complexity of computing the reduced clique graph $C_r(G)$? | <p>A graph $G$ is chordal if it doesn't have induced cycles of length $4$ or more. A clique tree $T$ of $G$ is a tree in which the vertices of the tree are the maximal cliques of $G$. An edge in $T$ corresponds to a minimal separator. The number of distinct clique trees can be exponential in the number of vertices in a... | algorithms graphs reference request | 1 | Given a chordal graph $G$, what is the complexity of computing the reduced clique graph $C_r(G)$? -- (algorithms graphs reference request)
<p>A graph $G$ is chordal if it doesn't have induced cycles of length $4$ or more. A clique tree $T$ of $G$ is a tree in which the vertices of the tree are the maximal cliques of $G... | habedi/stack-exchange-dataset |
10,981 | Subset Sum: reduce special to general case | <p><a href="http://en.wikipedia.org/wiki/Subset_sum_problem" rel="nofollow noreferrer">Wikipedia</a> states the subset sum problem as finding a subset of a given multiset of integers, whose sum is zero. Further it states that it is equivalent to finding a subset with sum <span class="math-container">$s$</span> for any... | complexity theory reductions np hard | 1 | Subset Sum: reduce special to general case -- (complexity theory reductions np hard)
<p><a href="http://en.wikipedia.org/wiki/Subset_sum_problem" rel="nofollow noreferrer">Wikipedia</a> states the subset sum problem as finding a subset of a given multiset of integers, whose sum is zero. Further it states that it is eq... | habedi/stack-exchange-dataset |
10,983 | Regular expression for odd binary numbers without leading zeros | <p>I have to write a regular expression that accepts any odd binary number not preceded by a 0. the best I can come up with is $1(0\cup1)^*1$, but that doesn't match just 1. The best it matches is 11.</p>
 | formal languages regular languages regular expressions | 1 | Regular expression for odd binary numbers without leading zeros -- (formal languages regular languages regular expressions)
<p>I have to write a regular expression that accepts any odd binary number not preceded by a 0. the best I can come up with is $1(0\cup1)^*1$, but that doesn't match just 1. The best it matches is... | habedi/stack-exchange-dataset |
10,985 | How can I show a linear languages are closed against concatenating with regular ones? | <p>This was given as a homework problem but I have already submitted the assignment. I'd like to resolve it at this point for my own satisfaction.</p>

<p>Given that $L_1$ is a linear language and $L_2$ is a regular language, show that $L=L_1L_2$ is a linear language.</p>

<p>Recall that a linear gramm... | formal languages context free closure properties check my proof | 1 | How can I show a linear languages are closed against concatenating with regular ones? -- (formal languages context free closure properties check my proof)
<p>This was given as a homework problem but I have already submitted the assignment. I'd like to resolve it at this point for my own satisfaction.</p>

<p>G... | habedi/stack-exchange-dataset |
10,990 | Colour a binary tree to be a red-black tree | <p>A common interview question is to give an algorithm to determine if a given binary tree is height balanced (AVL tree definition).</p>

<p>I was wondering if we can do something similar with Red-Black trees.</p>

<blockquote>
 <p>Given an arbitrary uncoloured binary tree (with NULL nodes), is the... | algorithms data structures binary trees search trees | 1 | Colour a binary tree to be a red-black tree -- (algorithms data structures binary trees search trees)
<p>A common interview question is to give an algorithm to determine if a given binary tree is height balanced (AVL tree definition).</p>

<p>I was wondering if we can do something similar with Red-Black trees.<... | habedi/stack-exchange-dataset |
10,996 | Difference between a TM with an empty language and the one accepting empty string | <p>If a TM(Turing Machine) accepts NO input string(even the blank), then its language is empty.</p>

<p>If a TM ONLY accepts the blank string(meaning that there is nothing on the tape except for the default blank characters), then its language has only one item and it is the blank string.</p>

<p>Are th... | terminology turing machines | 1 | Difference between a TM with an empty language and the one accepting empty string -- (terminology turing machines)
<p>If a TM(Turing Machine) accepts NO input string(even the blank), then its language is empty.</p>

<p>If a TM ONLY accepts the blank string(meaning that there is nothing on the tape except for th... | habedi/stack-exchange-dataset |
10,997 | Algorithms with polynomial time complexity of higher order | <p>I was learning about algorithms with polynomial time complexity. I found the following algorithms interesting.</p>

<ul>
<li><p>Linear Search - with time complexity $O(n)$</p></li>
<li><p>Matrix Addition - with time complexity $O(n^2)$</p></li>
<li><p>Matrix Multiplication - with time complexity ... | algorithms complexity theory asymptotics | 1 | Algorithms with polynomial time complexity of higher order -- (algorithms complexity theory asymptotics)
<p>I was learning about algorithms with polynomial time complexity. I found the following algorithms interesting.</p>

<ul>
<li><p>Linear Search - with time complexity $O(n)$</p></li>
<li><p>Matrix A... | habedi/stack-exchange-dataset |
11,004 | Give CFG and PDA for the words that start and end with the same symbol | <p>I need to give a PDA and CFG for a language that contains all binary strings that start and end with the same symbol. I've created the CFG with no problem, but I'm stuck with the PDA and don't quite know how to accomplish it.</p>

<p>The best I can figure is that I need to use non-determinism, but I don't qu... | formal languages context free pushdown automata | 1 | Give CFG and PDA for the words that start and end with the same symbol -- (formal languages context free pushdown automata)
<p>I need to give a PDA and CFG for a language that contains all binary strings that start and end with the same symbol. I've created the CFG with no problem, but I'm stuck with the PDA and don't ... | habedi/stack-exchange-dataset |
11,009 | Do any decision problems exist outside NP and NP-Hard? | <p><a href="https://cs.stackexchange.com/questions/9063/np-hard-that-is-not-np-complete-and-not-undecidable">This question</a> asks about NP-hard problems that are not NP-complete. I'm wondering if there exist any decision problems that are neither NP <em>nor</em> NP-hard.</p>

<p>In order to be in NP, problems... | complexity theory np complete np hard decision problem complexity classes | 1 | Do any decision problems exist outside NP and NP-Hard? -- (complexity theory np complete np hard decision problem complexity classes)
<p><a href="https://cs.stackexchange.com/questions/9063/np-hard-that-is-not-np-complete-and-not-undecidable">This question</a> asks about NP-hard problems that are not NP-complete. I'm w... | habedi/stack-exchange-dataset |
11,015 | Constructing a binary tree with given traversals | <p>I have given a post order & in order traversal a BST & I need to construct it. I want to know how to do this. </p>

<p>for eg.</p>

<p>Post Order : DCBGFEA</p>

<p>In Order : BDCAFGE </p>

<p>This is how I am trying to do : </p>

<ul>
<li><p>From POST order it is c... | binary trees | 1 | Constructing a binary tree with given traversals -- (binary trees)
<p>I have given a post order & in order traversal a BST & I need to construct it. I want to know how to do this. </p>

<p>for eg.</p>

<p>Post Order : DCBGFEA</p>

<p>In Order : BDCAFGE </p>

<p>This is how I am t... | habedi/stack-exchange-dataset |
11,022 | Differences between Fuzzy C-Means and EM | <p>When clustering a set of data points, what exactly are the differences between <a href="http://en.wikipedia.org/wiki/Fuzzy_clustering#Fuzzy_c-means_clustering" rel="nofollow">Fuzzy C-Means</a> (aka Soft K-Means) and <a href="http://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm" rel="nofollow">Expe... | algorithms terminology algorithm analysis machine learning statistics | 1 | Differences between Fuzzy C-Means and EM -- (algorithms terminology algorithm analysis machine learning statistics)
<p>When clustering a set of data points, what exactly are the differences between <a href="http://en.wikipedia.org/wiki/Fuzzy_clustering#Fuzzy_c-means_clustering" rel="nofollow">Fuzzy C-Means</a> (aka Sof... | habedi/stack-exchange-dataset |
11,023 | How to generate a pushdown automata for accepting a language? | <p>I have an exercise in my book to come up with a pushdown automaton accepting a language.</p>

<p>The exercise is to come up with a state diagram for the PDA accepting the language of all odd-length strings over $\{a, b\}$ with middle symbol $a$.</p>

<p>Here's what I have so far...</p>

<p><i... | formal languages automata pushdown automata | 1 | How to generate a pushdown automata for accepting a language? -- (formal languages automata pushdown automata)
<p>I have an exercise in my book to come up with a pushdown automaton accepting a language.</p>

<p>The exercise is to come up with a state diagram for the PDA accepting the language of all odd-length ... | habedi/stack-exchange-dataset |
11,026 | What is the relation between P vs. NP and Nature's ability to solve NP problems efficiently? | <p>I was thinking about how nature can efficiently compute ridiculous (i.e. NP) problems with ease. For example, a quantum system requires a $2^n$ element vector to represent the state, where $n$ is just the number of particles. Nature doesn't need any extra time despite the exponential nature of "solving" this $n$-par... | complexity theory quantum computing | 1 | What is the relation between P vs. NP and Nature's ability to solve NP problems efficiently? -- (complexity theory quantum computing)
<p>I was thinking about how nature can efficiently compute ridiculous (i.e. NP) problems with ease. For example, a quantum system requires a $2^n$ element vector to represent the state, ... | habedi/stack-exchange-dataset |
11,029 | Why is it best to use a prime number as a mod in a hashing function? | <p>If I have a list of key values from 1 to 100 and I want to organize them in an array of 11 buckets, I've been taught to form a mod function</p>

<p>$$ H = k \bmod \ 11$$</p>

<p>Now all the values will be placed one after another in 9 rows. For example, in the first bucket there will be $0, 11, 22 \d... | data structures hash hash tables primes | 1 | Why is it best to use a prime number as a mod in a hashing function? -- (data structures hash hash tables primes)
<p>If I have a list of key values from 1 to 100 and I want to organize them in an array of 11 buckets, I've been taught to form a mod function</p>

<p>$$ H = k \bmod \ 11$$</p>

<p>Now all t... | habedi/stack-exchange-dataset |
11,030 | What is semantic closure? | <p>In the context of database theory, what does semantic closure mean (linguistically speaking, i.e. not the mathematical definition)</p>

<p>If <strong>X</strong> is the set of attributes of $F$, then the semantic closure $F^+$ of $F$ is defined as follows:<br>
$F^+=\{$ <strong>Y</strong> $\rightarrow$ <st... | databases | 1 | What is semantic closure? -- (databases)
<p>In the context of database theory, what does semantic closure mean (linguistically speaking, i.e. not the mathematical definition)</p>

<p>If <strong>X</strong> is the set of attributes of $F$, then the semantic closure $F^+$ of $F$ is defined as follows:<br>
$F^+... | habedi/stack-exchange-dataset |
11,041 | Does $O(1) * o(1)$ equal a $o(1)$ function? | <p>Say I have two functions $f(x) = O(1)$ and $g(x) = o(1)$. Let $h(x) = f(x)g(x)$. Is $h(x) = o(1)$?</p>

<p>By definition of small-o $g(x)$ must approach 0 as $x \rightarrow \infty$, so I think yes. However, how can I formally prove it? Is my intuition correct?</p>
 | asymptotics | 1 | Does $O(1) * o(1)$ equal a $o(1)$ function? -- (asymptotics)
<p>Say I have two functions $f(x) = O(1)$ and $g(x) = o(1)$. Let $h(x) = f(x)g(x)$. Is $h(x) = o(1)$?</p>

<p>By definition of small-o $g(x)$ must approach 0 as $x \rightarrow \infty$, so I think yes. However, how can I formally prove it? Is my intuit... | habedi/stack-exchange-dataset |
11,043 | Number of possible search paths when searching in BST | <p>I have the following question, but don't have answer for this. I would appreciate if my method is correct :</p>

<p>Q. When searching for the key value 60 in a binary search tree, nodes containing the key values 10, 20, 40, 50, 70, 80, 90 are traversed, not necessarily in the order given. How many different ... | data structures combinatorics binary trees search trees graph traversal | 1 | Number of possible search paths when searching in BST -- (data structures combinatorics binary trees search trees graph traversal)
<p>I have the following question, but don't have answer for this. I would appreciate if my method is correct :</p>

<p>Q. When searching for the key value 60 in a binary search tree... | habedi/stack-exchange-dataset |
11,053 | How do we determine how much time a multi-tape DTM saves over a one-tape DTM? | <p>Note: This is a part of a homework question</p>

<p>Were asked to construct a multi-tape Turing Machine for language {$a^n b^n c^n \mid n \geq 0$}</p>

<p>Then it says "Discuss how much time your machines saves over a one-tape DTM using the same algorithm"
Any hint?</p>

<p>Here's my algo... | time complexity turing machines efficiency | 1 | How do we determine how much time a multi-tape DTM saves over a one-tape DTM? -- (time complexity turing machines efficiency)
<p>Note: This is a part of a homework question</p>

<p>Were asked to construct a multi-tape Turing Machine for language {$a^n b^n c^n \mid n \geq 0$}</p>

<p>Then it says "Discus... | habedi/stack-exchange-dataset |
11,056 | Program synthesis, decidability and the halting problem | <p>I was reading an answer to a recent question, and sort of a strange, ephemeral thought came to mind. My asking this might betray either that my theory chops are seriously lacking (mostly true) or that it's just too early for me to read this site. Now, with the disclaimer out of the way...</p>

<p>It is a wel... | turing machines undecidability halting problem | 1 | Program synthesis, decidability and the halting problem -- (turing machines undecidability halting problem)
<p>I was reading an answer to a recent question, and sort of a strange, ephemeral thought came to mind. My asking this might betray either that my theory chops are seriously lacking (mostly true) or that it's jus... | habedi/stack-exchange-dataset |
11,061 | Chomsky form for language of single alphabet member | <p>I'm a bit confused as to how to represent the Chomsky form for the language L that generates all strings with the alphabet {a}</p>

<p>My approach was</p>

<pre><code>S -> AB | e
A -> a
</code></pre>

<p>Now here's the part I'm confused, how do I represent B? If B -> a then I ge... | formal languages regular languages formal grammars normal forms | 1 | Chomsky form for language of single alphabet member -- (formal languages regular languages formal grammars normal forms)
<p>I'm a bit confused as to how to represent the Chomsky form for the language L that generates all strings with the alphabet {a}</p>

<p>My approach was</p>

<pre><code>S -> AB | ... | habedi/stack-exchange-dataset |
11,066 | Prove that if $\mathsf{P^k}=\mathsf{NP}$ then $\mathsf{NP}=\mathsf{co\text{-}NP}$ | <p>Prove if a oracle machine $K$ is given with $\mathsf{P^k}=\mathsf{NP}$ then $\mathsf{NP}=\mathsf{co\text{-}NP}$.</p>

<hr>

<p>Lets assume that $\mathsf{P^k}=\mathsf{NP}$ then $\mathsf{co\text{-}P^k}=\mathsf{co\text{-}NP}$. I am stuck here, I don't know how to prove this. Can someone help?</p>
&... | complexity theory turing machines np | 1 | Prove that if $\mathsf{P^k}=\mathsf{NP}$ then $\mathsf{NP}=\mathsf{co\text{-}NP}$ -- (complexity theory turing machines np)
<p>Prove if a oracle machine $K$ is given with $\mathsf{P^k}=\mathsf{NP}$ then $\mathsf{NP}=\mathsf{co\text{-}NP}$.</p>

<hr>

<p>Lets assume that $\mathsf{P^k}=\mathsf{NP}$ then $... | habedi/stack-exchange-dataset |
11,067 | Comparing variations of A* | <p>I am running some experiments with a maze, and trying different variations of A*. Based on my experiments, I have been able to form some opinion (that at least in those cases, graph checking is better than IDA). </p>

<p>I am looking for online articles that have done similar experiments, comparing variation... | algorithms reference request artificial intelligence search algorithms empirical research | 1 | Comparing variations of A* -- (algorithms reference request artificial intelligence search algorithms empirical research)
<p>I am running some experiments with a maze, and trying different variations of A*. Based on my experiments, I have been able to form some opinion (that at least in those cases, graph checking is b... | habedi/stack-exchange-dataset |
11,069 | Prize collecting steiner tree | <p>I'm reading about the <strong>prize collecting steiner tree</strong> problem and an approximation algorithm that uses randomization to set a lower bound on the optimal solution (see Chapter 5.7 in <a href="http://www.designofapproxalgs.com/book.pdf" rel="nofollow noreferrer"> The Design of Approximation Algorithms <... | algorithm analysis optimization approximation trees | 1 | Prize collecting steiner tree -- (algorithm analysis optimization approximation trees)
<p>I'm reading about the <strong>prize collecting steiner tree</strong> problem and an approximation algorithm that uses randomization to set a lower bound on the optimal solution (see Chapter 5.7 in <a href="http://www.designofappro... | habedi/stack-exchange-dataset |
11,073 | Negligible Function in Cryptography | <p>In the field of Cryptography and Computation Complexity there is a notion of negligible function.</p>
<p>I have some difficulties in understanding intuition behind this notion. The following are some definitions from Chapter 9. Cryptography from the textbook Computation Complexity. A modern approach by Arora and... | complexity theory probability theory cryptography | 1 | Negligible Function in Cryptography -- (complexity theory probability theory cryptography)
<p>In the field of Cryptography and Computation Complexity there is a notion of negligible function.</p>
<p>I have some difficulties in understanding intuition behind this notion. The following are some definitions from Chapt... | habedi/stack-exchange-dataset |
11,076 | CFG for $\{a^i b^j : 2 i<j\}$ | <p>So I have a question:</p>

<p>Give a CFG for $\{a^i b^j : 2 i<j\}$</p>

<p>And this is my approach:</p>

<p>$S\to AB$</p>

<p>$A\to aAb\mid \varepsilon$</p>

<p>$B\to b \mid bB$</p>

<p>A confirmation, or correction, along with how you tested(and tips for testing fu... | context free formal grammars check my answer | 1 | CFG for $\{a^i b^j : 2 i<j\}$ -- (context free formal grammars check my answer)
<p>So I have a question:</p>

<p>Give a CFG for $\{a^i b^j : 2 i<j\}$</p>

<p>And this is my approach:</p>

<p>$S\to AB$</p>

<p>$A\to aAb\mid \varepsilon$</p>

<p>$B\to b \mid bB$</p>

<p>... | habedi/stack-exchange-dataset |
11,077 | Fair cake-cutting when players join late | <p>The usual statement of the <a href="http://en.wikipedia.org/wiki/Fair_division">fair cake-cutting problem</a> assumes that all $n$ players get their share at the same time. However, in many cases the players arrive incrementally. For example, we may divide a cake over $n$ players, but then a new player arrives and w... | algorithms game theory online algorithms | 1 | Fair cake-cutting when players join late -- (algorithms game theory online algorithms)
<p>The usual statement of the <a href="http://en.wikipedia.org/wiki/Fair_division">fair cake-cutting problem</a> assumes that all $n$ players get their share at the same time. However, in many cases the players arrive incrementally. ... | habedi/stack-exchange-dataset |
11,081 | Is this graph a hamiltonian graph? | <p>I (will, at the end) have a connected, undirected graph with N nodes and 2N-3 edges. You can consider the graph as it is built onto an existing initial graph , which has 3 nodes and 3 edges, iteratively. Every node added onto the graph and has 2 connections with the existing nodes (not necessarily with the initial 3... | graphs | 1 | Is this graph a hamiltonian graph? -- (graphs)
<p>I (will, at the end) have a connected, undirected graph with N nodes and 2N-3 edges. You can consider the graph as it is built onto an existing initial graph , which has 3 nodes and 3 edges, iteratively. Every node added onto the graph and has 2 connections with the exi... | habedi/stack-exchange-dataset |
11,085 | Proving correctness of the algorithm for convex polygon minimum cost triangulation | <p>I have read many solutions for the minimum cost of triangulation problem and intuitively get the idea , however I am struggling to figure out how to prove it formally. I kind of feel that it has to be proven by induction but I struggle at choosing the right quantity to look at and also at the inductive step portion ... | algorithms algorithm analysis dynamic programming recursion correctness proof | 1 | Proving correctness of the algorithm for convex polygon minimum cost triangulation -- (algorithms algorithm analysis dynamic programming recursion correctness proof)
<p>I have read many solutions for the minimum cost of triangulation problem and intuitively get the idea , however I am struggling to figure out how to pr... | habedi/stack-exchange-dataset |
11,086 | AVL tree with fixed height and as few elements as possible | <p>I have been reading about AVL trees, at the moment I'm trying to figure out how to determine the height of a tree and how to draw an AVL tree of some height with minimum number of elements. </p>

<p>In a tutorial I found that this: would be a AVL tree of height 7<br>
<img src="https://i.stack.imgur.com/... | data structures binary trees search trees | 1 | AVL tree with fixed height and as few elements as possible -- (data structures binary trees search trees)
<p>I have been reading about AVL trees, at the moment I'm trying to figure out how to determine the height of a tree and how to draw an AVL tree of some height with minimum number of elements. </p>

<p>In ... | habedi/stack-exchange-dataset |
11,089 | Seeking popular science book on bioinformatics or computational genomics | <p>An intelligent 15-year-old I know is interested in both computer science and genetics. I told her that these fields make an excellent combination. I'd like to give her a book on bioinformatics or computational genomics. I'm looking for a fun book, not a textbook. Specifically, it should inspire people to want to... | education books bioinformatics | 1 | Seeking popular science book on bioinformatics or computational genomics -- (education books bioinformatics)
<p>An intelligent 15-year-old I know is interested in both computer science and genetics. I told her that these fields make an excellent combination. I'd like to give her a book on bioinformatics or computatio... | habedi/stack-exchange-dataset |
11,090 | What is the exact difference between a latch & a flipflop? | <p>From what I have understood :</p>

<ol>
<li>A Flip Flop is a clocked latch i.e. flip flop = latch + clock</li>
<li>Latch continuously checks for inputs & changes the output whenever there is a change in input</li>
<li>Flip Flop also continuously checks input, but changes the output time deter... | computer architecture sequential circuit digital circuits | 1 | What is the exact difference between a latch & a flipflop? -- (computer architecture sequential circuit digital circuits)
<p>From what I have understood :</p>

<ol>
<li>A Flip Flop is a clocked latch i.e. flip flop = latch + clock</li>
<li>Latch continuously checks for inputs & changes the output wh... | habedi/stack-exchange-dataset |
11,107 | How to find max number with a single-tape turing machine? | <p>I'd appreciate hints for this problem</p>

<p>I'm trying to design a Turing Machine which calculates $\max \{x_1, x_2,..,x_k \}$.</p>

<p>Assuming $1 = 1^1; 2=1^2; n=1^n$ and all numbers/strings are separated by a blank character $B$.</p>
 | turing machines | 1 | How to find max number with a single-tape turing machine? -- (turing machines)
<p>I'd appreciate hints for this problem</p>

<p>I'm trying to design a Turing Machine which calculates $\max \{x_1, x_2,..,x_k \}$.</p>

<p>Assuming $1 = 1^1; 2=1^2; n=1^n$ and all numbers/strings are separated by a blank ch... | habedi/stack-exchange-dataset |
11,110 | Are context-free languages in $a^*b^*$ closed under complement? | <p>The context-free languages are <em>not</em> closed under complement, we know that.</p>

<p>As far as I understand, context-free languages that are a subset of $a^*b^*$ for some letters $a,b$ are closed under complement(!?)</p>

<p>Here is my argument. Each CF language $L$ has a semi-linear Parikh ima... | formal languages reference request context free closure properties | 1 | Are context-free languages in $a^*b^*$ closed under complement? -- (formal languages reference request context free closure properties)
<p>The context-free languages are <em>not</em> closed under complement, we know that.</p>

<p>As far as I understand, context-free languages that are a subset of $a^*b^*$ for s... | habedi/stack-exchange-dataset |
11,114 | Closure under intersection of context free binary trees | <p>Some sets of ordered binary trees can be represented as a CFG with rules of the form</p>

<pre><code>A -> aBC
A -> b
</code></pre>

<p>Where <code>A,B,C</code> are nonterminals and <code>a</code> and <code>b</code> are terminals representing internal nodes and leaf nodes respectively. T... | context free formal grammars closure properties | 1 | Closure under intersection of context free binary trees -- (context free formal grammars closure properties)
<p>Some sets of ordered binary trees can be represented as a CFG with rules of the form</p>

<pre><code>A -> aBC
A -> b
</code></pre>

<p>Where <code>A,B,C</code> are nonterminals a... | habedi/stack-exchange-dataset |
11,116 | Difference between cross edges and forward edges in a DFT | <p>In a depth first tree, there are the edges define the tree (i.e the edges that were used in the traversal).</p>

<p>There are some leftover edges connecting some of the other nodes. What is the difference between a cross edge and a forward edge?</p>

<p>From wikipedia:</p>

<blockquote>
 ... | algorithms terminology graphs graph traversal | 1 | Difference between cross edges and forward edges in a DFT -- (algorithms terminology graphs graph traversal)
<p>In a depth first tree, there are the edges define the tree (i.e the edges that were used in the traversal).</p>

<p>There are some leftover edges connecting some of the other nodes. What is the differ... | habedi/stack-exchange-dataset |
11,117 | Why does a polynomial-time language have a polynomial-sized circuit? | <p>I wish to understand why P is a subset of PSCPACE, that is why a polynomial-time langauge does have a polynomial-sized circuit. I read many proofs like <a href="http://www.stanford.edu/~rrwill/week3.pdf" rel="nofollow">this one here on page 2-3</a>, but all the proofs use the same technique used in the Cook-Levin th... | complexity theory time complexity space complexity complexity classes polynomial time | 1 | Why does a polynomial-time language have a polynomial-sized circuit? -- (complexity theory time complexity space complexity complexity classes polynomial time)
<p>I wish to understand why P is a subset of PSCPACE, that is why a polynomial-time langauge does have a polynomial-sized circuit. I read many proofs like <a hr... | habedi/stack-exchange-dataset |
11,129 | Independent set where two vertices need to have distance >= c | <p>An independent set (IS) in a graph is a set $V' \subseteq V(G)$ of pairwise non-adjacent vertices. </p>

<p>I am interested in the generalization $c$-IS where two nodes in $V' \subseteq V(G)$ need to have distance at least $c$ to any other vertex in $V'$.</p>

<p>Has this problem been studied before... | algorithms reference request graphs | 1 | Independent set where two vertices need to have distance >= c -- (algorithms reference request graphs)
<p>An independent set (IS) in a graph is a set $V' \subseteq V(G)$ of pairwise non-adjacent vertices. </p>

<p>I am interested in the generalization $c$-IS where two nodes in $V' \subseteq V(G)$ need to have ... | habedi/stack-exchange-dataset |
11,146 | Average length of s-t (simple) paths in a directed graph | <p>Given the fact that $s$-$t$ path enumeration is a #P-complete problem, could there be efficient methods that compute (or at least approximate) the average length of $s$-$t$ path without enumerating them? <strike>What if paths are allowed to revisit vertices?</strike> </p>

<p>Relevant results on special grap... | algorithms complexity theory graphs approximation enumeration | 1 | Average length of s-t (simple) paths in a directed graph -- (algorithms complexity theory graphs approximation enumeration)
<p>Given the fact that $s$-$t$ path enumeration is a #P-complete problem, could there be efficient methods that compute (or at least approximate) the average length of $s$-$t$ path without enumera... | habedi/stack-exchange-dataset |
11,159 | Deciding if a Turing machine has made a left move | <p>In writing a decider for a machine to see if it has made a left move or not on an input of <em>w</em>, it is said that if we continue the computation for $|w|+N+1$ ($N$ : number of states) number of steps, we can make a decision for this decide.</p>

<p>I didn't get why $|w|+N+1$ number of steps. Could someo... | computability turing machines | 1 | Deciding if a Turing machine has made a left move -- (computability turing machines)
<p>In writing a decider for a machine to see if it has made a left move or not on an input of <em>w</em>, it is said that if we continue the computation for $|w|+N+1$ ($N$ : number of states) number of steps, we can make a decision for... | habedi/stack-exchange-dataset |
11,163 | Circles covering a rectangular, how to verify it? | <p>This may be basic to some of you, but excuse my inexperience with comp. geometry: </p>

<p>Given a set of $n$ circles with centers $(x_i, y_i)$ for $1 \leq i \leq n$ and each having radii $r$. Also given a rectangle. All objects are on a plane. How to verify that every point inside the rectangle (including ... | algorithms computational geometry | 1 | Circles covering a rectangular, how to verify it? -- (algorithms computational geometry)
<p>This may be basic to some of you, but excuse my inexperience with comp. geometry: </p>

<p>Given a set of $n$ circles with centers $(x_i, y_i)$ for $1 \leq i \leq n$ and each having radii $r$. Also given a rectangle. Al... | habedi/stack-exchange-dataset |
11,166 | Simple FSM question | <p>Considering this FSM:
<img src="https://i.stack.imgur.com/aIh8C.jpg" alt="finite state machine"></p>

<p>Can someone explain me why the grammar is not:</p>

<ol>
<li>$S \rightarrow aA$</li>
<li>$A \rightarrow aA \mid bB \mid \varepsilon$</li>
<li>$B \rightarrow bB \mid \varepsilon$</l... | formal grammars finite automata | 1 | Simple FSM question -- (formal grammars finite automata)
<p>Considering this FSM:
<img src="https://i.stack.imgur.com/aIh8C.jpg" alt="finite state machine"></p>

<p>Can someone explain me why the grammar is not:</p>

<ol>
<li>$S \rightarrow aA$</li>
<li>$A \rightarrow aA \mid bB \mid \vareps... | habedi/stack-exchange-dataset |
11,168 | Why is one often requiring space constructibility in Savitch's theorem? | <p>When Savitch's famous theorem is stated, one often sees the requirement that $S(n)$ be space constructible (interestingly, it is omitted in Wikipedia). My simple question is: Why do we need this? I understand the requirement for $S(n)$ being in $\Omega(\log n)$, which is clear from the proof. But no proof I have see... | complexity theory space complexity complexity classes nondeterminism | 1 | Why is one often requiring space constructibility in Savitch's theorem? -- (complexity theory space complexity complexity classes nondeterminism)
<p>When Savitch's famous theorem is stated, one often sees the requirement that $S(n)$ be space constructible (interestingly, it is omitted in Wikipedia). My simple question ... | habedi/stack-exchange-dataset |
11,171 | Syntax of a Pushdown Automata transition function | <p>I just learned PDAs in class today, but am having problems understanding the syntax of the transition function. Could someone please explain to me the meaning of this syntax:</p>

<p>$\delta(q, \lambda, S) = \{(q, aaB), (q, bbA)\}$</p>

<p>This is one of the rules for my language. I am unsure of wha... | terminology automata pushdown automata | 1 | Syntax of a Pushdown Automata transition function -- (terminology automata pushdown automata)
<p>I just learned PDAs in class today, but am having problems understanding the syntax of the transition function. Could someone please explain to me the meaning of this syntax:</p>

<p>$\delta(q, \lambda, S) = \{(q, a... | habedi/stack-exchange-dataset |
11,173 | What determines valid and invalid turing machines? | <p>According to my understanding, a Turing machine that's valid <em>has</em> to have finite steps to finish a certain step. If this is right, what else determines the validity of a turing machine? </p>
 | terminology turing machines | 1 | What determines valid and invalid turing machines? -- (terminology turing machines)
<p>According to my understanding, a Turing machine that's valid <em>has</em> to have finite steps to finish a certain step. If this is right, what else determines the validity of a turing machine? </p>
 | habedi/stack-exchange-dataset |
11,181 | How to show that a function is not computable? | <p>I know that there exist a Turing Machine, if a function is computable. Then how to show that the function is <em>not</em> computable or there aren't any Turing Machine for that. Is there anything like a Pumping lemma?</p>
 | computability proof techniques undecidability reference question | 1 | How to show that a function is not computable? -- (computability proof techniques undecidability reference question)
<p>I know that there exist a Turing Machine, if a function is computable. Then how to show that the function is <em>not</em> computable or there aren't any Turing Machine for that. Is there anything like... | habedi/stack-exchange-dataset |
11,182 | Convert CFG to PDA | <p>Is there any set of rules or methods to convert any context free grammar to a push down automata? </p>

<p>I already found <a href="http://infolab.stanford.edu/~ullman/ialc/spr10/slides/pda2.pdf" rel="noreferrer">some slides online</a> but I wasn't able to understand them.</p>

<p>In slide 10 he spea... | context free formal grammars pushdown automata simulation | 1 | Convert CFG to PDA -- (context free formal grammars pushdown automata simulation)
<p>Is there any set of rules or methods to convert any context free grammar to a push down automata? </p>

<p>I already found <a href="http://infolab.stanford.edu/~ullman/ialc/spr10/slides/pda2.pdf" rel="noreferrer">some slides on... | habedi/stack-exchange-dataset |
11,185 | Difference between Dominant strategy and Winning Strategy | <p>I am a little bit confused by the definition of dominant strategy and winning strategy, what's the difference between them.</p>

<p>Following are the definitions taken from wikipedia, below every definition I added some thoughts. If you fell that my thoughts are not correct or ambigues please let me know.</p... | terminology game theory | 1 | Difference between Dominant strategy and Winning Strategy -- (terminology game theory)
<p>I am a little bit confused by the definition of dominant strategy and winning strategy, what's the difference between them.</p>

<p>Following are the definitions taken from wikipedia, below every definition I added some th... | habedi/stack-exchange-dataset |
11,192 | Why we need EEPROM in this micro-controller | <p><a href="http://www.mikroe.com/img/publication/pic-books/programming-in-c/chapter/03/fig3-3.gif" rel="nofollow">PIC16F887 Block Diagram</a></p>

<p>According to the block diagram above, since we already have Program Memory, which may be used to store our program, why should we still need EEPROM? What is it f... | computer architecture memory hardware | 1 | Why we need EEPROM in this micro-controller -- (computer architecture memory hardware)
<p><a href="http://www.mikroe.com/img/publication/pic-books/programming-in-c/chapter/03/fig3-3.gif" rel="nofollow">PIC16F887 Block Diagram</a></p>

<p>According to the block diagram above, since we already have Program Memory... | habedi/stack-exchange-dataset |
11,208 | Given a tree, find a vertex which maximizes the minimum distance to any leaf | <p>If I am given a graph which forms a tree, I am interested in finding a vertex which maximizes the minimum distance to any leaf.</p>

<p>I am sure this problem has been studied before.
Does anybody know the name of this problem or an algorithm for solving it?</p>
 | algorithms graphs reference request trees | 1 | Given a tree, find a vertex which maximizes the minimum distance to any leaf -- (algorithms graphs reference request trees)
<p>If I am given a graph which forms a tree, I am interested in finding a vertex which maximizes the minimum distance to any leaf.</p>

<p>I am sure this problem has been studied before.&#... | habedi/stack-exchange-dataset |
11,218 | The physical implementation of quantum annealing algorithm | <p>From <a href="https://softwareengineering.stackexchange.com/questions/194552/what-is-the-difference-between-quantum-annealing-and-simulated-annealing">that question</a> about differences between Quantum annealing and simulated annealing, we found (in commets to answer) that physical implementation of quantum anneali... | algorithms randomized algorithms quantum computing | 1 | The physical implementation of quantum annealing algorithm -- (algorithms randomized algorithms quantum computing)
<p>From <a href="https://softwareengineering.stackexchange.com/questions/194552/what-is-the-difference-between-quantum-annealing-and-simulated-annealing">that question</a> about differences between Quantum... | habedi/stack-exchange-dataset |
11,220 | What is a computer year? | <p>In one of the text book its mentioned that 'running time of this algorithm is 200 computer years'. Can somebody please explain what is the meaning of a computer year?</p>
 | algorithms terminology runtime analysis | 1 | What is a computer year? -- (algorithms terminology runtime analysis)
<p>In one of the text book its mentioned that 'running time of this algorithm is 200 computer years'. Can somebody please explain what is the meaning of a computer year?</p>
 | habedi/stack-exchange-dataset |
11,223 | How is a witness found in a proof of $\mathsf{NP} \subseteq \mathsf{P}/\log \implies \mathsf{P} = \mathsf{NP}$? | <p>I'm having a hard time understanding the actual proof of this proposition:</p>

<p>$\qquad \mathsf{NP} \subseteq \mathsf{P}/\log \implies \mathsf{P} = \mathsf{NP}$</p>

<p>The sketch of the proof is on slides 6-8 of <a href="http://www.cs.uiuc.edu/class/sp08/cs579/slides/CC-S08-Lect10.pdf" rel="nofol... | complexity classes time complexity | 1 | How is a witness found in a proof of $\mathsf{NP} \subseteq \mathsf{P}/\log \implies \mathsf{P} = \mathsf{NP}$? -- (complexity classes time complexity)
<p>I'm having a hard time understanding the actual proof of this proposition:</p>

<p>$\qquad \mathsf{NP} \subseteq \mathsf{P}/\log \implies \mathsf{P} = \maths... | habedi/stack-exchange-dataset |
11,232 | Correctness of Strongly Connected Components algorithm for a directed graph | <p>I have been reading up on algorithm for finding the strongly connected components in a directed graph $G=(V,E)$. It considers two DFS search and the second step is transposing the original graph $G^T$. </p>

<p>The algorithm is the following :</p>

<ol>
<li>Execute DFS on $G$ (starting at an arbi... | algorithms graphs graph traversal | 1 | Correctness of Strongly Connected Components algorithm for a directed graph -- (algorithms graphs graph traversal)
<p>I have been reading up on algorithm for finding the strongly connected components in a directed graph $G=(V,E)$. It considers two DFS search and the second step is transposing the original graph $G^T$. ... | habedi/stack-exchange-dataset |
11,240 | Proving $\{xx^R \mid x\in L_1, x^R\in L_2\}$ is context-free | <p>I have this problem:</p>

<blockquote>
 <p>Let $L_1$ and $L_2$ be two regular languages. Show that $L_3 = \{xx^r : x \in L_1, x^r \in L_2 \}$ is a context-free language.</p>
</blockquote>

<p>I am unsure how to prove that some language is context-free. Could someone please provide the steps... | formal languages regular languages context free | 1 | Proving $\{xx^R \mid x\in L_1, x^R\in L_2\}$ is context-free -- (formal languages regular languages context free)
<p>I have this problem:</p>

<blockquote>
 <p>Let $L_1$ and $L_2$ be two regular languages. Show that $L_3 = \{xx^r : x \in L_1, x^r \in L_2 \}$ is a context-free language.</p>
</blockquot... | habedi/stack-exchange-dataset |
11,243 | Is the 0-1 Knapsack problem where value equals weight NP-complete? | <p>I have a problem which I suspect is NP-complete. It is easy to prove that it is NP. My current train of thought revolves around using a reduction from knapsack but it would result in instances of 0-1-Knapsack with the value of every item being equal to its weight.</p>

<p>Is this still NP-complete? Or am I m... | complexity theory np complete decision problem packing | 1 | Is the 0-1 Knapsack problem where value equals weight NP-complete? -- (complexity theory np complete decision problem packing)
<p>I have a problem which I suspect is NP-complete. It is easy to prove that it is NP. My current train of thought revolves around using a reduction from knapsack but it would result in instanc... | habedi/stack-exchange-dataset |
11,247 | Temporal logic for interface invariants | <p>I am looking for some sort of temporal logic for expressing invariants in interfaces. Since interfaces do not specify data representation, the invariants must rely solely on the publicly available functions of the interface.</p>

<p>For example, suppose we have a simple interface (Java style) Sum:</p>
&#... | logic object oriented linear temporal logic software verification | 1 | Temporal logic for interface invariants -- (logic object oriented linear temporal logic software verification)
<p>I am looking for some sort of temporal logic for expressing invariants in interfaces. Since interfaces do not specify data representation, the invariants must rely solely on the publicly available functions... | habedi/stack-exchange-dataset |
11,252 | Finding no. of leaf nodes for each node in a BST | <p>A program takes as input a balanced binary search tree with $n$ leaf nodes and computes the value of a function $g(x)$ for each node $x$. If the cost of computing $g(x)$ is </p>

<p>$\qquad \min(\#\text{leaves in } L(x), \#\text{leaves in } R(x))$</p>

<p>for $L(x), R(x)$ the left resp. right subtree... | algorithms algorithm analysis runtime analysis binary trees search trees | 1 | Finding no. of leaf nodes for each node in a BST -- (algorithms algorithm analysis runtime analysis binary trees search trees)
<p>A program takes as input a balanced binary search tree with $n$ leaf nodes and computes the value of a function $g(x)$ for each node $x$. If the cost of computing $g(x)$ is </p>

<p>... | habedi/stack-exchange-dataset |
11,263 | Longest path in an undirected tree with only one traversal | <p>There is this standard algorithm for finding longest path in undirected trees using two depth-first searches:</p>

<ul>
<li>Start DFS from a random vertex $v$ and find the farthest vertex from it; say it is $v'$. </li>
<li>Now start a DFS from $v'$ to find the vertex farthest from it. This path is th... | algorithms graphs trees | 1 | Longest path in an undirected tree with only one traversal -- (algorithms graphs trees)
<p>There is this standard algorithm for finding longest path in undirected trees using two depth-first searches:</p>

<ul>
<li>Start DFS from a random vertex $v$ and find the farthest vertex from it; say it is $v'$. </li... | habedi/stack-exchange-dataset |
11,266 | Finding the element that occurs more often than the other | <p>I want an algorithm that calculates which element, among two, appears more often than the other in a sorted array. The array will have only two types of elements. </p>

<p>Example : $aaaaaabbb$ </p>

<p>Here $a>b$. </p>

<p>I have to find an constant time algorithm. Is it possible? The onl... | algorithms data structures search algorithms arrays | 1 | Finding the element that occurs more often than the other -- (algorithms data structures search algorithms arrays)
<p>I want an algorithm that calculates which element, among two, appears more often than the other in a sorted array. The array will have only two types of elements. </p>

<p>Example : $aaaaaabbb$ ... | habedi/stack-exchange-dataset |
11,269 | Does this loop invariant guarantee that the variable never changes? | <p>Suppose you have some loop and and integer k:</p>

<pre><code>int k = 5;
for (int i = 0 ; i < N; i++)
{
 //(*)
 //do something 
}
</code></pre>

<p>The loop invariant at (*) is:
$\{ K=k\}$</p>

<p>Does that guarantee that $k$ doesn't change in between iteratio... | loop invariants program correctness hoare logic | 1 | Does this loop invariant guarantee that the variable never changes? -- (loop invariants program correctness hoare logic)
<p>Suppose you have some loop and and integer k:</p>

<pre><code>int k = 5;
for (int i = 0 ; i < N; i++)
{
 //(*)
 //do something 
}
</code></pre>

<p>The... | habedi/stack-exchange-dataset |
11,276 | Extracting the set of chains from a partial order | <p>Given a partial ordered set (poset) $S$, is there a known procedure or algorithm to find the set of chains (i.e. subsets of $S$ where every two elements are comparable)? </p>

<p>Note: I am asking here instead of math.SE because i'm looking for <em>an algorithm</em> for the problem. </p>
 | algorithms partial order | 1 | Extracting the set of chains from a partial order -- (algorithms partial order)
<p>Given a partial ordered set (poset) $S$, is there a known procedure or algorithm to find the set of chains (i.e. subsets of $S$ where every two elements are comparable)? </p>

<p>Note: I am asking here instead of math.SE because ... | habedi/stack-exchange-dataset |
11,280 | Time Complexity of Universal Turing Machine Simulations and the Time Hierarchy Theorem | <p>I have a little problem to understand the proof of the Time Hierarchy Theorem (Hennie and Stearns, 1966) that ensures the existence of a language acceptable in $U(n)$ but not acceptable in $T(n)$ for any functions $T(n),U(n)$, such that $U(n)$ is time-constructible and</p>

<p>$$n \leq T(n) = o\left(\frac{U(... | complexity theory turing machines simulation | 1 | Time Complexity of Universal Turing Machine Simulations and the Time Hierarchy Theorem -- (complexity theory turing machines simulation)
<p>I have a little problem to understand the proof of the Time Hierarchy Theorem (Hennie and Stearns, 1966) that ensures the existence of a language acceptable in $U(n)$ but not accep... | habedi/stack-exchange-dataset |
11,281 | How to find the minimum number of vertices whose removal make the graph disjoint | <p>Given a graph $G = (V,E)$.</p>

<p>Is there any algorithm which finds the minimum number of vertices to be removed from $G$ so that every vertex in the graph becomes disjoint, <em>i.e.</em>, every vertex is disconnected from every other vertex?</p>
 | algorithms graphs | 1 | How to find the minimum number of vertices whose removal make the graph disjoint -- (algorithms graphs)
<p>Given a graph $G = (V,E)$.</p>

<p>Is there any algorithm which finds the minimum number of vertices to be removed from $G$ so that every vertex in the graph becomes disjoint, <em>i.e.</em>, every vertex i... | habedi/stack-exchange-dataset |
11,285 | What does it mean to say that there doesn't exist an algorithm from a TM point of view? | <blockquote>
 <p>A TM for a recursive language corresponds to our informal notion of an algorithm.</p>
</blockquote>

<p>as per Automata Theory, Languages and Computation by Ullman et al. Then there are languages called RE and $L_d$, where there exist TM that halts for accepting strings in the case of ... | computability turing machines undecidability | 1 | What does it mean to say that there doesn't exist an algorithm from a TM point of view? -- (computability turing machines undecidability)
<blockquote>
 <p>A TM for a recursive language corresponds to our informal notion of an algorithm.</p>
</blockquote>

<p>as per Automata Theory, Languages and Comput... | habedi/stack-exchange-dataset |
11,288 | Maximum number of augmenting paths in a network flow | <p>Let's say we a have flow network with $m$ edges and integer capacities. </p>

<p>Prove that there exists a sequence of at most $m$ augmenting paths that yield the maximum flow.</p>

<p>A good way to start thinking about this is to imagine that we know the maximum flow already. How can we figure the ... | graphs combinatorics network flow | 1 | Maximum number of augmenting paths in a network flow -- (graphs combinatorics network flow)
<p>Let's say we a have flow network with $m$ edges and integer capacities. </p>

<p>Prove that there exists a sequence of at most $m$ augmenting paths that yield the maximum flow.</p>

<p>A good way to start thin... | habedi/stack-exchange-dataset |
11,292 | If A is poly-time reducible to B, is B poly-time reducible to A? | <p>Basically, is the following statement true?</p>

<blockquote>
 <p>$A \leq_p B$ $\rightarrow$ $B \leq_p A$</p>
</blockquote>
 | complexity theory reductions polynomial time | 1 | If A is poly-time reducible to B, is B poly-time reducible to A? -- (complexity theory reductions polynomial time)
<p>Basically, is the following statement true?</p>

<blockquote>
 <p>$A \leq_p B$ $\rightarrow$ $B \leq_p A$</p>
</blockquote>
 | habedi/stack-exchange-dataset |
11,295 | Finding shortest and longest paths between two vertices in a DAG | <p>Given an unweighted DAG (directed acyclic graph) $D = (V,A)$ and two vertices $s$ and $t$, is it possible to find the shortest and longest path from $s$ to $t$ in polynomial time? Path lengths are measured by the number of edges.</p>

<p>I am interested in finding the range of possible path lengths in polyn... | algorithms graphs shortest path polynomial time | 1 | Finding shortest and longest paths between two vertices in a DAG -- (algorithms graphs shortest path polynomial time)
<p>Given an unweighted DAG (directed acyclic graph) $D = (V,A)$ and two vertices $s$ and $t$, is it possible to find the shortest and longest path from $s$ to $t$ in polynomial time? Path lengths are m... | habedi/stack-exchange-dataset |
11,299 | What's harder: Shuffling a sorted deck or sorting a shuffled one? | <p>You have an array of $n$ distinct elements. You have access to a comparator (a black box function taking two elements $a$ and $b$ and returning true iff $a < b$) and a truly random source of bits (a black box function taking no arguments and returning an independently uniformly random bit). Consider the following... | algorithms algorithm analysis information theory permutations entropy | 1 | What's harder: Shuffling a sorted deck or sorting a shuffled one? -- (algorithms algorithm analysis information theory permutations entropy)
<p>You have an array of $n$ distinct elements. You have access to a comparator (a black box function taking two elements $a$ and $b$ and returning true iff $a < b$) and a truly... | habedi/stack-exchange-dataset |
11,300 | Hardware interrupts from keystrokes | <p>If there is an interrupt from every keypress (or one for keydown, one for keyup, one for keypress?) how does the OS handle so many interrupts at the same time. A person typing at 120WPM would be sending more than 500 interrupts per minute. How does a process ever finish if there is a context switch for the CPU to ha... | operating systems | 1 | Hardware interrupts from keystrokes -- (operating systems)
<p>If there is an interrupt from every keypress (or one for keydown, one for keyup, one for keypress?) how does the OS handle so many interrupts at the same time. A person typing at 120WPM would be sending more than 500 interrupts per minute. How does a process... | habedi/stack-exchange-dataset |
11,301 | Approximate time for selection operation using index when equality is on nonkey | <p>In database query processing, the approximate time for selection operation using primary index when equality is on key is $2(b_s + b_t)$ where $b_s$ is disk seek time and $b_t$ is disk transfer time (assuming one level of indexing), because one seek and transfer time will be needed for finding the index and another ... | runtime analysis search algorithms databases | 1 | Approximate time for selection operation using index when equality is on nonkey -- (runtime analysis search algorithms databases)
<p>In database query processing, the approximate time for selection operation using primary index when equality is on key is $2(b_s + b_t)$ where $b_s$ is disk seek time and $b_t$ is disk tr... | habedi/stack-exchange-dataset |
11,308 | Did I correctly prune this min-max search tree using alpha-beta pruning? | <p><img src="https://i.stack.imgur.com/reeMb.jpg" alt="Pruning"></p>

<p>I am studying some old past test questions. Is this search tree correctly pruned?</p>
 | search trees check my answer | 1 | Did I correctly prune this min-max search tree using alpha-beta pruning? -- (search trees check my answer)
<p><img src="https://i.stack.imgur.com/reeMb.jpg" alt="Pruning"></p>

<p>I am studying some old past test questions. Is this search tree correctly pruned?</p>
 | habedi/stack-exchange-dataset |
11,309 | Finding cache block transfer time in a 3 level memory system | <p>Following question was asked in one of entrance exams for a graduation programme. Please help me try to solve it :</p>
<blockquote>
<p>A computer system has an L1 cache, an L2 cache, and a main memory
unity connected as shown below. The block size in L1 cache is 4 words.
The block size in L2 cache is... | computer architecture cpu cache memory access | 1 | Finding cache block transfer time in a 3 level memory system -- (computer architecture cpu cache memory access)
<p>Following question was asked in one of entrance exams for a graduation programme. Please help me try to solve it :</p>
<blockquote>
<p>A computer system has an L1 cache, an L2 cache, and a main mem... | habedi/stack-exchange-dataset |
11,317 | Using pumping lemma to show $L = \{a^i b^j a^k \ | \ k > i + j\}$ cannot be accepted by an FA | <blockquote>
 <p>$L = \{a^i b^j a^k \ | \ k > i + j\}$</p>
 
 <p>Use the pumping lemma to show that this language cannot be accepted by an FA.</p>
</blockquote>

<p><strong>Proof:</strong></p>

<p>Suppose $L$ can be accepted by an FA.</p>

<p>Suppose a string $s = xyz \in L... | formal languages regular languages pumping lemma check my answer | 1 | Using pumping lemma to show $L = \{a^i b^j a^k \ | \ k > i + j\}$ cannot be accepted by an FA -- (formal languages regular languages pumping lemma check my answer)
<blockquote>
 <p>$L = \{a^i b^j a^k \ | \ k > i + j\}$</p>
 
 <p>Use the pumping lemma to show that this language cannot be accepted by an... | habedi/stack-exchange-dataset |
11,321 | Designing a PDA w/o $\epsilon$-moves and $\leq 2$ states to accept an $\epsilon$-free CFL by final state | <p>I understand that any CFL can be accepted by a PDA by final state or empty store but I have been rather stumped by this question.
The question states that the PDA has at most 2 states. Clearly 1 will be the start state while the other will be the final state (they cannot be the same since otherwise the empty str... | formal languages context free automata pushdown automata | 1 | Designing a PDA w/o $\epsilon$-moves and $\leq 2$ states to accept an $\epsilon$-free CFL by final state -- (formal languages context free automata pushdown automata)
<p>I understand that any CFL can be accepted by a PDA by final state or empty store but I have been rather stumped by this question.
The question sta... | habedi/stack-exchange-dataset |
11,325 | The convoy effect in process scheduling | <p>As I understand the <em>convoy effect</em>, in the context of vehicular traffic in a road system. A slow moving group of vehicles passes through the system, slowing traffic even in areas which were not directly affected by the convoy.</p>

<p>How does this apply in the context of CPU scheduling? It does not ... | operating systems process scheduling | 1 | The convoy effect in process scheduling -- (operating systems process scheduling)
<p>As I understand the <em>convoy effect</em>, in the context of vehicular traffic in a road system. A slow moving group of vehicles passes through the system, slowing traffic even in areas which were not directly affected by the convoy.<... | habedi/stack-exchange-dataset |
11,329 | Are permutations of context-free languages context-free? | <p>Given a context-free language $L$, define the language $p(L)$ as containing all permutations of strings in $L$ (i.e. all strings in $L$ such that the order of symbols is not important). Is $p(L)$ context-free?</p>

<p>I found two papers dealing with similar, but not identical, questions:</p>

<ul>&#x... | formal languages context free closure properties permutations | 1 | Are permutations of context-free languages context-free? -- (formal languages context free closure properties permutations)
<p>Given a context-free language $L$, define the language $p(L)$ as containing all permutations of strings in $L$ (i.e. all strings in $L$ such that the order of symbols is not important). Is $p(L... | habedi/stack-exchange-dataset |
11,330 | Is Hidoku NP complete? | <p>A Hidoku is a $n \times n$ grid with some pre-filled integers from 1 to $n^2$. The goal is to find a path of successive integers (from 1 to $n^2$) in the grid. More concrete, each cell of the grid must contain a different integer from 1 to $n^2$ and each cell with value $z ≠ n^{2}$ must have a neighbor cell with val... | complexity theory reductions np hard | 1 | Is Hidoku NP complete? -- (complexity theory reductions np hard)
<p>A Hidoku is a $n \times n$ grid with some pre-filled integers from 1 to $n^2$. The goal is to find a path of successive integers (from 1 to $n^2$) in the grid. More concrete, each cell of the grid must contain a different integer from 1 to $n^2$ and ea... | habedi/stack-exchange-dataset |
11,338 | How to evaluate the clock cycle for MIPS single cycle CPU | <p><strong>The Situation</strong></p>

<p>I'm trying to read the book 'Digital Design Computer Architecture'.<br>
In the part of Performance Analysis(7.3.4 in the book), Author refers to clock cycle for MIPS single cycle processor. But I think there's something wrong with author's evaluating clock cycle. <... | computer architecture | 1 | How to evaluate the clock cycle for MIPS single cycle CPU -- (computer architecture)
<p><strong>The Situation</strong></p>

<p>I'm trying to read the book 'Digital Design Computer Architecture'.<br>
In the part of Performance Analysis(7.3.4 in the book), Author refers to clock cycle for MIPS single cycle pr... | habedi/stack-exchange-dataset |
11,343 | Can you convert a positively weighted DAG into a non-weighted DAG in polynomial time? | <p>Given a positively weighted DAG (directed acyclic graph) $D = (V,E)$, can you create a new non-weighted DAG $D'$ by converting each edge with weight $w(e) = x$ into x non-weighted edges and vertices? I believe this would take $O(|E|+W)$ time where $|E|$ is the number of edges and $W$ is the total weight of all edges... | algorithms graphs algorithm analysis polynomial time | 1 | Can you convert a positively weighted DAG into a non-weighted DAG in polynomial time? -- (algorithms graphs algorithm analysis polynomial time)
<p>Given a positively weighted DAG (directed acyclic graph) $D = (V,E)$, can you create a new non-weighted DAG $D'$ by converting each edge with weight $w(e) = x$ into x non-we... | habedi/stack-exchange-dataset |
11,345 | What is a compact way to represent a partition of a set? | <p>There exist <a href="https://cs.stackexchange.com/q/3414/7741">efficient data
structures</a> for representing set
partitions. These data structures have good time complexities for operations
like Union and Find, but they are not particularly space-efficient.</p>

<p><strong>What is a space-effici... | data structures combinatorics space complexity sets partitions | 1 | What is a compact way to represent a partition of a set? -- (data structures combinatorics space complexity sets partitions)
<p>There exist <a href="https://cs.stackexchange.com/q/3414/7741">efficient data
structures</a> for representing set
partitions. These data structures have good time complexities for oper... | habedi/stack-exchange-dataset |
11,347 | Transforming an arbitrary cover into a vertex cover | <p>Given is a planar graph $G=(V,E)$ and let $\mathcal{G}$ denote its embedding in the plane s.t. each edge has length $1$. 
I have furthermore a set $C$ of points where each point $c \in C$ is contained in $\mathcal{G}$. Furthermore, it holds for any point $p$ in $\mathcal{G}$ that there exists a $c \in C$ with ... | algorithms graphs set cover | 1 | Transforming an arbitrary cover into a vertex cover -- (algorithms graphs set cover)
<p>Given is a planar graph $G=(V,E)$ and let $\mathcal{G}$ denote its embedding in the plane s.t. each edge has length $1$. 
I have furthermore a set $C$ of points where each point $c \in C$ is contained in $\mathcal{G}$. Furthermo... | habedi/stack-exchange-dataset |
11,354 | The notion of density of distribution | <p>I have difficulties in understanding the notion of density for distribution.</p>

<p><strong>Notion of density for distribution</strong>. A distribution $H$ over $\{0,1\}^n$ has density $\sigma$ if for every $x \in \{0,1\}^{n}$, $Pr[H=x] \leq \frac{1}{2^n\sigma}$.</p>

<p>The following is my desperat... | complexity theory probability theory | 1 | The notion of density of distribution -- (complexity theory probability theory)
<p>I have difficulties in understanding the notion of density for distribution.</p>

<p><strong>Notion of density for distribution</strong>. A distribution $H$ over $\{0,1\}^n$ has density $\sigma$ if for every $x \in \{0,1\}^{n}$, ... | habedi/stack-exchange-dataset |
11,358 | Questions about an answer to a pumping lemma question for CFLs | <p>In <a href="https://cs.stackexchange.com/a/7741/4689">the answer to this question</a>, I'm not understanding how the string is derived for a given $l$.</p>

<p>For example,</p>

<blockquote>
 <p>Case 1: $vx = a^i$ where $i > 0$. Choose $l = 2$ to get $a^{n+i} b^{n+1} c^{n+1} d^n \notin L$.</p... | context free pumping lemma | 1 | Questions about an answer to a pumping lemma question for CFLs -- (context free pumping lemma)
<p>In <a href="https://cs.stackexchange.com/a/7741/4689">the answer to this question</a>, I'm not understanding how the string is derived for a given $l$.</p>

<p>For example,</p>

<blockquote>
 <p>Case 1... | habedi/stack-exchange-dataset |
11,380 | Is a language with only a stack of fixed-size integers Turing-complete? | <p>I encountered the brainfuck programming language which I know is turing complete. However I then decided to create a high level language that gets compiled to brainfuck code.</p>

<p>There is only one data type in it (integer, since that's the only data type brainfuck supports). It supports functions and sub... | programming languages turing completeness | 1 | Is a language with only a stack of fixed-size integers Turing-complete? -- (programming languages turing completeness)
<p>I encountered the brainfuck programming language which I know is turing complete. However I then decided to create a high level language that gets compiled to brainfuck code.</p>

<p>There i... | habedi/stack-exchange-dataset |
11,385 | From Whence the Randomization in Randomized Quicksort | <p>Cormen talks briefly about the advantages of picking a random pivot in quicksort. However as pointed out <a href="http://algoviz.org/OpenDSA/Books/OpenDSA/html/Quicksort.html" rel="nofollow">here</a>(4th to the last paragraph):</p>

<blockquote>
 <p>Using a random number generator to choose the positio... | algorithms randomized algorithms quicksort | 1 | From Whence the Randomization in Randomized Quicksort -- (algorithms randomized algorithms quicksort)
<p>Cormen talks briefly about the advantages of picking a random pivot in quicksort. However as pointed out <a href="http://algoviz.org/OpenDSA/Books/OpenDSA/html/Quicksort.html" rel="nofollow">here</a>(4th to the las... | habedi/stack-exchange-dataset |
11,391 | Prove that the Language is Recognizable | <p>I got stuck on this question while studying for final exam.</p>

<p><img src="https://i.stack.imgur.com/AdZCy.png" alt="the language"></p>

<p>I thought about reducing L' to L to prove that L' is recognizable since L is recognizable. I am not 100% sure if that is correct.</p>
 | computability turing machines reductions | 1 | Prove that the Language is Recognizable -- (computability turing machines reductions)
<p>I got stuck on this question while studying for final exam.</p>

<p><img src="https://i.stack.imgur.com/AdZCy.png" alt="the language"></p>

<p>I thought about reducing L' to L to prove that L' is recognizable since ... | habedi/stack-exchange-dataset |
11,393 | Is the intersection of two context free languages recursively enumerable? | <p>I read a quotation attributed to Sheila Greibach that says that the intersection of two context free grammars is recursively enumerable.</p>

<p>I could not, however, find a citation for this quotation (and searching has failed to turn up a restatement of this result somewhere else).</p>

<p>Can anyo... | formal languages computability context free | 1 | Is the intersection of two context free languages recursively enumerable? -- (formal languages computability context free)
<p>I read a quotation attributed to Sheila Greibach that says that the intersection of two context free grammars is recursively enumerable.</p>

<p>I could not, however, find a citation for... | habedi/stack-exchange-dataset |
11,395 | Why isn't set $\{ \langle i, j \rangle \mid W_i = \overline{W_j}\}$ a recursively enumerated set? | <p>Why isn't the set $\{ \langle i, j \rangle \mid W_i = \overline W_j\}$ a r.e. set?</p>

<p>Note: $W_x = L(M_x)$</p>
 | computability reductions | 1 | Why isn't set $\{ \langle i, j \rangle \mid W_i = \overline{W_j}\}$ a recursively enumerated set? -- (computability reductions)
<p>Why isn't the set $\{ \langle i, j \rangle \mid W_i = \overline W_j\}$ a r.e. set?</p>

<p>Note: $W_x = L(M_x)$</p>
 | habedi/stack-exchange-dataset |
11,399 | Introduction to complexity and computability | <p>I'm looking for a good book that explains these subjects in a readable way.
Any suggestions ?</p>

<p>I currently pursuing my BSC in computer science, and I just failed to pass the course introduction to thr theory of computation and complexity.
I would like to have more reference and sources of know... | complexity theory computability reference request books | 1 | Introduction to complexity and computability -- (complexity theory computability reference request books)
<p>I'm looking for a good book that explains these subjects in a readable way.
Any suggestions ?</p>

<p>I currently pursuing my BSC in computer science, and I just failed to pass the course introductio... | habedi/stack-exchange-dataset |
11,403 | Set cover problem and the existence of such cover | <p>In the set cover problem we want to find in the $\mathbb{S} \subset 2^\mathbb{U}$ the subset $\{s_i\}_{1..k}$, such that $\cup s_i = \mathbb{U}$ for given $K$, where $k \le K$.
But how to reduce the set cover problem to the set covering decision problem (determining whether is there such cover or not)? The same ... | np complete reductions | 1 | Set cover problem and the existence of such cover -- (np complete reductions)
<p>In the set cover problem we want to find in the $\mathbb{S} \subset 2^\mathbb{U}$ the subset $\{s_i\}_{1..k}$, such that $\cup s_i = \mathbb{U}$ for given $K$, where $k \le K$.
But how to reduce the set cover problem to the set coverin... | habedi/stack-exchange-dataset |
11,405 | Is the language $L = \{ a^ib^j \mid i\ \nmid\ j \ \} $ context free? | <p>Is the language $L = \{ a^ib^j \mid i\ \nmid\ j \ \} $ context free ?</p>

<p>If we fix $n \in N$ then we know that the language $L = \{ a^ib^j \mid \ \forall \ 1 \le k \le n \ , \ \ j\neq ki \} $ is context free (as it can be presented as a finite union of context free languages in a similar way to the exa... | formal languages context free pumping lemma pushdown automata | 1 | Is the language $L = \{ a^ib^j \mid i\ \nmid\ j \ \} $ context free? -- (formal languages context free pumping lemma pushdown automata)
<p>Is the language $L = \{ a^ib^j \mid i\ \nmid\ j \ \} $ context free ?</p>

<p>If we fix $n \in N$ then we know that the language $L = \{ a^ib^j \mid \ \forall \ 1 \le k \le ... | habedi/stack-exchange-dataset |
11,408 | Asymptotic bounds on number of 3SAT formulas with unique solutions | <p>A set is sparse if it contains polynomially bounded number of strings of any given string length $n$ otherwise it is dense. All known NP-complete sets are dense. It was proven that P=NP if and only if there is a sparse NP-complete set (under Karp reduction).</p>

<p>I would like to find the density of unique... | complexity theory reference request np complete satisfiability | 1 | Asymptotic bounds on number of 3SAT formulas with unique solutions -- (complexity theory reference request np complete satisfiability)
<p>A set is sparse if it contains polynomially bounded number of strings of any given string length $n$ otherwise it is dense. All known NP-complete sets are dense. It was proven that P... | habedi/stack-exchange-dataset |
11,411 | Proving ALLTM complement not recognizable | <p>A few definitions..</p>

<p>$$
\begin{align*}
\mathrm{ALL}_{\mathrm{TM}} &= \Bigl\{\langle M \rangle \,\Big|\, \text{$M$ a Turing Machine over $\{0,1\}^{*}$},\;\; L(M) = \{0,1\}^{*} \Bigr\}
\\[2ex]
\overline{\mathrm{ALL}}_{\mathrm{TM}} &= \Bigl\{\langle M \rangle \,\Big|\, \text{$M$... | computability turing machines undecidability | 1 | Proving ALLTM complement not recognizable -- (computability turing machines undecidability)
<p>A few definitions..</p>

<p>$$
\begin{align*}
\mathrm{ALL}_{\mathrm{TM}} &= \Bigl\{\langle M \rangle \,\Big|\, \text{$M$ a Turing Machine over $\{0,1\}^{*}$},\;\; L(M) = \{0,1\}^{*} \Bigr\}
\\[2ex]&#x... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.