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 |
|---|---|---|---|---|---|---|
23,565 | How do you describe a language that is generated by Context Free Grammer | <p>I am familiar with describing Regular Expressions but when it comes to describing CFG I get confused. Do you describe it in words like you would regular expressions or do you do something like this ?</p>

<p>this is the CFG I am trying to describe</p>

<pre><code>S -> SS 
S -> XXX 
X -&... | context free | 1 | How do you describe a language that is generated by Context Free Grammer -- (context free)
<p>I am familiar with describing Regular Expressions but when it comes to describing CFG I get confused. Do you describe it in words like you would regular expressions or do you do something like this ?</p>

<p>this is th... | habedi/stack-exchange-dataset |
23,575 | Construct a digraph given its in-degree and out-degree distribution | <p>Could anyone help me with this algorithmic problem:</p>

<p>Given the in and out degrees of a set of vertices, is it possible to determine if there exist a valid graph respecting this constraint? The graph can allow self loops but not parallel edges.</p>

<p>Here's an example: </p>

<pre><cod... | algorithms graphs | 1 | Construct a digraph given its in-degree and out-degree distribution -- (algorithms graphs)
<p>Could anyone help me with this algorithmic problem:</p>

<p>Given the in and out degrees of a set of vertices, is it possible to determine if there exist a valid graph respecting this constraint? The graph can allow se... | habedi/stack-exchange-dataset |
23,582 | How to optimally seperate a student body? | <p>Students will identify certain students they want to work with. I have therefore decided to split them into two groups where I want to minimize the number of people in Group 1 who want to work with students from Group 2. </p>

<p>I was thinking about creating a source node <em>s</em>, and creating a node for... | algorithms optimization polynomial time bipartite matching | 1 | How to optimally seperate a student body? -- (algorithms optimization polynomial time bipartite matching)
<p>Students will identify certain students they want to work with. I have therefore decided to split them into two groups where I want to minimize the number of people in Group 1 who want to work with students from... | habedi/stack-exchange-dataset |
23,588 | Can we move quantifiers to the left in predicate logic? | <p>Say I have part of a query in the form: ∃x<sub>a</sub>(...)∧∃x<sub>b</sub>(...)∧∃x<sub>c</sub>(...), where a, b, and c are attributes and the ellipses can be anything (I'm looking for a general rule). Is this equivalent to saying ∃x<sub>a</sub>,x<sub>b</sub>,x<sub>c</sub>(...∧...∧...) - i.e. compacting all the exist... | logic first order logic normal forms | 1 | Can we move quantifiers to the left in predicate logic? -- (logic first order logic normal forms)
<p>Say I have part of a query in the form: ∃x<sub>a</sub>(...)∧∃x<sub>b</sub>(...)∧∃x<sub>c</sub>(...), where a, b, and c are attributes and the ellipses can be anything (I'm looking for a general rule). Is this equivalent... | habedi/stack-exchange-dataset |
23,591 | How do people measure performance overhead? | <p>How do people measure performance overhead? Whenever someone is bragging about how their program or application performs better than another, they talk about particular measurements, eg time, performance etc. </p>

<p>Whilst I understand how time to perform a task can be calculated, I cannot understand how p... | algorithms terminology performance | 1 | How do people measure performance overhead? -- (algorithms terminology performance)
<p>How do people measure performance overhead? Whenever someone is bragging about how their program or application performs better than another, they talk about particular measurements, eg time, performance etc. </p>

<p>Whilst ... | habedi/stack-exchange-dataset |
23,607 | Bounding the recurrence $f(n)=2f(n-1)+2f(n/2)$ | <p>I met a recurrence equation for my algorithm 
$$ f(n) = 2\cdot \left( f(n-1) + f(\frac{n}{2}) \right)$$
with $f(1)=1$, $f(2)=4$, $f(3)=10$. </p>

<p>I guess it is $\Theta((2+\epsilon)^n)$, where $\epsilon$ ban be arbitrarily close to 0. 
I want to have an asymptotic formula of $f(n)$. I do not kn... | asymptotics recurrence relation | 1 | Bounding the recurrence $f(n)=2f(n-1)+2f(n/2)$ -- (asymptotics recurrence relation)
<p>I met a recurrence equation for my algorithm 
$$ f(n) = 2\cdot \left( f(n-1) + f(\frac{n}{2}) \right)$$
with $f(1)=1$, $f(2)=4$, $f(3)=10$. </p>

<p>I guess it is $\Theta((2+\epsilon)^n)$, where $\epsilon$ ban be arbi... | habedi/stack-exchange-dataset |
23,615 | How do I mathematically express a set generated using two loop variables within a single for loop? | <p>I don't know the proper mathematical expression for for-loops, especially those that carry two distinctly behaving variables with each iteration.</p>

<p>For example, assuming <code>n</code> is previously defined and holds some positive integer, how I would I represent the set printed by this for-loop in mat... | terminology discrete mathematics sets | 1 | How do I mathematically express a set generated using two loop variables within a single for loop? -- (terminology discrete mathematics sets)
<p>I don't know the proper mathematical expression for for-loops, especially those that carry two distinctly behaving variables with each iteration.</p>

<p>For example, ... | habedi/stack-exchange-dataset |
23,631 | Find a CFG for a language | <p>In an assignment I've been asked to find a CFG for $a^x b^y a^z b^w$, where, $x,y,z,w \in \mathbb{N}^+$, $y > x$, $z > w$, and $x+z = y+w$. A hint was given, think of the language as $(a^p b^p)(b^q a^q)(a^r b^r)$.</p>

<p>I've had a go at it, and have come up with </p>

<ul>
<li>S -> A </li... | formal languages context free formal grammars | 1 | Find a CFG for a language -- (formal languages context free formal grammars)
<p>In an assignment I've been asked to find a CFG for $a^x b^y a^z b^w$, where, $x,y,z,w \in \mathbb{N}^+$, $y > x$, $z > w$, and $x+z = y+w$. A hint was given, think of the language as $(a^p b^p)(b^q a^q)(a^r b^r)$.</p>

<p>I've... | habedi/stack-exchange-dataset |
23,634 | What are these special strings called? | <p>Is there any specific name for strings of data that have well defined format ? For example URLS, domain names, IP Addresses, Email addresses, File Paths etc. are all having well defined delimiters and data formats. What are these special strings in general called ? </p>
 | terminology strings | 1 | What are these special strings called? -- (terminology strings)
<p>Is there any specific name for strings of data that have well defined format ? For example URLS, domain names, IP Addresses, Email addresses, File Paths etc. are all having well defined delimiters and data formats. What are these special strings in gene... | habedi/stack-exchange-dataset |
23,636 | kd-tree stores points in inner nodes? If yes, how to search for NN? | <p>The <a href="http://en.wikipedia.org/wiki/K-d_tree" rel="nofollow">link</a> in wikipedia about kd-trees store points in the inner nodes. I have to perform NN queries and I <strong>think</strong> (newbie here), I am understanding the concept.</p>

<p>However, I was said to study Kd-trees from Computational Ge... | data structures computational geometry search algorithms search trees nearest neighbour | 1 | kd-tree stores points in inner nodes? If yes, how to search for NN? -- (data structures computational geometry search algorithms search trees nearest neighbour)
<p>The <a href="http://en.wikipedia.org/wiki/K-d_tree" rel="nofollow">link</a> in wikipedia about kd-trees store points in the inner nodes. I have to perform N... | habedi/stack-exchange-dataset |
23,643 | NP Problem definition – verifiable on DFA vs. solvable on NFA | <p>So in complexity theory, I've run across different definitions for NP problems -- </p>

<ul>
<li>Decision problems where a solution can be <em>verified</em> by a <strong>DFA</strong> in polynomial time</li>
<li>Decision problems where a solution can be <em>found</em> by an <strong>NFA</strong> in pol... | complexity theory np | 1 | NP Problem definition – verifiable on DFA vs. solvable on NFA -- (complexity theory np)
<p>So in complexity theory, I've run across different definitions for NP problems -- </p>

<ul>
<li>Decision problems where a solution can be <em>verified</em> by a <strong>DFA</strong> in polynomial time</li>
<li>De... | habedi/stack-exchange-dataset |
23,646 | Why are the two farthest points vertices of the Convex Hull? | <p>I read that in a 2D space, the two points farthest away must be in the convex hull (CH).</p>

<p>Intuitively, I can see why. If the two farthest points are not in the convex hull, then there must be a point that is outside the convex hull (contradiction). I know that a vertex of CH has two adjacent edges tha... | algorithms computational geometry | 1 | Why are the two farthest points vertices of the Convex Hull? -- (algorithms computational geometry)
<p>I read that in a 2D space, the two points farthest away must be in the convex hull (CH).</p>

<p>Intuitively, I can see why. If the two farthest points are not in the convex hull, then there must be a point th... | habedi/stack-exchange-dataset |
23,654 | Showing that DNF VALID is coNP-hard | <p>I'm trying to understand/show that DNF VALID is coNP-hard. I have given an algorithm for the complement of DNF VALID and shown that this is in NP (since the complement of a language in NP is in coNP), but I'm really struggling to show that DNF VALID is coNP-hard. </p>

<blockquote>
 <p>The complement of... | complexity theory reductions co np | 1 | Showing that DNF VALID is coNP-hard -- (complexity theory reductions co np)
<p>I'm trying to understand/show that DNF VALID is coNP-hard. I have given an algorithm for the complement of DNF VALID and shown that this is in NP (since the complement of a language in NP is in coNP), but I'm really struggling to show that D... | habedi/stack-exchange-dataset |
23,662 | Application of Combinatorics, Logic and computability theory in physical science: Tiling of Wang Tile with proportionality | <p>The original problem of Domino Tiling and Wang Tile has great theoretical interest on computability theory... However, the great emerging problem on application of Wang Tile in material science and physics requires the tiling to satisfy one more condition:</p>

<p>The tiling should satisfy some proportionali... | complexity theory optimization logic satisfiability | 1 | Application of Combinatorics, Logic and computability theory in physical science: Tiling of Wang Tile with proportionality -- (complexity theory optimization logic satisfiability)
<p>The original problem of Domino Tiling and Wang Tile has great theoretical interest on computability theory... However, the great emerging... | habedi/stack-exchange-dataset |
23,669 | How to check ambiguity of a specific grammar | <p>Giving the following Grammar:<br></p>

<pre><code>S → ^ | SaSMSM | SMSaSM | SMSMSa 
M → b | c
</code></pre>

<p><br>
^ means eopsilon.</p>

<p>How can i check whether its ambgious or not?
My intuition is that its not: every time you derive,the a is placed in different place... | formal languages context free formal grammars | 1 | How to check ambiguity of a specific grammar -- (formal languages context free formal grammars)
<p>Giving the following Grammar:<br></p>

<pre><code>S → ^ | SaSMSM | SMSaSM | SMSMSa 
M → b | c
</code></pre>

<p><br>
^ means eopsilon.</p>

<p>How can i check whether its ambgious or... | habedi/stack-exchange-dataset |
23,671 | Possible to connect arbitrary number of dots without intersections? | <p>A (now closed) question on SO made me think about the following problem:</p>

<blockquote>
 <p>Given an arbirtary number of points (2D), draw a path that consists of
 straight lines between points, visits each point exactly once and does
 not intersect with itself.</p>
</blockquote>
&#... | graphs computational geometry | 1 | Possible to connect arbitrary number of dots without intersections? -- (graphs computational geometry)
<p>A (now closed) question on SO made me think about the following problem:</p>

<blockquote>
 <p>Given an arbirtary number of points (2D), draw a path that consists of
 straight lines between points... | habedi/stack-exchange-dataset |
23,673 | EM algorithm for two Gaussian models | <p>This is about basic machine learning which I do not understand clearly.</p>

<p>I have 2 Gaussian models $G_1$ and $G_2$ and given a list of data as below.</p>

<p>(1, 3, 4, 5, 7, 8, 9, 13, 14, 15, 16, 18, 23)</p>

<p>I do not know which numbers were generated by which $G_i$ model, but I want... | algorithms machine learning | 1 | EM algorithm for two Gaussian models -- (algorithms machine learning)
<p>This is about basic machine learning which I do not understand clearly.</p>

<p>I have 2 Gaussian models $G_1$ and $G_2$ and given a list of data as below.</p>

<p>(1, 3, 4, 5, 7, 8, 9, 13, 14, 15, 16, 18, 23)</p>

<p>I do ... | habedi/stack-exchange-dataset |
23,683 | Is summing over all possible $k$-combinations NP-hard? | <p>Say we have a set of numbers $A=\{a_1, a_2, \dots, a_n\}$, and we wish to sum over all possible combinations of $k$ terms to compute</p>

<p>$$
\sum_{\substack{C \subseteq \{1,2,\dots,n\} \\ |C|=k}} \prod_{c \in C} a_c
$$</p>

<p>Naively this requires $O(k\binom{n}{k})$ operations.</p>
&#... | complexity theory time complexity np hard | 1 | Is summing over all possible $k$-combinations NP-hard? -- (complexity theory time complexity np hard)
<p>Say we have a set of numbers $A=\{a_1, a_2, \dots, a_n\}$, and we wish to sum over all possible combinations of $k$ terms to compute</p>

<p>$$
\sum_{\substack{C \subseteq \{1,2,\dots,n\} \\ |C|=k}} \pro... | habedi/stack-exchange-dataset |
23,686 | How to determine if a black-box is polynomial or exponential | <p>I have a problem which essentially reduces to this:</p>

<ol>
<li>You have a black-box function that accepts inputs of length $n$.</li>
<li>You can measure the amount of time the function takes to return the answer, but you can't see exactly how it was calculated.</li>
<li>You have to determine w... | complexity theory time complexity polynomial time statistics | 1 | How to determine if a black-box is polynomial or exponential -- (complexity theory time complexity polynomial time statistics)
<p>I have a problem which essentially reduces to this:</p>

<ol>
<li>You have a black-box function that accepts inputs of length $n$.</li>
<li>You can measure the amount of time... | habedi/stack-exchange-dataset |
23,694 | Are there any steps or rules to draw a DFA? | <p>In my first lecture of "Theory of Automata", after giving some concepts of Alphabet, Language, transition function etc. and a couple of simple automata of an electric circuit with one and two switches, is this question.</p>

<p><img src="https://i.stack.imgur.com/WIYoO.png" alt="enter image description here"... | automata finite automata | 1 | Are there any steps or rules to draw a DFA? -- (automata finite automata)
<p>In my first lecture of "Theory of Automata", after giving some concepts of Alphabet, Language, transition function etc. and a couple of simple automata of an electric circuit with one and two switches, is this question.</p>

<p><img sr... | habedi/stack-exchange-dataset |
23,696 | Which kind of interrupt has the highest priority on 8086 processors? | <p>Which of the following interrupts has the highest priority in 8086 micro-processor:</p>

<ol>
<li>Overflow,</li>
<li>NMI or</li>
<li>Type 255?</li>
</ol>

<p>The book I read suggests that type 255 has highest priority.
But most of the searches on google showed that it is NMI. Whic... | computer architecture | 1 | Which kind of interrupt has the highest priority on 8086 processors? -- (computer architecture)
<p>Which of the following interrupts has the highest priority in 8086 micro-processor:</p>

<ol>
<li>Overflow,</li>
<li>NMI or</li>
<li>Type 255?</li>
</ol>

<p>The book I read suggests that t... | habedi/stack-exchange-dataset |
23,703 | Why is constant always dropped from big O analysis? | <p>Suppose I have an algorithm that has a performance of $O(n + 2)$. Here if n gets really large the 2 becomes insignificant. In this case it's perfectly clear the real performance is $O(n)$.</p>

<p>However, say another algorithm has a performance of $O(n^2/2)$. Here if n gets really large then $n^2/2$ is exac... | terminology algorithm analysis asymptotics landau notation | 1 | Why is constant always dropped from big O analysis? -- (terminology algorithm analysis asymptotics landau notation)
<p>Suppose I have an algorithm that has a performance of $O(n + 2)$. Here if n gets really large the 2 becomes insignificant. In this case it's perfectly clear the real performance is $O(n)$.</p>

... | habedi/stack-exchange-dataset |
23,721 | Why is TIME(n log (log n)) \ TIME(n) = ∅? | <p>In my computation book by Sipser, he says that since every language that can be decided in time $o(n \log n)$ is regular, then that can be used to show $TIME(n \log (\log n))\setminus TIME(n)$ must be the empty set. Can anyone show me why this is?</p>

<p>both $TIME(n\log(\log n))$ and $TIME(n)$ are regular.... | complexity theory regular languages time complexity complexity classes | 1 | Why is TIME(n log (log n)) \ TIME(n) = ∅? -- (complexity theory regular languages time complexity complexity classes)
<p>In my computation book by Sipser, he says that since every language that can be decided in time $o(n \log n)$ is regular, then that can be used to show $TIME(n \log (\log n))\setminus TIME(n)$ must b... | habedi/stack-exchange-dataset |
23,724 | n-Cube as a Cayley Graph | <p>I'm taking a class on graph theory that uses "Graph Theory (Graduate Texts in Mathematics)" by Bondy and Murty. One of the questions is about Cayley graphs and the n-cube, and I don't understand how to interpret it. It runs as follows:</p>

<blockquote>
 <p>Let $\Gamma$ be a group and $S$ be a subset of... | graphs terminology group theory | 1 | n-Cube as a Cayley Graph -- (graphs terminology group theory)
<p>I'm taking a class on graph theory that uses "Graph Theory (Graduate Texts in Mathematics)" by Bondy and Murty. One of the questions is about Cayley graphs and the n-cube, and I don't understand how to interpret it. It runs as follows:</p>

<block... | habedi/stack-exchange-dataset |
23,725 | Mathematical function vs Computer program | <p>In mathematics , an $n$-ary relation is subset of cross product on $n$ sets took under consideration.</p>

<p>Let us take $A_1,A_2,A_3 \cdots A_n$ be the n sets.</p>

<p>Then relation $R \subseteq A_1\times A_2\times A_3 \times A_n$ .</p>

<p>Here $X$ represents cross product betwen two sets.... | terminology computability programming languages functional programming | 1 | Mathematical function vs Computer program -- (terminology computability programming languages functional programming)
<p>In mathematics , an $n$-ary relation is subset of cross product on $n$ sets took under consideration.</p>

<p>Let us take $A_1,A_2,A_3 \cdots A_n$ be the n sets.</p>

<p>Then relation... | habedi/stack-exchange-dataset |
23,731 | What is the asymptotic runtime of the best known TSP solving algorithm? | <p>I always thought that TSP currently requires time exponential in the number of cities to solve.</p>

<blockquote>
 <p>How, then, has <a href="http://www.math.uwaterloo.ca/tsp/concorde.html" rel="nofollow">Concorde</a> optimally solved a TSP instance with
 <strong>85,900 cities</strong>?!?</p>
<... | algorithms np hard traveling salesman | 1 | What is the asymptotic runtime of the best known TSP solving algorithm? -- (algorithms np hard traveling salesman)
<p>I always thought that TSP currently requires time exponential in the number of cities to solve.</p>

<blockquote>
 <p>How, then, has <a href="http://www.math.uwaterloo.ca/tsp/concorde.html"... | habedi/stack-exchange-dataset |
23,740 | Knapsack problem, partition problem, or in general dynamic algorithm with negative numbers allowed | <p>How to think about dynamic algorithms which allows negative integers in input (where it's problematic, because obviously it's not always the case)?</p>

<p>Examples:</p>

<ul>
<li><a href="http://en.wikipedia.org/wiki/Partition_problem" rel="nofollow" title="Partition problem">Partition Problem</... | algorithms dynamic programming | 1 | Knapsack problem, partition problem, or in general dynamic algorithm with negative numbers allowed -- (algorithms dynamic programming)
<p>How to think about dynamic algorithms which allows negative integers in input (where it's problematic, because obviously it's not always the case)?</p>

<p>Examples:</p>
... | habedi/stack-exchange-dataset |
23,748 | Confusion with the Running Time of an algorithm that finds duplicate character | <p>I have the following simple algorithm to find duplicate characters in a string:</p>

<pre><code>for i = 1 -> n
 for j = i + 1 -> n
 if A[i] == A[j] return true
return false 
</code></pre>

<p>Why is the running time of this algorithm $\mathcal{O}(n^2)$?
If the firs... | terminology asymptotics runtime analysis landau notation | 1 | Confusion with the Running Time of an algorithm that finds duplicate character -- (terminology asymptotics runtime analysis landau notation)
<p>I have the following simple algorithm to find duplicate characters in a string:</p>

<pre><code>for i = 1 -> n
 for j = i + 1 -> n
 if A[i] == A... | habedi/stack-exchange-dataset |
23,752 | Branch Prediction - LOCAL BHR without tag | <p>I have a question about the common course "Computer Architecture".</p>

<p>How is it possible to have a LOCAL Branch Predecitor with 1024 entries, 3 bits for HISTORY but without a TAG.</p>

<p>As I understand,in that way i will get a Global branch predictor because i dont have a way to map a branch t... | computer architecture | 1 | Branch Prediction - LOCAL BHR without tag -- (computer architecture)
<p>I have a question about the common course "Computer Architecture".</p>

<p>How is it possible to have a LOCAL Branch Predecitor with 1024 entries, 3 bits for HISTORY but without a TAG.</p>

<p>As I understand,in that way i will get ... | habedi/stack-exchange-dataset |
23,768 | Regular expressions and semi-linear sets | <p>In proving Parikh's Theorem, my Theory of Computer Science textbook defines a linear set as:</p>

<p>$u_0 + \langle u_1, \dots, u_m \rangle = \{u_0 + a_1u_1 + \dots + a_mu_m \mid a_1, \dots, a_m \in \mathbb{N}\}$ where $u_i$ are vectors of natural numbers.</p>

<p>and a semi-linear set as a union of ... | formal languages regular languages regular expressions | 1 | Regular expressions and semi-linear sets -- (formal languages regular languages regular expressions)
<p>In proving Parikh's Theorem, my Theory of Computer Science textbook defines a linear set as:</p>

<p>$u_0 + \langle u_1, \dots, u_m \rangle = \{u_0 + a_1u_1 + \dots + a_mu_m \mid a_1, \dots, a_m \in \mathbb{N... | habedi/stack-exchange-dataset |
23,776 | Is it compulsory that every infinite set be non regular? | <p>I am confused regarding the statements provided by one of our faculty regarding 
 "Is it compulsory that every infinite set is non regular 
 though every finite set is a regular set".
Providing this example:</p>

<blockquote>
 <p>$$L= \{ 0^n 1^n | n>=0 \} $$ its formal as $\Sig... | formal languages regular languages | 1 | Is it compulsory that every infinite set be non regular? -- (formal languages regular languages)
<p>I am confused regarding the statements provided by one of our faculty regarding 
 "Is it compulsory that every infinite set is non regular 
 though every finite set is a regular set".
Providing this exa... | habedi/stack-exchange-dataset |
23,784 | Shortest directed path connecting given subset of vertices | <p>Given</p>

<ul>
<li>weighted directed graph $G = (V,E,w)$, where $w : E \to \mathbb R^+$</li>
<li>source vertex $v \in V$</li>
<li>vertex subset $U \subset V$</li>
</ul>

<p>how to find a shortest directed path from $v$ containing all vertices from $U$? Note that such path may contain... | graphs terminology shortest path weighted graphs | 1 | Shortest directed path connecting given subset of vertices -- (graphs terminology shortest path weighted graphs)
<p>Given</p>

<ul>
<li>weighted directed graph $G = (V,E,w)$, where $w : E \to \mathbb R^+$</li>
<li>source vertex $v \in V$</li>
<li>vertex subset $U \subset V$</li>
</ul>

<... | habedi/stack-exchange-dataset |
23,785 | Question about threads and locks | <p>I am currently reading <a href="https://www.kernel.org/doc/ols/2002/ols2002-pages-479-495.pdf">Fuss, Futexes and Furwocks: Fast Userland Locking in Linux</a> and came across this quote:</p>

<blockquote>
 <p>In a fair locking scheme the lock is granted in the order it was
 requested. This can have ... | concurrency threads | 1 | Question about threads and locks -- (concurrency threads)
<p>I am currently reading <a href="https://www.kernel.org/doc/ols/2002/ols2002-pages-479-495.pdf">Fuss, Futexes and Furwocks: Fast Userland Locking in Linux</a> and came across this quote:</p>

<blockquote>
 <p>In a fair locking scheme the lock is g... | habedi/stack-exchange-dataset |
23,791 | Lower bound on number of comparisons needed to search for a number in a sorted 3-d array | <p>Suppose we have an $N \times N \times N$ 3-d sorted array meaning that every row,column, and file is in sorted order. Searching for an element in this structure can be done using $O(N^2)$ comparisons. However are $\Omega(N^2)$ comparisons needed in the worst-case? For an $N \times N$ 2-d sorted array I recall a proo... | algorithm analysis runtime analysis search algorithms arrays lower bounds | 1 | Lower bound on number of comparisons needed to search for a number in a sorted 3-d array -- (algorithm analysis runtime analysis search algorithms arrays lower bounds)
<p>Suppose we have an $N \times N \times N$ 3-d sorted array meaning that every row,column, and file is in sorted order. Searching for an element in thi... | habedi/stack-exchange-dataset |
23,792 | What is the formal description of a Turing machine? | <p>I was asked to give a formal description of a Turing machine I have no experience with this, and was wondering what "formal description" entails.</p>
 | terminology turing machines | 1 | What is the formal description of a Turing machine? -- (terminology turing machines)
<p>I was asked to give a formal description of a Turing machine I have no experience with this, and was wondering what "formal description" entails.</p>
 | habedi/stack-exchange-dataset |
23,804 | Showing that deciding whether a given TM accepts a word of length 5 is undecidable | <p>I'm having trouble grasping this the concept of reductions. I found the solution and it looks like this:</p>

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

<p>Assume that $M_5$ is a Turing Machine that can decide if a given Turing Machine $M$
accepts a... | computability turing machines reductions | 1 | Showing that deciding whether a given TM accepts a word of length 5 is undecidable -- (computability turing machines reductions)
<p>I'm having trouble grasping this the concept of reductions. I found the solution and it looks like this:</p>

<p><img src="https://i.stack.imgur.com/eqv7G.png" alt="enter image des... | habedi/stack-exchange-dataset |
23,811 | Why are the two random variables independent in the analysis of Randomized Selection algorithm in CLRS? | <p>In section 9.2 of CLRS (<em>Introduction to Algorithms; page 185 in the 2nd edition and page 215 in the 3rd edition</em>), a randomized selection algorithm is presented. </p>

<p>For its analysis, $T(n)$ is a random variable denoting the time required on an input array $A[p \cdots r]$ of $n$ elements and $X_... | algorithm analysis randomized algorithms | 1 | Why are the two random variables independent in the analysis of Randomized Selection algorithm in CLRS? -- (algorithm analysis randomized algorithms)
<p>In section 9.2 of CLRS (<em>Introduction to Algorithms; page 185 in the 2nd edition and page 215 in the 3rd edition</em>), a randomized selection algorithm is presente... | habedi/stack-exchange-dataset |
23,826 | Intersection/Union of recursively enumerable languages that aren't decidable? | <p>For $L_1,L_2 \in RE - R $ , I want to prove or disprove if the following can occur:</p>

<ol>
<li>$L_1 \cap L_2 \in R$</li>
<li>$L_1 \cup L_2 \in R$</li>
<li>$L_1 \cap L_2 \in R$ and $L_1 \cup L_2 \in R$</li>
</ol>

<p><strong>What I did:</strong></p>

<ol>
<li><p>I think ... | formal languages turing machines | 1 | Intersection/Union of recursively enumerable languages that aren't decidable? -- (formal languages turing machines)
<p>For $L_1,L_2 \in RE - R $ , I want to prove or disprove if the following can occur:</p>

<ol>
<li>$L_1 \cap L_2 \in R$</li>
<li>$L_1 \cup L_2 \in R$</li>
<li>$L_1 \cap L_2 \in R$ an... | habedi/stack-exchange-dataset |
23,829 | Computer Architecture - Von Neumann | <p>With regards to introductory (beginner) Von Neumann computer architecture, how does a program change the order in which instructions are executed?</p>

<p>I know the control unit is responsible for retrieving the instruction from memory and then decodes and executes the instruction. Their connected by a bus.... | computer architecture | 1 | Computer Architecture - Von Neumann -- (computer architecture)
<p>With regards to introductory (beginner) Von Neumann computer architecture, how does a program change the order in which instructions are executed?</p>

<p>I know the control unit is responsible for retrieving the instruction from memory and then ... | habedi/stack-exchange-dataset |
23,835 | Big O running time for this algorithm? | <p>Here's the code for the algorithm:</p>

<pre><code>Foo(n)
 lcm = 1
 for i = 2 to n
 lcm = lcm*i/Euclid(lcm,i)
return lcm
</code></pre>

<p>The running time of <code>Euclid</code>$(a, b)$ is given as $O(\log(\min(a, b)))$</p>

<p>So the running time of the for loo... | algorithms runtime analysis | 1 | Big O running time for this algorithm? -- (algorithms runtime analysis)
<p>Here's the code for the algorithm:</p>

<pre><code>Foo(n)
 lcm = 1
 for i = 2 to n
 lcm = lcm*i/Euclid(lcm,i)
return lcm
</code></pre>

<p>The running time of <code>Euclid</code>$(a, b)$ is given as ... | habedi/stack-exchange-dataset |
23,843 | The min cut capacity in a network based on a bipartite graph (Hall's Theorem) | <p>Thanks to Yuval Filmus, I got to read <a href="http://theory.stanford.edu/~trevisan/cs261/lecture14.pdf" rel="nofollow">these lecture notes by Trevisan</a>. At the bottom half of Page 5, </p>

<blockquote>
 <p>The capacity of cut $S$ is the number of edges that go from $S$ to $\overline{S}$, that is $\t... | graphs bipartite matching | 1 | The min cut capacity in a network based on a bipartite graph (Hall's Theorem) -- (graphs bipartite matching)
<p>Thanks to Yuval Filmus, I got to read <a href="http://theory.stanford.edu/~trevisan/cs261/lecture14.pdf" rel="nofollow">these lecture notes by Trevisan</a>. At the bottom half of Page 5, </p>

<blockq... | habedi/stack-exchange-dataset |
23,848 | Can every program be turned into a quine? | <p>Given a program $P$ which takes a binary string as input, can one always (effectively) construct a program $P'$ such that $P'(0x)$ runs $P(x)$ and $P'(1x)$ outputs the source code of $P'$? I didn't find anything with some googling, but it seems like the kind of thing that could be known.</p>
 | computability | 1 | Can every program be turned into a quine? -- (computability)
<p>Given a program $P$ which takes a binary string as input, can one always (effectively) construct a program $P'$ such that $P'(0x)$ runs $P(x)$ and $P'(1x)$ outputs the source code of $P'$? I didn't find anything with some googling, but it seems like the ki... | habedi/stack-exchange-dataset |
23,849 | Deciding the set of all Turing machines that halt in at most $k|x|$ steps $\forall x \in \Sigma^*$ | <p>Let $L = \{ <M> | M$ halts on every input $x$ in at most $200 * |x|$ steps $\}$. </p>

<p>Is $L$ decidable? Recognizable?</p>

<p>Given that membership in $L$ asserts something about $M$'s behavior on an infinite set of strings, it seems extremely unlikely to me that $L$ could be either. I have... | computability turing machines undecidability decision problem | 1 | Deciding the set of all Turing machines that halt in at most $k|x|$ steps $\forall x \in \Sigma^*$ -- (computability turing machines undecidability decision problem)
<p>Let $L = \{ <M> | M$ halts on every input $x$ in at most $200 * |x|$ steps $\}$. </p>

<p>Is $L$ decidable? Recognizable?</p>

<p... | habedi/stack-exchange-dataset |
23,850 | Matrix equality up to row/column permutations problem name | <p>Sorry for the trivial question; has the following decision problem an "official" (possibly short) name?</p>

<blockquote>
Given two $n \times m$ $\text{0-1}$ (binary) matrices $M_1, M_2$ check if they are the same up to row and column permutations.
</blockquote>

<p>(something like the short... | terminology reference request | 1 | Matrix equality up to row/column permutations problem name -- (terminology reference request)
<p>Sorry for the trivial question; has the following decision problem an "official" (possibly short) name?</p>

<blockquote>
Given two $n \times m$ $\text{0-1}$ (binary) matrices $M_1, M_2$ check if they are the s... | habedi/stack-exchange-dataset |
23,871 | Determining the minimum vertex cover in a bipartite graph from a maximum flow/matching using the residual network rather than alternating paths | <p><a href="https://en.wikipedia.org/wiki/K%C3%B6nig%27s_theorem_%28graph_theory%29#Proof" rel="nofollow">Wikipedia</a> shows how one can determine the minimum vertex cover in a bipartite graph ($G(X \cup Y, E)$) in polytime from a maximum flow using alternating paths. However, I read that the (S,T) cut (extracted from... | graphs network flow bipartite matching | 1 | Determining the minimum vertex cover in a bipartite graph from a maximum flow/matching using the residual network rather than alternating paths -- (graphs network flow bipartite matching)
<p><a href="https://en.wikipedia.org/wiki/K%C3%B6nig%27s_theorem_%28graph_theory%29#Proof" rel="nofollow">Wikipedia</a> shows how on... | habedi/stack-exchange-dataset |
23,875 | Category theory and graphs | <p>Could most categories , or a finite part of them be represented on a subset of a complete graph of N vertices (Kn) which is connected. and partly directed? Could all the axioms of category theory be written for such graphs?</p>
 | graphs category theory | 1 | Category theory and graphs -- (graphs category theory)
<p>Could most categories , or a finite part of them be represented on a subset of a complete graph of N vertices (Kn) which is connected. and partly directed? Could all the axioms of category theory be written for such graphs?</p>
 | habedi/stack-exchange-dataset |
23,880 | Is the language $L = \{a^nb^m : n = 2^m\}$ context-free? | <p>Is the language $L = \{a^nb^m : n = 2^m\}$ context-free?</p>

<p>Assume L is a context-free language. Then $\ \exists p\in \mathbb{Z}^{+}:\forall s\in L\left | s \right |\geq p. s = uvxyz,\left | vy \right |\geq 1,\left | vxy \right |\leq p. s_i = uv^{i}xy^{i}z\in L\forall i\geq 0\ $.</p>

<p>Let s =... | pumping lemma | 1 | Is the language $L = \{a^nb^m : n = 2^m\}$ context-free? -- (pumping lemma)
<p>Is the language $L = \{a^nb^m : n = 2^m\}$ context-free?</p>

<p>Assume L is a context-free language. Then $\ \exists p\in \mathbb{Z}^{+}:\forall s\in L\left | s \right |\geq p. s = uvxyz,\left | vy \right |\geq 1,\left | vxy \right ... | habedi/stack-exchange-dataset |
23,885 | Recognizing interval graphs--"equivalent intervals" | <p>I was reading a paper for recognizing interval graphs. Here is an excerpt from the paper:</p>

<blockquote>
 <p>Each interval graph has a corresponding interval model in which two intervals overlap if
 and only if their corresponding vertices are adjacent. Such a representation is usually far&#... | algorithms graphs intervals | 1 | Recognizing interval graphs--"equivalent intervals" -- (algorithms graphs intervals)
<p>I was reading a paper for recognizing interval graphs. Here is an excerpt from the paper:</p>

<blockquote>
 <p>Each interval graph has a corresponding interval model in which two intervals overlap if
 and only... | habedi/stack-exchange-dataset |
23,886 | Is there a general-case sweep line algorithm for line segment intersection? | <p>I'm looking for a sweep line algorithm for finding all intersections in a set of line segments which doesn't necessarily require the general position constraint of Bentley-Ottman's algorithm (taken from Wikipedia):</p>

<ul>
<li>No two line segment endpoints or crossings have the same x-coordinate</li>&#... | algorithms computational geometry | 1 | Is there a general-case sweep line algorithm for line segment intersection? -- (algorithms computational geometry)
<p>I'm looking for a sweep line algorithm for finding all intersections in a set of line segments which doesn't necessarily require the general position constraint of Bentley-Ottman's algorithm (taken from... | habedi/stack-exchange-dataset |
23,895 | Can a Post machine have more than one accepting state? | <p>I was searching through Google and I couldn't find anything.</p>

<p>Can a Post machine have more than one accepting state?</p>
 | turing machines | 1 | Can a Post machine have more than one accepting state? -- (turing machines)
<p>I was searching through Google and I couldn't find anything.</p>

<p>Can a Post machine have more than one accepting state?</p>
 | habedi/stack-exchange-dataset |
23,901 | Information loss of a 9-input majority gate | <p>According to information theory, the logic gates AND, NAND, OR, NOR all lose 1.189 bits of information each with two bits of information at their inputs and with all inputs being independently and uniformly distributed.</p>

<p>When gates are used in combination with other gates in a circuit, to calculate th... | information theory | 1 | Information loss of a 9-input majority gate -- (information theory)
<p>According to information theory, the logic gates AND, NAND, OR, NOR all lose 1.189 bits of information each with two bits of information at their inputs and with all inputs being independently and uniformly distributed.</p>

<p>When gates ar... | habedi/stack-exchange-dataset |
23,905 | Control flow graphs - Tree decomposition | <p><img src="https://i.stack.imgur.com/k1d7R.png" alt="Control flow graphs"></p>

<p>Considering above terminologies for drawing control flow graphs for any program, it is very simple. For example :</p>

<pre><code>While A
if B
do ..
else do ..
end while
</code></pre>

<p>For... | graphs software engineering software testing | 1 | Control flow graphs - Tree decomposition -- (graphs software engineering software testing)
<p><img src="https://i.stack.imgur.com/k1d7R.png" alt="Control flow graphs"></p>

<p>Considering above terminologies for drawing control flow graphs for any program, it is very simple. For example :</p>

<pre><cod... | habedi/stack-exchange-dataset |
23,908 | Studying Skiena. War Story: What’s Past is Prolog | <p>I am reading The Algorithm Design Manual, 2nd Edition. 
The book gives an example task and then explains how to solve it step by step.
(The task and solution is detailed <a href="http://www8.cs.umu.se/kurser/TDBA77/VT06/algorithms/BOOK/BOOK2/NODE51.HTM" rel="nofollow noreferrer">here</a>)</p>

<p><em... | algorithms dynamic programming | 1 | Studying Skiena. War Story: What’s Past is Prolog -- (algorithms dynamic programming)
<p>I am reading The Algorithm Design Manual, 2nd Edition. 
The book gives an example task and then explains how to solve it step by step.
(The task and solution is detailed <a href="http://www8.cs.umu.se/kurser/TDBA77/VT06/alg... | habedi/stack-exchange-dataset |
23,909 | Functional dependencies with the same key? | <p>let's consider a table with</p>

<pre><code>carID | hireDate | manufactory | model | custID | custName | outletNo | outletLoc
</code></pre>

<p>I want to evaluate all the <strong>functional dependencies</strong> to bring in first, second and then third normal form.</p>

<ul>
<li><p>Fu... | database theory databases | 1 | Functional dependencies with the same key? -- (database theory databases)
<p>let's consider a table with</p>

<pre><code>carID | hireDate | manufactory | model | custID | custName | outletNo | outletLoc
</code></pre>

<p>I want to evaluate all the <strong>functional dependencies</strong> to bring in... | habedi/stack-exchange-dataset |
23,910 | Convex Hull algorithm - why it can't be computed using only comparisons | <p>Say I want to compute a covnex hull of given points on the plane. I would like to write an algorithm, that only compares the points and doesn't do any arithmetic operations. Wikipedia states, that:</p>

<blockquote>
 <p>The standard $\Omega(n \log n)$ lower bound for sorting is proven in the decision tr... | algorithms computational geometry computation models | 1 | Convex Hull algorithm - why it can't be computed using only comparisons -- (algorithms computational geometry computation models)
<p>Say I want to compute a covnex hull of given points on the plane. I would like to write an algorithm, that only compares the points and doesn't do any arithmetic operations. Wikipedia sta... | habedi/stack-exchange-dataset |
23,913 | Efficient lookup when key is made of multiple elements and elements can be empty | <p>I am wanting to create a map where the key contains multiple elements and the elements can be empty/null. The empty values are treated as "anything". I want to lookup function to match when the stored key is the lookup value or it is a generalised version - index key has empties where lookup value has values. I thin... | time complexity | 1 | Efficient lookup when key is made of multiple elements and elements can be empty -- (time complexity)
<p>I am wanting to create a map where the key contains multiple elements and the elements can be empty/null. The empty values are treated as "anything". I want to lookup function to match when the stored key is the loo... | habedi/stack-exchange-dataset |
23,928 | Deterministic Multi-tape Turing Machine construction | <p>I'm trying to construct a deterministic multi-tape turing machine for the following language in order to show that $L$ is in $DTIME(n)$:</p>

<p>$$L = \{ www \mid w \in \{a,b\}^+ \}$$</p>

<p>I'm not sure how to get started. Any hints would be appreciated.</p>
 | turing machines complexity classes | 1 | Deterministic Multi-tape Turing Machine construction -- (turing machines complexity classes)
<p>I'm trying to construct a deterministic multi-tape turing machine for the following language in order to show that $L$ is in $DTIME(n)$:</p>

<p>$$L = \{ www \mid w \in \{a,b\}^+ \}$$</p>

<p>I'm not sure how... | habedi/stack-exchange-dataset |
23,936 | Can a Multi-Tape Turing Machine have an infinite number of tapes? | <p>So if k is the number of tapes, is a multi-tape Turing machine allowed to have k = ∞ tapes.</p>

<p>I'd assume not since this would give an infinite transition function?</p>
 | turing machines machine models | 1 | Can a Multi-Tape Turing Machine have an infinite number of tapes? -- (turing machines machine models)
<p>So if k is the number of tapes, is a multi-tape Turing machine allowed to have k = ∞ tapes.</p>

<p>I'd assume not since this would give an infinite transition function?</p>
 | habedi/stack-exchange-dataset |
23,941 | Complexity of general polynomial map evaluation is polynomial? | <p>A polynomial map is equal to another polynomial map iff they take on the same values at each point. So this is different from formal polynomials. So since in $\Bbb{Z}_p$, $x^{p-1} = 1$ for all $x \neq 0$, and is $0$ on $0$, we have that there are a finite number of polynomial maps in $\Bbb{Z}_p[x_1, \dots, x_k]$.... | algorithms complexity theory polynomial time polynomials | 1 | Complexity of general polynomial map evaluation is polynomial? -- (algorithms complexity theory polynomial time polynomials)
<p>A polynomial map is equal to another polynomial map iff they take on the same values at each point. So this is different from formal polynomials. So since in $\Bbb{Z}_p$, $x^{p-1} = 1$ for ... | habedi/stack-exchange-dataset |
23,942 | Algorithm for computing volume of union or intersection of n-dimensional convex polytopes given their facets? | <p>I've googled this problem somewhat pretty extensively, and all the relevant literature understandably deals with 2-d or 3-d cases, rather than the n-d case.</p>

<p>EDIT: Yes, ℝ<sup>n</sup>. I've done many searches combining terms like union, intersection, volume, convex hulls, polytope, etc. I've come acros... | computational geometry | 1 | Algorithm for computing volume of union or intersection of n-dimensional convex polytopes given their facets? -- (computational geometry)
<p>I've googled this problem somewhat pretty extensively, and all the relevant literature understandably deals with 2-d or 3-d cases, rather than the n-d case.</p>

<p>EDIT: ... | habedi/stack-exchange-dataset |
23,944 | Proving a language (ir)regular (standard methods have failed) | <p>I'm currently trying to prove a language regular (for personal amusement). The language is:</p>

<p><em>The language containing all numbers in ternary that have even bit-parity when encoded in binary.</em></p>

<p>Now, I've currently tried a few different approaches that have not led me to any succes... | formal languages regular languages arithmetic | 1 | Proving a language (ir)regular (standard methods have failed) -- (formal languages regular languages arithmetic)
<p>I'm currently trying to prove a language regular (for personal amusement). The language is:</p>

<p><em>The language containing all numbers in ternary that have even bit-parity when encoded in bin... | habedi/stack-exchange-dataset |
23,945 | 3-coloring a graph with propositional formulas | <p>I am trying to tackle a specific problem so any help would be greatly appreciated:</p>
<blockquote>
<p>Let <span class="math-container">$G = (V,E)$</span> be an undirected graph with vertex set <span class="math-container">$V$</span> and edge set <span class="math-container">$E$</span>. A 3-coloring of <span... | logic propositional logic | 1 | 3-coloring a graph with propositional formulas -- (logic propositional logic)
<p>I am trying to tackle a specific problem so any help would be greatly appreciated:</p>
<blockquote>
<p>Let <span class="math-container">$G = (V,E)$</span> be an undirected graph with vertex set <span class="math-container">$V$</spa... | habedi/stack-exchange-dataset |
23,950 | Card-buying algorithm | <p>I'm trying to make an algorithm to calculate what combination of cards from what buyers I should get to get the cheapest deal. Taking the shipping costs into consideration. It's for a website called MagicCardMarket, which is kind of an Ebay for trading cards. The problem is that the site doesn't have a proper optimi... | algorithms | 1 | Card-buying algorithm -- (algorithms)
<p>I'm trying to make an algorithm to calculate what combination of cards from what buyers I should get to get the cheapest deal. Taking the shipping costs into consideration. It's for a website called MagicCardMarket, which is kind of an Ebay for trading cards. The problem is that... | habedi/stack-exchange-dataset |
23,951 | Are Java and C# also purely interpreted languages? | <p>I was wondering about the nature of these managed languages i-e since c# and java both are converted into intermediate language and byte code respectively, and are interpreted by their respective runtime(s). So if they are somehow pure interpreted languages then is it feasible to develop any crucial application on t... | programming languages interpreters | 1 | Are Java and C# also purely interpreted languages? -- (programming languages interpreters)
<p>I was wondering about the nature of these managed languages i-e since c# and java both are converted into intermediate language and byte code respectively, and are interpreted by their respective runtime(s). So if they are som... | habedi/stack-exchange-dataset |
23,953 | Reducing optimization problem to decision problem | <p>I'm trying to reduce an optimization problem to a decision problem, more specifically, consider the Max-Cut problem in its decision version:<br>
Given $(G=(V,E),k)$ as input, where $G$ is an undirected weighted graph (all weights are positive integers, formally: $w: E\rightarrow \mathbb{N}$ is the weight functio... | reductions | 1 | Reducing optimization problem to decision problem -- (reductions)
<p>I'm trying to reduce an optimization problem to a decision problem, more specifically, consider the Max-Cut problem in its decision version:<br>
Given $(G=(V,E),k)$ as input, where $G$ is an undirected weighted graph (all weights are positive inte... | habedi/stack-exchange-dataset |
23,955 | Why is the Boolean hierarchy contained in the class $P^{NP}$? | <p>My textbook says: "The Boolean hierarchy is contained in the class $P^{NP}\subseteq\Sigma^P_2\cap\Pi^P_2$." However, it provides neither a proof nor a proof sketch nor some hint. How can I convince myself that the claim is true?</p>
 | complexity theory complexity classes oracle machines | 1 | Why is the Boolean hierarchy contained in the class $P^{NP}$? -- (complexity theory complexity classes oracle machines)
<p>My textbook says: "The Boolean hierarchy is contained in the class $P^{NP}\subseteq\Sigma^P_2\cap\Pi^P_2$." However, it provides neither a proof nor a proof sketch nor some hint. How can I convince... | habedi/stack-exchange-dataset |
23,961 | Fast algorithm to find points on one side of hyperplane? | <p>Given $n$ points $x_1, x_2, ..., x_n \in \mathbb{R}^k$, where $\mathbb{R}^k$ can be high dimensional. Is it possible to devise a fast algorithm </p>

<p>(1) Preparation: first take the n points as an input, do whatever preprocessing necessary. </p>

<p>(2) Query: for each query $f_i = w^\top x$ being... | algorithms complexity theory computational geometry | 1 | Fast algorithm to find points on one side of hyperplane? -- (algorithms complexity theory computational geometry)
<p>Given $n$ points $x_1, x_2, ..., x_n \in \mathbb{R}^k$, where $\mathbb{R}^k$ can be high dimensional. Is it possible to devise a fast algorithm </p>

<p>(1) Preparation: first take the n points a... | habedi/stack-exchange-dataset |
23,963 | Type inference + overloading | <p>I'm looking for a type inference algorithm for a language I'm developing, but I couldn't find one that suits my needs because they usually are either:</p>

<ul>
<li>à la Haskell, with polymorphism but no ad-hoc overloading</li>
<li>à la C++ (auto) in which you have ad-hoc overloading but functions ar... | type theory type inference | 1 | Type inference + overloading -- (type theory type inference)
<p>I'm looking for a type inference algorithm for a language I'm developing, but I couldn't find one that suits my needs because they usually are either:</p>

<ul>
<li>à la Haskell, with polymorphism but no ad-hoc overloading</li>
<li>à la C++... | habedi/stack-exchange-dataset |
23,969 | How to determine if a state is a fixed point in a Hopfield network? | <p>I have been reading a lot and I am still unsure of how to determine this. Let's say I have an initial binary state vector (1, 1, 1). How would I go about determining whether (1, 1, 1) is a fixed point in the network? </p>

<p>My initial understanding was to put the state through the network and if it converg... | neural networks | 1 | How to determine if a state is a fixed point in a Hopfield network? -- (neural networks)
<p>I have been reading a lot and I am still unsure of how to determine this. Let's say I have an initial binary state vector (1, 1, 1). How would I go about determining whether (1, 1, 1) is a fixed point in the network? </p>
&#... | habedi/stack-exchange-dataset |
23,971 | Alternate definitions of enumeration machines | <p>In my textbook, enumeration machines are defined as possessing a special write-only output tape, which they can write characters to, but not move the head of. When they hit the print state, the string on the output tape is enumerated and reset to a blank tape.</p>

<p>Is this equivalent to the model of enume... | turing machines enumeration | 1 | Alternate definitions of enumeration machines -- (turing machines enumeration)
<p>In my textbook, enumeration machines are defined as possessing a special write-only output tape, which they can write characters to, but not move the head of. When they hit the print state, the string on the output tape is enumerated and ... | habedi/stack-exchange-dataset |
23,975 | Do you know of a brute-force algorithm for optimizing polynomial expressions? | <p>For instance, given the polynomial expression $xy + x + y + 1$ it will output $(x+1)(y+1)$.</p>

<p>Thanks!</p>
 | polynomials | 1 | Do you know of a brute-force algorithm for optimizing polynomial expressions? -- (polynomials)
<p>For instance, given the polynomial expression $xy + x + y + 1$ it will output $(x+1)(y+1)$.</p>

<p>Thanks!</p>
 | habedi/stack-exchange-dataset |
23,981 | Small-step semantics: for-loops | <p>I'm trying to construct the small-step semantic rules involving the for-loops, but I can't find anything about it in the literature (only about while-loops).</p>

<p>I was wondering if anyone could help me out with this? This is a first attempt, where $s$ represents a statement and $e$ an expression:</p>
... | formal languages programming languages semantics operational semantics small step semantics | 1 | Small-step semantics: for-loops -- (formal languages programming languages semantics operational semantics small step semantics)
<p>I'm trying to construct the small-step semantic rules involving the for-loops, but I can't find anything about it in the literature (only about while-loops).</p>

<p>I was wonderin... | habedi/stack-exchange-dataset |
23,984 | How to reduce MAX-2SAT problem to finding a cut in a graph | <p>I'm trying to reduce the MAX-2SAT problem to finding a cut in a graph, with no luck so far.<br>
Let me first show a description of the problem:<br>
<strong>2SAT</strong>: Given a boolean formula $\varphi$ in a CNF form, where every clause has 2 literals (a variable or its negation), one should decide whether... | reductions | 1 | How to reduce MAX-2SAT problem to finding a cut in a graph -- (reductions)
<p>I'm trying to reduce the MAX-2SAT problem to finding a cut in a graph, with no luck so far.<br>
Let me first show a description of the problem:<br>
<strong>2SAT</strong>: Given a boolean formula $\varphi$ in a CNF form, where every cl... | habedi/stack-exchange-dataset |
23,985 | Is Simon's problem a good NP-intermediate candidate? | <p>We know that $BPP \subseteq BQP$ but we have no proof $BPP \subset BQP$
(Though we have the proof that BQP $!=$ BPP with an oracle)</p>

<p>Since Simon's problem (as factoring) it's easily solvable by a quantum computer, and in exponential time complexity solvable by a classical computer, that's a hint o... | complexity theory complexity classes quantum computing | 1 | Is Simon's problem a good NP-intermediate candidate? -- (complexity theory complexity classes quantum computing)
<p>We know that $BPP \subseteq BQP$ but we have no proof $BPP \subset BQP$
(Though we have the proof that BQP $!=$ BPP with an oracle)</p>

<p>Since Simon's problem (as factoring) it's easily sol... | habedi/stack-exchange-dataset |
23,996 | FOL substitution - is it possible to substitute two variables with each other? e.g. $\theta=\{x/y,y/x\}$? | <p>Let $C = m(P,X,Y) \leftarrow m(Q,X,Z), m(R,Z,Y)$. </p>

<p>Is it possible to do the following substitution? </p>

<p>$D = C\theta$ where $\theta = \{Q/R,R/Q\}$ s.t. $D = m(P,X,Y) \leftarrow m(R,X,Z),m(Q,Z,Y)$</p>
 | logic first order logic logic programming | 1 | FOL substitution - is it possible to substitute two variables with each other? e.g. $\theta=\{x/y,y/x\}$? -- (logic first order logic logic programming)
<p>Let $C = m(P,X,Y) \leftarrow m(Q,X,Z), m(R,Z,Y)$. </p>

<p>Is it possible to do the following substitution? </p>

<p>$D = C\theta$ where $\theta = \... | habedi/stack-exchange-dataset |
24,012 | Chomsky normal form: epsilon rule | <p>I have pretty simple question, but still can't find an answer just googling it.</p>

<p>I'm trying to understand Chomsky Normal Form (CNF). There are three production rules:</p>

<ol>
<li>$A \to BC$</li>
<li>$A \to \alpha$</li>
<li>$S \to \epsilon$</li>
</ol>

<p>First two I u... | formal grammars context free | 1 | Chomsky normal form: epsilon rule -- (formal grammars context free)
<p>I have pretty simple question, but still can't find an answer just googling it.</p>

<p>I'm trying to understand Chomsky Normal Form (CNF). There are three production rules:</p>

<ol>
<li>$A \to BC$</li>
<li>$A \to \alpha$</l... | habedi/stack-exchange-dataset |
24,025 | Odd Parity Function | <p>I am trying to define a Odd Parity Function that takes three 1 bit inputs and will output a 1 if the 3 bits are odd as a Boolean function.</p>

<pre><code>1 1 0 = 0
1 0 0 = 1
0 0 0 = 0
1 1 1 = 1
</code></pre>

<p>I understand this has a relationship to XOR as I can define this with 2 ... | logic boolean algebra xor | 1 | Odd Parity Function -- (logic boolean algebra xor)
<p>I am trying to define a Odd Parity Function that takes three 1 bit inputs and will output a 1 if the 3 bits are odd as a Boolean function.</p>

<pre><code>1 1 0 = 0
1 0 0 = 1
0 0 0 = 0
1 1 1 = 1
</code></pre>

<p>I understand this has... | habedi/stack-exchange-dataset |
24,033 | $NP\subseteq TIME[O(n^{\log n})]$ | <p>Is it more plausible that $NP\subseteq TIME[O(n^{\log n})]$ than $NP\subseteq P$? I don't see this mentioned much and is there a reason why? If this question doesn't make sense, explain why.</p>
 | complexity theory time complexity complexity classes np | 1 | $NP\subseteq TIME[O(n^{\log n})]$ -- (complexity theory time complexity complexity classes np)
<p>Is it more plausible that $NP\subseteq TIME[O(n^{\log n})]$ than $NP\subseteq P$? I don't see this mentioned much and is there a reason why? If this question doesn't make sense, explain why.</p>
 | habedi/stack-exchange-dataset |
24,037 | What does it mean for a random number generator's sequence to be only 1-dimensionally equidistributed? | <p>Whilst reading up on <a href="https://en.wikipedia.org/wiki/Xorshift" rel="noreferrer">Xorshift</a> I came across the following (emphases added):</p>
<blockquote>
<p>The following xorshift+ generator, instead, has 128 bits of state, a maximal period of 2^128 − 1 and passes BigCrush:</p>
<p><code>[snip co... | randomness statistics pseudo random generators | 1 | What does it mean for a random number generator's sequence to be only 1-dimensionally equidistributed? -- (randomness statistics pseudo random generators)
<p>Whilst reading up on <a href="https://en.wikipedia.org/wiki/Xorshift" rel="noreferrer">Xorshift</a> I came across the following (emphases added):</p>
<blockqu... | habedi/stack-exchange-dataset |
24,050 | Negative numbers in Subset-Sum | <p>If I have a set $A$ with positive and negative numbers, and a number to find C. </p>

<p>It is possible to reduce the problem to one with only positive numbers in set $A$? </p>

<p>I mean, it is possible to find a new set $A$ and a new number $C$, so $A$ were only positive numbers, but the same prob... | np complete | 1 | Negative numbers in Subset-Sum -- (np complete)
<p>If I have a set $A$ with positive and negative numbers, and a number to find C. </p>

<p>It is possible to reduce the problem to one with only positive numbers in set $A$? </p>

<p>I mean, it is possible to find a new set $A$ and a new number $C$, so $... | habedi/stack-exchange-dataset |
24,057 | Concrete and simple applications for bipartite graphs | <p>I am looking for concrete and simple problems that may be solved using bipartite graphs or bipartite graph properties. Any idea along with explanations are welcome.</p>
 | graphs bipartite matching | 1 | Concrete and simple applications for bipartite graphs -- (graphs bipartite matching)
<p>I am looking for concrete and simple problems that may be solved using bipartite graphs or bipartite graph properties. Any idea along with explanations are welcome.</p>
 | habedi/stack-exchange-dataset |
24,060 | Complexity of finding the pseudoinverse matrix | <blockquote>
 <p>How many arithmetic operations are required to find a <a href="http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse">Moore–Penrose
 pseudoinverse
 matrix</a> of a arbitrary field?</p>
</blockquote>

<p>If the matrix is invertible and complex valued, then it's just... | algorithms linear algebra | 1 | Complexity of finding the pseudoinverse matrix -- (algorithms linear algebra)
<blockquote>
 <p>How many arithmetic operations are required to find a <a href="http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse">Moore–Penrose
 pseudoinverse
 matrix</a> of a arbitrary field?</p>
</blockquo... | habedi/stack-exchange-dataset |
24,070 | Problem with derivative of sigmoid activation function | <p>I'm following Jeff heatons book 'Introduction to Neural Networks with Java'.
To get node deltas, we need to calculate $f'(sum)$. In the very first row for <a href="http://www.heatonresearch.com/wiki/Backpropagation" rel="nofollow">Training Element #1</a>, we need to compute $f'(1.13) \cdot 0.25$ which Heaton eva... | mathematical analysis | 1 | Problem with derivative of sigmoid activation function -- (mathematical analysis)
<p>I'm following Jeff heatons book 'Introduction to Neural Networks with Java'.
To get node deltas, we need to calculate $f'(sum)$. In the very first row for <a href="http://www.heatonresearch.com/wiki/Backpropagation" rel="nofollow">... | habedi/stack-exchange-dataset |
24,076 | Number of iterations of the Euclidean algorithm | <p>I have a doubt about the runtime of the Euclidean algorithm; the slide of my Professor says:</p>
<blockquote>
<p>The calculation of <span class="math-container">$\mathrm{GCD} (a, b)$</span> stops at the most after <span class="math-container">$2\log_2 a$</span> iterations.</p>
<ol>
<li>Since <span cl... | algorithm analysis runtime analysis | 1 | Number of iterations of the Euclidean algorithm -- (algorithm analysis runtime analysis)
<p>I have a doubt about the runtime of the Euclidean algorithm; the slide of my Professor says:</p>
<blockquote>
<p>The calculation of <span class="math-container">$\mathrm{GCD} (a, b)$</span> stops at the most after <span ... | habedi/stack-exchange-dataset |
24,078 | Why is the reduction from Vertex-Cover to Subset-Sum of polynomial time? | <p>In the standard proof why Subset-Sum is (weakly) NP-complete, one reduces Vertex Cover to Subset-Sum by using suitable numbers with O(m+n) bits (where m is the number of edges and n the number of vertices). But how can we talk about a polynomial time reduction if we generate exponential-size numbers?</p>

<p... | np complete reductions | 1 | Why is the reduction from Vertex-Cover to Subset-Sum of polynomial time? -- (np complete reductions)
<p>In the standard proof why Subset-Sum is (weakly) NP-complete, one reduces Vertex Cover to Subset-Sum by using suitable numbers with O(m+n) bits (where m is the number of edges and n the number of vertices). But how c... | habedi/stack-exchange-dataset |
24,085 | Finding a finite model | <p>Hello I am having difficulty with this question, I am not even sure what strategy one would go about proving something like this:</p>

<blockquote>
 <p>Suppose $L$ is a language which includes an infinite list $c_1,c_2,\cdots$ of constant symbols. Let $\Gamma$ be a set of sentences $\Gamma = \{c_i \neq ... | logic proof techniques | 1 | Finding a finite model -- (logic proof techniques)
<p>Hello I am having difficulty with this question, I am not even sure what strategy one would go about proving something like this:</p>

<blockquote>
 <p>Suppose $L$ is a language which includes an infinite list $c_1,c_2,\cdots$ of constant symbols. Let $... | habedi/stack-exchange-dataset |
24,088 | Finding a graph-theoretic representation of expressions in Boole's algebra | <p>I just read "Boole's Algebra Isn't Boolean Algebra" by Theodore Halperin (behind a paywall <a href="http://link.springer.com/chapter/10.1007/978-94-015-9385-4_4#page-1" rel="nofollow">here</a>). I don't have a strong background in abstract algebra, so, frankly, the paper is a bit over my head but the gist of it is a... | graphs logic boolean algebra | 1 | Finding a graph-theoretic representation of expressions in Boole's algebra -- (graphs logic boolean algebra)
<p>I just read "Boole's Algebra Isn't Boolean Algebra" by Theodore Halperin (behind a paywall <a href="http://link.springer.com/chapter/10.1007/978-94-015-9385-4_4#page-1" rel="nofollow">here</a>). I don't have ... | habedi/stack-exchange-dataset |
24,092 | Dual-pivot Quicksort reference implementation? | <p>Has some sort of canonical - or reference - implementation of Dual-pivot Quicksort been posted anywhere?</p>

<p>I would like to include that algorithm in a comparison among sorting algorithms for a specialized need that I have, but the Java versions I've seen appear to have various kinds of tweaks applied t... | algorithms reference request sorting quicksort | 1 | Dual-pivot Quicksort reference implementation? -- (algorithms reference request sorting quicksort)
<p>Has some sort of canonical - or reference - implementation of Dual-pivot Quicksort been posted anywhere?</p>

<p>I would like to include that algorithm in a comparison among sorting algorithms for a specialized... | habedi/stack-exchange-dataset |
24,094 | What does $\{$ a set $\}^{+}$ mean in the context of languages? | <p>I came across this notation and I don't know the meaning of it, or if it's a typo: $\{$ some set $\}^{+}$</p>

<p>What does the + mean, i.e., the plus operator applied to a set?</p>
 | formal languages terminology regular languages sets | 1 | What does $\{$ a set $\}^{+}$ mean in the context of languages? -- (formal languages terminology regular languages sets)
<p>I came across this notation and I don't know the meaning of it, or if it's a typo: $\{$ some set $\}^{+}$</p>

<p>What does the + mean, i.e., the plus operator applied to a set?</p>
 | habedi/stack-exchange-dataset |
24,100 | Prove not context free | <p>How can we prove that:</p>

<p>$$
L = \{ w_1\#w_2 \mid w_1 \in w_2;\; |w_2| > |w_1|;\; w_1 , w_2 \in \{0, 1\}^*\}
$$</p>

<p>is not context-free? </p>

<p>The language defines $w_1$ as a sub-string of $w_2$, and they are separated by a $\#$. This is easy with the CFG pumping-lemma ... | formal languages context free proof techniques pumping lemma | 1 | Prove not context free -- (formal languages context free proof techniques pumping lemma)
<p>How can we prove that:</p>

<p>$$
L = \{ w_1\#w_2 \mid w_1 \in w_2;\; |w_2| > |w_1|;\; w_1 , w_2 \in \{0, 1\}^*\}
$$</p>

<p>is not context-free? </p>

<p>The language defines $w_1$ as a sub-st... | habedi/stack-exchange-dataset |
24,103 | Maximizing the Sum of a Subset with Excluding pairs | <p>I have a set of nodes S where all the nodes of an arbitrary integer value. I Also have a set of pairs of nodes from S, indicating that those node cannot be in the same subset. Given a subset of S, how can I determine the largest possible Sum of that subset taking into account the exclusion pairs.</p>

<p>E... | graphs sets | 1 | Maximizing the Sum of a Subset with Excluding pairs -- (graphs sets)
<p>I have a set of nodes S where all the nodes of an arbitrary integer value. I Also have a set of pairs of nodes from S, indicating that those node cannot be in the same subset. Given a subset of S, how can I determine the largest possible Sum of t... | habedi/stack-exchange-dataset |
24,112 | Algorithm to find Dominance Frontiers | <p>The algorithm that is used by gcc and llvm is that of <a href="http://www.cs.rice.edu/~keith/EMBED/dom.pdf" rel="nofollow">Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy</a> (page 9). We start with the <em>immediate dominators</em> of each control-flow graph node <code>B</code> already calculated and stored in... | compilers | 1 | Algorithm to find Dominance Frontiers -- (compilers)
<p>The algorithm that is used by gcc and llvm is that of <a href="http://www.cs.rice.edu/~keith/EMBED/dom.pdf" rel="nofollow">Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy</a> (page 9). We start with the <em>immediate dominators</em> of each control-flow graph... | habedi/stack-exchange-dataset |
24,115 | Linearithmic lower bound for 1-D "distinct" closest pair of points problem | <p>The 1-D <strong>distinct</strong> closest pair of points problem is as follows: Given a set of n <strong>distinct integer</strong> points on real line, find a pair of points with the smallest distance between them, here the distance between two points p_i and p_j is absolute difference of their values, i.e, |p_i-p_j... | algorithms data structures sorting lower bounds | 1 | Linearithmic lower bound for 1-D "distinct" closest pair of points problem -- (algorithms data structures sorting lower bounds)
<p>The 1-D <strong>distinct</strong> closest pair of points problem is as follows: Given a set of n <strong>distinct integer</strong> points on real line, find a pair of points with the smalle... | habedi/stack-exchange-dataset |
24,117 | Is it possible to easily reduce 0/1 subset sum to subset sum with multiplicities? | <p>So both the 0/1 subset sum problem (find a subset of given numbers that add up to a target sum) and the subset sum problem with "multiplicities" (find non-negative integer coefficients for the set elements so that the linear combination of set elements equals a target sum) are NP-complete. Is there some fairly easy ... | complexity theory combinatorics | 1 | Is it possible to easily reduce 0/1 subset sum to subset sum with multiplicities? -- (complexity theory combinatorics)
<p>So both the 0/1 subset sum problem (find a subset of given numbers that add up to a target sum) and the subset sum problem with "multiplicities" (find non-negative integer coefficients for the set e... | habedi/stack-exchange-dataset |
24,118 | Is there an anti-Bloom filter? | <p>A <a href="https://en.wikipedia.org/wiki/Bloom_filter" rel="noreferrer">Bloom filter</a> makes it possible to efficiently keep track of whether various values have already been encountered during processing. When there are many data items then a Bloom filter can result in a significant memory saving over a hash tab... | reference request data structures hash bloom filters dictionaries | 1 | Is there an anti-Bloom filter? -- (reference request data structures hash bloom filters dictionaries)
<p>A <a href="https://en.wikipedia.org/wiki/Bloom_filter" rel="noreferrer">Bloom filter</a> makes it possible to efficiently keep track of whether various values have already been encountered during processing. When t... | habedi/stack-exchange-dataset |
24,125 | Is a Turing Machine that only takes strings of the form $0^*$ Turing Complete? | <p>You have a Turing machine that only processes input on the form $0^*$. If it is given an input without 0's, it will simply halt without accepting or do anything else. Is it Turing Complete?</p>

<p>The set $0^*$ is countably infinite, since you can make the bijective function $f(x) : 0^* → \mathbb{N} $:</p>&... | turing machines turing completeness machine models | 1 | Is a Turing Machine that only takes strings of the form $0^*$ Turing Complete? -- (turing machines turing completeness machine models)
<p>You have a Turing machine that only processes input on the form $0^*$. If it is given an input without 0's, it will simply halt without accepting or do anything else. Is it Turing Co... | habedi/stack-exchange-dataset |
24,140 | Is there a Context-free grammar for this language? | <p>Is there a <code>Context-free grammar</code> for the following language:</p>

<p>$L=\{ x\#1^m|x \in \{0,1\}^* \text{ and the $m^{\text{th}}$ char in $x$ is 1} \}$</p>

<p>If so what is it? Because i couldn't find any. I also tried to prove there isn't (by the <a href="http://en.wikipedia.org/wiki/Pum... | formal languages context free pumping lemma | 1 | Is there a Context-free grammar for this language? -- (formal languages context free pumping lemma)
<p>Is there a <code>Context-free grammar</code> for the following language:</p>

<p>$L=\{ x\#1^m|x \in \{0,1\}^* \text{ and the $m^{\text{th}}$ char in $x$ is 1} \}$</p>

<p>If so what is it? Because i co... | habedi/stack-exchange-dataset |
24,149 | How can I identify that a restricted variant of Boolean SAT remains hard or not? | <p>While I was studying SAT problem and its different instances, in Algorithms for the Satisfiability (SAT) Problem: A Survey by J. Gu et. al <a href="http://www.dtic.mil/dtic/tr/fulltext/u2/a326042.pdf" rel="nofollow">PDF</a>, I came up with this variant (not mentioned there, but I though of it) and searched, but coul... | complexity theory np hard satisfiability | 1 | How can I identify that a restricted variant of Boolean SAT remains hard or not? -- (complexity theory np hard satisfiability)
<p>While I was studying SAT problem and its different instances, in Algorithms for the Satisfiability (SAT) Problem: A Survey by J. Gu et. al <a href="http://www.dtic.mil/dtic/tr/fulltext/u2/a3... | habedi/stack-exchange-dataset |
24,152 | What is the significance of primitive recursive functions? | <p>I was studying the proof of Ackermann function being recursive, but not primitive recursive, and a question hit me: "So what?". Why does it matter? What is the significance of primitive recursive functions?</p>
 | terminology computability machine models | 1 | What is the significance of primitive recursive functions? -- (terminology computability machine models)
<p>I was studying the proof of Ackermann function being recursive, but not primitive recursive, and a question hit me: "So what?". Why does it matter? What is the significance of primitive recursive functions?</p>&#... | habedi/stack-exchange-dataset |
24,160 | Can This Property (Representative Property) Be Generalized? | <p>I recently came across with a question that asks for the greatest subset of a given set, which includes relatively prime elements.(Randomly selected item from a set is always relatively prime to all others.)
My approach was eliminating the subsets depending on if the subset satisfies the rule.
Which means te... | algorithms decision problem numeral representations | 1 | Can This Property (Representative Property) Be Generalized? -- (algorithms decision problem numeral representations)
<p>I recently came across with a question that asks for the greatest subset of a given set, which includes relatively prime elements.(Randomly selected item from a set is always relatively prime to all o... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.