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 |
|---|---|---|---|---|---|---|
87,282 | General algorithm for generating a description of the language it is written in | <p>Does there exist a general algorithm which can output a finite and complete description of the (programming) language in which it is written, if it is given the permission to execute programs in that language? </p>

<p>The description should be sufficient to associate a correct output for any given program i... | algorithms programming languages | 1 | General algorithm for generating a description of the language it is written in -- (algorithms programming languages)
<p>Does there exist a general algorithm which can output a finite and complete description of the (programming) language in which it is written, if it is given the permission to execute programs in that... | habedi/stack-exchange-dataset |
87,284 | Turing machine halting in at least 100 steps on all inputs | <p>L = {< M > $\mid$ L(M) = M halts on all inputs in atleast 100 steps }.</p>

<p>Answer to this question is given undecidable in my book without any explanation but I think it is decidable.</p>

<hr>

<p>$\overline{L}$ = {< M > $\mid$ L(M) = M halts on <strong>some</strong> input in <st... | formal languages turing machines | 1 | Turing machine halting in at least 100 steps on all inputs -- (formal languages turing machines)
<p>L = {< M > $\mid$ L(M) = M halts on all inputs in atleast 100 steps }.</p>

<p>Answer to this question is given undecidable in my book without any explanation but I think it is decidable.</p>

<hr>&#x... | habedi/stack-exchange-dataset |
87,291 | It is possible to write any program (i.e. Turing complete) with just one single expression? | <p>So I'm currently taking discrete math II at my university and I came across a somewhat philosophical question (so I apologize if this is question is hard to answer precisely) of whether mathematicians and computer scientists view computation in the same way.</p>

<p>We computer scientists define computation ... | formal languages turing machines automata lambda calculus church turing thesis | 1 | It is possible to write any program (i.e. Turing complete) with just one single expression? -- (formal languages turing machines automata lambda calculus church turing thesis)
<p>So I'm currently taking discrete math II at my university and I came across a somewhat philosophical question (so I apologize if this is ques... | habedi/stack-exchange-dataset |
87,298 | Number of automorphism for clique of 6 vertices minus two non adjacent edges | <p>How many automorphism does a clique with 6 vertices have, when we take two edges from it (two edges that don't have the same vertex)?</p>

<p>I thought the answer is 6*(n-2)!
Number of automorphism for a full graph Kn is n!. Clique can be seen as a full graph since all of the vertices must be connected t... | algorithms graphs | 1 | Number of automorphism for clique of 6 vertices minus two non adjacent edges -- (algorithms graphs)
<p>How many automorphism does a clique with 6 vertices have, when we take two edges from it (two edges that don't have the same vertex)?</p>

<p>I thought the answer is 6*(n-2)!
Number of automorphism for a f... | habedi/stack-exchange-dataset |
87,304 | Is every edge of a graph included in some spanning tree? | <p>Let's say we have a graph $G$. We pick one edge from it (any edge). Will there always be such a spanning tree that contains that very edge?</p>

<p>I think the answer is yes, because no matter what we do we can always create such a spanning tree so that the very edge we picked is included. Of course, a more ... | graphs spanning trees | 1 | Is every edge of a graph included in some spanning tree? -- (graphs spanning trees)
<p>Let's say we have a graph $G$. We pick one edge from it (any edge). Will there always be such a spanning tree that contains that very edge?</p>

<p>I think the answer is yes, because no matter what we do we can always create ... | habedi/stack-exchange-dataset |
87,311 | How to prove that a minimum edge cover is a forest? | <p>How can it be proved that any minimum edge cover is a forest? As far as I understand an edge cover could be one connected component therefore a spanning tree). If it's the case then it wouldn't be a forest.</p>
 | graphs | 1 | How to prove that a minimum edge cover is a forest? -- (graphs)
<p>How can it be proved that any minimum edge cover is a forest? As far as I understand an edge cover could be one connected component therefore a spanning tree). If it's the case then it wouldn't be a forest.</p>
 | habedi/stack-exchange-dataset |
87,313 | If there's algorithm which returns true if Hamiltonian cycle exists in polynomial time then an algorithm to find the cycle in such time also exists? | <blockquote>
 <p>How can it be proved that if there's an algorithm which in polynomial time determines whether a graph has a Hamiltonian cycle then there's an algorithm which can find such Hamiltonian cycle in polynomial time as well?</p>
</blockquote>

<p><strong>Note:</strong> there's no need to devi... | algorithms graphs | 1 | If there's algorithm which returns true if Hamiltonian cycle exists in polynomial time then an algorithm to find the cycle in such time also exists? -- (algorithms graphs)
<blockquote>
 <p>How can it be proved that if there's an algorithm which in polynomial time determines whether a graph has a Hamiltonian cycle ... | habedi/stack-exchange-dataset |
87,316 | Computation Complexity of stream algorithm | <p>I want to analyze a clustering algorithm that clusters data stream.
Since the stream can be unbounded, I cannot write O(N^2), or explicitly denote the size of the stream. How can I use the arrival rate of the data for the computation complexity? Do you have any other idea for correct analysis of stream computati... | algorithm analysis time complexity | 1 | Computation Complexity of stream algorithm -- (algorithm analysis time complexity)
<p>I want to analyze a clustering algorithm that clusters data stream.
Since the stream can be unbounded, I cannot write O(N^2), or explicitly denote the size of the stream. How can I use the arrival rate of the data for the computat... | habedi/stack-exchange-dataset |
87,328 | Question regarding $O(n^2)$ efficiency | <p>I'm going through a video of EDX course which talks about Big O notation. At the end of the video they have some questions but the <span class="math-container">$O(n^2)$</span> answer is confusing me. It feels like a mistake, but I just want to make sure.</p>
<p>The question is :</p>
<blockquote>
<p>Imagi... | asymptotics landau notation | 1 | Question regarding $O(n^2)$ efficiency -- (asymptotics landau notation)
<p>I'm going through a video of EDX course which talks about Big O notation. At the end of the video they have some questions but the <span class="math-container">$O(n^2)$</span> answer is confusing me. It feels like a mistake, but I just want to m... | habedi/stack-exchange-dataset |
87,335 | Detect whether one Turing machine invokes another | <p>Given two Turing machines $M,M'$, is it possible to check whether $M$ invokes $M'$?</p>

<p>In other words, is the following problem computable/decidable?</p>

<p>Inputs: Turing machines $M,M'$<br>
Question: Does $M$ ever invoke $M'$?</p>

<p>Perhaps we can look whether $M$ includes the c... | turing machines computability | 1 | Detect whether one Turing machine invokes another -- (turing machines computability)
<p>Given two Turing machines $M,M'$, is it possible to check whether $M$ invokes $M'$?</p>

<p>In other words, is the following problem computable/decidable?</p>

<p>Inputs: Turing machines $M,M'$<br>
Question: Does... | habedi/stack-exchange-dataset |
87,336 | Maximum sum of depths of all external nodes in a Binary Tree | <p>Let $T$ be a (possibly improper) binary tree with $n$ nodes, and let $E(T)$ be the
sum of the depths of all the external nodes of $T$. (In a proper binary tree each node have 0 or 2 children. An external node is a leaf, i.e., any node that is not an internal node.)</p>

<p>Is there a configuration for ... | binary trees | 1 | Maximum sum of depths of all external nodes in a Binary Tree -- (binary trees)
<p>Let $T$ be a (possibly improper) binary tree with $n$ nodes, and let $E(T)$ be the
sum of the depths of all the external nodes of $T$. (In a proper binary tree each node have 0 or 2 children. An external node is a leaf, i.e., any no... | habedi/stack-exchange-dataset |
87,348 | Transitive dependency in 3NF | <p>Came across this question : State whether True or False</p>

<blockquote>
 <p>A prime attribute can be transitively dependent on a key in 3NF</p>
</blockquote>

<p>Answer: True<br>
How could this be true? Because as far as I know, A relation initially in 1NF is said to be in 3NF when par... | database theory databases normal forms | 1 | Transitive dependency in 3NF -- (database theory databases normal forms)
<p>Came across this question : State whether True or False</p>

<blockquote>
 <p>A prime attribute can be transitively dependent on a key in 3NF</p>
</blockquote>

<p>Answer: True<br>
How could this be true? Because as... | habedi/stack-exchange-dataset |
87,353 | Number of edges in a graph with N vertices and K components | <p>What is the possible biggest and the smallest number of edges in a graph with N vertices and K components?</p>

<p>I think that the smallest is (N-1)<em>K. The biggest one is N</em>K. Is this correct? I think it also may depend on whether we have and even or an odd number of vertices?</p>
 | algorithms graphs | 1 | Number of edges in a graph with N vertices and K components -- (algorithms graphs)
<p>What is the possible biggest and the smallest number of edges in a graph with N vertices and K components?</p>

<p>I think that the smallest is (N-1)<em>K. The biggest one is N</em>K. Is this correct? I think it also may depen... | habedi/stack-exchange-dataset |
87,361 | Finding the best poker hand in a connected grid structure where order matters | <p>I am trying to find the best poker hand in a connected grid, where order matters. An illustration is the best way of explaining the situation.</p>

<p><a href="https://i.stack.imgur.com/SDnws.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SDnws.png" alt="3x4 connected grid of playing card... | algorithms search algorithms square grid | 1 | Finding the best poker hand in a connected grid structure where order matters -- (algorithms search algorithms square grid)
<p>I am trying to find the best poker hand in a connected grid, where order matters. An illustration is the best way of explaining the situation.</p>

<p><a href="https://i.stack.imgur.com... | habedi/stack-exchange-dataset |
87,362 | Finding the Voronoi cell a point belongs to | <p>Given a set of Voronoi edges. Each edge consists of (indices of, pointers to) 4 points: $\mathrm{left}$ and $\mathrm{right}$ are sites, $\mathrm{begin}$ and $\mathrm{end}$ are vertices (one of them or even both (in case if all the sites lies on a straight line) may point to infinity). $\angle \Big(\overrightarrow{(\... | algorithms algorithm analysis computational geometry voronoi diagrams | 1 | Finding the Voronoi cell a point belongs to -- (algorithms algorithm analysis computational geometry voronoi diagrams)
<p>Given a set of Voronoi edges. Each edge consists of (indices of, pointers to) 4 points: $\mathrm{left}$ and $\mathrm{right}$ are sites, $\mathrm{begin}$ and $\mathrm{end}$ are vertices (one of them ... | habedi/stack-exchange-dataset |
87,378 | Not quite-infinitely expandable human-friendly naming system? | <p>This may be a known problem, with known approaches, but I can't find the right way to search for it.</p>

<p>I would like to name points along a line of unknown final length such that their name reflects their relative position to all other named points on that line. One should be able to insert an arbitrar... | algorithms terminology | 1 | Not quite-infinitely expandable human-friendly naming system? -- (algorithms terminology)
<p>This may be a known problem, with known approaches, but I can't find the right way to search for it.</p>

<p>I would like to name points along a line of unknown final length such that their name reflects their relative ... | habedi/stack-exchange-dataset |
87,379 | Calculating mod of n^k mod p in O(log k) | <blockquote>
 <p>Given $n>0$, $k>0$, and a prime number $p$, compute: $$n^k\mod p$$ in $O(\log k)$ time. Here $x \mod y$ means the remainder for $x$ being divided by $y$. For example, $2^3\mod 7 = 1$. You assume that all of $n$, $k$, and $p$ can fit in a single word in your computer. Moreover, if $x$ and $y$... | algorithms number theory modular arithmetic | 1 | Calculating mod of n^k mod p in O(log k) -- (algorithms number theory modular arithmetic)
<blockquote>
 <p>Given $n>0$, $k>0$, and a prime number $p$, compute: $$n^k\mod p$$ in $O(\log k)$ time. Here $x \mod y$ means the remainder for $x$ being divided by $y$. For example, $2^3\mod 7 = 1$. You assume that al... | habedi/stack-exchange-dataset |
87,388 | number of connected subgraphs of $G$ with at most $ k>0$ vertices | <p>Suppose we have an undirected graph $G=(V,E)$ with $n$ vertices and with max degree of $d>0$.</p>

<p>I need to prove that number of connected subgraphs of $G$ with at most $n\geq k>0$ vertices is $M\leq n\cdot d^{2k}$</p>

<p>My approach was by induction.</p>

<p>For $k=1$ it is true</... | algorithms graphs connected | 1 | number of connected subgraphs of $G$ with at most $ k>0$ vertices -- (algorithms graphs connected)
<p>Suppose we have an undirected graph $G=(V,E)$ with $n$ vertices and with max degree of $d>0$.</p>

<p>I need to prove that number of connected subgraphs of $G$ with at most $n\geq k>0$ vertices is $M\leq ... | habedi/stack-exchange-dataset |
87,391 | Probability that a leaf with 1 will be selected in game tree evaluation | <p>I am trying to understand randomized AND-OR Game Tree Evaluation. I am stuck with proving the most basic case, namely, an OR node with two leaves (AND node with two leaves is similar).</p>

<pre><code> (OR) = 1
 / \
 / \&#x... | randomized algorithms probabilistic algorithms game theory | 1 | Probability that a leaf with 1 will be selected in game tree evaluation -- (randomized algorithms probabilistic algorithms game theory)
<p>I am trying to understand randomized AND-OR Game Tree Evaluation. I am stuck with proving the most basic case, namely, an OR node with two leaves (AND node with two leaves is simila... | habedi/stack-exchange-dataset |
87,406 | Show that graph is planar or not? | <p>Show that the following graph is planar or not.</p>

<p><a href="https://i.stack.imgur.com/MIlLX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MIlLX.png" alt="Given graph"></a></p>

<p>My first assumption is that this graph is not planar, but could not find a reasonable prove (ex... | graphs planar graphs | 1 | Show that graph is planar or not? -- (graphs planar graphs)
<p>Show that the following graph is planar or not.</p>

<p><a href="https://i.stack.imgur.com/MIlLX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MIlLX.png" alt="Given graph"></a></p>

<p>My first assumption is that this gr... | habedi/stack-exchange-dataset |
87,417 | How Turing recognizer accepts any string? | <p>I've got a basic doubt for such I'm not getting convicting argument. See,</p>

<p>We say a TM <span class="math-container">$M$</span> is Turing recognizer if it accepts a string belonging to the language <span class="math-container">$L(M)$</span> & says <span class="math-container">$yes$</span> if the st... | turing machines undecidability computation models | 1 | How Turing recognizer accepts any string? -- (turing machines undecidability computation models)
<p>I've got a basic doubt for such I'm not getting convicting argument. See,</p>

<p>We say a TM <span class="math-container">$M$</span> is Turing recognizer if it accepts a string belonging to the language <span cl... | habedi/stack-exchange-dataset |
87,421 | Find Number of even subarrays $O(n)$ [explanation needed] | <p>So I found a solution to this problem here <a href="http://marcodiiga.github.io/number-of-even-sum-subarrays" rel="nofollow noreferrer">http://marcodiiga.github.io/number-of-even-sum-subarrays</a> but I am unsure of exactly how it works. I get the premise that in order to have an even sum it must be even or even + e... | algorithms loops iteration | 1 | Find Number of even subarrays $O(n)$ [explanation needed] -- (algorithms loops iteration)
<p>So I found a solution to this problem here <a href="http://marcodiiga.github.io/number-of-even-sum-subarrays" rel="nofollow noreferrer">http://marcodiiga.github.io/number-of-even-sum-subarrays</a> but I am unsure of exactly how... | habedi/stack-exchange-dataset |
87,426 | Why is "accepted by Turing Machine with even number of states" a trivial property? | <p>$$
L = \left\{ \left< M \right>~\middle|~
\small{
\begin{array}{l}
L(M)\text{ is recognized by a Turing Machine} \\
\text{having even number of states}
\end{array}
}
\right\}.
$$</p>

<p>Isn't $L$ same as asking if $L\left(M\right)$ is recursively enumerable (RE)? H... | turing machines computability rice theorem | 1 | Why is "accepted by Turing Machine with even number of states" a trivial property? -- (turing machines computability rice theorem)
<p>$$
L = \left\{ \left< M \right>~\middle|~
\small{
\begin{array}{l}
L(M)\text{ is recognized by a Turing Machine} \\
\text{having even number of states}
\end... | habedi/stack-exchange-dataset |
87,432 | What does the $O^*$ notation mean? | <p>I'm recently reading some papers on the <em>maximum independent set problem</em>, all the algorithms' time complexity is donated by $O^*()$ notation, like $O^*(1.0836^n)$. One paper says "<em>the $O^*$notation suppresses polynomial factors in the input size.</em>" I'm a little bit confused and couldn't find helpful... | asymptotics landau notation notation | 1 | What does the $O^*$ notation mean? -- (asymptotics landau notation notation)
<p>I'm recently reading some papers on the <em>maximum independent set problem</em>, all the algorithms' time complexity is donated by $O^*()$ notation, like $O^*(1.0836^n)$. One paper says "<em>the $O^*$notation suppresses polynomial factors ... | habedi/stack-exchange-dataset |
87,435 | Amount of classes for a semantic segmentation neural network | <p>I am currently working on implementation of semantic segmentation of images neural network, and try to implement one of the already existing solution such as Fully Convolutional Neural Network <a href="https://i.stack.imgur.com/7SHlN.png" rel="nofollow noreferrer">1</a>.</p>

<p>Data that I am using is based... | neural networks | 1 | Amount of classes for a semantic segmentation neural network -- (neural networks)
<p>I am currently working on implementation of semantic segmentation of images neural network, and try to implement one of the already existing solution such as Fully Convolutional Neural Network <a href="https://i.stack.imgur.com/7SHlN.p... | habedi/stack-exchange-dataset |
87,440 | Convolutional Neural Network for Insects | <p>I've recently started learning CNN's. I need a CNN that is specialized for insects detection. Dead insects will be put on a piece of paper / container, then images will be taken from a same distance, and are at same pixels.</p>

<p>I am expecting to prepare my own training datasets: 
- Thousands of image... | artificial intelligence neural networks computer vision | 1 | Convolutional Neural Network for Insects -- (artificial intelligence neural networks computer vision)
<p>I've recently started learning CNN's. I need a CNN that is specialized for insects detection. Dead insects will be put on a piece of paper / container, then images will be taken from a same distance, and are at same... | habedi/stack-exchange-dataset |
87,441 | Proving that $L = \{ a^{n!} \ | \ n \geq 0 \}$ is not regular | <p>Let $L$ a language over $X = \{a\}$ defined as follow : </p>

<p>$$L = \{ a^{n!} \ | \ n \geq 0 \}$$</p>

<p>I want to prove that $L$ isn't regular, I have searched in the forum for an equivalent question, but I found nothing. If it's a duplicate, I apologize and I'll be glad if you provide me the li... | formal languages regular languages pumping lemma | 1 | Proving that $L = \{ a^{n!} \ | \ n \geq 0 \}$ is not regular -- (formal languages regular languages pumping lemma)
<p>Let $L$ a language over $X = \{a\}$ defined as follow : </p>

<p>$$L = \{ a^{n!} \ | \ n \geq 0 \}$$</p>

<p>I want to prove that $L$ isn't regular, I have searched in the forum for an ... | habedi/stack-exchange-dataset |
87,471 | Does XNOR of three variable equals XOR of same three variables | <p>I came across following excerpt:</p>

<blockquote>
 <p>$(x'y'+xy)'z'+(x'y'+xy)z=x\oplus y\oplus z$</p>
</blockquote>

<p>What I see is left hand side is XNOR of $x,y$ and on right, $z$ and I get XOR of of $x,y$ and $z$ !!!
In other word,</p>

<blockquote>
 <p>$XNOR(XNOR(x,y)... | boolean algebra | 1 | Does XNOR of three variable equals XOR of same three variables -- (boolean algebra)
<p>I came across following excerpt:</p>

<blockquote>
 <p>$(x'y'+xy)'z'+(x'y'+xy)z=x\oplus y\oplus z$</p>
</blockquote>

<p>What I see is left hand side is XNOR of $x,y$ and on right, $z$ and I get XOR of of $x,... | habedi/stack-exchange-dataset |
87,481 | Are there practical methods for solving ILP? | <p>Recently I encountered some papers in which the most important part seems to be writing an Integer Linear Program for a problem for which there exist some exact or heuristic algorithms!
Is solving an ILP easy and fast in practice? Is this solution exact or approximate?</p>
 | optimization heuristics integer programming | 1 | Are there practical methods for solving ILP? -- (optimization heuristics integer programming)
<p>Recently I encountered some papers in which the most important part seems to be writing an Integer Linear Program for a problem for which there exist some exact or heuristic algorithms!
Is solving an ILP easy and fast i... | habedi/stack-exchange-dataset |
87,484 | How is the Time Complexity of a Function Problem different than its corresponding Decision Problem? | <p>Every function problem has a corresponding decision problem, which is simply the graph of the function problem, according to </p>

<p><a href="https://en.wikipedia.org/wiki/Decision_problem#Function_problems" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Decision_problem#Function_problems</a></p>&#... | time complexity decision problem | 1 | How is the Time Complexity of a Function Problem different than its corresponding Decision Problem? -- (time complexity decision problem)
<p>Every function problem has a corresponding decision problem, which is simply the graph of the function problem, according to </p>

<p><a href="https://en.wikipedia.org/wik... | habedi/stack-exchange-dataset |
87,498 | Master Theorem on a*T(n/b) + c? | <p>The recurrence equations solved by the Master Theorem are in the following format :</p>

<p>$ T(n) = a T(\frac{n}{b}) + f(n) $</p>

<p>but is it possible to use it on :</p>

<p>$ T(n) = a T(\frac{n}{b}) + c $</p>

<p>?</p>
 | algorithms asymptotics | 1 | Master Theorem on a*T(n/b) + c? -- (algorithms asymptotics)
<p>The recurrence equations solved by the Master Theorem are in the following format :</p>

<p>$ T(n) = a T(\frac{n}{b}) + f(n) $</p>

<p>but is it possible to use it on :</p>

<p>$ T(n) = a T(\frac{n}{b}) + c $</p>

<p>?</p>&... | habedi/stack-exchange-dataset |
87,506 | Is machine learning a subarea of expert systems? | <p>My question is short and straightforward: Can be considered "machine learning" a subarea of "expert systems"?</p>
 | machine learning expert systems | 1 | Is machine learning a subarea of expert systems? -- (machine learning expert systems)
<p>My question is short and straightforward: Can be considered "machine learning" a subarea of "expert systems"?</p>
 | habedi/stack-exchange-dataset |
87,507 | How could a total asymptotic runtime exceed the upper bound of an algorithm's runtime? | <p>This question is specifically related to</p>

<p><a href="https://stackoverflow.com/questions/3980416/time-complexity-of-euclids-algorithm">https://stackoverflow.com/questions/3980416/time-complexity-of-euclids-algorithm</a></p>

<p>The $gcd(x,y)$ is solved in $O(T(n) log n)$, where $n$ is the number... | time complexity runtime analysis modular arithmetic | 1 | How could a total asymptotic runtime exceed the upper bound of an algorithm's runtime? -- (time complexity runtime analysis modular arithmetic)
<p>This question is specifically related to</p>

<p><a href="https://stackoverflow.com/questions/3980416/time-complexity-of-euclids-algorithm">https://stackoverflow.com... | habedi/stack-exchange-dataset |
87,513 | Basic doubt in converting PDA to DPDA | <p><img src="https://i.stack.imgur.com/iUPch.png" alt="enter image description here"></p>

<p>This is the PDA to accept strings with equal number of $a$'s and $b$'s. The $\epsilon$ transition in the first state is causing nondeterminism.
When we have input a with Z at the bottom of the stack, then at the be... | formal languages context free pushdown automata | 1 | Basic doubt in converting PDA to DPDA -- (formal languages context free pushdown automata)
<p><img src="https://i.stack.imgur.com/iUPch.png" alt="enter image description here"></p>

<p>This is the PDA to accept strings with equal number of $a$'s and $b$'s. The $\epsilon$ transition in the first state is causing... | habedi/stack-exchange-dataset |
87,528 | Simulating AVL Tree Right, then Left rotation | <p>I have the following AVL tree and want to AVL-INSERT a node 5 into the tree. Since the middle branch will be unbalanced, I'm guessing that it will require a right rotation, then a left rotation to rebalance the tree. However, what would the actual steps to rebalance the tree look like?</p>

<p>Before insert ... | data structures balanced search trees binary search trees | 1 | Simulating AVL Tree Right, then Left rotation -- (data structures balanced search trees binary search trees)
<p>I have the following AVL tree and want to AVL-INSERT a node 5 into the tree. Since the middle branch will be unbalanced, I'm guessing that it will require a right rotation, then a left rotation to rebalance t... | habedi/stack-exchange-dataset |
87,535 | Can every DFA be simulated by a PDA? | <p>Given a Deterministic Finite Automata (DFA) $M_1$, does there always exist a Pushdown Automata (PDA) $M_2$ that accepts the same language as $M_1$? I.e. <strong>can any DFA be simulated by a PDA?</strong> Intuitively, it makes sense to me that a PDA is more powerful since it has an arbitrary amount of memory and c... | automata finite automata pushdown automata simulation | 1 | Can every DFA be simulated by a PDA? -- (automata finite automata pushdown automata simulation)
<p>Given a Deterministic Finite Automata (DFA) $M_1$, does there always exist a Pushdown Automata (PDA) $M_2$ that accepts the same language as $M_1$? I.e. <strong>can any DFA be simulated by a PDA?</strong> Intuitively, i... | habedi/stack-exchange-dataset |
87,541 | Infix to postfix by stack | <p>Convert in postfix</p>

<p>(((P+Q)<em>(R+S))/T) +(A</em>(B+C)) 
note : there is * between (P+Q) (R+s)
My attempt in image <a href="https://i.stack.imgur.com/oOdrT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oOdrT.png" alt="POSTFIX"></a> and size of stack = 15 given, but iam g... | algorithms | 1 | Infix to postfix by stack -- (algorithms)
<p>Convert in postfix</p>

<p>(((P+Q)<em>(R+S))/T) +(A</em>(B+C)) 
note : there is * between (P+Q) (R+s)
My attempt in image <a href="https://i.stack.imgur.com/oOdrT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oOdrT.png" alt="POSTFIX"></... | habedi/stack-exchange-dataset |
87,542 | How to Identify which instructions are represented by this microcode | <p>I'm having issues with a question how to identify which instruction are represented by this microcode. 
The pc starts at 5000 and 7000 and 7001 have values 31 and 64 - I'm really confused how to approach this wouldn't each line be an instruction? </p>

<pre><code> MAR = PC, PC+1, Assert MAR 
 IR = M... | computer architecture operating systems code generation | 1 | How to Identify which instructions are represented by this microcode -- (computer architecture operating systems code generation)
<p>I'm having issues with a question how to identify which instruction are represented by this microcode. 
The pc starts at 5000 and 7000 and 7001 have values 31 and 64 - I'm really con... | habedi/stack-exchange-dataset |
87,546 | Hardware thread context and register renaming | <p>I'm having some issues understanding what happens on a context switch with the physical register file in an out-of-order CPU that implements context switching. Suppose that a CPU consists of 4 hardware thread contexts and that the ISA consists of 32 architectural registers. Does the physical register file get overwr... | computer architecture cpu threads | 1 | Hardware thread context and register renaming -- (computer architecture cpu threads)
<p>I'm having some issues understanding what happens on a context switch with the physical register file in an out-of-order CPU that implements context switching. Suppose that a CPU consists of 4 hardware thread contexts and that the I... | habedi/stack-exchange-dataset |
87,548 | Does no parents imply variable independence in a Bayesian network? | <p>If A and B don't have parents on a Bayesian network, does that mean we can infer A and B are independent? Whatever the answer is, please explain how you get to it.</p>
 | bayesian network | 1 | Does no parents imply variable independence in a Bayesian network? -- (bayesian network)
<p>If A and B don't have parents on a Bayesian network, does that mean we can infer A and B are independent? Whatever the answer is, please explain how you get to it.</p>
 | habedi/stack-exchange-dataset |
87,551 | How many node does the final B-tree have? | <p>I'm currently studying the B-Trees chapter of Introduction to Algorithms. One of the question from the chapter is:</p>

<blockquote>
 <p>Suppose that we insert the keys $\{1,2,...,n\}$ into an empty B-tree with minimum degree 2. How many nodes does the final B-tree have?</p>
</blockquote>

<... | data structures search trees balanced search trees b tree | 1 | How many node does the final B-tree have? -- (data structures search trees balanced search trees b tree)
<p>I'm currently studying the B-Trees chapter of Introduction to Algorithms. One of the question from the chapter is:</p>

<blockquote>
 <p>Suppose that we insert the keys $\{1,2,...,n\}$ into an empty ... | habedi/stack-exchange-dataset |
87,556 | Negative edge weights in Dijkstra and Bellman Ford shortest path algorithms | <p>The main difference between Dijkstra algorithm and Bellman Ford algorithm that all texts (including CLRS) specify is that Dijkstra's algorithm need all non negative edge weights, while Bellman Ford algorithm can work with and detect -negative edge cycles. </p>

<p>However I feel a bit different, especially a... | algorithms graphs shortest path | 1 | Negative edge weights in Dijkstra and Bellman Ford shortest path algorithms -- (algorithms graphs shortest path)
<p>The main difference between Dijkstra algorithm and Bellman Ford algorithm that all texts (including CLRS) specify is that Dijkstra's algorithm need all non negative edge weights, while Bellman Ford algori... | habedi/stack-exchange-dataset |
87,560 | Finding missing edge weights in the context of minimum spanning tree | <p>I came across following problem:</p>

<blockquote>
 <p><strong>Problem 1</strong><br>
 Suppose that minimum spanning tree of the following edge weighted graph contains the edges with weights $x$ and $z$, then what are $x$ and $z$?
 <a href="https://i.stack.imgur.com/BjB4o.png" rel="nofollow no... | graphs minimum spanning tree | 1 | Finding missing edge weights in the context of minimum spanning tree -- (graphs minimum spanning tree)
<p>I came across following problem:</p>

<blockquote>
 <p><strong>Problem 1</strong><br>
 Suppose that minimum spanning tree of the following edge weighted graph contains the edges with weights $x$ a... | habedi/stack-exchange-dataset |
87,568 | Enforcing application layer consensus on top of a distributed consensus protocol | <p>If I understand correctly, the term "consensus" in distributed consensus algorithms means that all the participants ("peers") achieve a common understanding of some data value. Different algorithms can handle different types of failures or misbehavior by some of the peers, network disconnections or partitions, lost... | algorithms distributed systems fault tolerance byzantine | 1 | Enforcing application layer consensus on top of a distributed consensus protocol -- (algorithms distributed systems fault tolerance byzantine)
<p>If I understand correctly, the term "consensus" in distributed consensus algorithms means that all the participants ("peers") achieve a common understanding of some data valu... | habedi/stack-exchange-dataset |
87,569 | Using computer vision instead of algorithms? | <p>I have been thinking of a problem i have here with a calendar scheduler where i basically want to split a year into seconds and have access to the dataset of whole year.</p>

<p>In this year i assign blocks of time that varies in size can be big or can be small, it has to be placed in non assigned places ( w... | machine learning search algorithms computer vision python | 1 | Using computer vision instead of algorithms? -- (machine learning search algorithms computer vision python)
<p>I have been thinking of a problem i have here with a calendar scheduler where i basically want to split a year into seconds and have access to the dataset of whole year.</p>

<p>In this year i assign b... | habedi/stack-exchange-dataset |
87,586 | Finding an element in an unsorted array equal to its rank in $O(n)$ time | <p>I'm trying to figure out a way to think about this problem. Background: Given an unsorted array of distinct integers (can be positive or negative), I want to determine if there is an element in the array that is equal to its rank (i.e. if I do $S = Sort(Array)$, I want to find an element s.t. $S[i] = i$).</p>
&#... | algorithms sorting | 1 | Finding an element in an unsorted array equal to its rank in $O(n)$ time -- (algorithms sorting)
<p>I'm trying to figure out a way to think about this problem. Background: Given an unsorted array of distinct integers (can be positive or negative), I want to determine if there is an element in the array that is equal to... | habedi/stack-exchange-dataset |
87,592 | Understanding about creating a DFA | <p>This is a school assignment, I am fairly new to DFA's. </p>

<pre><code>L = {ww|w∈{0,1}*
</code></pre>

<p>I feel like I need to put this in words to understand how it works.</p>

<p>Translating L: </p>

<blockquote>
 <p>W can be a string of an infinite combination of 1s and... | finite automata | 1 | Understanding about creating a DFA -- (finite automata)
<p>This is a school assignment, I am fairly new to DFA's. </p>

<pre><code>L = {ww|w∈{0,1}*
</code></pre>

<p>I feel like I need to put this in words to understand how it works.</p>

<p>Translating L: </p>

<blockquote>
 <... | habedi/stack-exchange-dataset |
87,595 | Does this proof work for infinite regular languages | <p>My proof was deemed false because it does not work for infinite regular languages, but I don't understand why.</p>

<p>Prove: "If we remove one string from any nonempty regular set, the resulting set is still regular.</p>

<p>I used to lemmas:</p>

<ul>
<li>A set containing only one strin... | formal languages regular languages closure properties | 1 | Does this proof work for infinite regular languages -- (formal languages regular languages closure properties)
<p>My proof was deemed false because it does not work for infinite regular languages, but I don't understand why.</p>

<p>Prove: "If we remove one string from any nonempty regular set, the resulting se... | habedi/stack-exchange-dataset |
87,600 | Is complexity class $\Sigma^1_1$ from polynomial hierarchy decidable? | <p>It is within <em>polynomial</em> hierarchy so I assumed it is decidable. The picture like <a href="https://rjlipton.files.wordpress.com/2010/01/classes.jpg" rel="nofollow noreferrer">this</a> further hinted in that direction.
Yet, in a <a href="https://arxiv.org/pdf/cs/0610027.pdf" rel="nofollow noreferrer">pape... | complexity theory complexity classes | 1 | Is complexity class $\Sigma^1_1$ from polynomial hierarchy decidable? -- (complexity theory complexity classes)
<p>It is within <em>polynomial</em> hierarchy so I assumed it is decidable. The picture like <a href="https://rjlipton.files.wordpress.com/2010/01/classes.jpg" rel="nofollow noreferrer">this</a> further hinte... | habedi/stack-exchange-dataset |
87,602 | How to compute all primes between upto $n$ in time $O(n)$ time? | <p>Suppose that I want to compute all the prime numbers between 2 and $n$. The natural way or most obvious way to do so is given below. Let $A$ is an array contain the numbers from $1$ to $n$.</p>

<ol>
<li>For $j=2$ to $j=\sqrt n$</li>
<li>mark multiples of $j$ from $A$</li>
</ol>

<p>Runni... | algorithms enumeration primes | 1 | How to compute all primes between upto $n$ in time $O(n)$ time? -- (algorithms enumeration primes)
<p>Suppose that I want to compute all the prime numbers between 2 and $n$. The natural way or most obvious way to do so is given below. Let $A$ is an array contain the numbers from $1$ to $n$.</p>

<ol>
<li>Fo... | habedi/stack-exchange-dataset |
87,613 | Finding common structure in strings | <p>I don't even know the right words to describe my problem, so I'll start with an example:</p>

<p>"aabaa", "ccrcc", "ffaff" are equivalent to some extent, because they all have the same length and follow the same formula: twice one letter, once another letter and finally twice the first letter again.</p>
... | algorithms strings | 1 | Finding common structure in strings -- (algorithms strings)
<p>I don't even know the right words to describe my problem, so I'll start with an example:</p>

<p>"aabaa", "ccrcc", "ffaff" are equivalent to some extent, because they all have the same length and follow the same formula: twice one letter, once anoth... | habedi/stack-exchange-dataset |
87,616 | Where is PCP(1,1) located? | <p>The PCP-Theorem states that $PCP(log(n), 1) = NP$. So can anyone explain, where $PCP(1,1)$ is located in relation to other classes? 
My thoughts:</p>

<p>$P \subseteq PCP(1,1) \subseteq PCP(log(n)) = NP$
Is there some theorem like "$P \neq NP \implies PCP(1,1) ...$"
What is the relation to the pr... | complexity theory | 1 | Where is PCP(1,1) located? -- (complexity theory)
<p>The PCP-Theorem states that $PCP(log(n), 1) = NP$. So can anyone explain, where $PCP(1,1)$ is located in relation to other classes? 
My thoughts:</p>

<p>$P \subseteq PCP(1,1) \subseteq PCP(log(n)) = NP$
Is there some theorem like "$P \neq NP \implies... | habedi/stack-exchange-dataset |
87,620 | NP completeness proof of sensor selection problem | <p>There are $n$ points in a plane. </p>

<p>The decision problem is to identify whether there exists a set $S$ of $k$ or less points from the $n$ points such that all $n$ points are at most $d$ distance from the selected set of points. </p>

<p>I am trying to use the sensor coverage problem where the i... | np complete np hard np set cover | 1 | NP completeness proof of sensor selection problem -- (np complete np hard np set cover)
<p>There are $n$ points in a plane. </p>

<p>The decision problem is to identify whether there exists a set $S$ of $k$ or less points from the $n$ points such that all $n$ points are at most $d$ distance from the selected se... | habedi/stack-exchange-dataset |
87,624 | How can I make a pipeline with undefined/unlimited stages? | <p>I've been told that if you understand a pipeline then you should be able to make it with any depth, but I can only do 4 stages and <em>maybe</em> 5 if the memory is not too slow. How can I learn how to make infinite pipelines?</p>
 | cpu pipelines | 1 | How can I make a pipeline with undefined/unlimited stages? -- (cpu pipelines)
<p>I've been told that if you understand a pipeline then you should be able to make it with any depth, but I can only do 4 stages and <em>maybe</em> 5 if the memory is not too slow. How can I learn how to make infinite pipelines?</p>
 | habedi/stack-exchange-dataset |
87,631 | Reservoir sampling algorithm probability | <p>I'm reading about the reservoir sampling technique called <em>Algorithm R</em>.</p>

<p>The idea is we can take a sample of size $n$ from a population of size $N$ even when $N$ is unknown/too expensive to retrieve in $N$ time. I quote a sample implementation from wikipedia:</p>

<blockquote>
<pre... | algorithms probability theory | 1 | Reservoir sampling algorithm probability -- (algorithms probability theory)
<p>I'm reading about the reservoir sampling technique called <em>Algorithm R</em>.</p>

<p>The idea is we can take a sample of size $n$ from a population of size $N$ even when $N$ is unknown/too expensive to retrieve in $N$ time. I quot... | habedi/stack-exchange-dataset |
87,636 | Can we find size of total interval in O(N) | <p>Let's say we have given $N$ intervals in the form $[x, y]$, both $x,y$ are integers , we want to find the number of integers covered by at least one interval of all $N$ intervals, (look in the example for better understand). </p>

<p>The intervals may or may not intersect.</p>

<p>Example: Let N = 3... | intervals | 1 | Can we find size of total interval in O(N) -- (intervals)
<p>Let's say we have given $N$ intervals in the form $[x, y]$, both $x,y$ are integers , we want to find the number of integers covered by at least one interval of all $N$ intervals, (look in the example for better understand). </p>

<p>The intervals ma... | habedi/stack-exchange-dataset |
87,653 | Weak bisimulation up-to $\approx$ | <p>Given this definition of weak bisimilarity:</p>

<p>A configuration relation $\mathcal{R}$ is a weak bisimulation
 provided that whenever $P\ \mathcal{R}\ Q$ and $\alpha$ is $\mu$ or $\tau$ action then: </p>

<ol>
<li><p>$P \to^\alpha P'$ then $Q \Rightarrow^\widehat{\alpha} Q'$ for some $Q... | automata formal methods process algebras | 1 | Weak bisimulation up-to $\approx$ -- (automata formal methods process algebras)
<p>Given this definition of weak bisimilarity:</p>

<p>A configuration relation $\mathcal{R}$ is a weak bisimulation
 provided that whenever $P\ \mathcal{R}\ Q$ and $\alpha$ is $\mu$ or $\tau$ action then: </p>

<ol>&#... | habedi/stack-exchange-dataset |
87,660 | Necessity of convolution operations for product of two polynomials via brute force method | <p>Reference: Page 4 of this <a href="http://algorithm.cs.nthu.edu.tw/~course/Extra_Info/Divide%20and%20Conquer_supplement.pdf" rel="nofollow noreferrer">document</a></p>

<p>Given two polynomials $p(x)$ and $q(x)$ each of degree $n$ represented in coefficient form, it takes $\mathcal{\Theta}(n)$ time to evalua... | algorithms algorithm analysis polynomials multiplication | 1 | Necessity of convolution operations for product of two polynomials via brute force method -- (algorithms algorithm analysis polynomials multiplication)
<p>Reference: Page 4 of this <a href="http://algorithm.cs.nthu.edu.tw/~course/Extra_Info/Divide%20and%20Conquer_supplement.pdf" rel="nofollow noreferrer">document</a></... | habedi/stack-exchange-dataset |
87,663 | Does a turing machine halt with input left on tape? | <p><a href="https://i.stack.imgur.com/JeNB5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JeNB5.png" alt="consider the turing machine below "></a></p>

<p>is the string aabb in the language of this Turing machine ?? as upon reading aa it goes to the final state but upon b there is no transi... | turing machines | 1 | Does a turing machine halt with input left on tape? -- (turing machines)
<p><a href="https://i.stack.imgur.com/JeNB5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JeNB5.png" alt="consider the turing machine below "></a></p>

<p>is the string aabb in the language of this Turing machine ?? as... | habedi/stack-exchange-dataset |
87,664 | Solving Recurrence relation with master method? | <p>I have to solve the following recurrence equation and I thought to solve it with case #3 of the master theorem. Can I do that?</p>

<p>$$T(1) = c>0 $$
$$T(n) = 9T(n/3) + f(n)$$
$$f(n) = n^2\cdot lg^3 (n) + n^3 \cdot lg(n)$$</p>

<p>I think that $f(n) = \Omega(n^{log_ba})$ where $a=9, b=3$ ... | recurrence relation master theorem check my answer | 1 | Solving Recurrence relation with master method? -- (recurrence relation master theorem check my answer)
<p>I have to solve the following recurrence equation and I thought to solve it with case #3 of the master theorem. Can I do that?</p>

<p>$$T(1) = c>0 $$
$$T(n) = 9T(n/3) + f(n)$$
$$f(n) = n^2\cdot... | habedi/stack-exchange-dataset |
87,677 | Perfect natural number | <p>A perfect natural number is that which is equal to the sum of it's divisors.
For example 6 is perfect: 1+2+3=6 also 28 is perfect.</p>

<p>Prove the following language is NP hard: </p>

<p>L={< n> | n is a perfect natural number}.</p>

<p>You can use the fact that if </p>

<p>$... | complexity theory | 1 | Perfect natural number -- (complexity theory)
<p>A perfect natural number is that which is equal to the sum of it's divisors.
For example 6 is perfect: 1+2+3=6 also 28 is perfect.</p>

<p>Prove the following language is NP hard: </p>

<p>L={< n> | n is a perfect natural number}.</p>

<p>Y... | habedi/stack-exchange-dataset |
87,679 | Dangling else problem | <p>I was reading a book about compiler design, then in the CFG section, they introduced the dangling-else problem. They offered to match the the <code>else</code> with the last <code>if</code>. I still don't see how this solves the problem. Can somebody give me an explanation? </p>

<p>I searched before I put t... | compilers parsers | 1 | Dangling else problem -- (compilers parsers)
<p>I was reading a book about compiler design, then in the CFG section, they introduced the dangling-else problem. They offered to match the the <code>else</code> with the last <code>if</code>. I still don't see how this solves the problem. Can somebody give me an explanatio... | habedi/stack-exchange-dataset |
87,698 | Sort by typical position? | <p>Lets say, we have a lot of lists (sequences of variable length) of some limited set of elements:</p>

<pre><code>[A, B, D, E, Q], [A, D], [A, C, E, F, G, H, Y, Z], [B, A, E, D, Z, Y], ...
</code></pre>

<p>The problem is to get the single order, based on "how typical" some position is, eg, in our... | string metrics ordering | 1 | Sort by typical position? -- (string metrics ordering)
<p>Lets say, we have a lot of lists (sequences of variable length) of some limited set of elements:</p>

<pre><code>[A, B, D, E, Q], [A, D], [A, C, E, F, G, H, Y, Z], [B, A, E, D, Z, Y], ...
</code></pre>

<p>The problem is to get the single ord... | habedi/stack-exchange-dataset |
87,700 | Prove EXP to be regular or non-regular | <p>Given L is regular, Prove/Disprove that the following language is regular or not.
$EXP = \{w| w^{|w|} ∈L\}$</p>
 | regular languages | 1 | Prove EXP to be regular or non-regular -- (regular languages)
<p>Given L is regular, Prove/Disprove that the following language is regular or not.
$EXP = \{w| w^{|w|} ∈L\}$</p>
 | habedi/stack-exchange-dataset |
87,704 | Expander Graph - Is the following graph family an expander graph? | <blockquote>
 <p>Consider the family of graphs of degree $6$ with vertex set $V_n=(a, b, c)$ for all $0\leq a, b, c \leq n-1$ with $(a,b,c)$ being connected to $(a-1, b, c),(a+1, b,c), (a, b-1, c), (a, b+1, c), (a,b,c-1), (a,b, c+1)$, with all operations modulo $n$. Show that this is not a family of expander gra... | graphs expanders | 1 | Expander Graph - Is the following graph family an expander graph? -- (graphs expanders)
<blockquote>
 <p>Consider the family of graphs of degree $6$ with vertex set $V_n=(a, b, c)$ for all $0\leq a, b, c \leq n-1$ with $(a,b,c)$ being connected to $(a-1, b, c),(a+1, b,c), (a, b-1, c), (a, b+1, c), (a,b,c-1), (a,b... | habedi/stack-exchange-dataset |
87,709 | Is the class of Turing-recognizable languages closed under Homomorphism? | <p>Would this proof work?</p>

<p>Given a language $L$ that is Turing recognizable and a TM M that recognizes it and a homomorphism $f$, we build a NTM M' that recognizes $f(L)$, </p>

<p>M' looks like this:</p>

<p>On input $w$ :</p>

<p>-Non-deterministicly feed words from $\Sigma^{*}$... | complexity theory computability | 1 | Is the class of Turing-recognizable languages closed under Homomorphism? -- (complexity theory computability)
<p>Would this proof work?</p>

<p>Given a language $L$ that is Turing recognizable and a TM M that recognizes it and a homomorphism $f$, we build a NTM M' that recognizes $f(L)$, </p>

<p>M' loo... | habedi/stack-exchange-dataset |
87,711 | How to minimally extend a digraph such that all nodes are on a cycle? | <p>Let's say we have a directed graph with $n$ nodes and $m$ edges. For each node we want to make path that will start from this node, possibly traverse some other nodes and finish in the same node, in other words we want to make a cycle through each node. It is allowed to add edges that start and finish in the same no... | graphs graph traversal | 1 | How to minimally extend a digraph such that all nodes are on a cycle? -- (graphs graph traversal)
<p>Let's say we have a directed graph with $n$ nodes and $m$ edges. For each node we want to make path that will start from this node, possibly traverse some other nodes and finish in the same node, in other words we want ... | habedi/stack-exchange-dataset |
87,716 | How to show MULT={a#b#c| a,b,c binary natural numbers and a ✕ b = c} is in Log Space? | <p>Let MULT$=\{a\#b\#c| a,b,c \text{ binary natural numbers and } a\times b=c\}$</p>

<p>Prove that MULT $\in L$</p>

<p>How do I show that this language, MULT, is computable in Logarithmic space?</p>

<p>Let us assume a#b#c is on the input tape, we now need away of multiplying a with b and chec... | complexity theory space complexity | 1 | How to show MULT={a#b#c| a,b,c binary natural numbers and a ✕ b = c} is in Log Space? -- (complexity theory space complexity)
<p>Let MULT$=\{a\#b\#c| a,b,c \text{ binary natural numbers and } a\times b=c\}$</p>

<p>Prove that MULT $\in L$</p>

<p>How do I show that this language, MULT, is computable in ... | habedi/stack-exchange-dataset |
87,721 | What is the time complexity of this Factorization program? | <p><code>input: n-bit integer X</code></p>

<p><code>output: list of prime factors and their multiplicity</code></p>

<p><code>acc = X</code></p>

<p><code>for i = 2 ... sqrt( X )</code></p>

<p><code>--count = 0</code></p>

<p><code>--while acc % i == 0</code></p>

<p><c... | algorithms algorithm analysis time complexity asymptotics java | 1 | What is the time complexity of this Factorization program? -- (algorithms algorithm analysis time complexity asymptotics java)
<p><code>input: n-bit integer X</code></p>

<p><code>output: list of prime factors and their multiplicity</code></p>

<p><code>acc = X</code></p>

<p><code>for i = 2 ...... | habedi/stack-exchange-dataset |
87,726 | A plane-sweep algorithm for a points in triangles inclusion problem | <p>I was given the following homework assignment:</p>

<p>Consider a set of $p$ points and $t$ triangles in the plane. The triangles are pairwise disjoint, that is, their edges do not intersect, no triangle lies in the interior of another, and no edge/vertex is part of more than one triangle. The points are in ... | asymptotics runtime analysis computational geometry | 1 | A plane-sweep algorithm for a points in triangles inclusion problem -- (asymptotics runtime analysis computational geometry)
<p>I was given the following homework assignment:</p>

<p>Consider a set of $p$ points and $t$ triangles in the plane. The triangles are pairwise disjoint, that is, their edges do not int... | habedi/stack-exchange-dataset |
87,728 | Recursive Algorithm Copying Array vs. Time Complexity | <p>If I am implementing binary search using a recursive algorithm on an array it will be bounded by $O(\log(n))$. 
However, what will occur if the array is <strong>NOT</strong> passed by referenced and rather by value. 
This means that the recursive call will have to first copy the elements of the array (half t... | algorithm analysis time complexity recursion | 1 | Recursive Algorithm Copying Array vs. Time Complexity -- (algorithm analysis time complexity recursion)
<p>If I am implementing binary search using a recursive algorithm on an array it will be bounded by $O(\log(n))$. 
However, what will occur if the array is <strong>NOT</strong> passed by referenced and rather by ... | habedi/stack-exchange-dataset |
87,746 | Composition of handler types in algebraic effects and handlers | <p>In the paper <a href="https://www.sciencedirect.com/science/article/pii/S1571066115000705" rel="nofollow noreferrer">"An introduction to algebraic effects and handlers"</a> (Pretnar, Matija. Electronic Notes in Theoretical Computer Science 319 (2015): 19-35), handlers get a handler type that looks like a function ty... | lambda calculus | 1 | Composition of handler types in algebraic effects and handlers -- (lambda calculus)
<p>In the paper <a href="https://www.sciencedirect.com/science/article/pii/S1571066115000705" rel="nofollow noreferrer">"An introduction to algebraic effects and handlers"</a> (Pretnar, Matija. Electronic Notes in Theoretical Computer S... | habedi/stack-exchange-dataset |
87,748 | Abstractions in call-by-push-value | <p>In <a href="https://link.springer.com/chapter/10.1007/978-94-007-0954-6_2" rel="noreferrer">"Call-by-push-value: A subsuming paradigm."</a> (Levy, Paul Blain. Springer, Dordrecht, 2003. 27-47) terms of the lambda calculus get split in to values and computations, with the slogan "A value is, a computation does".</p>&... | lambda calculus | 1 | Abstractions in call-by-push-value -- (lambda calculus)
<p>In <a href="https://link.springer.com/chapter/10.1007/978-94-007-0954-6_2" rel="noreferrer">"Call-by-push-value: A subsuming paradigm."</a> (Levy, Paul Blain. Springer, Dordrecht, 2003. 27-47) terms of the lambda calculus get split in to values and computations... | habedi/stack-exchange-dataset |
87,755 | relational algebra to get unique pairs | <p>Let's say we are given this table of the relation Person(name, hobby)</p>

<pre><code>name hobby
bob hockey
alice basketball
mary cricket
mark basketball
rick snowboarding
andy hockey
</code></pre>

<p>How would I use relational algebra to find the hobby that... | relational algebra | 1 | relational algebra to get unique pairs -- (relational algebra)
<p>Let's say we are given this table of the relation Person(name, hobby)</p>

<pre><code>name hobby
bob hockey
alice basketball
mary cricket
mark basketball
rick snowboarding
andy hockey
</code></pre>
&#... | habedi/stack-exchange-dataset |
87,765 | Time Complexity of reconstructing corrupted file | <p>Suppose all the spaces between the words(only small letter alphabets and no punctuation) in a file has been deleted and we need to reconstruct the file. There is a dictionary available which answers whether a word is valid or not in O(1).</p>

<p>Brute force approach is to use backtracking i.e try out all th... | algorithms algorithm analysis strings | 1 | Time Complexity of reconstructing corrupted file -- (algorithms algorithm analysis strings)
<p>Suppose all the spaces between the words(only small letter alphabets and no punctuation) in a file has been deleted and we need to reconstruct the file. There is a dictionary available which answers whether a word is valid or... | habedi/stack-exchange-dataset |
87,780 | How to maximize $(h[j]-h[i])(j-i)$ in $O(n)$ | <p>I see many algorithmic problems that always reduce to something a long the lines of:</p>

<p>You have an <strong>integer</strong> array $h[1..n]\geq 0$, you need to find $i,j$ such that maximizes $(h[j]-h[i])(j-i)$ in $O(n)$ time. </p>

<p>Obviously the $O(n^2)$ time solution is to consider all pairs... | algorithms algorithm analysis optimization | 1 | How to maximize $(h[j]-h[i])(j-i)$ in $O(n)$ -- (algorithms algorithm analysis optimization)
<p>I see many algorithmic problems that always reduce to something a long the lines of:</p>

<p>You have an <strong>integer</strong> array $h[1..n]\geq 0$, you need to find $i,j$ such that maximizes $(h[j]-h[i])(j-i)$ i... | habedi/stack-exchange-dataset |
87,787 | what is the 'x :=' part mean in a hoare triple? | <p>In <a href="https://en.wikipedia.org/wiki/Hoare_logic" rel="nofollow noreferrer">Hoare logic</a>, there's a thing called a <a href="https://en.wikipedia.org/wiki/Hoare_logic#Hoare_triple" rel="nofollow noreferrer"><em>Hoare triple</em></a>, e.g.$$
\begin{array}{ccccc}
\{x = 2\} & & x := x+1 & &am... | notation hoare logic | 1 | what is the 'x :=' part mean in a hoare triple? -- (notation hoare logic)
<p>In <a href="https://en.wikipedia.org/wiki/Hoare_logic" rel="nofollow noreferrer">Hoare logic</a>, there's a thing called a <a href="https://en.wikipedia.org/wiki/Hoare_logic#Hoare_triple" rel="nofollow noreferrer"><em>Hoare triple</em></a>, e.... | habedi/stack-exchange-dataset |
87,789 | Segmentation technique for handwritten text (cursive and unconstrained) | <p>Although I am new to the computer vision domain, I am tasked with automating handwritten text recognition from bank cheques. I first did some preprocessing(blurring and binarization) and then dilated it so that I could segment the words. But since the words are handwritten (cursive and unconstrained), the segmentati... | image processing computer vision | 1 | Segmentation technique for handwritten text (cursive and unconstrained) -- (image processing computer vision)
<p>Although I am new to the computer vision domain, I am tasked with automating handwritten text recognition from bank cheques. I first did some preprocessing(blurring and binarization) and then dilated it so t... | habedi/stack-exchange-dataset |
87,797 | The order of which time complexity is higher, 3 ^ log(n) or n ^ 3? | <p>Which one has a higher order time complexity:</p>

<ul>
<li>$n ^ 3$</li>
<li>$3 ^ {\log n}$</li>
</ul>

<p>I know that an exponential time order is higher than polynomials. However, it uses a logarithmic power which is low for a large n, while n^3 or more could remain still high, not?</p>... | time complexity | 1 | The order of which time complexity is higher, 3 ^ log(n) or n ^ 3? -- (time complexity)
<p>Which one has a higher order time complexity:</p>

<ul>
<li>$n ^ 3$</li>
<li>$3 ^ {\log n}$</li>
</ul>

<p>I know that an exponential time order is higher than polynomials. However, it uses a logarithm... | habedi/stack-exchange-dataset |
87,798 | How can I solve a recursive equation with a summation notation? | <p>Consider the following formula:</p>

<p>$T(n) = n + \sum_{k=1}^{n-1} [T(n-k) + T(k)], T(1) = 1$</p>

<p>What is the order of T?</p>
 | time complexity recurrence relation | 1 | How can I solve a recursive equation with a summation notation? -- (time complexity recurrence relation)
<p>Consider the following formula:</p>

<p>$T(n) = n + \sum_{k=1}^{n-1} [T(n-k) + T(k)], T(1) = 1$</p>

<p>What is the order of T?</p>
 | habedi/stack-exchange-dataset |
87,801 | Some points about type checking of simply typed $\lambda$-calculus? | <h1>type checking</h1>

<p>I was preparing examples of type checking in simply typed $\lambda$-calculus. I wanted to explain it to my audience in the way of implementation. And I found a bit tricky point in the typing rule of application, which is as follows.</p>

<p>$$
 \frac {\Gamma \vdash t_1:... | lambda calculus type theory | 1 | Some points about type checking of simply typed $\lambda$-calculus? -- (lambda calculus type theory)
<h1>type checking</h1>

<p>I was preparing examples of type checking in simply typed $\lambda$-calculus. I wanted to explain it to my audience in the way of implementation. And I found a bit tricky point in the ... | habedi/stack-exchange-dataset |
87,803 | Big-O complexity of finding exception handler for zero-cost exceptions | <p>I am wondering what the time complexity of finding the most appropriate exception handler for dispatching zero-cost exceptions is.</p>

<p>For zero-cost (this refers to execution under the assumption that no exceptoins occur) exception dispatching, the compiler stores a big table of all possible exceptions. ... | algorithms complexity theory data structures time complexity compilers | 1 | Big-O complexity of finding exception handler for zero-cost exceptions -- (algorithms complexity theory data structures time complexity compilers)
<p>I am wondering what the time complexity of finding the most appropriate exception handler for dispatching zero-cost exceptions is.</p>

<p>For zero-cost (this ref... | habedi/stack-exchange-dataset |
87,804 | Number of ways to make $n$ cents | <p>How to find a recurrence relation for $F(n)$ the number of ways to make n cents change using only pennies (4 cents), nickels(5cents), and dimes(10cents) and ordering matters. </p>

<p>There are three exclusive case here </p>

<ol>
<li>Start with pennies then new subproblem is $F(n-4)$</li>
<l... | recurrence relation | 1 | Number of ways to make $n$ cents -- (recurrence relation)
<p>How to find a recurrence relation for $F(n)$ the number of ways to make n cents change using only pennies (4 cents), nickels(5cents), and dimes(10cents) and ordering matters. </p>

<p>There are three exclusive case here </p>

<ol>
<li>Star... | habedi/stack-exchange-dataset |
87,812 | Comparison between MA and $P^{NP}$ | <p>I am aware that $MA \subseteq ZPP^{NP} \subseteq \Sigma_2^{P}\cap \Pi_{2}^{P}$ and also $NP^{BPP} \subseteq MA \subseteq AM \subseteq \Pi_{2}^{P}$.</p>

<p>My question is: In this whole thing, where does $P^{NP}$ lie? (Obviously, $P^{NP} \subseteq ZPP^{NP}$) But, what about the relationship between $MA$ and ... | complexity theory time complexity complexity classes | 1 | Comparison between MA and $P^{NP}$ -- (complexity theory time complexity complexity classes)
<p>I am aware that $MA \subseteq ZPP^{NP} \subseteq \Sigma_2^{P}\cap \Pi_{2}^{P}$ and also $NP^{BPP} \subseteq MA \subseteq AM \subseteq \Pi_{2}^{P}$.</p>

<p>My question is: In this whole thing, where does $P^{NP}$ lie... | habedi/stack-exchange-dataset |
87,814 | Perceptrons: Functions not learnable without bias | <p>I am trying to determine which functions are not learnable without a bias when building a perceptron. The set of functions I need to evaluate is {NOT, OR, AND}. </p>

<p>Could someone help interpret these results? </p>

<p>AND FUNCTION</p>

<p><a href="https://imgur.com/a/OTFUT" rel="nofollow... | machine learning perceptron | 1 | Perceptrons: Functions not learnable without bias -- (machine learning perceptron)
<p>I am trying to determine which functions are not learnable without a bias when building a perceptron. The set of functions I need to evaluate is {NOT, OR, AND}. </p>

<p>Could someone help interpret these results? </p>
&#x... | habedi/stack-exchange-dataset |
87,828 | Complexity of the problem to determine if a spanning tree exists inside a connected graph | <p>Given a connected graph G, what is the complexity of the problem to determine if a spanning tree with a number of leaves less or equal to k exists inside G? I don't really know how to determine it and how to reach a proper solution to this. </p>
 | complexity theory graphs | 1 | Complexity of the problem to determine if a spanning tree exists inside a connected graph -- (complexity theory graphs)
<p>Given a connected graph G, what is the complexity of the problem to determine if a spanning tree with a number of leaves less or equal to k exists inside G? I don't really know how to determine it ... | habedi/stack-exchange-dataset |
87,838 | How to find the supremum over all the "good" (interior) polytopes for a given set of 3D points? | <p>Let $S \subset \mathbf{R}^3$ be a set of points in 3D and let $O=(x_0,y_0,z_0)$ be the origin/point of reference. </p>

<p>We consider a <a href="https://en.wikipedia.org/wiki/Polytope" rel="nofollow noreferrer">convex polytope</a> $P$ <em>good</em> / <em>interior</em> if:</p>

<ol>
<li><p>$P$ is... | algorithms optimization linear programming convex hull | 1 | How to find the supremum over all the "good" (interior) polytopes for a given set of 3D points? -- (algorithms optimization linear programming convex hull)
<p>Let $S \subset \mathbf{R}^3$ be a set of points in 3D and let $O=(x_0,y_0,z_0)$ be the origin/point of reference. </p>

<p>We consider a <a href="https:/... | habedi/stack-exchange-dataset |
87,840 | Finding the number of ways to partition $\{1,...,N\}$ into $P_1$ and $P_2$ such that $sum(P_1) = sum(P_2)$ for a given $N$ | <p>I am trying to think of how to optimize the following problem:</p>

<p>Let $S = \{1,2,...,N\}$. How many ways can $S$ be partitioned into non-empty subsets $P_1$ and $P_2$ such that $sum(P_1) = sum(P_2)$? I have implemented an algorithm that checks all partitions of $S$ into 2 subsets $P_1$ and $P_2$, but I... | algorithms optimization sets partitions | 1 | Finding the number of ways to partition $\{1,...,N\}$ into $P_1$ and $P_2$ such that $sum(P_1) = sum(P_2)$ for a given $N$ -- (algorithms optimization sets partitions)
<p>I am trying to think of how to optimize the following problem:</p>

<p>Let $S = \{1,2,...,N\}$. How many ways can $S$ be partitioned into non... | habedi/stack-exchange-dataset |
87,851 | What is the difference between $AC^2$ and $FO (\log \log n)$ complexity classes? | <p>$FOLL$ or $FO (\log \log n)$ is a complexity class of all problems solvable by uniform poly-size circuit families of unbounded fan-in and depth $O(\log \log n)$.</p>

<p>$AC^2$ is a complexity class of all problems recognized by boolean circuits with depth $O(\log ^{2}n)$ and polynomial number of unlimited f... | complexity theory | 1 | What is the difference between $AC^2$ and $FO (\log \log n)$ complexity classes? -- (complexity theory)
<p>$FOLL$ or $FO (\log \log n)$ is a complexity class of all problems solvable by uniform poly-size circuit families of unbounded fan-in and depth $O(\log \log n)$.</p>

<p>$AC^2$ is a complexity class of all... | habedi/stack-exchange-dataset |
87,857 | Convex hull of fixed size | <p>I have heard that the quickhull algorithm can be modified if the size of the convex hull (the number of points it consists of) is known beforehand, in which case it will run in linear time. What modifications are required in order to decrease the time complexity of the convex hull algorithm?</p>
 | algorithms time complexity convex hull | 1 | Convex hull of fixed size -- (algorithms time complexity convex hull)
<p>I have heard that the quickhull algorithm can be modified if the size of the convex hull (the number of points it consists of) is known beforehand, in which case it will run in linear time. What modifications are required in order to decrease the ... | habedi/stack-exchange-dataset |
87,859 | Do Nested Monte Carlo Algorithm always find the best score where score is the number of moves on the leftmost path | <p>I am studying <a href="http://www.lamsade.dauphine.fr/%7Ecazenave/papers/nested.pdf" rel="nofollow noreferrer">Nested Monte Carlo Algorithm</a> addressing the problem of guiding the search toward better states when there is no available heuristic. It uses nested levels of random games in order to guide the se... | algorithms algorithm analysis monte carlo | 1 | Do Nested Monte Carlo Algorithm always find the best score where score is the number of moves on the leftmost path -- (algorithms algorithm analysis monte carlo)
<p>I am studying <a href="http://www.lamsade.dauphine.fr/%7Ecazenave/papers/nested.pdf" rel="nofollow noreferrer">Nested Monte Carlo Algorithm</a> addressing ... | habedi/stack-exchange-dataset |
87,860 | Obtaining a recurrence from a rational generating function | <p>Looking at some Generating functions of a series, I have conjectured - </p>

<p>If $G(x) \ =\ \frac{1}{1-x^{t_1}-x^{t_2}-...-x^{t_n}}$, then the recurrence equation of the the series is -</p>

<p>$a_n = a_{n-t_1}+a_{n-t_2}+...+a_{n-t_n}$</p>

<p>How can I prove or disprove this?</p>
 | combinatorics recurrence relation generating functions | 1 | Obtaining a recurrence from a rational generating function -- (combinatorics recurrence relation generating functions)
<p>Looking at some Generating functions of a series, I have conjectured - </p>

<p>If $G(x) \ =\ \frac{1}{1-x^{t_1}-x^{t_2}-...-x^{t_n}}$, then the recurrence equation of the the series is -</p... | habedi/stack-exchange-dataset |
87,867 | The complexity of checking the correctness of the problem solution on the Turing machine | <p>There is a powerful simulation of Turing machine. At the input it takes problems of class P. At the output it gives solution for the problem. So, is it easier (in complexity theory) to test the correctness solution of the given problem than to solve this problem? If checking the solution is really easier than solvin... | algorithms complexity theory algorithm analysis | 1 | The complexity of checking the correctness of the problem solution on the Turing machine -- (algorithms complexity theory algorithm analysis)
<p>There is a powerful simulation of Turing machine. At the input it takes problems of class P. At the output it gives solution for the problem. So, is it easier (in complexity t... | habedi/stack-exchange-dataset |
87,870 | How $N$ qubits correspond to $2^N$ bits? | <p>I read everywhere that $N$ qubits correspond to $2^N$ bits. Let's start with 1 qubit, which is commonly represented by $\alpha |0\rangle + \beta |1\rangle$ where alpha and beta are complex numbers. This looks to me like infinite bits. How do they choose alpha and beta so that it becomes 2 bits?</p>

<p>Edit:... | computation models quantum computing | 1 | How $N$ qubits correspond to $2^N$ bits? -- (computation models quantum computing)
<p>I read everywhere that $N$ qubits correspond to $2^N$ bits. Let's start with 1 qubit, which is commonly represented by $\alpha |0\rangle + \beta |1\rangle$ where alpha and beta are complex numbers. This looks to me like infinite bits.... | habedi/stack-exchange-dataset |
87,873 | Complexity of Two problems graphs with cycle | <p>I want to determine the complexity of these two problems (with a given k):</p>

<p>1) Determine if the graph G has a cycle of length less or equal than k;</p>

<p>2) Determine if the graph G has a cycle of length equal or more than k.</p>

<p>For the first problem, I think it is NP-complete b... | complexity theory graphs np complete | 1 | Complexity of Two problems graphs with cycle -- (complexity theory graphs np complete)
<p>I want to determine the complexity of these two problems (with a given k):</p>

<p>1) Determine if the graph G has a cycle of length less or equal than k;</p>

<p>2) Determine if the graph G has a cycle of length e... | habedi/stack-exchange-dataset |
87,874 | How to handle dfa with countless states? | <p>I have a question regarding DFA:</p>

<p><em>Design a DFA M with alphabet $\sum = \ {\{0,1,2,R}\}$ where the states remember actual sums of the number, except that the sum is reset to 0 whenever the symbol $R$ appears. Show diagrammatically how this DFA can be constructed. What is the problem with this DFA?<... | automata finite automata | 1 | How to handle dfa with countless states? -- (automata finite automata)
<p>I have a question regarding DFA:</p>

<p><em>Design a DFA M with alphabet $\sum = \ {\{0,1,2,R}\}$ where the states remember actual sums of the number, except that the sum is reset to 0 whenever the symbol $R$ appears. Show diagrammatical... | habedi/stack-exchange-dataset |
87,875 | What is the best way to algorithmically sort physical boxes? | <p>I work part time at UPS. Part of my job consists of taking boxes from in front of me, determining if the correct cage (1 of 6 moving cages) is behind me (true about 50% of the time), and then putting the box down either in the cage or back in front of me. There can be 6-20 boxes in front of me at any given time depe... | algorithms sorting radix sort | 1 | What is the best way to algorithmically sort physical boxes? -- (algorithms sorting radix sort)
<p>I work part time at UPS. Part of my job consists of taking boxes from in front of me, determining if the correct cage (1 of 6 moving cages) is behind me (true about 50% of the time), and then putting the box down either i... | habedi/stack-exchange-dataset |
87,891 | Counter-example to regular expression statement | <p>Show a counter-example to disprove the following statement:</p>

<p>If $R1$ and $R2$ are two regular expressions, then $L((R1 \cup R2)^*) = L(R1^* \cup R2^*)$.</p>
 | automata regular expressions | 1 | Counter-example to regular expression statement -- (automata regular expressions)
<p>Show a counter-example to disprove the following statement:</p>

<p>If $R1$ and $R2$ are two regular expressions, then $L((R1 \cup R2)^*) = L(R1^* \cup R2^*)$.</p>
 | habedi/stack-exchange-dataset |
87,892 | How do we show that the polynomial time reduction of one problem to another has been done in polynomial time? | <p>I have just been reading through a SO post which <a href="https://stackoverflow.com/a/6990715/2910074">proves that the Halting Problem is NP-Hard</a>. Whilst this is an easily followed proof, one slight slight aspect of it has left me scratching my head: it says that</p>

<blockquote>
 <p>"This pairing ... | complexity theory reductions polynomial time | 1 | How do we show that the polynomial time reduction of one problem to another has been done in polynomial time? -- (complexity theory reductions polynomial time)
<p>I have just been reading through a SO post which <a href="https://stackoverflow.com/a/6990715/2910074">proves that the Halting Problem is NP-Hard</a>. Whilst... | habedi/stack-exchange-dataset |
87,893 | What is the definition of$\mathcal{Mod} P$ counting complexity class? | <p><strong>Question :</strong> What is the definition of $\mathcal{Mod} P$ counting complexity class?</p>

<p>I am not getting anything relevant about this complexity class on Google search. If it is available on Wikipedia, please share a link.</p>

<p>$\mathcal{Mod} P$: A set $L$ is in the class $\mat... | complexity theory | 1 | What is the definition of$\mathcal{Mod} P$ counting complexity class? -- (complexity theory)
<p><strong>Question :</strong> What is the definition of $\mathcal{Mod} P$ counting complexity class?</p>

<p>I am not getting anything relevant about this complexity class on Google search. If it is available on Wikipe... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.