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 |
|---|---|---|---|---|---|---|
18,799 | Find subset with minimal sum under constraints | <p>Let $M$ be a finite set of even cardinality. Define $C=\{\{a,b\}:a,b \in M, a \neq b\}$ the set of all pairs over $M$. Let $w:C \rightarrow \mathbb{R}^+_0$ be a function.</p>

<p>Now find $C' \subset C$ with the following constraints:</p>

<p>$$
\bigcup C' = M \\
\forall x,y \in C': x \cap y ... | algorithms reductions optimization | 1 | Find subset with minimal sum under constraints -- (algorithms reductions optimization)
<p>Let $M$ be a finite set of even cardinality. Define $C=\{\{a,b\}:a,b \in M, a \neq b\}$ the set of all pairs over $M$. Let $w:C \rightarrow \mathbb{R}^+_0$ be a function.</p>

<p>Now find $C' \subset C$ with the following ... | habedi/stack-exchange-dataset |
18,807 | About the complexity of deciding whether no two elements of a collection are the same | <p>Given a collection of $n$ numbers, $S$, the question is to decide whether all the elements of $S$ are distinct from each other. If they are distinct from each other (no two of them are the same), print "Yes". Otherwise print "No".</p>

<p>I know the worst case time complexity of this question is $\Theta \lef... | algorithm analysis time complexity | 1 | About the complexity of deciding whether no two elements of a collection are the same -- (algorithm analysis time complexity)
<p>Given a collection of $n$ numbers, $S$, the question is to decide whether all the elements of $S$ are distinct from each other. If they are distinct from each other (no two of them are the sa... | habedi/stack-exchange-dataset |
18,810 | Are there problems with complexity between $O(n^c/\log^b n)$ and $O(n^{c - \varepsilon})$? | <p>I am having an extremely tough time with this homework question, wondering if anyone could help me (for all you theory aficionados, this one's for you).</p>

<p><em>There is a language $L$ with the following property: There is a Turing machine that decides $L$ in time $O(n^{2013}/\log^{2012} n)$, but there i... | complexity theory time complexity | 1 | Are there problems with complexity between $O(n^c/\log^b n)$ and $O(n^{c - \varepsilon})$? -- (complexity theory time complexity)
<p>I am having an extremely tough time with this homework question, wondering if anyone could help me (for all you theory aficionados, this one's for you).</p>

<p><em>There is a lan... | habedi/stack-exchange-dataset |
18,815 | Question on SAT reduction | <p>Let Two-Solutions-SAT be the language of Boolean formulas that have exactly two distinct satisfying assignments. Show Two-Solutions-SAT is co-NP-hard.</p>

<p>I know how to show that the complement of Two-Solutions-SAT is in NP, it's relatively easy to create a nondeterministic polynomial time TM that decide... | complexity theory np complete reductions np hard | 1 | Question on SAT reduction -- (complexity theory np complete reductions np hard)
<p>Let Two-Solutions-SAT be the language of Boolean formulas that have exactly two distinct satisfying assignments. Show Two-Solutions-SAT is co-NP-hard.</p>

<p>I know how to show that the complement of Two-Solutions-SAT is in NP, ... | habedi/stack-exchange-dataset |
18,831 | Relative complement of a Non CFL to CFL | <p>Let $L$ be a given Context Free Language over the alphabet $\{a,b\}$. Now consider $$L_1=L-\{xyx\ |\ x,y\in\{a,b\}^*\}$$
I know that $\{xyx\ |\ x,y\in\{a,b\}^*\}$ is not Context Free (by using pumping lemma).</p>

<p>Based on that can we affirmatively say that $L_1$ will <strong>NEVER</strong> be Context... | formal languages context free | 1 | Relative complement of a Non CFL to CFL -- (formal languages context free)
<p>Let $L$ be a given Context Free Language over the alphabet $\{a,b\}$. Now consider $$L_1=L-\{xyx\ |\ x,y\in\{a,b\}^*\}$$
I know that $\{xyx\ |\ x,y\in\{a,b\}^*\}$ is not Context Free (by using pumping lemma).</p>

<p>Based on that... | habedi/stack-exchange-dataset |
18,835 | Binary operators with higher precedence than unary operators | <p>Generally (perhaps always) in programming languages, unary operators have the highest precedence. In some langauges, such as Standard ML, one can dynamically change the precedence of binary operators at run time.</p>

<p>But what if we have a language where binary operators had higher precedence than unary ... | context free parsing | 1 | Binary operators with higher precedence than unary operators -- (context free parsing)
<p>Generally (perhaps always) in programming languages, unary operators have the highest precedence. In some langauges, such as Standard ML, one can dynamically change the precedence of binary operators at run time.</p>

<p>... | habedi/stack-exchange-dataset |
18,842 | Kolmogorov Complexity: Why would you need more bytes than the string itself? | <p>I was reading <a href="http://en.wikipedia.org/wiki/Kolmogorov_complexity" rel="nofollow noreferrer">Wikipedia's entry on Kolmogorov Complexity</a> (<a href="https://cs.stackexchange.com/questions/3501/approximating-the-kolmogorov-complexity">thanks to this question</a>), which states:</p>

<blockquote>
... | kolmogorov complexity | 1 | Kolmogorov Complexity: Why would you need more bytes than the string itself? -- (kolmogorov complexity)
<p>I was reading <a href="http://en.wikipedia.org/wiki/Kolmogorov_complexity" rel="nofollow noreferrer">Wikipedia's entry on Kolmogorov Complexity</a> (<a href="https://cs.stackexchange.com/questions/3501/approximati... | habedi/stack-exchange-dataset |
18,849 | Finding the k-shortest path between two nodes | <p>Given a weighted digraph <span class="math-container">$G=V,E$</span>, and a weight function, <span class="math-container">$d(u,v)$</span>, one can normally use Dijkstra's algorithm to obtain the shortest path. What I am interested in, is how to obtain the <span class="math-container">$2^{nd}$</span>-shortest path, t... | algorithms graphs shortest path graph traversal | 1 | Finding the k-shortest path between two nodes -- (algorithms graphs shortest path graph traversal)
<p>Given a weighted digraph <span class="math-container">$G=V,E$</span>, and a weight function, <span class="math-container">$d(u,v)$</span>, one can normally use Dijkstra's algorithm to obtain the shortest path. What I a... | habedi/stack-exchange-dataset |
18,852 | Prove the red blue separation problem is NP-complete | <p>Consider the following problem: given a set of $m$ red points and $n$ blue points in the plane, find a minimum length cycle that separates the red points from the blue points. That is, the red points are inside the cycle and the blue points are outside the cycle, or vice versa. This problem is called the <em>red blu... | algorithms algorithm analysis np complete np hard np | 1 | Prove the red blue separation problem is NP-complete -- (algorithms algorithm analysis np complete np hard np)
<p>Consider the following problem: given a set of $m$ red points and $n$ blue points in the plane, find a minimum length cycle that separates the red points from the blue points. That is, the red points are in... | habedi/stack-exchange-dataset |
18,858 | Why does a regular expression only accept all my required strings when the concatenation is the first of the OR operations? | <p>I am having a bit of difficulty understanding the order of precedence in boolean logic for the OR operation. Take this example:</p>

<p>Assume the following regular expression:</p>

<pre><code>((a(b+))+(a|c))|a|c
</code></pre>

<p>Why is it that this accepts the strings:</p>

<pre... | formal languages automata regular expressions | 1 | Why does a regular expression only accept all my required strings when the concatenation is the first of the OR operations? -- (formal languages automata regular expressions)
<p>I am having a bit of difficulty understanding the order of precedence in boolean logic for the OR operation. Take this example:</p>

<... | habedi/stack-exchange-dataset |
18,865 | What is a dichotomy? Whether 2-SAT itself is a dichotomy of SAT? | <p>Recently, I am reading papers about <em>dichotomy</em>. I do not understant what condition can be called as a <em>dichotomy</em>? What is the meaning of "a question is either in <strong>P</strong> or in <strong>NP</strong>-<em>complete</em>"? (assume <strong>P</strong> $\neq$ <strong>NP</strong>)</p>

<p>For... | complexity theory np complete satisfiability | 1 | What is a dichotomy? Whether 2-SAT itself is a dichotomy of SAT? -- (complexity theory np complete satisfiability)
<p>Recently, I am reading papers about <em>dichotomy</em>. I do not understant what condition can be called as a <em>dichotomy</em>? What is the meaning of "a question is either in <strong>P</strong> or in... | habedi/stack-exchange-dataset |
18,867 | Minimum spanning tree and its connected subgraph | <p>This problem is from the book [1]. In case of being closed as a duplication of that in [2], I first make a defense:</p>

<ul>
<li>The accepted answer at [2] is still in dispute.</li>
<li>The proof given by <code>@eh9</code> is based on Kruskal's algorithm.</li>
<li>I am seeking for a proof indepe... | algorithms graphs spanning trees | 1 | Minimum spanning tree and its connected subgraph -- (algorithms graphs spanning trees)
<p>This problem is from the book [1]. In case of being closed as a duplication of that in [2], I first make a defense:</p>

<ul>
<li>The accepted answer at [2] is still in dispute.</li>
<li>The proof given by <code>@e... | habedi/stack-exchange-dataset |
18,873 | Hashing a Specific Range Of a Character Array | <p>I need to process queries to Hash various ranges of a character array. I am currently using the <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#hashCode%28char%5B%5D%29" rel="nofollow">Arrays.hashCode</a> from the standard java library. But the problem is that this method is too slow. Also my... | data structures arrays hash hash tables | 1 | Hashing a Specific Range Of a Character Array -- (data structures arrays hash hash tables)
<p>I need to process queries to Hash various ranges of a character array. I am currently using the <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#hashCode%28char%5B%5D%29" rel="nofollow">Arrays.hashCode</... | habedi/stack-exchange-dataset |
18,883 | Finding valid permutation using a graph | <p>Let <span class="math-container">$A$</span> be a set of integers: <span class="math-container">$A=\left \{ x_1, x_2...x_n \mid 10<x_i<100\right \}$</span></p>

<p>A <em>valid permutation</em> <span class="math-container">$x_{i_1}x_{i_2}...x_{i_n}$</span> is a permutation that holds the following proper... | graphs eulerian paths | 1 | Finding valid permutation using a graph -- (graphs eulerian paths)
<p>Let <span class="math-container">$A$</span> be a set of integers: <span class="math-container">$A=\left \{ x_1, x_2...x_n \mid 10<x_i<100\right \}$</span></p>

<p>A <em>valid permutation</em> <span class="math-container">$x_{i_1}x_{i_2}... | habedi/stack-exchange-dataset |
18,887 | How can a Turing machine run another machine for an infinite amount of strings? | <p>The proof in my textbook, that $E_{TM}$ can be decided by oracle machine $O^{A_{TM}}$, uses a Turing machine $P$ such that for an input $w$:</p>

<ul>
<li>$P$ runs the Turing machine $M$ on all strings of $\Sigma^*$</li>
<li>If $M$ accepts the string, $P$ accepts</li>
</ul>

<p>$O^{A_{TM}... | turing machines strings | 1 | How can a Turing machine run another machine for an infinite amount of strings? -- (turing machines strings)
<p>The proof in my textbook, that $E_{TM}$ can be decided by oracle machine $O^{A_{TM}}$, uses a Turing machine $P$ such that for an input $w$:</p>

<ul>
<li>$P$ runs the Turing machine $M$ on all st... | habedi/stack-exchange-dataset |
18,889 | Is radix sort a greedy algorithm? | <p>I was thinking of radix sort, and at a sudden thought that it uses de facto the paradigm of dynamic programming, but I soon changed my mind to greedy algorithm. Is it really a greedy algorithm? </p>
 | algorithms terminology sorting | 1 | Is radix sort a greedy algorithm? -- (algorithms terminology sorting)
<p>I was thinking of radix sort, and at a sudden thought that it uses de facto the paradigm of dynamic programming, but I soon changed my mind to greedy algorithm. Is it really a greedy algorithm? </p>
 | habedi/stack-exchange-dataset |
18,894 | Reducing from a Turing machine that recognizes is regular to the halting problem | <p>I'm trying to understand reduction, this is from my textbook and is not a homework problem or even any exercise, just trying to understand an example they present.</p>

<p>This is the reduction they give: </p>

<p>PROOF We let R be a TM that decides REGULARTM and construct TM S to
decide ATM . Th... | computability turing machines reductions undecidability | 1 | Reducing from a Turing machine that recognizes is regular to the halting problem -- (computability turing machines reductions undecidability)
<p>I'm trying to understand reduction, this is from my textbook and is not a homework problem or even any exercise, just trying to understand an example they present.</p>
&#x... | habedi/stack-exchange-dataset |
18,897 | Complexity classes that are closed under subtraction | <p>Are NP or P closed under subtraction? Im having a hard time deciding whether they are or aren't.
<em>Question was edited</em></p>

<p><strong>Original question</strong>:
Im having some hard time figuring out what languages are closed under subtraction.
Say you have 2 languages A, B ∈ NP. Is A\B ∈... | complexity theory closure properties np | 1 | Complexity classes that are closed under subtraction -- (complexity theory closure properties np)
<p>Are NP or P closed under subtraction? Im having a hard time deciding whether they are or aren't.
<em>Question was edited</em></p>

<p><strong>Original question</strong>:
Im having some hard time figuring... | habedi/stack-exchange-dataset |
18,900 | How do I show T(n) = 2T(n-1) + k is O(2^n)? | <p>This is a practice problem I've come up with in order to study for an exam I have in a couple of hours.</p>

<p>Again, here's the problem: Show T(n) = 2T(n-1) + k is O(2^n) where k is some positive constant.</p>

<p>First of all, 2^n is indeed the upperbound, right? Since I've made this problem up my... | asymptotics recurrence relation | 1 | How do I show T(n) = 2T(n-1) + k is O(2^n)? -- (asymptotics recurrence relation)
<p>This is a practice problem I've come up with in order to study for an exam I have in a couple of hours.</p>

<p>Again, here's the problem: Show T(n) = 2T(n-1) + k is O(2^n) where k is some positive constant.</p>

<p>Firs... | habedi/stack-exchange-dataset |
18,906 | Reducing from Hamiltonian Cycle to Subgraph Isomorphism | <p>I am reading <a href="http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem" rel="nofollow">Subgraph isomorphism problem</a> </p>

<p>I am having trouble understanding how they prove that the subgraph isomorphism problem is NP-Complete using the Hamiltonian cycles problem in the article. </p>

<... | algorithms graphs np complete | 1 | Reducing from Hamiltonian Cycle to Subgraph Isomorphism -- (algorithms graphs np complete)
<p>I am reading <a href="http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem" rel="nofollow">Subgraph isomorphism problem</a> </p>

<p>I am having trouble understanding how they prove that the subgraph isomorphism p... | habedi/stack-exchange-dataset |
18,910 | Is $O(N+M)$ exponential or polynomial? | <p>So In a review section, our professor asked:</p>

<p>Given integers $N$ and $M$</p>

<p>Is $O(N+M)$ exponential or polynomial.</p>

<p>It's exponential, but I just don't see how that is. I would have thought it's linear.</p>
 | landau notation | 1 | Is $O(N+M)$ exponential or polynomial? -- (landau notation)
<p>So In a review section, our professor asked:</p>

<p>Given integers $N$ and $M$</p>

<p>Is $O(N+M)$ exponential or polynomial.</p>

<p>It's exponential, but I just don't see how that is. I would have thought it's linear.</p>
 | habedi/stack-exchange-dataset |
18,912 | Complexity of calculating a single model versus all models of a propositional formula with a SAT solver | <p>I have little background with SAT sovers and theoretical computer science.</p>

<p>How can I describe the complexity of calculating all models of a propositional formula versus just the usual SAT problem of finding just one model?</p>

<p>I am writing a paper, in an area where finding a single of a m... | complexity theory np complete satisfiability sat | 1 | Complexity of calculating a single model versus all models of a propositional formula with a SAT solver -- (complexity theory np complete satisfiability sat)
<p>I have little background with SAT sovers and theoretical computer science.</p>

<p>How can I describe the complexity of calculating all models of a pro... | habedi/stack-exchange-dataset |
18,913 | How to approach NFA design questions intuitively? | <p>I did see a lot of nice and informative questions, articles on inter-net and on StackOverflow itself, of-course. But I found all the questions or articles following a specific rule or a pattern to explain the topic. I mean, when a question was asked on NFA, DFA or Regular Expression, a solution was presented to the ... | regular languages finite automata education | 1 | How to approach NFA design questions intuitively? -- (regular languages finite automata education)
<p>I did see a lot of nice and informative questions, articles on inter-net and on StackOverflow itself, of-course. But I found all the questions or articles following a specific rule or a pattern to explain the topic. I ... | habedi/stack-exchange-dataset |
18,934 | Data structure to use for a consumable message queue where it's safe for messages to overwrite one another | <p>I have a queue of messages representing filesystem operations that need to be processed in order. A message may succeed or fail when it's sent. A change message, for example, is generated when a user creates or saves a file.</p>

<ul>
<li>Delete Foo.txt message sent</li>
<li>Delete Bar.txt message se... | data structures | 1 | Data structure to use for a consumable message queue where it's safe for messages to overwrite one another -- (data structures)
<p>I have a queue of messages representing filesystem operations that need to be processed in order. A message may succeed or fail when it's sent. A change message, for example, is generated w... | habedi/stack-exchange-dataset |
18,939 | Relation between space and time complexity for machines with write once read many (WORM) memory | <p>While thinking about different calculi for predicate logic (like natural deduction and sequent calculus), I noticed that these calculi are (often) presented in a form suitable for "human computers". A "human computer" is limited to use <a href="http://en.wikipedia.org/wiki/Write_once_read_many" rel="noreferrer">writ... | time complexity runtime analysis space complexity | 1 | Relation between space and time complexity for machines with write once read many (WORM) memory -- (time complexity runtime analysis space complexity)
<p>While thinking about different calculi for predicate logic (like natural deduction and sequent calculus), I noticed that these calculi are (often) presented in a form... | habedi/stack-exchange-dataset |
18,951 | Detecting a subsequence that's an arithmetic progression, in a sorted sequence | <p>I have following problem: I have a sorted sequence of $N$ integers (assume they are monotonically increasing). I want to check whether there is any subsequence of length $\ge N/4$, such that consecutive elements of the subsequence all differ by the same value.</p>

<p>For example, in the sequence [3,4,5,8,1... | algorithms decision problem subsequences | 1 | Detecting a subsequence that's an arithmetic progression, in a sorted sequence -- (algorithms decision problem subsequences)
<p>I have following problem: I have a sorted sequence of $N$ integers (assume they are monotonically increasing). I want to check whether there is any subsequence of length $\ge N/4$, such that ... | habedi/stack-exchange-dataset |
18,955 | Relaxing the stack in a push down automata | <p>Given a non-deterministic push down automata (we define "accept" here using accept states), if we assume any operation popping from the stack and checking if the top of the stack contains some symbol can succeed (i.e. "getting rid" of the stack), we get a non-deterministic finite automata.</p>

<p>If we conv... | formal languages pushdown automata nondeterminism | 1 | Relaxing the stack in a push down automata -- (formal languages pushdown automata nondeterminism)
<p>Given a non-deterministic push down automata (we define "accept" here using accept states), if we assume any operation popping from the stack and checking if the top of the stack contains some symbol can succeed (i.e. "... | habedi/stack-exchange-dataset |
18,959 | Decidability of Turing Machines with input of fixed length | <p>I'm learning about undecidability, and found this question:</p>

<pre><code>Is this language decidable, make a proof:
 L = { M : machine M halts for every input of length not exceeding 100 }
</code></pre>

<p>Update: This is translated from an exam paper some years ago, and I'm quite sure ... | computability turing machines undecidability | 1 | Decidability of Turing Machines with input of fixed length -- (computability turing machines undecidability)
<p>I'm learning about undecidability, and found this question:</p>

<pre><code>Is this language decidable, make a proof:
 L = { M : machine M halts for every input of length not exceeding 100 }&#x... | habedi/stack-exchange-dataset |
18,987 | Doesn't post-order traversal require subtrees to be evaluated separately? | <p>Consider this tree:</p>

<p><img src="https://i.stack.imgur.com/cMslZ.png" alt="Simple binary tree"></p>

<p>If I traverse it using post-order, I'd start at <em>B</em> (as it is the leftmost leaf) and that's where my misunderstanding begins. I know <em>B</em> is the first and <em>A</em> will be the l... | data structures binary trees search algorithms trees search trees | 1 | Doesn't post-order traversal require subtrees to be evaluated separately? -- (data structures binary trees search algorithms trees search trees)
<p>Consider this tree:</p>

<p><img src="https://i.stack.imgur.com/cMslZ.png" alt="Simple binary tree"></p>

<p>If I traverse it using post-order, I'd start at... | habedi/stack-exchange-dataset |
18,989 | Can I construct a Turing machine that accepts only its own encoding? | <p>Is the set $S$ = $\lbrace M \mid M \text{ is a Turing machine and }L(M)=\lbrace \langle M\rangle\rbrace\rbrace$ empty?</p>

<p>In other words is there a Turing machine $M$ that only accepts its own encoding? What about a Turing machine that rejects only its own encoding? </p>
 | computability turing machines | 1 | Can I construct a Turing machine that accepts only its own encoding? -- (computability turing machines)
<p>Is the set $S$ = $\lbrace M \mid M \text{ is a Turing machine and }L(M)=\lbrace \langle M\rangle\rbrace\rbrace$ empty?</p>

<p>In other words is there a Turing machine $M$ that only accepts its own encodin... | habedi/stack-exchange-dataset |
18,993 | Is there always a Big Oh complexity strictly between any two others? | <p>I'm learning about asymptotic analysis, and have seen some exotic looking complexities living between other common ones. For instance "log log n" is strictly between 1 and log n. It makes me wonder if one can always find complexities between any other two.</p>

<p>Specifically, for any functions f and g with... | complexity theory time complexity asymptotics | 1 | Is there always a Big Oh complexity strictly between any two others? -- (complexity theory time complexity asymptotics)
<p>I'm learning about asymptotic analysis, and have seen some exotic looking complexities living between other common ones. For instance "log log n" is strictly between 1 and log n. It makes me wonder... | habedi/stack-exchange-dataset |
18,997 | Reduce variant of Vertex Cover to original decision-version Vertex cover problem | <p>Consider the following variation (let us call it Q) on the Vertex Cover problem: Given a Graph G and a number K, we are asked if there is a k-cover of G so that it is the minimum cover.
My question is: How may one prove that Q can be reduced to the general Vertex Cover problem?
And, more generally, what is t... | complexity theory np complete | 1 | Reduce variant of Vertex Cover to original decision-version Vertex cover problem -- (complexity theory np complete)
<p>Consider the following variation (let us call it Q) on the Vertex Cover problem: Given a Graph G and a number K, we are asked if there is a k-cover of G so that it is the minimum cover.
My question... | habedi/stack-exchange-dataset |
19,001 | What were the research outcomes of the Univalent Foundations Program year (Homotopy Type Theory) | <p>The Institute for Advanced Study <a href="http://homotopytypetheory.org/events/">has had</a> a year-long special program devoted to the <a href="http://homotopytypetheory.org/">Univalent Foundations Program</a>. </p>

<p>At the end of this they have produced a <a href="http://homotopytypetheory.org/book/">bo... | homotopy type theory | 1 | What were the research outcomes of the Univalent Foundations Program year (Homotopy Type Theory) -- (homotopy type theory)
<p>The Institute for Advanced Study <a href="http://homotopytypetheory.org/events/">has had</a> a year-long special program devoted to the <a href="http://homotopytypetheory.org/">Univalent Foundat... | habedi/stack-exchange-dataset |
19,019 | Problems that are NP but polynomial on graphs of bounded treewidth | <p>I <em>heard</em> <a href="http://www.youtube.com/watch?v=cQwhYtTfZCs&list=PLawkBQ15NDElkyLbJBKwZCgA5jxsKRlK-&index=22" rel="nofollow">here</a> that the Hamiltonian cycle problem is polynomial on graphs of bounded treewidth.</p>

<p>I am interested in examples/references to different problems which is... | complexity theory graphs reference request np polynomial time | 1 | Problems that are NP but polynomial on graphs of bounded treewidth -- (complexity theory graphs reference request np polynomial time)
<p>I <em>heard</em> <a href="http://www.youtube.com/watch?v=cQwhYtTfZCs&list=PLawkBQ15NDElkyLbJBKwZCgA5jxsKRlK-&index=22" rel="nofollow">here</a> that the Hamiltonian cycle probl... | habedi/stack-exchange-dataset |
19,020 | Why should one not use a 2^p size hash table when using the division method as a hash function? | <p>I don't understand what is meant by:</p>

<p>"m should not be a power of 2, since if m = 2^p, then h(k) is just the p lowest-order bits of k." (pg. 231 of CLRS)</p>

<p>Terms defined:</p>

<pre><code>m: size of hash table
h(k): hash function = k mod m
k: key
</code></pre>

... | hash tables | 1 | Why should one not use a 2^p size hash table when using the division method as a hash function? -- (hash tables)
<p>I don't understand what is meant by:</p>

<p>"m should not be a power of 2, since if m = 2^p, then h(k) is just the p lowest-order bits of k." (pg. 231 of CLRS)</p>

<p>Terms defined:</p>&... | habedi/stack-exchange-dataset |
19,026 | Given the same set of nodes, why is it (generally) easier to find a Euler cycle than a Hamilton cycle? | <p>To find a Hamilton cycle is a NPC problem, but Euler is not. 
Considering one can always transform the vertex as edge or vice versa conceptually. Then the vertex can be used to describe the information which originally edge does.</p>

<p>What properties make the Euler graph more easily to be resolved? </... | graphs | 1 | Given the same set of nodes, why is it (generally) easier to find a Euler cycle than a Hamilton cycle? -- (graphs)
<p>To find a Hamilton cycle is a NPC problem, but Euler is not. 
Considering one can always transform the vertex as edge or vice versa conceptually. Then the vertex can be used to describe the informat... | habedi/stack-exchange-dataset |
19,032 | IDDFS explained | <p>I am trying to understand how IDDFS works by reading a <a href="http://en.wikipedia.org/wiki/Iterative_deepening_depth-first_search" rel="nofollow">wikipedia article</a> on it.
(If someone has a better literature on the subject, don't hesitate to post).
Pseudocode is as follows:</p>

<pre><code>IDDFS... | graphs graph traversal | 1 | IDDFS explained -- (graphs graph traversal)
<p>I am trying to understand how IDDFS works by reading a <a href="http://en.wikipedia.org/wiki/Iterative_deepening_depth-first_search" rel="nofollow">wikipedia article</a> on it.
(If someone has a better literature on the subject, don't hesitate to post).
Pseudocode ... | habedi/stack-exchange-dataset |
19,040 | Help reducing 3-SAT to 3-COLORING | <p>I am working on showing that 3-colorability is NP-complete. I read a few articles and walkthroughs on this but none are really clicking. I get to this part</p>

<blockquote>
 <p>"Then for every variable xi that appears in the instance of Satisfiability, we connect a
 vertex xi to a vertex xi, ... | complexity theory np complete reductions np | 1 | Help reducing 3-SAT to 3-COLORING -- (complexity theory np complete reductions np)
<p>I am working on showing that 3-colorability is NP-complete. I read a few articles and walkthroughs on this but none are really clicking. I get to this part</p>

<blockquote>
 <p>"Then for every variable xi that appears in... | habedi/stack-exchange-dataset |
19,042 | Fast hashing: combination of different techniques to identify changes in a file? | <p>I want to create a fast way to detect whether a file might or might not be the same. For almost 100% sureness I would use an existing hash algorithm, e.g. SHA256.
However, the files are expected to be huge video files with several GB, so calculating the SHA256 hash could take some time, especially over the netwo... | hash performance | 1 | Fast hashing: combination of different techniques to identify changes in a file? -- (hash performance)
<p>I want to create a fast way to detect whether a file might or might not be the same. For almost 100% sureness I would use an existing hash algorithm, e.g. SHA256.
However, the files are expected to be huge vide... | habedi/stack-exchange-dataset |
19,048 | all pairs shortest path using Dijkstra | <p>So, I have a list of cities (A, B, C, etc) with weighted edges (two-way, undirected) between them with a list of cities that already have a store.</p>

<p>My task is to place a one new store at either A, B, C, etc so that I minimize the travel distance from any city to a store.</p>

<p>So my head is ... | algorithms | 1 | all pairs shortest path using Dijkstra -- (algorithms)
<p>So, I have a list of cities (A, B, C, etc) with weighted edges (two-way, undirected) between them with a list of cities that already have a store.</p>

<p>My task is to place a one new store at either A, B, C, etc so that I minimize the travel distance f... | habedi/stack-exchange-dataset |
19,049 | Find a diffrent minimal spanning tree for a graph | <p>For my homework I have a problem that I can't solve and it makes me wonder about 2 different MST:</p>
<blockquote>
<p>Let <span class="math-container">$G=(V,E)$</span> be a graph that has a minimum spanning tree <span class="math-container">$T$</span>.</p>
<p>I want to find another minimum spanning tree ... | algorithms graphs spanning trees | 1 | Find a diffrent minimal spanning tree for a graph -- (algorithms graphs spanning trees)
<p>For my homework I have a problem that I can't solve and it makes me wonder about 2 different MST:</p>
<blockquote>
<p>Let <span class="math-container">$G=(V,E)$</span> be a graph that has a minimum spanning tree <span cla... | habedi/stack-exchange-dataset |
19,053 | Does types being terms imply your dependend theory is considered polymorphic? | <p>In the introduction of the book by B.Jacobs, "Categorical Logic and Type Theory" (it's online <a href="http://synrc.com/publications/cat/Category%20Theory/Categorical%20Logic/Jacobs%20B.%20Categorical%20Logic%20and%20Type%20Theory.pdf" rel="nofollow">here</a>), he classifies type systems into three general flavours:... | type theory dependent types | 1 | Does types being terms imply your dependend theory is considered polymorphic? -- (type theory dependent types)
<p>In the introduction of the book by B.Jacobs, "Categorical Logic and Type Theory" (it's online <a href="http://synrc.com/publications/cat/Category%20Theory/Categorical%20Logic/Jacobs%20B.%20Categorical%20Log... | habedi/stack-exchange-dataset |
19,061 | When describing a CS paper, can it be assumed that the meaning of "tick" is known? | <p>I thinkt this question fits better here than on english.stackexchange.</p>

<p>When describing a figure in a computer science paper, is it safe to use "tick" meaning "tick mark"?</p>

<p>Examples:<br>
<code>... (see the thick line right of tick "17")</code> meaning <code>tick mark "17"</code><br... | terminology | 1 | When describing a CS paper, can it be assumed that the meaning of "tick" is known? -- (terminology)
<p>I thinkt this question fits better here than on english.stackexchange.</p>

<p>When describing a figure in a computer science paper, is it safe to use "tick" meaning "tick mark"?</p>

<p>Examples:<br>&... | habedi/stack-exchange-dataset |
19,065 | Non-termination of types in Martin-Löf's Type:Type? | <p>In the pre-history of dependent type theory, Per Martin Löf
introduced a calculus that is in some sense the simplest dependent
type theory and the most general form of impredicative polymorphism.
It is often referred to as <strong><em>Type:Type</em></strong> because the kind <strong><em>Type</em></strong... | type theory functional programming dependent types curry howard | 1 | Non-termination of types in Martin-Löf's Type:Type? -- (type theory functional programming dependent types curry howard)
<p>In the pre-history of dependent type theory, Per Martin Löf
introduced a calculus that is in some sense the simplest dependent
type theory and the most general form of impredicative polymo... | habedi/stack-exchange-dataset |
19,074 | What do functions look like, if I stated out with the categoical model of my type theory? | <p>I see how objects in a category stand for types, but where do I find the terms and more specifically the rules which tell me which of them are allowed? When I e.g. consider a <a href="http://en.wikipedia.org/wiki/Cartesian_closed_categories#Definition" rel="nofollow">Cartesian closed category</a> as model of a type ... | lambda calculus type theory category theory | 1 | What do functions look like, if I stated out with the categoical model of my type theory? -- (lambda calculus type theory category theory)
<p>I see how objects in a category stand for types, but where do I find the terms and more specifically the rules which tell me which of them are allowed? When I e.g. consider a <a ... | habedi/stack-exchange-dataset |
19,077 | Master theorem for $T(n) = 2T(n/2) + n^{2}\log n$ | <p>Would I use the third case of the <a href="http://en.wikipedia.org/wiki/Master_theorem" rel="nofollow">Master Theorem</a> for the recurrence equation $T(n) = 2T(n/2) + n^{2}\log n$? </p>

<p>The condition given for the third case by Wikipedia is $f(n) = \Theta(n^c)$ when $c > \log_{b}a$.</p>
 | recurrence relation master theorem | 1 | Master theorem for $T(n) = 2T(n/2) + n^{2}\log n$ -- (recurrence relation master theorem)
<p>Would I use the third case of the <a href="http://en.wikipedia.org/wiki/Master_theorem" rel="nofollow">Master Theorem</a> for the recurrence equation $T(n) = 2T(n/2) + n^{2}\log n$? </p>

<p>The condition given for the ... | habedi/stack-exchange-dataset |
19,092 | How to prove the NP-completeness of the ``Exact-3D-Matching`` problem by reducing the ``3-Partition`` problem to it? | <p><strong>Background:</strong> The <code>Exact-3D-Matching</code> problem is defined as follows (The definition is from Jeff's lecture note: <a href="http://www.cs.uiuc.edu/~jeffe/teaching/algorithms/notes/29-nphard.pdf" rel="nofollow">Lecture 29: NP-Hard Problems</a>. You can also refer to <a href="https://en.wikiped... | complexity theory np complete np hard | 1 | How to prove the NP-completeness of the ``Exact-3D-Matching`` problem by reducing the ``3-Partition`` problem to it? -- (complexity theory np complete np hard)
<p><strong>Background:</strong> The <code>Exact-3D-Matching</code> problem is defined as follows (The definition is from Jeff's lecture note: <a href="http://ww... | habedi/stack-exchange-dataset |
19,093 | Viterbi algorithm recursive justification | <p>I have a question regarding recursion in <a href="http://en.wikipedia.org/wiki/Viterbi_algorithm" rel="nofollow">Viterbi algorithm</a>.</p>

<p>Define $\pi(k; u; v)$ which is the maximum probability for any sequence of length $k$, ending in the tag bigram $(u; v)$.</p>

<p>The base case if obvious $... | algorithms dynamic programming recursion correctness proof hidden markov models | 1 | Viterbi algorithm recursive justification -- (algorithms dynamic programming recursion correctness proof hidden markov models)
<p>I have a question regarding recursion in <a href="http://en.wikipedia.org/wiki/Viterbi_algorithm" rel="nofollow">Viterbi algorithm</a>.</p>

<p>Define $\pi(k; u; v)$ which is the ma... | habedi/stack-exchange-dataset |
19,094 | Selection Sort runtime in terms of Big O | <p>I'm trying to understand why the sorting algorithm Selection Sort has asymptotic runtime in $O(n^2)$.</p>

<p>Looking at the math, the runtime is</p>

<p>$\qquad T(n) = (n-1) + (n-2) + \dots + 2 + 1$.</p>

<p>And this is stated to be equal to</p>

<p>$\qquad O(n^2)$.</p>

<p>H... | algorithm analysis asymptotics runtime analysis sorting | 1 | Selection Sort runtime in terms of Big O -- (algorithm analysis asymptotics runtime analysis sorting)
<p>I'm trying to understand why the sorting algorithm Selection Sort has asymptotic runtime in $O(n^2)$.</p>

<p>Looking at the math, the runtime is</p>

<p>$\qquad T(n) = (n-1) + (n-2) + \dots + 2 + 1$... | habedi/stack-exchange-dataset |
19,103 | Multi-dimensional Neural Network for fingerprint matching | <p>I want to use <a href="http://www.sciencedirect.com/science/article/pii/S0952197609001626" rel="nofollow">“Fingerprint matching using multi-dimensional ANN”
by Rajesh Kumar and B.R. Deva Vikram</a> [<a href="https://www.dropbox.com/s/6uxx9874bvc4hqo/neural_network_fingerprint.pdf" rel="nofollow">content link</a>... | artificial intelligence neural networks | 1 | Multi-dimensional Neural Network for fingerprint matching -- (artificial intelligence neural networks)
<p>I want to use <a href="http://www.sciencedirect.com/science/article/pii/S0952197609001626" rel="nofollow">“Fingerprint matching using multi-dimensional ANN”
by Rajesh Kumar and B.R. Deva Vikram</a> [<a href="ht... | habedi/stack-exchange-dataset |
19,134 | In type systems, is there a name for SQL's way of cutting and combining record types into new types? | <p>I'd like to have this feature in my application programming language (which these days, is Scala), but when I went to learn more about it on the internets, I realized I don't know the name of it. I'm talking about the ability to do this (in Scala-ish pseudocode):</p>

<pre><code>// Define some types that co... | type theory type checking notation | 1 | In type systems, is there a name for SQL's way of cutting and combining record types into new types? -- (type theory type checking notation)
<p>I'd like to have this feature in my application programming language (which these days, is Scala), but when I went to learn more about it on the internets, I realized I don't k... | habedi/stack-exchange-dataset |
19,135 | Is Wadler's 'Theorems for Free' as general as Design By Contract for establishing correctness? | <p>Philip Wadler has written a <a href="http://ttic.uchicago.edu/~dreyer/course/papers/wadler.pdf" rel="nofollow">brilliant paper</a> called 'Theorems for Free'. The big idea is that you can use types to reason about your program, and even prove simple theorems about your program. </p>

<p>We see these ideas ab... | type theory curry howard | 1 | Is Wadler's 'Theorems for Free' as general as Design By Contract for establishing correctness? -- (type theory curry howard)
<p>Philip Wadler has written a <a href="http://ttic.uchicago.edu/~dreyer/course/papers/wadler.pdf" rel="nofollow">brilliant paper</a> called 'Theorems for Free'. The big idea is that you can use ... | habedi/stack-exchange-dataset |
19,141 | What is an asymptotically tight upper bound? | <p>From what I have learned asymptotically tight bound means that it is bound from above and below as in theta notation.
But what does asymptotically tight upper bound mean for Big-O notation?</p>
 | asymptotics | 1 | What is an asymptotically tight upper bound? -- (asymptotics)
<p>From what I have learned asymptotically tight bound means that it is bound from above and below as in theta notation.
But what does asymptotically tight upper bound mean for Big-O notation?</p>
 | habedi/stack-exchange-dataset |
19,146 | What would be a decent threshold for classification problem? | <p>I'm using machine-learning algorithms to solve binary classification problem (i.e. classification can be 'good' or 'bad'). I'm using <code>SVM</code> based algorithms, <code>LibLinear</code> in particular. When I get a classification result, sometimes, the probability estimations over the result are pretty low. For ... | machine learning probabilistic algorithms statistics classification | 1 | What would be a decent threshold for classification problem? -- (machine learning probabilistic algorithms statistics classification)
<p>I'm using machine-learning algorithms to solve binary classification problem (i.e. classification can be 'good' or 'bad'). I'm using <code>SVM</code> based algorithms, <code>LibLinear... | habedi/stack-exchange-dataset |
19,151 | Is the complement of { ww | ... } context-free? | <p>Define the language $L$ as $L = \{a, b\}^* - \{ww\mid w \in \{a, b\}^*\}$. In other words, $L$ contains the words that cannot be expressed as some word repeated twice. Is $L$ context-free or not?</p>

<p>I've tried to intersect $L$ with $a^*b^*a^*b^*$, but I still can't prove anything. I also looked at Par... | formal languages context free formal grammars | 1 | Is the complement of { ww | ... } context-free? -- (formal languages context free formal grammars)
<p>Define the language $L$ as $L = \{a, b\}^* - \{ww\mid w \in \{a, b\}^*\}$. In other words, $L$ contains the words that cannot be expressed as some word repeated twice. Is $L$ context-free or not?</p>

<p>I've... | habedi/stack-exchange-dataset |
19,152 | No number is equal to Zero, is this statement true or false? | <p>While reading an <a href="http://lesswrong.com/lw/93q/completeness_incompleteness_and_what_it_all_means/" rel="nofollow">article</a> on logic, there is a sentence "No number is equal to zero" and we have to assign truth values to this sentence. I hope this is true and the article says it as false. </p>

<p>C... | logic first order logic | 1 | No number is equal to Zero, is this statement true or false? -- (logic first order logic)
<p>While reading an <a href="http://lesswrong.com/lw/93q/completeness_incompleteness_and_what_it_all_means/" rel="nofollow">article</a> on logic, there is a sentence "No number is equal to zero" and we have to assign truth values ... | habedi/stack-exchange-dataset |
19,159 | Pumping lemma for {w | w = ddd} | <p>I want to use the pumping lemma to show that the following language is not context free:
$$
 L = \{w \in \{a,b\}^* \mid \exists d \in \{a,b\}^*, w=ddd \}
$$</p>

<p>We suppose that $L$ is context-free. Then from the pumping lemma there is a pumping length $p$. Which word $s$ do I have to use, th... | context free pumping lemma | 1 | Pumping lemma for {w | w = ddd} -- (context free pumping lemma)
<p>I want to use the pumping lemma to show that the following language is not context free:
$$
 L = \{w \in \{a,b\}^* \mid \exists d \in \{a,b\}^*, w=ddd \}
$$</p>

<p>We suppose that $L$ is context-free. Then from the pumping lemma th... | habedi/stack-exchange-dataset |
19,160 | graph isomorphism completeness of class X and not-X | <p>there are many classes of graphs proved <a href="http://en.wikipedia.org/wiki/Graph_isomorphism_problem#GI-complete_and_GI-hard_problems" rel="nofollow noreferrer">GI complete</a> & many questions related to GI on tcs.se eg [1] & many others.</p>

<blockquote>
 <p>suppose a class both $X$ and no... | graphs graph isomorphism | 1 | graph isomorphism completeness of class X and not-X -- (graphs graph isomorphism)
<p>there are many classes of graphs proved <a href="http://en.wikipedia.org/wiki/Graph_isomorphism_problem#GI-complete_and_GI-hard_problems" rel="nofollow noreferrer">GI complete</a> & many questions related to GI on tcs.se eg [1] &am... | habedi/stack-exchange-dataset |
19,170 | The theoretical upper bounds for duplicate detection in a set of objects? | <p>I recently had a lengthy exchange with someone about the most efficient way to remove duplicates from a collection. The debate was mostly centered around the specific behavior of C# collections, such as HashSet(T) and HashTable(T).</p>

<p>I think we agreed on the fundamentals, but where we couldn’t come to... | hash tables performance | 1 | The theoretical upper bounds for duplicate detection in a set of objects? -- (hash tables performance)
<p>I recently had a lengthy exchange with someone about the most efficient way to remove duplicates from a collection. The debate was mostly centered around the specific behavior of C# collections, such as HashSet(T)... | habedi/stack-exchange-dataset |
19,171 | Decidability of $\lbrace \langle D \rangle \mid \text{$D$ accepts $a^kb^k$ for some $k > 0$}\rbrace$ | <p>I'm trying to understand decidable languages. In particular, I would like to show that
$$B = \lbrace \langle D \rangle \mid \exists k \geq 0 \,.\,\text{DFA $D$ accepts $a^k b^k$}\rangle.$$
I don't quite understand the process of proving these. I know that $a^kb^k$ is not regular, so then no DFA accepts it. I... | computability finite automata | 1 | Decidability of $\lbrace \langle D \rangle \mid \text{$D$ accepts $a^kb^k$ for some $k > 0$}\rbrace$ -- (computability finite automata)
<p>I'm trying to understand decidable languages. In particular, I would like to show that
$$B = \lbrace \langle D \rangle \mid \exists k \geq 0 \,.\,\text{DFA $D$ accepts $a^k b^k$... | habedi/stack-exchange-dataset |
19,175 | Naive Bayes Intuition | <p>I have some difficulties in understanding the intuition behind Naive Bayes Classification.</p>

<p>In general, I do understand every argument of the definition, however I don't understand why it's correct and why any other argument is incorrect.</p>

<p>Start from the beginning:</p>

<p><stro... | machine learning probability theory | 1 | Naive Bayes Intuition -- (machine learning probability theory)
<p>I have some difficulties in understanding the intuition behind Naive Bayes Classification.</p>

<p>In general, I do understand every argument of the definition, however I don't understand why it's correct and why any other argument is incorrect.<... | habedi/stack-exchange-dataset |
19,178 | Can this CFG be written into an equivalent LL(1) grammar? | <p>I have the following CFG which I suspect cannot be rewritten to one which is LL(1):</p>

<p>$S \rightarrow \epsilon\ |\ aSbS\ |\ bSaS\ |\ cSdS\ |\ dScS$</p>

<p>I've thought about it for a while, and can't seem to make any progress. I know that <a href="https://stackoverflow.com/questions/15161636/ma... | formal languages context free formal grammars parsing | 1 | Can this CFG be written into an equivalent LL(1) grammar? -- (formal languages context free formal grammars parsing)
<p>I have the following CFG which I suspect cannot be rewritten to one which is LL(1):</p>

<p>$S \rightarrow \epsilon\ |\ aSbS\ |\ bSaS\ |\ cSdS\ |\ dScS$</p>

<p>I've thought about it f... | habedi/stack-exchange-dataset |
19,187 | Would adding recursive named functions to Simply typed lambda calculus make it Turing complete? | <p>Say I have Simply typed lambda calculus, and add an assignment rule:</p>

<pre><code><identifier> : <type> = <abstraction>
</code></pre>

<p>Where <code><identifier></code> is the name of the function, <code><type></code> is the function type and <code><abstractio... | lambda calculus recursion type theory turing completeness typing | 1 | Would adding recursive named functions to Simply typed lambda calculus make it Turing complete? -- (lambda calculus recursion type theory turing completeness typing)
<p>Say I have Simply typed lambda calculus, and add an assignment rule:</p>

<pre><code><identifier> : <type> = <abstraction>&#x... | habedi/stack-exchange-dataset |
19,192 | How to evaluate the accuracy of a method for the extraction of the principal lines of the palmprint | <p>Let's assume that I've implemented a method for the extraction of the principal lines of the palmprint. For instance, let's say that I'm able to do a transformation like the following one (image from <a href="http://kst.buu.ac.th/proceedings/KST2010/docs/en08.pdf" rel="nofollow noreferrer">Patprapa Tunkpien, Sasipa ... | algorithms algorithm analysis image processing | 1 | How to evaluate the accuracy of a method for the extraction of the principal lines of the palmprint -- (algorithms algorithm analysis image processing)
<p>Let's assume that I've implemented a method for the extraction of the principal lines of the palmprint. For instance, let's say that I'm able to do a transformation ... | habedi/stack-exchange-dataset |
19,194 | Why do they say `A, B, C, ... implies M` instead of `A∧B∧ C∧ ... implies M`? | <p>The conclusion follows from all the premises. It seems to me that this means that conclusion from the conjuntion of the premises. Right? Why does logic uses comma instead?</p>
 | logic | 1 | Why do they say `A, B, C, ... implies M` instead of `A∧B∧ C∧ ... implies M`? -- (logic)
<p>The conclusion follows from all the premises. It seems to me that this means that conclusion from the conjuntion of the premises. Right? Why does logic uses comma instead?</p>
 | habedi/stack-exchange-dataset |
19,205 | A doubt in Ladner's Proof | <p>I got stuck in Ladner's Proof while reading "Computational Complexity: A Modern Approach" by Sanjeev Arora and Boaz Barak. Pardon me if I'm missing something really obvious here but the authors do the following:</p>

<p>For every function $H\colon\mathbb{N}\to\mathbb{N}$ define</p>

<p>$$SAT_H=\{\psi... | complexity theory | 1 | A doubt in Ladner's Proof -- (complexity theory)
<p>I got stuck in Ladner's Proof while reading "Computational Complexity: A Modern Approach" by Sanjeev Arora and Boaz Barak. Pardon me if I'm missing something really obvious here but the authors do the following:</p>

<p>For every function $H\colon\mathbb{N}\to... | habedi/stack-exchange-dataset |
19,207 | Find least probable path in graph | <p>I am working on a special case of the longest path problem. For a cyclic directed graph $G=(V, E)$, where the edge-weights are probability values (i.e., $P(\_) = w(s, q)$ with $s,q \in V$), my aim is to find the least 'probable' path between two vertices. </p>

<p>My initial approach is to generate an graph ... | algorithms graphs shortest path | 1 | Find least probable path in graph -- (algorithms graphs shortest path)
<p>I am working on a special case of the longest path problem. For a cyclic directed graph $G=(V, E)$, where the edge-weights are probability values (i.e., $P(\_) = w(s, q)$ with $s,q \in V$), my aim is to find the least 'probable' path between two ... | habedi/stack-exchange-dataset |
19,220 | Class P is closed under rotation? | <p>Is the complexity class $P$ closed under rotation, where rotation is defined as $\text{rot}(L) = \{ wv \mid vw \in L \}$? How would we prove it?</p>
 | complexity theory | 1 | Class P is closed under rotation? -- (complexity theory)
<p>Is the complexity class $P$ closed under rotation, where rotation is defined as $\text{rot}(L) = \{ wv \mid vw \in L \}$? How would we prove it?</p>
 | habedi/stack-exchange-dataset |
19,221 | Finding minimum spanning tree with O(|V|) | <p>Given an undirected weighted graph $G(V,E)$, where the number of edges is $|V|+10$, how can I find the minimum spanning tree of $G$ in $O(|V|)$?</p>

<p>Kruskal's algorithm is out of the question, since sorting alone is $O(|V|\log |V|)$, so I thought maybe using Prim's algorithm with minimum binary heap, but... | graphs | 1 | Finding minimum spanning tree with O(|V|) -- (graphs)
<p>Given an undirected weighted graph $G(V,E)$, where the number of edges is $|V|+10$, how can I find the minimum spanning tree of $G$ in $O(|V|)$?</p>

<p>Kruskal's algorithm is out of the question, since sorting alone is $O(|V|\log |V|)$, so I thought mayb... | habedi/stack-exchange-dataset |
19,222 | Finding squares touching points | <p>I am looking for an algorithm to solve the following problem:</p>

<p>INPUT: a set of $n$ points in the plane, $(x_1,y_1),...,(x_n,y_n)$.</p>

<p>OUTPUT: a set of $n-1$ axis-parallel interior-disjoint squares, such that the boundary of each square contains at least two points. (*)</p>

<p>Her... | algorithms computational geometry | 1 | Finding squares touching points -- (algorithms computational geometry)
<p>I am looking for an algorithm to solve the following problem:</p>

<p>INPUT: a set of $n$ points in the plane, $(x_1,y_1),...,(x_n,y_n)$.</p>

<p>OUTPUT: a set of $n-1$ axis-parallel interior-disjoint squares, such that the bounda... | habedi/stack-exchange-dataset |
19,228 | NP-hard proof: Polynomial time reduction | <p>As I understand, to show that a certain problem <span class="math-container">$P$</span> is NP-hard we can reduce a known NP-hard problem <span class="math-container">$Q$</span> to a problem in <span class="math-container">$P$</span>. This reduction, say <span class="math-container">$f$</span>, has to be polynomial t... | complexity theory | 1 | NP-hard proof: Polynomial time reduction -- (complexity theory)
<p>As I understand, to show that a certain problem <span class="math-container">$P$</span> is NP-hard we can reduce a known NP-hard problem <span class="math-container">$Q$</span> to a problem in <span class="math-container">$P$</span>. This reduction, say... | habedi/stack-exchange-dataset |
19,230 | Are self-stabilizing algorithms guaranteed to work in parallel? | <p>Self-stabilizing algorithms are extremely useful in distributed systems,
 but can the algorithm be applied concurrently to each computational node?</p>

<p>My instinct is to say yes, but I can't help but imagine a 'Game Of Life' scenario
 where the state of the graph toggles between two states.
... | algorithms parallel computing | 1 | Are self-stabilizing algorithms guaranteed to work in parallel? -- (algorithms parallel computing)
<p>Self-stabilizing algorithms are extremely useful in distributed systems,
 but can the algorithm be applied concurrently to each computational node?</p>

<p>My instinct is to say yes, but I can't help but i... | habedi/stack-exchange-dataset |
19,231 | Is the halting problem specific to Turing machines? | <p>The proofs that the halting problem is undecidable seem to make very few assumptions about the kind of program/machine under consideration: just that the programs take one input and either loop or produce an output. Not just Turing machines have these characteristics: for example, a linear-bounded automaton can also... | turing machines halting problem | 1 | Is the halting problem specific to Turing machines? -- (turing machines halting problem)
<p>The proofs that the halting problem is undecidable seem to make very few assumptions about the kind of program/machine under consideration: just that the programs take one input and either loop or produce an output. Not just Tur... | habedi/stack-exchange-dataset |
19,235 | In case of program overlays; is it necessary to have error handling routine in memory, regardless of error? | <p>I came accross the question regarding program overlays, 
<br><br>
<code>Program1 is of 100kB and program2 is of 90kB and common code is 10kB and overlay driver is 20kB and error handling routine is 50kB, min memory required when there is no error?</code></p>

<p>according to me it should be 100 + 20 ... | operating systems memory management virtual memory memory allocation | 1 | In case of program overlays; is it necessary to have error handling routine in memory, regardless of error? -- (operating systems memory management virtual memory memory allocation)
<p>I came accross the question regarding program overlays, 
<br><br>
<code>Program1 is of 100kB and program2 is of 90kB and common... | habedi/stack-exchange-dataset |
19,237 | Finding edges with minimal weight sum, such that every simple cycle contain at least one edge | <p>Given simple, udirected and connected graph with $n$ verticies. Every edge in this graph has some weight. I have to find (in polynomial time) a set of edges such that : </p>

<p>1.every simple cycle in graph contains at least one edge from this set<br>
2.sum of weights of these edges is the least possib... | algorithms graphs | 1 | Finding edges with minimal weight sum, such that every simple cycle contain at least one edge -- (algorithms graphs)
<p>Given simple, udirected and connected graph with $n$ verticies. Every edge in this graph has some weight. I have to find (in polynomial time) a set of edges such that : </p>

<p>1.every simpl... | habedi/stack-exchange-dataset |
19,239 | Satisfying condition to be in minimum spanning tree of an edge (maximum weight) | <p>Let G be a weighted undirected graph and e be an edge with maximum weight in G.Suppose there is a minimum weight spanning tree in G containing the edge e.Which of the following statements is always TRUE?</p>

<p>1.There exists a cut in g having all edges if maximum weight</p>

<p>2.There exists a cyc... | algorithms graphs trees spanning trees | 1 | Satisfying condition to be in minimum spanning tree of an edge (maximum weight) -- (algorithms graphs trees spanning trees)
<p>Let G be a weighted undirected graph and e be an edge with maximum weight in G.Suppose there is a minimum weight spanning tree in G containing the edge e.Which of the following statements is al... | habedi/stack-exchange-dataset |
19,258 | Can't under stand change of variable | <p>T (n) = T(√n) + 1
The easy way to do this is with a change of variables. Let m = lg n and
S(m) = T (2^m).</p>

<p>T(2^m) = T (2^(m/2)) + 1</p>

<p>S(m) = S(m/2) + 1</p>

<p>Can any one explain why 1 and 2 are same and this works ??</p>
 | algorithms algorithm analysis | 1 | Can't under stand change of variable -- (algorithms algorithm analysis)
<p>T (n) = T(√n) + 1
The easy way to do this is with a change of variables. Let m = lg n and
S(m) = T (2^m).</p>

<p>T(2^m) = T (2^(m/2)) + 1</p>

<p>S(m) = S(m/2) + 1</p>

<p>Can any one explain why 1 and 2 are same... | habedi/stack-exchange-dataset |
19,263 | Reduction from max-cut to min-cut | <p>Algorithms for the finding of an MST in a graph can be applied for both maximum and minimum spanning trees.</p>

<p>It is well known, however, that the finding of a max-cut in a graph is an NP-hard problem while the min-cut problem can be easily solved in polynomial time.</p>

<p>Why aren't the two e... | complexity theory graphs np complete | 1 | Reduction from max-cut to min-cut -- (complexity theory graphs np complete)
<p>Algorithms for the finding of an MST in a graph can be applied for both maximum and minimum spanning trees.</p>

<p>It is well known, however, that the finding of a max-cut in a graph is an NP-hard problem while the min-cut problem c... | habedi/stack-exchange-dataset |
19,266 | Examples of context-free languages with a non-context-free complements | <p>Context-free languages are not closed under complementation. In the lectures we have been given the same argument as <a href="https://en.wikipedia.org/wiki/Context_free_language#Nonclosure_under_intersection_and_complement" rel="nofollow noreferrer">here on Wikipedia</a>: For
<span class="math-container">$$A = \... | formal languages context free | 1 | Examples of context-free languages with a non-context-free complements -- (formal languages context free)
<p>Context-free languages are not closed under complementation. In the lectures we have been given the same argument as <a href="https://en.wikipedia.org/wiki/Context_free_language#Nonclosure_under_intersection_and... | habedi/stack-exchange-dataset |
19,271 | Hardness proof of EVEN-ODD PARTITION | <p>The PARTITION problem is NP-complete:</p>

<p>INSTANCE: finite set $A$ and a size $s(a) \in \mathbb{Z}^+$ for each $a \in A$<br>
QUESTION: Is there a subset $A' \subseteq A$ such that $\sum_{a \in A'} s(a) = \sum_{a \in A \setminus A'} s(a)$ </p>

<p>The problem remains NP-complete even if the el... | np complete reference request partitions | 1 | Hardness proof of EVEN-ODD PARTITION -- (np complete reference request partitions)
<p>The PARTITION problem is NP-complete:</p>

<p>INSTANCE: finite set $A$ and a size $s(a) \in \mathbb{Z}^+$ for each $a \in A$<br>
QUESTION: Is there a subset $A' \subseteq A$ such that $\sum_{a \in A'} s(a) = \sum_{a \in A ... | habedi/stack-exchange-dataset |
19,275 | Number of Matchings in a Bipartite | <p>Given two sets A and B of sizes |A| = n and |B| = m, where m >= n.
There are edges from set A to set B.
I need to find the <code>number</code> of matchings where all of vertices in set A have been matched with one vertex in set B.
Is it possible to caclulate this quantity ?</p>

<p>(I have very l... | graphs combinatorics bipartite matching matching | 1 | Number of Matchings in a Bipartite -- (graphs combinatorics bipartite matching matching)
<p>Given two sets A and B of sizes |A| = n and |B| = m, where m >= n.
There are edges from set A to set B.
I need to find the <code>number</code> of matchings where all of vertices in set A have been matched with one vertex... | habedi/stack-exchange-dataset |
19,277 | optimal placement of fixed length items on a given length | <p>I have got some equipment of standard lengths, say: </p>

<blockquote>
 <p>equipment_lengths = {60, 48, 36, 29}</p>
</blockquote>

<p>that I have to place on a given length of, say 100. I have to place this equipment so as to minimize material waste while covering the given length. I am allo... | algorithms optimization | 1 | optimal placement of fixed length items on a given length -- (algorithms optimization)
<p>I have got some equipment of standard lengths, say: </p>

<blockquote>
 <p>equipment_lengths = {60, 48, 36, 29}</p>
</blockquote>

<p>that I have to place on a given length of, say 100. I have to place thi... | habedi/stack-exchange-dataset |
19,281 | Partition a bipartite graph to a complete matching and an independent set | <p>I am looking for a reference for the following theorem:</p>

<p>Let $G$ be a bipartite graph with partitions $X$ and $Y$, each with the same number of vertices ($n$).</p>

<p>There is a nonempty subset $Y_1 \subseteq Y$, and a partition of $X$ to disjoint subsets $X_1$ and $X_2$, such that:</p>
&... | graphs reference request | 1 | Partition a bipartite graph to a complete matching and an independent set -- (graphs reference request)
<p>I am looking for a reference for the following theorem:</p>

<p>Let $G$ be a bipartite graph with partitions $X$ and $Y$, each with the same number of vertices ($n$).</p>

<p>There is a nonempty su... | habedi/stack-exchange-dataset |
19,288 | Number of ways to fill a 2xN grid with M colors | <p>This question was asked in the onsite regionals for ACM ICPC 2013 at Amritapuri.
In short, the question asked to find the number of ways to fill a $ 2\times N$ grid with $M$ colors such that no two cells with the same row or same column have the same color.</p>

<p>The limits given are $1 \leq N$, and $M... | graphs combinatorics permutations bipartite matching | 1 | Number of ways to fill a 2xN grid with M colors -- (graphs combinatorics permutations bipartite matching)
<p>This question was asked in the onsite regionals for ACM ICPC 2013 at Amritapuri.
In short, the question asked to find the number of ways to fill a $ 2\times N$ grid with $M$ colors such that no two cells wit... | habedi/stack-exchange-dataset |
19,297 | Is Equational Reasoning an application of Referential Transparency? | <p>In various discussions of the merits of functional programming, the phrase <a href="http://en.wikipedia.org/wiki/Referential_transparency_%28computer_science%29" rel="noreferrer">referential transparency</a> or <a href="http://www.haskellforall.com/2013/12/equational-reasoning.html" rel="noreferrer">equational reaso... | functional programming | 1 | Is Equational Reasoning an application of Referential Transparency? -- (functional programming)
<p>In various discussions of the merits of functional programming, the phrase <a href="http://en.wikipedia.org/wiki/Referential_transparency_%28computer_science%29" rel="noreferrer">referential transparency</a> or <a href="h... | habedi/stack-exchange-dataset |
19,299 | Partition points in a plane with a straigth line | <p>Given are a 2D plane and a array of points in this plane, with every point having an integer value assigned.</p>

<p>Is there an algorithm which, when given a ratio a/b, divides the plane with a straight line, so that the values of the points are distributed as close as possible to the given ratio? </p>
... | algorithms computational geometry partitions | 1 | Partition points in a plane with a straigth line -- (algorithms computational geometry partitions)
<p>Given are a 2D plane and a array of points in this plane, with every point having an integer value assigned.</p>

<p>Is there an algorithm which, when given a ratio a/b, divides the plane with a straight line, ... | habedi/stack-exchange-dataset |
19,306 | Minimal Spanning tree and Prim's Algorithm | <p>Is there any example that anybody could come up with that shows Prim's algorithm does not always give the correct result when it comes knowing the minimal spanning tree.</p>
 | algorithms greedy algorithms spanning trees | 1 | Minimal Spanning tree and Prim's Algorithm -- (algorithms greedy algorithms spanning trees)
<p>Is there any example that anybody could come up with that shows Prim's algorithm does not always give the correct result when it comes knowing the minimal spanning tree.</p>
 | habedi/stack-exchange-dataset |
19,318 | Solution to recurrence $T(n) = T(n/2) + n^2$ | <p>I am getting confused with the solution to this recurrence - 
$T(n) = T(n/2) + n^2$</p>

<p>Recursion tree - </p>

<pre><code>T(n) Height lg n + 1
 |
T(n/2)
 |
T(n/4)
</code></pre>

<p>So it turns out to be -</p>

<p>$T(n) = n^2(1 + 1/4 + (... | recurrence relation recursion master theorem | 1 | Solution to recurrence $T(n) = T(n/2) + n^2$ -- (recurrence relation recursion master theorem)
<p>I am getting confused with the solution to this recurrence - 
$T(n) = T(n/2) + n^2$</p>

<p>Recursion tree - </p>

<pre><code>T(n) Height lg n + 1
 |
T(n/2)
 |
T(n/4... | habedi/stack-exchange-dataset |
19,329 | Undecidable unary languages (also known as Tally languages) | <p>An exercise that was in a past session is the following:</p>

<blockquote>
 <p>Prove that there exists an undecidable subset of $\{1\}^*$</p>
</blockquote>

<p>This exercise looks very strange to me, because I think that all subsets are decidable.</p>

<p>Is there a topic that I shou... | reference request turing machines undecidability | 1 | Undecidable unary languages (also known as Tally languages) -- (reference request turing machines undecidability)
<p>An exercise that was in a past session is the following:</p>

<blockquote>
 <p>Prove that there exists an undecidable subset of $\{1\}^*$</p>
</blockquote>

<p>This exercise look... | habedi/stack-exchange-dataset |
19,342 | Any way to optimize this with subset caching? | <p>I have some algorithm and I wonder whether there is a way to optimize it beyond the naive approach.</p>

<p>Basically I have time steps and the current time is $t_c$. At any given time step, a couple of "ranges" are active from now up to some given time $t_i$ (i.e. $\forall t\leq t_i: r_i\in R(t)$).</p>
... | algorithms | 1 | Any way to optimize this with subset caching? -- (algorithms)
<p>I have some algorithm and I wonder whether there is a way to optimize it beyond the naive approach.</p>

<p>Basically I have time steps and the current time is $t_c$. At any given time step, a couple of "ranges" are active from now up to some give... | habedi/stack-exchange-dataset |
19,343 | CLRS 4.4-3 Height of recursion tree for T(N) = 4T(n/2 +2) + n | <p>I'm having a hard time with the following question:</p>

<p>Use a recursion tree to determine a good asymptotic upper bound on the recurrence $T(n) = 4T(n/2 + 2) + n$. Use the substitution method to verify your answer.</p>

<p>This is not homework, I'm just practicing myself for an upcoming exam.</p>... | algorithm analysis recursion | 1 | CLRS 4.4-3 Height of recursion tree for T(N) = 4T(n/2 +2) + n -- (algorithm analysis recursion)
<p>I'm having a hard time with the following question:</p>

<p>Use a recursion tree to determine a good asymptotic upper bound on the recurrence $T(n) = 4T(n/2 + 2) + n$. Use the substitution method to verify your an... | habedi/stack-exchange-dataset |
19,344 | SVM math question | <p>I'm studying support vector machines and came across <a href="http://www.tristanfletcher.co.uk/SVM%20Explained.pdf" rel="nofollow">this paper</a>. The following equation doesn't make sense to me, especially the part with the 0 ∀i. Any help understanding the basics of SVMs?</p>

<p>yi * (xi * w + b) - 1 >= 0 ... | machine learning | 1 | SVM math question -- (machine learning)
<p>I'm studying support vector machines and came across <a href="http://www.tristanfletcher.co.uk/SVM%20Explained.pdf" rel="nofollow">this paper</a>. The following equation doesn't make sense to me, especially the part with the 0 ∀i. Any help understanding the basics of SVMs?</p>... | habedi/stack-exchange-dataset |
19,349 | defining the operational semantics of a concurrent language | <p>As big-step operational semantics is about evaluating an expression to a final value, can we state that for defining a concurrent language one needs small-step semantics, as concurrent programs need not result in a value?</p>
 | concurrency operational semantics | 1 | defining the operational semantics of a concurrent language -- (concurrency operational semantics)
<p>As big-step operational semantics is about evaluating an expression to a final value, can we state that for defining a concurrent language one needs small-step semantics, as concurrent programs need not result in a val... | habedi/stack-exchange-dataset |
19,352 | Simply Typed Combinatory Logic? | <p>As there is an untyped lambda calculus, and a simply-typed lambda calculus (as described, for example, in Benjamin Pierce's book Types and Programming Languages), is there a simply-typed combinatory logic?</p>

<p>For example, it would seem that natural types for the combinators S, K, and I would be</p>
... | logic lambda calculus functional programming combinatory logic | 1 | Simply Typed Combinatory Logic? -- (logic lambda calculus functional programming combinatory logic)
<p>As there is an untyped lambda calculus, and a simply-typed lambda calculus (as described, for example, in Benjamin Pierce's book Types and Programming Languages), is there a simply-typed combinatory logic?</p>
&#x... | habedi/stack-exchange-dataset |
19,355 | Enhancing this turing machine's runtime | <p>As in, I have to design a determenistic (one-taped) turing machine that accepts that language (All strings made up of 0 and 1, where the j-th character from the end is a 0, and $j$ is a constant that we know what it is before running the machine) in less steps than the trivial steps. </p>

<p>In the trivial ... | turing machines | 1 | Enhancing this turing machine's runtime -- (turing machines)
<p>As in, I have to design a determenistic (one-taped) turing machine that accepts that language (All strings made up of 0 and 1, where the j-th character from the end is a 0, and $j$ is a constant that we know what it is before running the machine) in less s... | habedi/stack-exchange-dataset |
19,367 | $\Omega(\sqrt[3]{n})$ lower bound on random-access memory? | <p>Here is a perhaps naive question that has been tingling me: Is there an $\Omega(\sqrt[3]{n})$ asymptotic lower bound for addressing arbitrarily large memory randomly? My cause of belief is that the shortest path to any memory stored physically must be through three-dimensional space, and the diagonal here must have ... | algorithms | 1 | $\Omega(\sqrt[3]{n})$ lower bound on random-access memory? -- (algorithms)
<p>Here is a perhaps naive question that has been tingling me: Is there an $\Omega(\sqrt[3]{n})$ asymptotic lower bound for addressing arbitrarily large memory randomly? My cause of belief is that the shortest path to any memory stored physicall... | habedi/stack-exchange-dataset |
19,372 | How to express Rob Pike's classic Go Code presentation in Hoare's CSP Algebra? | <p>At 15:30 in <a href="http://www.infoq.com/presentations/clojure-core-async" rel="nofollow">this talk</a> (p13 of <a href="http://qconsf.com/system/files/presentation-slides/Clojure.pdf" rel="nofollow">this presentation here</a>) Rich Hickey mentions the formalisms available for reasoning about Communicating Sequent... | concurrency process algebras threads | 1 | How to express Rob Pike's classic Go Code presentation in Hoare's CSP Algebra? -- (concurrency process algebras threads)
<p>At 15:30 in <a href="http://www.infoq.com/presentations/clojure-core-async" rel="nofollow">this talk</a> (p13 of <a href="http://qconsf.com/system/files/presentation-slides/Clojure.pdf" rel="nofo... | habedi/stack-exchange-dataset |
19,373 | If a problem is PSPACE-complete what do we know about NL-completeness | <p>I have a problem $A$ which was shown to be PSPACE-complete by reduction from planning. 
However, $A$ can also be transformed into reachability problem which is NL-complete. </p>

<p>I know that $NL=NSPACE(log \ n)$ and $PSPACE=NSPACE$. </p>

<p>Does this mean $A$ is also NL-complete? IF yes, doe... | complexity theory space complexity | 1 | If a problem is PSPACE-complete what do we know about NL-completeness -- (complexity theory space complexity)
<p>I have a problem $A$ which was shown to be PSPACE-complete by reduction from planning. 
However, $A$ can also be transformed into reachability problem which is NL-complete. </p>

<p>I know that $... | habedi/stack-exchange-dataset |
19,378 | Is 0-1 integer linear programming NP-hard when $c^T$ is the all-ones vector? | <p><a href="http://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems" rel="nofollow">Karp's 21 NP-complete problems</a> show that 0-1 integer linear programming is NP-hard. That is, an integer linear program with binary variables.</p>

<p>If we set the $c^T$ vector of the objective $\text {maximize } c^Tx$... | complexity theory np hard linear programming | 1 | Is 0-1 integer linear programming NP-hard when $c^T$ is the all-ones vector? -- (complexity theory np hard linear programming)
<p><a href="http://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems" rel="nofollow">Karp's 21 NP-complete problems</a> show that 0-1 integer linear programming is NP-hard. That is, an int... | habedi/stack-exchange-dataset |
19,388 | Computation Tree Logic and its Temporal Opeators | <p>I've got some questions about the <a href="http://en.wikipedia.org/wiki/Computation_tree_logic#Temporal_operators" rel="nofollow noreferrer">temporal operators</a> in computation tree logic:</p>

<ol>
<li>Does the <strong>F</strong><code>inally</code> path-specific quantifier <code>Fq</code> mean that <c... | logic temporal logic | 1 | Computation Tree Logic and its Temporal Opeators -- (logic temporal logic)
<p>I've got some questions about the <a href="http://en.wikipedia.org/wiki/Computation_tree_logic#Temporal_operators" rel="nofollow noreferrer">temporal operators</a> in computation tree logic:</p>

<ol>
<li>Does the <strong>F</stron... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.