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 |
|---|---|---|---|---|---|---|
102,939 | Max flow and Matching problem | <p>Where can i find a list of problems reducible to max flow and matching problems. I need such examples to learn and practice .</p>
 | reductions np hard approximation | 1 | Max flow and Matching problem -- (reductions np hard approximation)
<p>Where can i find a list of problems reducible to max flow and matching problems. I need such examples to learn and practice .</p>
 | habedi/stack-exchange-dataset |
102,944 | Merging two splay trees whose ranges may overlap in $O(\log N)$ | <p>I have two splay trees, <span class="math-container">$A$</span> and <span class="math-container">$B$</span>.</p>

<p>When every element in <span class="math-container">$A$</span> is smaller than every element in <span class="math-container">$B$</span>, we can merge them in <span class="math-container">$O(\lo... | splay trees | 1 | Merging two splay trees whose ranges may overlap in $O(\log N)$ -- (splay trees)
<p>I have two splay trees, <span class="math-container">$A$</span> and <span class="math-container">$B$</span>.</p>

<p>When every element in <span class="math-container">$A$</span> is smaller than every element in <span class="mat... | habedi/stack-exchange-dataset |
102,946 | Solving $T(n) = 3T(n-1) + 2$ | <p>I am trying to get better at solving recurrence relations, so I am making my own simple relations and try to solve them. I have made the following recurrence:</p>

<p><span class="math-container">$$T(n) = 3T(n-1) + 2, \quad\quad T(1) = 1$$</span></p>

<p>My work at solving it:
<span class="math-c... | recurrence relation | 1 | Solving $T(n) = 3T(n-1) + 2$ -- (recurrence relation)
<p>I am trying to get better at solving recurrence relations, so I am making my own simple relations and try to solve them. I have made the following recurrence:</p>

<p><span class="math-container">$$T(n) = 3T(n-1) + 2, \quad\quad T(1) = 1$$</span></p>
... | habedi/stack-exchange-dataset |
102,955 | Algorithm for blending/merging shapes together like liquid | <p>This is a basic example of how 2 circles would come together:</p>

<p><a href="https://i.stack.imgur.com/Rzp23.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rzp23.jpg" alt="enter image description here"></a></p>

<p>A more complex example would be an arbitrarily shaped polygon li... | algorithms graphics | 1 | Algorithm for blending/merging shapes together like liquid -- (algorithms graphics)
<p>This is a basic example of how 2 circles would come together:</p>

<p><a href="https://i.stack.imgur.com/Rzp23.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rzp23.jpg" alt="enter image description here"><... | habedi/stack-exchange-dataset |
102,964 | Are Big-Theta functions asymptotic monotonically non decreasing? | <p>For example, suppose <span class="math-container">$f(n) = \Theta(n^2)$</span>, then does that mean for any sufficiently large <span class="math-container">$n$</span>, <span class="math-container">$f(n) \le f(n+1)$</span>? Is it a general case for all Big-Theta?</p>
 | time complexity asymptotics | 1 | Are Big-Theta functions asymptotic monotonically non decreasing? -- (time complexity asymptotics)
<p>For example, suppose <span class="math-container">$f(n) = \Theta(n^2)$</span>, then does that mean for any sufficiently large <span class="math-container">$n$</span>, <span class="math-container">$f(n) \le f(n+1)$</span... | habedi/stack-exchange-dataset |
102,968 | What is the fastest algorithm to establish whether a linear system in $\mathbb{R}$ has a solution? | <p>I know the best algorithm to solve a linear system in <span class="math-container">$\mathbb{R}$</span> with <span class="math-container">$n$</span> variables is Coppersmith-Winograd's algorithm, which has a complexity of
<span class="math-container">$$
O\left(n^{2.376}\right).
$$</span>
How much easi... | algorithms complexity theory linear algebra | 1 | What is the fastest algorithm to establish whether a linear system in $\mathbb{R}$ has a solution? -- (algorithms complexity theory linear algebra)
<p>I know the best algorithm to solve a linear system in <span class="math-container">$\mathbb{R}$</span> with <span class="math-container">$n$</span> variables is Coppersm... | habedi/stack-exchange-dataset |
102,973 | Floating point precision from rearranging equation | <p>When I run <span class="math-container">$x^2 - y^2$</span> with x=8.8888888888 and y=9.9999999999 in python, I get the following result:</p>

<pre><code>>>> 8.8888888888**2 - 9.9999999999**2
-20.9876543205679
</code></pre>

<p>However, if I rearrange it to <span class="math-container... | floating point | 1 | Floating point precision from rearranging equation -- (floating point)
<p>When I run <span class="math-container">$x^2 - y^2$</span> with x=8.8888888888 and y=9.9999999999 in python, I get the following result:</p>

<pre><code>>>> 8.8888888888**2 - 9.9999999999**2
-20.9876543205679
</code></pre... | habedi/stack-exchange-dataset |
102,978 | transformation between two formulations of the mincost flow problem | <p>According to <a href="http://www.columbia.edu/~cs2035/courses/ieor6614.S16/mcf.pdf" rel="nofollow noreferrer">this slide</a>, the following two formulations of the mincost flow problem are equivalent:</p>

<p>Given directed graph G = (V, E)</p>

<blockquote>
 <ul>
 <li>Let u denote capaciti... | network flow | 1 | transformation between two formulations of the mincost flow problem -- (network flow)
<p>According to <a href="http://www.columbia.edu/~cs2035/courses/ieor6614.S16/mcf.pdf" rel="nofollow noreferrer">this slide</a>, the following two formulations of the mincost flow problem are equivalent:</p>

<p>Given directed... | habedi/stack-exchange-dataset |
102,986 | Ambiguous grammar to equivalent unambiguous grammar | <p>I stumbled on this ambiguous grammar and I've been trying to make it unambiguous but it's still ambiguous. </p>

<p>Given the ambiguous CFG :<br>
<span class="math-container">$S \to A\mid B$</span><br>
<span class="math-container">$A \to aAb\mid ab$</span><br>
<span class="math-container">$B \to ... | automata formal grammars | 1 | Ambiguous grammar to equivalent unambiguous grammar -- (automata formal grammars)
<p>I stumbled on this ambiguous grammar and I've been trying to make it unambiguous but it's still ambiguous. </p>

<p>Given the ambiguous CFG :<br>
<span class="math-container">$S \to A\mid B$</span><br>
<span class="math... | habedi/stack-exchange-dataset |
102,987 | Return copy of array, each element product of all others, constant additional space, no division | <p><strong>Question</strong>: I am trying to solve question <code>6.10.1</code> from Elements of Programming Interviews. The task is as follows:</p>

<p>Given an array <span class="math-container">$<a_1, \ldots, a_n>$</span> of fixed-length <code>int</code>s, devise an algorithm which returns a new array ... | algorithms algorithm analysis time complexity space complexity | 1 | Return copy of array, each element product of all others, constant additional space, no division -- (algorithms algorithm analysis time complexity space complexity)
<p><strong>Question</strong>: I am trying to solve question <code>6.10.1</code> from Elements of Programming Interviews. The task is as follows:</p>
&#... | habedi/stack-exchange-dataset |
102,988 | Tailrecursive definition for a function | <p>In an exam I took we were asked to provide a tailrecursive definition of a recursive function. I failed miserably and the provided solution makes absolutely no sense to me. If anyone could explain that would be very helpful for my resit. The provided solution is the following:</p>

<hr>

<p>Given are... | lambda calculus functional programming | 1 | Tailrecursive definition for a function -- (lambda calculus functional programming)
<p>In an exam I took we were asked to provide a tailrecursive definition of a recursive function. I failed miserably and the provided solution makes absolutely no sense to me. If anyone could explain that would be very helpful for my re... | habedi/stack-exchange-dataset |
102,990 | Is the complexity of this algorithm O($\sqrt{n}$) or linear? | <p>Let's say I have two identical jars and I want to find the height that the jars will breaks when dropped from various heights. I can drop the jars from height increments using steps on a staircase. I want to solve this problem sublinearly.</p>

<p>I decided to increment using square numbers (1, 4, 9, 16..etc... | algorithms | 1 | Is the complexity of this algorithm O($\sqrt{n}$) or linear? -- (algorithms)
<p>Let's say I have two identical jars and I want to find the height that the jars will breaks when dropped from various heights. I can drop the jars from height increments using steps on a staircase. I want to solve this problem sublinearly.<... | habedi/stack-exchange-dataset |
102,991 | Are $A$ and $B$ necessarily be decidable if $(A∩\overline{B})∪(\overline{A}∩B)$ is decidable and $A$ & $B$ being exhaustive? | <p>I found the following question </p>

<blockquote>
 <p>Suppose A and B are recursively enumerable languages such that <span class="math-container">$A∪B=Σ^∗$</span>. Further, suppose <span class="math-container">$(A∩\overline{B})∪(\overline{A}∩B)$</span> is decidable. Which of the following is true? <br>&... | turing machines undecidability | 1 | Are $A$ and $B$ necessarily be decidable if $(A∩\overline{B})∪(\overline{A}∩B)$ is decidable and $A$ & $B$ being exhaustive? -- (turing machines undecidability)
<p>I found the following question </p>

<blockquote>
 <p>Suppose A and B are recursively enumerable languages such that <span class="math-containe... | habedi/stack-exchange-dataset |
102,997 | Binary Floating Point Range/Precision for 4-bit Mantissa and 4-bit Exponent | <p>I'm trying to understand binary floating point and using just a 4-bit mantissa and a 4-bit exponent (both 2s compliment) to keep things simple.</p>

<p>As far as I can tell, the largest denary number I can represent is 112: 0111 0111</p>

<p>So why do I have trouble representing denary 11 (eleven) in... | floating point binary | 1 | Binary Floating Point Range/Precision for 4-bit Mantissa and 4-bit Exponent -- (floating point binary)
<p>I'm trying to understand binary floating point and using just a 4-bit mantissa and a 4-bit exponent (both 2s compliment) to keep things simple.</p>

<p>As far as I can tell, the largest denary number I can ... | habedi/stack-exchange-dataset |
103,008 | Proof of QuickSort algorithm correctness | <p>Recently I’ve studied QuickSort and understood its general idea. </p>

<p>Basically, we do the following:</p>

<ol>
<li>Pick an element from the array (no matter which one and how in this context)</li>
<li>Rearrange elements in the array so that elements less than the pivot are placed prior t... | algorithms sorting correctness proof induction quicksort | 1 | Proof of QuickSort algorithm correctness -- (algorithms sorting correctness proof induction quicksort)
<p>Recently I’ve studied QuickSort and understood its general idea. </p>

<p>Basically, we do the following:</p>

<ol>
<li>Pick an element from the array (no matter which one and how in this contex... | habedi/stack-exchange-dataset |
103,011 | Induction to prove equivalence of a recursive and iterative algorithm for Towers of Hanoi | <p>Using induction how do you prove that two algorithm implementations, one recursive and the other iterative, of the Towers of Hanoi perform identical move operations? The implementations are as follows.</p>

<pre><code>Hanoi(n, src, dst, tmp):
 if n > 0
 hanoi(n-1, src, dst, tmp)
 move d... | algorithm analysis recurrence relation recursion induction towers of hanoi | 1 | Induction to prove equivalence of a recursive and iterative algorithm for Towers of Hanoi -- (algorithm analysis recurrence relation recursion induction towers of hanoi)
<p>Using induction how do you prove that two algorithm implementations, one recursive and the other iterative, of the Towers of Hanoi perform identica... | habedi/stack-exchange-dataset |
103,015 | How to calculate a direct mapped chace capacity with tag and valid bits? | <p>I've seen some very useful posts about this, but none took into consideration both the tag and valid bits. This is a question I took from a notebook in my computer engineering course.</p>

<blockquote>
 <p>Consider a machine with a direct mapped cache, with 1 Byte blocks and 7 bits for
 the tag. Th... | computer architecture cpu cache | 1 | How to calculate a direct mapped chace capacity with tag and valid bits? -- (computer architecture cpu cache)
<p>I've seen some very useful posts about this, but none took into consideration both the tag and valid bits. This is a question I took from a notebook in my computer engineering course.</p>

<blockquot... | habedi/stack-exchange-dataset |
103,018 | How can you find all unbalanced parens in a string in linear time with constant memory? | <p>I was given the following problem during an interview:</p>
<blockquote>
<p>Gives a string which contains some mixture of parens (not brackets or braces-- only parens) with other alphanumeric characters, identify all parens that have no matching paren.</p>
<p>For example, in the string ")(ab))",... | algorithms | 1 | How can you find all unbalanced parens in a string in linear time with constant memory? -- (algorithms)
<p>I was given the following problem during an interview:</p>
<blockquote>
<p>Gives a string which contains some mixture of parens (not brackets or braces-- only parens) with other alphanumeric characters, id... | habedi/stack-exchange-dataset |
103,035 | Using LP to prove the max matching - min cover theorem | <p><a href="https://en.wikipedia.org/wiki/K%C5%91nig%27s_theorem_(graph_theory)" rel="nofollow noreferrer">Konig's theorem</a> says that, in a bipartite graph, the size of the maximum matching equals the size of the minimum vertex cover. This theorem has several proofs; I would like to know if the following proof, base... | linear programming bipartite matching duality | 1 | Using LP to prove the max matching - min cover theorem -- (linear programming bipartite matching duality)
<p><a href="https://en.wikipedia.org/wiki/K%C5%91nig%27s_theorem_(graph_theory)" rel="nofollow noreferrer">Konig's theorem</a> says that, in a bipartite graph, the size of the maximum matching equals the size of th... | habedi/stack-exchange-dataset |
103,056 | Is ∅ ∈ {{∅}} true? | <p>I learned that the empty set is not an element of every set unless the empty set is explicitly included in the set like {∅}, so I believe it is false because it is not ∅ ∈ {∅}.</p>
 | discrete mathematics | 1 | Is ∅ ∈ {{∅}} true? -- (discrete mathematics)
<p>I learned that the empty set is not an element of every set unless the empty set is explicitly included in the set like {∅}, so I believe it is false because it is not ∅ ∈ {∅}.</p>
 | habedi/stack-exchange-dataset |
103,066 | T&PL: Language grammar with terms | <p>I'm autodidacting Pierce's <em>Types and Programming Languages</em>. On page 27 he states a definition for "terms, concretely" in constructing a language of terms, thus:</p>

<p>For each natural number <span class="math-container">$i$</span>, define a set <span class="math-container">$S_i$</span> as follows:... | type theory | 1 | T&PL: Language grammar with terms -- (type theory)
<p>I'm autodidacting Pierce's <em>Types and Programming Languages</em>. On page 27 he states a definition for "terms, concretely" in constructing a language of terms, thus:</p>

<p>For each natural number <span class="math-container">$i$</span>, define a set <s... | habedi/stack-exchange-dataset |
103,072 | What Are the Ideas Behind Variations of the Coin Change Problem? | <blockquote>
 <p>Problem: given a set of <code>n</code> coins of unique face values, and a value
 <code>change</code>, find number of ways of making change for <code>change</code>.</p>
</blockquote>

<p>Assuming we can use a denomination more than once, here's the pseudocode I came up with</p>
... | algorithms dynamic programming coin change | 1 | What Are the Ideas Behind Variations of the Coin Change Problem? -- (algorithms dynamic programming coin change)
<blockquote>
 <p>Problem: given a set of <code>n</code> coins of unique face values, and a value
 <code>change</code>, find number of ways of making change for <code>change</code>.</p>
</blockq... | habedi/stack-exchange-dataset |
103,073 | Is it possible that $L=NP$? | <p>According to <a href="https://en.wikipedia.org/wiki/L_(complexity)" rel="nofollow noreferrer">Wikipedia</a> and other sources, the question whether <span class="math-container">$L=P$</span> is an open problem, and of course everyone is familiar with the problem of whether <span class="math-container">$P=NP$</span>. ... | complexity theory | 1 | Is it possible that $L=NP$? -- (complexity theory)
<p>According to <a href="https://en.wikipedia.org/wiki/L_(complexity)" rel="nofollow noreferrer">Wikipedia</a> and other sources, the question whether <span class="math-container">$L=P$</span> is an open problem, and of course everyone is familiar with the problem of w... | habedi/stack-exchange-dataset |
103,077 | Is there any relationship between grammar being ambiguous and the language itself? | <p>According to my understanding, a grammar is ambiguous if it generate strings which can be interpreted in more than one ways ( that is , more than one parse tree), but when it comes to the language itself , is there any kind of relationship between the language itself and the ambiguous nature of a particular grammar ... | formal grammars ambiguity | 1 | Is there any relationship between grammar being ambiguous and the language itself? -- (formal grammars ambiguity)
<p>According to my understanding, a grammar is ambiguous if it generate strings which can be interpreted in more than one ways ( that is , more than one parse tree), but when it comes to the language itself... | habedi/stack-exchange-dataset |
103,080 | How to generate a grammer from this language? | <p>I'm trying to generate a grammar from this language:</p>

<pre><code>L={a^i b^j c^k d^l : i+j=k+l}
</code></pre>

<p>to be clear its a in the power of i and b in the power of j... and so on, so that i+j will equal k+l,
I would love an explanation how to get to the solution as well, thank you... | formal languages automata formal grammars | 1 | How to generate a grammer from this language? -- (formal languages automata formal grammars)
<p>I'm trying to generate a grammar from this language:</p>

<pre><code>L={a^i b^j c^k d^l : i+j=k+l}
</code></pre>

<p>to be clear its a in the power of i and b in the power of j... and so on, so that i+j ... | habedi/stack-exchange-dataset |
103,081 | How to understand out of bound in the following theoretical context? | <p>Consider the following initialization step of loop invariant for merge procedure</p>

<p><strong>Initialization</strong>: Prior to the first iteration of the loop, <strong>we have 
<span class="math-container">$k=p$</span>, so that the subarray <span class="math-container">$A[p .. k - 1]$</span> is empty... | loop invariants | 1 | How to understand out of bound in the following theoretical context? -- (loop invariants)
<p>Consider the following initialization step of loop invariant for merge procedure</p>

<p><strong>Initialization</strong>: Prior to the first iteration of the loop, <strong>we have 
<span class="math-container">$k=p$... | habedi/stack-exchange-dataset |
103,083 | NP-hardness does not imply lower bound, strictly speaking? | <pre><code>A problem is NP-hard iff every NP problem can be polynomially-time reduced to it.
</code></pre>

<p>Hardness is often intuitively explained as a lower bound. But it isn't, <em>strictly speaking</em>. For the sake of the argument, assume P=NP. Now the definition becomes:</p>

<pre><code>A ... | complexity theory reductions np hard complexity classes | 1 | NP-hardness does not imply lower bound, strictly speaking? -- (complexity theory reductions np hard complexity classes)
<pre><code>A problem is NP-hard iff every NP problem can be polynomially-time reduced to it.
</code></pre>

<p>Hardness is often intuitively explained as a lower bound. But it isn't, <em>s... | habedi/stack-exchange-dataset |
103,090 | Effective Procedures and P vs NP Problem | <p>If, suppose, P doesn't equal NP. Implication of this statement is that there is no effective procedure to solve a hard problem; however there exists an acceptable solution S. I have following two explicit queries:</p>

<ol>
<li><p>If an effective procedure cannot be given which yields a solution, in what... | p vs np formal methods mathematical foundations | 1 | Effective Procedures and P vs NP Problem -- (p vs np formal methods mathematical foundations)
<p>If, suppose, P doesn't equal NP. Implication of this statement is that there is no effective procedure to solve a hard problem; however there exists an acceptable solution S. I have following two explicit queries:</p>
&... | habedi/stack-exchange-dataset |
103,099 | Give a grammar for words whose number of $a$'s modulo 2 is larger than whose number of $b$'s modulo 2 | <p>Given is an alphabet <span class="math-container">$\Sigma = \{ a, b, c \}$</span>, and a language <span class="math-container">$A4 =\{ w \mid w \in \Sigma^* \wedge |w|_a \operatorname{mod} 2 \ge |w|_b \operatorname{mod} 2 \}$</span></p>

<p>whereas <span class="math-container">$|w|_a$</span> is the number <s... | formal languages automata formal grammars | 1 | Give a grammar for words whose number of $a$'s modulo 2 is larger than whose number of $b$'s modulo 2 -- (formal languages automata formal grammars)
<p>Given is an alphabet <span class="math-container">$\Sigma = \{ a, b, c \}$</span>, and a language <span class="math-container">$A4 =\{ w \mid w \in \Sigma^* \wedge |w|_... | habedi/stack-exchange-dataset |
103,109 | Shortest common supersequence with Genetic Algorithm | <p>I'm trying to solve the shortest common supersequence with Genetic Algorithm.
I found it a little bit hard to reduce the size of the chromosomes in each generation.</p>

<p>I know that the maximum size of the chromosome is the total length of the strings.
Even if we create a "naive" genetic algorithm... | genetic algorithms | 1 | Shortest common supersequence with Genetic Algorithm -- (genetic algorithms)
<p>I'm trying to solve the shortest common supersequence with Genetic Algorithm.
I found it a little bit hard to reduce the size of the chromosomes in each generation.</p>

<p>I know that the maximum size of the chromosome is the t... | habedi/stack-exchange-dataset |
103,117 | Minimal shift operations to sort an array | <p>I have been stuck on this sorting problem for a while now:</p>

<p>Given an array of length N find the minimum number of shift operations in order to sort the array. A shift operation is defined as shifting a value in an array to another position. For this problem however, <strong>you can only perform this s... | sorting | 1 | Minimal shift operations to sort an array -- (sorting)
<p>I have been stuck on this sorting problem for a while now:</p>

<p>Given an array of length N find the minimum number of shift operations in order to sort the array. A shift operation is defined as shifting a value in an array to another position. For th... | habedi/stack-exchange-dataset |
103,120 | Maximum flow with constraints | <p>In a flow network, suppose we add constraints of the following type:</p>
<blockquote>
<p>The flow entering a vertex <span class="math-container">$v$</span> must be at most the flow exiting a vertex <span class="math-container">$u$</span>.</p>
</blockquote>
<p>Is maximum-flow with such constraints sti... | optimization network flow | 1 | Maximum flow with constraints -- (optimization network flow)
<p>In a flow network, suppose we add constraints of the following type:</p>
<blockquote>
<p>The flow entering a vertex <span class="math-container">$v$</span> must be at most the flow exiting a vertex <span class="math-container">$u$</span>.</p>
<... | habedi/stack-exchange-dataset |
103,123 | How to decide which bytes will form a packet ?(computer networks) | <p>In wireless communication , I understand what it means to transmit a "bit" but I wanted to understand what exactly does it mean by a packet . </p>

<p>*******POST EDIT/RECEIVING INITIAL ANSWERS*******
I got the following question , which is also there in my comment , </p>

<ol>
<li>How to dec... | computer networks communication protocols protocols | 1 | How to decide which bytes will form a packet ?(computer networks) -- (computer networks communication protocols protocols)
<p>In wireless communication , I understand what it means to transmit a "bit" but I wanted to understand what exactly does it mean by a packet . </p>

<p>*******POST EDIT/RECEIVING INITIAL ... | habedi/stack-exchange-dataset |
103,127 | Round-Robin fashion exercise | <p>In my Operating Systems class I have an exercise to sketch out how a round-robin algorithm would apply to a specific scenario, which is the following:</p>

<hr>

<p><a href="https://i.stack.imgur.com/SuQgr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SuQgr.png" alt="Exercise"></... | operating systems scheduling process scheduling | 1 | Round-Robin fashion exercise -- (operating systems scheduling process scheduling)
<p>In my Operating Systems class I have an exercise to sketch out how a round-robin algorithm would apply to a specific scenario, which is the following:</p>

<hr>

<p><a href="https://i.stack.imgur.com/SuQgr.png" rel="nof... | habedi/stack-exchange-dataset |
103,132 | Is it possible to convert LBA into DFA? | <p>Today I learned about an abstract class of machines called <a href="https://en.wikipedia.org/wiki/Linear_bounded_automaton" rel="nofollow noreferrer">linear bounded automata</a>.</p>

<p>It is intended to model real-world computers that have a limited amount of memory. I have always thought that real compute... | finite automata linear bounded automata | 1 | Is it possible to convert LBA into DFA? -- (finite automata linear bounded automata)
<p>Today I learned about an abstract class of machines called <a href="https://en.wikipedia.org/wiki/Linear_bounded_automaton" rel="nofollow noreferrer">linear bounded automata</a>.</p>

<p>It is intended to model real-world co... | habedi/stack-exchange-dataset |
103,134 | Prove that there always exists a line bisecting each of two point sets | <p>A line <span class="math-container">$\ell$</span> for a set <span class="math-container">$S$</span> of points is <em>bisecting</em> if the open halfspaces on either side of <span class="math-container">$\ell$</span> contain at most <span class="math-container">$\frac{|S|}{2}$</span> points.</p>

<p>Now given... | computational geometry | 1 | Prove that there always exists a line bisecting each of two point sets -- (computational geometry)
<p>A line <span class="math-container">$\ell$</span> for a set <span class="math-container">$S$</span> of points is <em>bisecting</em> if the open halfspaces on either side of <span class="math-container">$\ell$</span> co... | habedi/stack-exchange-dataset |
103,136 | Why a TM with infinite states can decide the halting problem? | <p>Assuming we have a model of TM with an infinite number of states.
The domain and range of the transition function are also infinite.
Given a description of a TM <span class="math-container">$M$</span> and a string <span class="math-container">$w$</span> how can we use the new model to tell if <span class="ma... | computability computation models halting problem | 1 | Why a TM with infinite states can decide the halting problem? -- (computability computation models halting problem)
<p>Assuming we have a model of TM with an infinite number of states.
The domain and range of the transition function are also infinite.
Given a description of a TM <span class="math-container">$M$... | habedi/stack-exchange-dataset |
103,139 | Induction on strings (words) | <p>Given is an alphabet <span class="math-container">$\Sigma = \{ 0, 1, 2 \}$</span> and a function <strong>quer</strong> to calculate the cross sum of a word. </p>

<p><span class="math-container">$quer : \Sigma^*\to \Bbb N$</span> with:</p>

<p><span class="math-container">$$quer(w)=\begin{cases} 0, &... | formal languages regular languages induction | 1 | Induction on strings (words) -- (formal languages regular languages induction)
<p>Given is an alphabet <span class="math-container">$\Sigma = \{ 0, 1, 2 \}$</span> and a function <strong>quer</strong> to calculate the cross sum of a word. </p>

<p><span class="math-container">$quer : \Sigma^*\to \Bbb N$</span> ... | habedi/stack-exchange-dataset |
103,144 | Complexity of brute force primality test in the number of digits | <p>I'm wondering how to express the complexity of a brute force primality testing algorithm in the number of digits the number under test has. The brute force algorithm just checks whether <span class="math-container">$n$</span> is prime by checking if there is a number <span class="math-container">$k$</span> from <spa... | algorithm analysis runtime analysis primes | 1 | Complexity of brute force primality test in the number of digits -- (algorithm analysis runtime analysis primes)
<p>I'm wondering how to express the complexity of a brute force primality testing algorithm in the number of digits the number under test has. The brute force algorithm just checks whether <span class="math-... | habedi/stack-exchange-dataset |
103,146 | What should we return when pattern matching on a Path constructor? | <p>Context: Cubical Type Theory</p>

<p>Consider a simple HIT, say, an <code>HitInt</code>:</p>

<pre><code>data HitInt : Set where
 pos : (n : ℕ) → HitInt
 neg : (n : ℕ) → HitInt
 posneg : pos 0 ≡ neg 0
</code></pre>

<p>Or, if you don't speak Agda we can use cubicaltt:</p>&#... | homotopy type theory cubical type theory higher inductive types | 1 | What should we return when pattern matching on a Path constructor? -- (homotopy type theory cubical type theory higher inductive types)
<p>Context: Cubical Type Theory</p>

<p>Consider a simple HIT, say, an <code>HitInt</code>:</p>

<pre><code>data HitInt : Set where
 pos : (n : ℕ) → HitInt
 n... | habedi/stack-exchange-dataset |
103,148 | What is the difference between a Top type and a Unit type | <p>Wikipedia defines a Top type: (edited for readability)</p>

<blockquote>
 <p>The <strong>Top</strong> type [...] is the universal supertype, as all other types in any given type system are subtypes of <strong>Top</strong></p>
</blockquote>

<p>However, the article goes on to say:</p>
&#x... | type theory | 1 | What is the difference between a Top type and a Unit type -- (type theory)
<p>Wikipedia defines a Top type: (edited for readability)</p>

<blockquote>
 <p>The <strong>Top</strong> type [...] is the universal supertype, as all other types in any given type system are subtypes of <strong>Top</strong></p>
... | habedi/stack-exchange-dataset |
103,157 | Finding a subset with few neighbors | <p>Given a bipartite graph <span class="math-container">$G(X+Y,E)$</span>, how can I find a non-empty subset <span class="math-container">$Y'\subseteq Y$</span>, such that <span class="math-container">$|N(Y')| \leq |Y'|$</span> (where <span class="math-container">$N$</span> is the set of neighbors)? </p>

<p>If... | algorithms graphs bipartite matching | 1 | Finding a subset with few neighbors -- (algorithms graphs bipartite matching)
<p>Given a bipartite graph <span class="math-container">$G(X+Y,E)$</span>, how can I find a non-empty subset <span class="math-container">$Y'\subseteq Y$</span>, such that <span class="math-container">$|N(Y')| \leq |Y'|$</span> (where <span c... | habedi/stack-exchange-dataset |
103,162 | Let G be a graph directed without circles. Suggest a method to find a minimum set of vertices So that all the vertices in the graph can be reached | <p>Let G be a graph directed without circles. Suggest a method to find a minimum set of vertices
So that all the vertices in the graph can be reached.</p>

<p>I thought to run an SCC algorithm to find binding components and then return them. This is true? Or is there a better algorithm?</p>
 | algorithms graphs optimization dag | 1 | Let G be a graph directed without circles. Suggest a method to find a minimum set of vertices So that all the vertices in the graph can be reached -- (algorithms graphs optimization dag)
<p>Let G be a graph directed without circles. Suggest a method to find a minimum set of vertices
So that all the vertices in the ... | habedi/stack-exchange-dataset |
103,168 | Why does little endian apply to numbers and not to text strings? | <p>The Portable Executable file format is the format that Windows EXE files use.</p>

<p>It is a binary format.</p>

<p>Numbers are in little endian form. Thus, the following hex represents the decimal number 256, not 1.</p>

<pre><code>00 01
</code></pre>

<p>Some fields in the file... | strings number formats binary | 1 | Why does little endian apply to numbers and not to text strings? -- (strings number formats binary)
<p>The Portable Executable file format is the format that Windows EXE files use.</p>

<p>It is a binary format.</p>

<p>Numbers are in little endian form. Thus, the following hex represents the decimal nu... | habedi/stack-exchange-dataset |
103,176 | Why does packet delivery time only count transmission time once? | <p>Why is packet delivery time equal to transmission time + propagation delay, and not equal to 2*(transmission time) + propagation delay?</p>

<p>At the end of packet delivery time, doesn't that mean that those bits haven't been received? </p>
 | computer networks | 1 | Why does packet delivery time only count transmission time once? -- (computer networks)
<p>Why is packet delivery time equal to transmission time + propagation delay, and not equal to 2*(transmission time) + propagation delay?</p>

<p>At the end of packet delivery time, doesn't that mean that those bits haven't... | habedi/stack-exchange-dataset |
103,180 | lambda expressions, parenthesis, and order of application | <p>I am building a lambda applicator in Java, and I have uncovered a bit of misunderstanding. Either my question at the bottom is what I am asking, or something in the build-up below is wrong. Either way, I'd appreciate any insight.</p>

<p>So, <code>NOT</code> can be defined as </p>

<p><code>λb.b (λ... | lambda calculus | 1 | lambda expressions, parenthesis, and order of application -- (lambda calculus)
<p>I am building a lambda applicator in Java, and I have uncovered a bit of misunderstanding. Either my question at the bottom is what I am asking, or something in the build-up below is wrong. Either way, I'd appreciate any insight.</p>&#x... | habedi/stack-exchange-dataset |
103,185 | Is this context-free grammar correct for this regular expression? | <p>I have created a context-free grammar</p>

<p><span class="math-container">$$
\begin{align*}
&S \to S_1 \mid S_2 \\
&S_1 \to aS_3bS_4 \mid \epsilon \\
&S_2 \to bS_4 \\
&S_3 \to aS_3 \mid \epsilon \\
&S_4 \to aS_4 \mid bS_4 \mid \epsilon
\end{align*}
$$</spa... | context free formal grammars regular expressions | 1 | Is this context-free grammar correct for this regular expression? -- (context free formal grammars regular expressions)
<p>I have created a context-free grammar</p>

<p><span class="math-container">$$
\begin{align*}
&S \to S_1 \mid S_2 \\
&S_1 \to aS_3bS_4 \mid \epsilon \\
&S_2 \to b... | habedi/stack-exchange-dataset |
103,202 | Chomsky Classification of Languages | <p>Given is a language <span class="math-container">$A = \{ a^n\:b\:c^{2n}\:b^m |\; n ∈ N^{+} ;\; m ∈ N \}$</span> ; where <span class="math-container">$N^{+}$</span> are the natural numbers excluding 0. </p>

<p>I have found a type-1 grammar to describe it: </p>

<p><span class="math-container">$S \to ... | formal languages formal grammars chomsky hierarchy | 1 | Chomsky Classification of Languages -- (formal languages formal grammars chomsky hierarchy)
<p>Given is a language <span class="math-container">$A = \{ a^n\:b\:c^{2n}\:b^m |\; n ∈ N^{+} ;\; m ∈ N \}$</span> ; where <span class="math-container">$N^{+}$</span> are the natural numbers excluding 0. </p>

<p>I have ... | habedi/stack-exchange-dataset |
103,216 | How to write recurrence relation for backtracking problem? | <p>I am not able to understand how to write a recurrence relation for <a href="https://www.geeksforgeeks.org/n-queen-problem-backtracking-3/" rel="nofollow noreferrer">n queen problem</a>. I searched on web and everywhere it was given directly without explaining how can we arrive to that. 
Recurrence relation is fo... | time complexity recurrence relation divide and conquer | 1 | How to write recurrence relation for backtracking problem? -- (time complexity recurrence relation divide and conquer)
<p>I am not able to understand how to write a recurrence relation for <a href="https://www.geeksforgeeks.org/n-queen-problem-backtracking-3/" rel="nofollow noreferrer">n queen problem</a>. I searched o... | habedi/stack-exchange-dataset |
103,237 | What is the motivation behind restore model of computation? | <p>The memory that stores the input is called the input memory. The memory that an algorithm additionally occupies during the computation is called the working memory.</p>

<p><span class="math-container">$\textit{Model of Computations}$</span></p>

<ol>
<li>Word RAM <strong>:</strong> This a very w... | algorithms computation models | 1 | What is the motivation behind restore model of computation? -- (algorithms computation models)
<p>The memory that stores the input is called the input memory. The memory that an algorithm additionally occupies during the computation is called the working memory.</p>

<p><span class="math-container">$\textit{Mod... | habedi/stack-exchange-dataset |
103,247 | What is the Name of the Problem or Technique of Determining if a Line in a Program Will Execute | <p>If I were to pose the question: "Given a program <span class="math-container">$P$</span> containing statement <span class="math-container">$X$</span>, will <span class="math-container">$X$</span> be executed (given enough runs with all possible inputs)?"</p>

<p>This strikes me of being a relative of the Hal... | computability terminology rice theorem | 1 | What is the Name of the Problem or Technique of Determining if a Line in a Program Will Execute -- (computability terminology rice theorem)
<p>If I were to pose the question: "Given a program <span class="math-container">$P$</span> containing statement <span class="math-container">$X$</span>, will <span class="math-con... | habedi/stack-exchange-dataset |
103,250 | Relation between semi decidable, undecidable and countable sets | <p>I know that</p>

<ul>
<li><strong>decidable</strong> problem: has both counting (bijection with <span class="math-container">$\mathbb N $</span>) and membership algorithm (TM halts for both member and non member strings )</li>
<li><strong>semidecidable</strong> problem: has counting algorithm and TM ... | computability terminology | 1 | Relation between semi decidable, undecidable and countable sets -- (computability terminology)
<p>I know that</p>

<ul>
<li><strong>decidable</strong> problem: has both counting (bijection with <span class="math-container">$\mathbb N $</span>) and membership algorithm (TM halts for both member and non membe... | habedi/stack-exchange-dataset |
103,254 | Fixed point of hash | <p>Are hashing algorithms constructed to guarantee that no fixed point exists?</p>

<p>My assumption is not, because I don’t see what utility that would have. (Please correct me if I’m wrong.) As such, purely for curiosity’s sake, have any fixed points of common algorithms (e.g., MD5, SHA-256, etc.) been found?... | algorithms hash mathematical analysis fixed point | 1 | Fixed point of hash -- (algorithms hash mathematical analysis fixed point)
<p>Are hashing algorithms constructed to guarantee that no fixed point exists?</p>

<p>My assumption is not, because I don’t see what utility that would have. (Please correct me if I’m wrong.) As such, purely for curiosity’s sake, have a... | habedi/stack-exchange-dataset |
103,255 | Worst-case complexity in terms of n? | <p>I have this algorithm taken out from the Manual of Algorithms Analysis:</p>

<pre><code>function pesky (n)
r:=0
for i:=1 to n do
 for j:=1 to i do
 for k:= j to i + j do
 r := r + 1
return (r)
</code></pre>

<p>I understand the time complexity of this algorithm fo... | algorithm analysis time complexity | 1 | Worst-case complexity in terms of n? -- (algorithm analysis time complexity)
<p>I have this algorithm taken out from the Manual of Algorithms Analysis:</p>

<pre><code>function pesky (n)
r:=0
for i:=1 to n do
 for j:=1 to i do
 for k:= j to i + j do
 r := r + 1
return (r)
</... | habedi/stack-exchange-dataset |
103,258 | proof of the rice's theorem | <p>Let <span class="math-container">$P$</span> be any nontrivial property of the language of a Turing machine. Prove
that the problem of determining whether a given TM’s language has property <span class="math-container">$P$</span> is undecidable.</p>
<p>Proof:(This is from sipser's book).</p>
<p>Assume for... | complexity theory computability regular languages rice theorem | 1 | proof of the rice's theorem -- (complexity theory computability regular languages rice theorem)
<p>Let <span class="math-container">$P$</span> be any nontrivial property of the language of a Turing machine. Prove
that the problem of determining whether a given TM’s language has property <span class="math-container"... | habedi/stack-exchange-dataset |
103,261 | Why proving the solution of a problem is polynomial time is sufficient enough to say that it is a NP prolbem? | <p>Why proving that we can verify the solution of a problem is polynomial time is sufficient enough to say that the problem is nondeterministic polynomial time? Please note: this is not a question on how to prove a questions is NP, but instead asking why, we can just do so? If there is more step we need to do, what ar... | proof techniques np proof assistants | 1 | Why proving the solution of a problem is polynomial time is sufficient enough to say that it is a NP prolbem? -- (proof techniques np proof assistants)
<p>Why proving that we can verify the solution of a problem is polynomial time is sufficient enough to say that the problem is nondeterministic polynomial time? Please ... | habedi/stack-exchange-dataset |
103,285 | Recursive factorial algorithm | <p>I'm struggling to understand this factorial algorithm.</p>

<pre><code>Falling(n, m):
 if m = 0
 return 1
 if m = 1
 return n
 return Falling(n, floor(m/2))*
 Falling(n - floor(m/2), ceil(m/2))
</code></pre>

<p>The algorithm should compute... | algorithms algorithm analysis recursion | 1 | Recursive factorial algorithm -- (algorithms algorithm analysis recursion)
<p>I'm struggling to understand this factorial algorithm.</p>

<pre><code>Falling(n, m):
 if m = 0
 return 1
 if m = 1
 return n
 return Falling(n, floor(m/2))*
 Falling(n - floor(... | habedi/stack-exchange-dataset |
103,297 | Why are finite automata defined as ordered $n-tuples$ and not as sets? | <p>First off, I should mention that I am a new contributor on this site and as such, please bear with me if this has been asked and answered before. I searched to the best of my ability to find similar questions and didn't find any.</p>

<p><strong>The Question</strong></p>

<p>Consider the definition o... | automata finite automata | 1 | Why are finite automata defined as ordered $n-tuples$ and not as sets? -- (automata finite automata)
<p>First off, I should mention that I am a new contributor on this site and as such, please bear with me if this has been asked and answered before. I searched to the best of my ability to find similar questions and did... | habedi/stack-exchange-dataset |
103,300 | Language of TM is Undecidable | <p>why is this Problem<span class="math-container">$$L = \{ \langle M\rangle \mid L(M) \text{ is undecidable}\}$$</span> undecidable?</p>

<p>I thought if we know <span class="math-container">$L(M)$</span> the turingmaschine accepts all <span class="math-container">$x \in L(M)$</span>, so <span class="math-cont... | turing machines undecidability rice theorem | 1 | Language of TM is Undecidable -- (turing machines undecidability rice theorem)
<p>why is this Problem<span class="math-container">$$L = \{ \langle M\rangle \mid L(M) \text{ is undecidable}\}$$</span> undecidable?</p>

<p>I thought if we know <span class="math-container">$L(M)$</span> the turingmaschine accepts ... | habedi/stack-exchange-dataset |
103,302 | Check if K-Sum Variation is NP-Complete | <h1>Problem</h1>

<p>Given a range of integers <span class="math-container">$\{a,a+1,...,b-1,b\}$</span>, find a subset of size <span class="math-container">$k$</span> such that the sum is equal to <span class="math-container">$s$</span>.</p>

<h1>Question</h1>

<p>This problem came from evaluat... | complexity theory time complexity np complete subset sum | 1 | Check if K-Sum Variation is NP-Complete -- (complexity theory time complexity np complete subset sum)
<h1>Problem</h1>

<p>Given a range of integers <span class="math-container">$\{a,a+1,...,b-1,b\}$</span>, find a subset of size <span class="math-container">$k$</span> such that the sum is equal to <span class=... | habedi/stack-exchange-dataset |
103,304 | REC and RE under intersection | <p>Would the intersection of a recursive language and a recursively enumarable language be recursive or recurisvely enumbarable or neither? </p>

<p>Assume <span class="math-container">$L_{3}$</span> is the intersection of some language <span class="math-container">$L_{1}$</span> <span class="math-container">$\... | formal languages turing machines computability undecidability semi decidability | 1 | REC and RE under intersection -- (formal languages turing machines computability undecidability semi decidability)
<p>Would the intersection of a recursive language and a recursively enumarable language be recursive or recurisvely enumbarable or neither? </p>

<p>Assume <span class="math-container">$L_{3}$</spa... | habedi/stack-exchange-dataset |
103,308 | Reason programming language B was named "B"? | <p>I’ve searched around for this already but ironically the results have been overshadowed by “Why C was named C” instead.</p>

<p>If C was named “C” because it came after B, why was B named "B", since the only languages preceding B were FORTRAN and Plankalkül?</p>

<p>Is it possible naming B - “B” was ... | programming languages history | 1 | Reason programming language B was named "B"? -- (programming languages history)
<p>I’ve searched around for this already but ironically the results have been overshadowed by “Why C was named C” instead.</p>

<p>If C was named “C” because it came after B, why was B named "B", since the only languages preceding B... | habedi/stack-exchange-dataset |
103,326 | Why does $L\subseteq \textbf{P} \cap \textbf{NP}$ is $\textbf{NP}$-complete imply $\textbf{NP} = \textbf{P}$? | <p>If I show that a language <span class="math-container">$L$</span> is contained in <span class="math-container">$\textbf{P}$</span> and <span class="math-container">$\textbf{NP}$</span> and I know that the language is <span class="math-container">$\textbf{NP}$</span>-complete, why did I proof that <span class="math-c... | complexity theory | 1 | Why does $L\subseteq \textbf{P} \cap \textbf{NP}$ is $\textbf{NP}$-complete imply $\textbf{NP} = \textbf{P}$? -- (complexity theory)
<p>If I show that a language <span class="math-container">$L$</span> is contained in <span class="math-container">$\textbf{P}$</span> and <span class="math-container">$\textbf{NP}$</span>... | habedi/stack-exchange-dataset |
103,329 | Randomized communication complexity of indexing | <p>The function <span class="math-container">$\mathrm{INDEX}:\{0,1\}^n\times\{1,\dots,n\}\to \{0,1\}$</span> is defined as</p>

<p><span class="math-container">$$\mathrm{INDEX}(x,i)=x_i,$$</span>
where <span class="math-container">$x=x_1\dots x_n$</span>. I am looking for the randomized communication comple... | reference request communication protocols communication complexity randomized | 1 | Randomized communication complexity of indexing -- (reference request communication protocols communication complexity randomized)
<p>The function <span class="math-container">$\mathrm{INDEX}:\{0,1\}^n\times\{1,\dots,n\}\to \{0,1\}$</span> is defined as</p>

<p><span class="math-container">$$\mathrm{INDEX}(x,i)... | habedi/stack-exchange-dataset |
103,331 | MST: Is there such an example of a graph with unique mst and not unique light edge? | <p>The problem is the following:</p>

<p>Give an example of a graph that has a unique minimum spanning tree but for every cut of the graph, there is not a unique light edge crossing the cut.</p>

<p>I am trying to find such a graph, but I have not find any example. Is it possible to have such a graph? I... | graphs minimum spanning tree prims algorithm | 1 | MST: Is there such an example of a graph with unique mst and not unique light edge? -- (graphs minimum spanning tree prims algorithm)
<p>The problem is the following:</p>

<p>Give an example of a graph that has a unique minimum spanning tree but for every cut of the graph, there is not a unique light edge cross... | habedi/stack-exchange-dataset |
103,333 | What are different ways to provide a semantics to a language? | <p>Suppose you have 1. a grammar for terms of a language; 2. type-assignment rules, 3. a set of reduction rules. You want to prove that your language is adequate for mathematical reasoning. If I understand correctly, the right way to do it is to develop a semantics for it, and then prove certain desirable properties su... | lambda calculus type theory functional programming | 1 | What are different ways to provide a semantics to a language? -- (lambda calculus type theory functional programming)
<p>Suppose you have 1. a grammar for terms of a language; 2. type-assignment rules, 3. a set of reduction rules. You want to prove that your language is adequate for mathematical reasoning. If I underst... | habedi/stack-exchange-dataset |
103,349 | Performance of Modified Dijkstra's algorithm with Binariy heap as Priority Queue | <p>we know the performance of Dijkstra's algorithm with binary heap is O(log |V |) for delete_min, O(log |V |) for insert/ decrease_key, so the overall run time is O((|V|+|E|)log|V|).</p>

<p>Now let's modify the Dijkstra to stop once it reaches T (Destination) from S(Start). The given performance is:
<a hr... | algorithms graphs algorithm analysis asymptotics performance | 1 | Performance of Modified Dijkstra's algorithm with Binariy heap as Priority Queue -- (algorithms graphs algorithm analysis asymptotics performance)
<p>we know the performance of Dijkstra's algorithm with binary heap is O(log |V |) for delete_min, O(log |V |) for insert/ decrease_key, so the overall run time is O((|V|+|E... | habedi/stack-exchange-dataset |
103,355 | Solve PARTITION-INTO-THREE-SETS in pseudo-polynomial time | <p>Let <strong>PARTITION-INTO-THREE-SETS</strong> be defined as following:</p>

<p><strong>Input</strong>: Positive integers <span class="math-container">$a_1, ..., a_n$</span></p>

<p><strong>Problem</strong>: Are there three pairwise disjoint sets <span class="math-container">$I, J, K \subseteq \{1, .... | complexity theory np complete dynamic programming partitions pseudo polynomial | 1 | Solve PARTITION-INTO-THREE-SETS in pseudo-polynomial time -- (complexity theory np complete dynamic programming partitions pseudo polynomial)
<p>Let <strong>PARTITION-INTO-THREE-SETS</strong> be defined as following:</p>

<p><strong>Input</strong>: Positive integers <span class="math-container">$a_1, ..., a_n$<... | habedi/stack-exchange-dataset |
103,360 | What is wrong with this reduction from vertex cover to binary programming? | <p>I am trying to polynomial-time reduce the decision version of vertex cover to the decision version of binary programming. Here are the problem statements.</p>

<p><strong>Vertex Cover Decision Problem</strong></p>

<p>Instance: A graph <span class="math-container">$G=(V,E)$</span> and an integer <sp... | np complete reductions decision problem | 1 | What is wrong with this reduction from vertex cover to binary programming? -- (np complete reductions decision problem)
<p>I am trying to polynomial-time reduce the decision version of vertex cover to the decision version of binary programming. Here are the problem statements.</p>

<p><strong>Vertex Cover Deci... | habedi/stack-exchange-dataset |
103,365 | Detailed step of Dijkstra's algorithm performance analysis | <p>Reading the book of <a href="http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf" rel="nofollow noreferrer">Dasgupta-Papadimitriou-Vazirani.pdf</a> about the performance of Dijkstra's algorithm on Page 118, we are given:</p>
<blockquote>
<h3>4.4.3 Running time</h3>
<p>At the level o... | algorithm analysis search algorithms | 1 | Detailed step of Dijkstra's algorithm performance analysis -- (algorithm analysis search algorithms)
<p>Reading the book of <a href="http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf" rel="nofollow noreferrer">Dasgupta-Papadimitriou-Vazirani.pdf</a> about the performance of Dijkstra's algorithm ... | habedi/stack-exchange-dataset |
103,368 | Grover's Algorithm result when the desired element is not present | <p>What does Grover's algorithm output when the desired element is absent from the database? Since there will be no phase inversion, how exactly will the probabilities work?</p>
 | search algorithms quantum computing | 1 | Grover's Algorithm result when the desired element is not present -- (search algorithms quantum computing)
<p>What does Grover's algorithm output when the desired element is absent from the database? Since there will be no phase inversion, how exactly will the probabilities work?</p>
 | habedi/stack-exchange-dataset |
103,383 | Understanding connection between minimum spanning tree, shortest path, breadth first and depth first traversal | <p>In CLRS, in the later part of breadth first search topic, for unweighted graphs, it says:</p>

<blockquote>
 <p>At the beginning of this section, we claimed that breadth-first search finds the distance to each reachable vertex in a graph <span class="math-container">$G=(V,E)$</span> from a given source ... | graphs shortest path minimum spanning tree | 1 | Understanding connection between minimum spanning tree, shortest path, breadth first and depth first traversal -- (graphs shortest path minimum spanning tree)
<p>In CLRS, in the later part of breadth first search topic, for unweighted graphs, it says:</p>

<blockquote>
 <p>At the beginning of this section,... | habedi/stack-exchange-dataset |
103,390 | Constructing PDA to accept language $\{a^ib^j \mid 0 \leq j \leq 2i\}$ | <p>How can I construct a PDA which accepts the language 
<span class="math-container">$\{a^ib^j \mid 0 \leq j \leq 2i\}$</span>?</p>
 | pushdown automata | 1 | Constructing PDA to accept language $\{a^ib^j \mid 0 \leq j \leq 2i\}$ -- (pushdown automata)
<p>How can I construct a PDA which accepts the language 
<span class="math-container">$\{a^ib^j \mid 0 \leq j \leq 2i\}$</span>?</p>
 | habedi/stack-exchange-dataset |
103,391 | How is Johnson's shortest path weighting function $\hat{w}(u, v) = w(u, v) + h(u) - h(v)$ proven by the triangular inequility? | <p>Recap to the Johnson's shortest path algorithm:</p>

<p>By the procedure extending the original graph <span class="math-container">$G^\prime = (V^\prime, E^\prime), V^\prime = V\ \cup \{s\}, E^\prime = E\ \cup \{(s, v)\ |\ \forall v \in V\}$</span>, and then extend the original weighting function <span class... | shortest path weighted graphs | 1 | How is Johnson's shortest path weighting function $\hat{w}(u, v) = w(u, v) + h(u) - h(v)$ proven by the triangular inequility? -- (shortest path weighted graphs)
<p>Recap to the Johnson's shortest path algorithm:</p>

<p>By the procedure extending the original graph <span class="math-container">$G^\prime = (V^\... | habedi/stack-exchange-dataset |
103,393 | Rice's theorem applicable to the following language? | <p>Let <span class="math-container">$L= \{\langle M \rangle \mid M \text{ halts on } \langle M \rangle \} $</span>
be a language where <span class="math-container">$\langle M \rangle$</span> is the Code of the TM <span class="math-container">$M$</span>. <span class="math-container">$L$</span> is undecidable. </p>&#... | complexity theory turing machines computability undecidability rice theorem | 1 | Rice's theorem applicable to the following language? -- (complexity theory turing machines computability undecidability rice theorem)
<p>Let <span class="math-container">$L= \{\langle M \rangle \mid M \text{ halts on } \langle M \rangle \} $</span>
be a language where <span class="math-container">$\langle M \rangle... | habedi/stack-exchange-dataset |
103,401 | Where are C++ templates inside of the lambda cube? | <p>C++ templates have type variables and can express lambdas, so they must have System F embedded. But is that exactly where they are located in the lambda cube? Can C++ templates produce new types or express dependent types?</p>

<p>(I <a href="https://stackoverflow.com/questions/54371831/where-in-the-lambda-c... | programming languages type theory dependent types c++ calculus of constructions | 1 | Where are C++ templates inside of the lambda cube? -- (programming languages type theory dependent types c++ calculus of constructions)
<p>C++ templates have type variables and can express lambdas, so they must have System F embedded. But is that exactly where they are located in the lambda cube? Can C++ templates prod... | habedi/stack-exchange-dataset |
103,402 | Algorithm to find the two closest elements in a BST | <p>For example, consider an AVL tree:</p>

<p><a href="https://i.stack.imgur.com/CuKN7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CuKN7.png" alt="enter image description here"></a></p>

<p>Performing the two_close(T) should give back (13, 12), as they are the closest elements tog... | algorithms complexity theory trees binary trees | 1 | Algorithm to find the two closest elements in a BST -- (algorithms complexity theory trees binary trees)
<p>For example, consider an AVL tree:</p>

<p><a href="https://i.stack.imgur.com/CuKN7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CuKN7.png" alt="enter image description here"></a></p... | habedi/stack-exchange-dataset |
103,403 | Why Cook-Levin thorem's proof can mean SAT's NP-Hardness | <p>I'm studying about Cook-Levin theorem but there is a problem I faced. Cook-Levin theorem shows that any NPTM can be encoded as a boolean formula. About given language <span class="math-container">$A$</span>, instance <span class="math-container">$w$</span>, and NPTM <span class="math-container">$M$</span> that decid... | complexity theory np complete np hard satisfiability | 1 | Why Cook-Levin thorem's proof can mean SAT's NP-Hardness -- (complexity theory np complete np hard satisfiability)
<p>I'm studying about Cook-Levin theorem but there is a problem I faced. Cook-Levin theorem shows that any NPTM can be encoded as a boolean formula. About given language <span class="math-container">$A$</s... | habedi/stack-exchange-dataset |
103,411 | Bounds on "well dispersed" sparse matrices | <p>Suppose we have an <span class="math-container">$n\times n$</span> zero/one matrix <span class="math-container">$M$</span>, with <span class="math-container">$k$</span> ones. Let us say that the <em>extent</em> of <span class="math-container">$M$</span> is the maximum of <span class="math-container">$i+j$</span> ove... | graphs optimization asymptotics combinatorics | 1 | Bounds on "well dispersed" sparse matrices -- (graphs optimization asymptotics combinatorics)
<p>Suppose we have an <span class="math-container">$n\times n$</span> zero/one matrix <span class="math-container">$M$</span>, with <span class="math-container">$k$</span> ones. Let us say that the <em>extent</em> of <span cla... | habedi/stack-exchange-dataset |
103,413 | How to show that this decision problem is in co-NP? | <p>Given a set of strictly positive numbers <span class="math-container">$a_1, ..., a_n$</span>, the problem is to determine if <span class="math-container">$\lfloor n/2 \rfloor$</span> different indexes <span class="math-container">$i_1, ..., i_{\lfloor n/2 \rfloor}$</span> exist so that <span class="math-container">$... | complexity theory np co np | 1 | How to show that this decision problem is in co-NP? -- (complexity theory np co np)
<p>Given a set of strictly positive numbers <span class="math-container">$a_1, ..., a_n$</span>, the problem is to determine if <span class="math-container">$\lfloor n/2 \rfloor$</span> different indexes <span class="math-container">$i_... | habedi/stack-exchange-dataset |
103,422 | Interpretation of Turing's statement on universal computers | <p>I'm currently reading a book about artificial intelligence and i frequently come across the concept of universal computers, as it is essential to understand the book i would like to know the meaning of author's statement referring to Turning's paper of 1936: </p>

<blockquote>
 <p>If a type of computer ... | turing machines history | 1 | Interpretation of Turing's statement on universal computers -- (turing machines history)
<p>I'm currently reading a book about artificial intelligence and i frequently come across the concept of universal computers, as it is essential to understand the book i would like to know the meaning of author's statement referri... | habedi/stack-exchange-dataset |
103,439 | Are all countable partial functions computable? | <p>I know all computable partial functions are countable. Wondering if it is the the other way around as well. </p>
 | computability | 1 | Are all countable partial functions computable? -- (computability)
<p>I know all computable partial functions are countable. Wondering if it is the the other way around as well. </p>
 | habedi/stack-exchange-dataset |
103,440 | Efficient data structure handling insert(number) and find(sum) returning pair a,b such that a + b = sum | <p>There are two operations as follows:</p>
<blockquote>
<p><code>insert(num)</code>: insert num into the data structure.</p>
<p><code>find(sum)</code>: return a pair(a, b) such that <code>a + b = sum</code>, if no such pair exists return -1</p>
</blockquote>
<p>How such data structure could be desi... | algorithms data structures efficiency | 1 | Efficient data structure handling insert(number) and find(sum) returning pair a,b such that a + b = sum -- (algorithms data structures efficiency)
<p>There are two operations as follows:</p>
<blockquote>
<p><code>insert(num)</code>: insert num into the data structure.</p>
<p><code>find(sum)</code>: return a... | habedi/stack-exchange-dataset |
103,442 | Grammar of words with exactly $k$ prefixes in another grammar | <p>Given a context-free grammar <span class="math-container">$G$</span>, how can one systematically construct a grammar <span class="math-container">$G_k$</span> such that</p>

<p><span class="math-container">$$ L(G_k) = \{w \in \Sigma^* : |\text{Pref}(w) \cap L(G)| = k\} $$</span></p>

<p>where <span c... | formal languages context free pushdown automata strings substrings | 1 | Grammar of words with exactly $k$ prefixes in another grammar -- (formal languages context free pushdown automata strings substrings)
<p>Given a context-free grammar <span class="math-container">$G$</span>, how can one systematically construct a grammar <span class="math-container">$G_k$</span> such that</p>

<... | habedi/stack-exchange-dataset |
103,446 | Running Time for Finding Maximum | <p>Consider the algorithm findMax that finds the maximum entry in an integer array.</p>

<p><strong>Algorithm</strong> findMax(<span class="math-container">$A$</span>)<br>
 <strong><em>Input</em></strong>: An integer array <span class="math-container">$A$</span><br>
 <strong><em>Output</em></stron... | algorithms algorithm analysis time complexity asymptotics runtime analysis | 1 | Running Time for Finding Maximum -- (algorithms algorithm analysis time complexity asymptotics runtime analysis)
<p>Consider the algorithm findMax that finds the maximum entry in an integer array.</p>

<p><strong>Algorithm</strong> findMax(<span class="math-container">$A$</span>)<br>
 <strong><em>Input</... | habedi/stack-exchange-dataset |
103,449 | How many neurons is needed for UAT to hold? | <p>The universal approximation theorem states that a feed-forward network with a single hidden layer containing a finite number of neurons can approximate continuous functions on compact subsets of Rn, under mild assumptions on the activation function.</p>

<p>How many neurons is needed? For a function in 3 var... | neural networks | 1 | How many neurons is needed for UAT to hold? -- (neural networks)
<p>The universal approximation theorem states that a feed-forward network with a single hidden layer containing a finite number of neurons can approximate continuous functions on compact subsets of Rn, under mild assumptions on the activation function.</p... | habedi/stack-exchange-dataset |
103,453 | Given a constant k, find the biggest possible rooted tree, if for every path from root to leaf, the sum of the arity of its nodes equals k? | <p>As an example, here are all possible trees for the case <span class="math-container">$k=3$</span>:
<a href="https://i.stack.imgur.com/bggQZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bggQZ.png" alt="enter image description here"></a>
On each node written is its arity (= the number of ... | trees combinatorics | 1 | Given a constant k, find the biggest possible rooted tree, if for every path from root to leaf, the sum of the arity of its nodes equals k? -- (trees combinatorics)
<p>As an example, here are all possible trees for the case <span class="math-container">$k=3$</span>:
<a href="https://i.stack.imgur.com/bggQZ.png" rel... | habedi/stack-exchange-dataset |
103,454 | What does it mean " The outer level page table need not be page aligned? | <p>The question is in context to multilevel page table. I was trying to solve numerical on multi-level paging and noticed that page size might not be same at all levels. I came across the point "Outer level page tables need not be page aligned to inner page tables". </p>

<p>Question 1: Does this mean that oute... | operating systems virtual memory paging | 1 | What does it mean " The outer level page table need not be page aligned? -- (operating systems virtual memory paging)
<p>The question is in context to multilevel page table. I was trying to solve numerical on multi-level paging and noticed that page size might not be same at all levels. I came across the point "Outer l... | habedi/stack-exchange-dataset |
103,457 | Iterative Fibonacci algorithm correctness proof, finding loop invariants | <p>The algorithm take in an integer <span class="math-container">$n$</span> and outputs the <span class="math-container">$n$</span>th number in the Fibonacci sequence (<span class="math-container">$F_n$</span>). The sequence starts with <span class="math-container">$F_0$</span>. I am trying to prove the correctness ass... | algorithms correctness proof induction loop invariants | 1 | Iterative Fibonacci algorithm correctness proof, finding loop invariants -- (algorithms correctness proof induction loop invariants)
<p>The algorithm take in an integer <span class="math-container">$n$</span> and outputs the <span class="math-container">$n$</span>th number in the Fibonacci sequence (<span class="math-c... | habedi/stack-exchange-dataset |
103,467 | Complexity of Estrin polynomial evaluation | <p>The Estrin model for polynomial of degree <span class="math-container">$n$</span> is well known. But the reading of the Knuth (vol 2) or the original's paper <a href="https://www.computer.org/csdl/proceedings/afips/1960/5056/00/50560033.pdf" rel="nofollow noreferrer">Estrin</a> do not help (or I miss it). I am not a... | algorithm analysis | 1 | Complexity of Estrin polynomial evaluation -- (algorithm analysis)
<p>The Estrin model for polynomial of degree <span class="math-container">$n$</span> is well known. But the reading of the Knuth (vol 2) or the original's paper <a href="https://www.computer.org/csdl/proceedings/afips/1960/5056/00/50560033.pdf" rel="nof... | habedi/stack-exchange-dataset |
103,473 | If a deterministic finite automaton recognizes a language, must that language contain every accepting input? | <p>May a DFA recognize a language which is a proper subset of the set of all accepted inputs? </p>

<p>For instance, if there is a DFA which decides if an input <span class="math-container">$W$</span> has <span class="math-container">$w_0 = w_n$</span>, can it recognize a language <span class="math-container">$... | automata finite automata | 1 | If a deterministic finite automaton recognizes a language, must that language contain every accepting input? -- (automata finite automata)
<p>May a DFA recognize a language which is a proper subset of the set of all accepted inputs? </p>

<p>For instance, if there is a DFA which decides if an input <span class=... | habedi/stack-exchange-dataset |
103,477 | Church numerals without functions | <p>This is really a second part to my <a href="https://cs.stackexchange.com/questions/103476/is-there-a-systematic-way-to-know-when-to-alpha-transform-free-variables">first question</a>, but I felt that this was different enough from the first part that it merited its own question.</p>

<p>So, using Church nume... | lambda calculus church numerals | 1 | Church numerals without functions -- (lambda calculus church numerals)
<p>This is really a second part to my <a href="https://cs.stackexchange.com/questions/103476/is-there-a-systematic-way-to-know-when-to-alpha-transform-free-variables">first question</a>, but I felt that this was different enough from the first part ... | habedi/stack-exchange-dataset |
103,485 | $f(n) = o(n^c) \rightarrow \exists \epsilon > 0 \ s.t. f(n) = O(n^{c-\epsilon})$ | <p>I'm trying to prove that for arbitrary <span class="math-container">$c > 0$</span>, </p>

<p><span class="math-container">$f(n) = o(n^c) \rightarrow \exists \epsilon > 0 \ s.t. f(n) = O(n^{c-\epsilon})$</span></p>

<p>Intuitively, this seems to be true to me (little-o implies some gap "between"... | asymptotics master theorem | 1 | $f(n) = o(n^c) \rightarrow \exists \epsilon > 0 \ s.t. f(n) = O(n^{c-\epsilon})$ -- (asymptotics master theorem)
<p>I'm trying to prove that for arbitrary <span class="math-container">$c > 0$</span>, </p>

<p><span class="math-container">$f(n) = o(n^c) \rightarrow \exists \epsilon > 0 \ s.t. f(n) = O(n^{c... | habedi/stack-exchange-dataset |
103,488 | How to prove that if $L, G$ are regular languages then $\{w\in L|\exists x\in G: |x|=2\cdot |w|\}$ is a context-free language? | <blockquote>
 <p>Prove that if <span class="math-container">$L, G$</span> are regular languages over <span class="math-container">$\{a,b,c\}$</span> then <span class="math-container">$H=\{w\in L|\exists x\in G: |x|=2\cdot |w|\}$</span> is a context-free language?</p>
</blockquote>

<p>I think this coul... | formal languages regular languages context free pushdown automata | 1 | How to prove that if $L, G$ are regular languages then $\{w\in L|\exists x\in G: |x|=2\cdot |w|\}$ is a context-free language? -- (formal languages regular languages context free pushdown automata)
<blockquote>
 <p>Prove that if <span class="math-container">$L, G$</span> are regular languages over <span class="mat... | habedi/stack-exchange-dataset |
103,490 | address spaces of changing processes | <p>I read that the mapping for user-space processes is changed after each process switch. By mapping I mean the translation from virtual addresses to "real" memory address. I thought that processes are loaded into RAM and are held there (that's what the RAM is for). So the addresses in "real" memory addresses shouldn't... | operating systems virtual memory | 1 | address spaces of changing processes -- (operating systems virtual memory)
<p>I read that the mapping for user-space processes is changed after each process switch. By mapping I mean the translation from virtual addresses to "real" memory address. I thought that processes are loaded into RAM and are held there (that's ... | habedi/stack-exchange-dataset |
103,494 | Better implementation to find the root of an element in QuickUnion implementation of UnionFind problem | <p>I wanted to know which implementation is better to find the root of the element in the Quick Union implementation of the UnionFind problem.
The professor has used a while loop to find the root of the element, while I have implemented it using a recursive approach. 
Which approach is better in terms of space ... | algorithms algorithm analysis space complexity union find | 1 | Better implementation to find the root of an element in QuickUnion implementation of UnionFind problem -- (algorithms algorithm analysis space complexity union find)
<p>I wanted to know which implementation is better to find the root of the element in the Quick Union implementation of the UnionFind problem.
The pro... | habedi/stack-exchange-dataset |
103,497 | Calculating the average waiting time of tasks | <p>I have proposed a load balancing algorithm for a group of homogeneous processing devices and now I want to measure <strong>the average waiting time</strong> to see if my algorithm is successful in decreasing the waiting time. I have considered number of tasks on each device as the load of that device.</p>

<... | algorithm analysis | 1 | Calculating the average waiting time of tasks -- (algorithm analysis)
<p>I have proposed a load balancing algorithm for a group of homogeneous processing devices and now I want to measure <strong>the average waiting time</strong> to see if my algorithm is successful in decreasing the waiting time. I have considered num... | habedi/stack-exchange-dataset |
103,502 | How to prove that $\{\$x\$\}$ is a regular language if $x$ is derived from $L=\{w\}$ by substituting substrings? | <blockquote>
 <p>Prove that if <span class="math-container">$L$</span> is regular over <span class="math-container">$\Sigma=\{0,1,2\}$</span> then the following language over <span class="math-container">$\{0,1,2,\$\}$</span> is also regular:
 <span class="math-container">$$
G=\{\$x\$|\exists w\in L: x\te... | formal languages regular languages regular expressions | 1 | How to prove that $\{\$x\$\}$ is a regular language if $x$ is derived from $L=\{w\}$ by substituting substrings? -- (formal languages regular languages regular expressions)
<blockquote>
 <p>Prove that if <span class="math-container">$L$</span> is regular over <span class="math-container">$\Sigma=\{0,1,2\}$</span> ... | habedi/stack-exchange-dataset |
103,508 | What is the depth of recursion if we split an array into $\log_2(n)$ with each recursive call? | <p>We have a function which takes an array as input. It breaks an array into <span class="math-container">$\log_2(n)$</span> parts with equal sizes where <span class="math-container">$n$</span> is the size of the subarray. It keeps breaking each of the subarrays until there are only two elements left in it. What is th... | complexity theory time complexity asymptotics recursion mathematical analysis | 1 | What is the depth of recursion if we split an array into $\log_2(n)$ with each recursive call? -- (complexity theory time complexity asymptotics recursion mathematical analysis)
<p>We have a function which takes an array as input. It breaks an array into <span class="math-container">$\log_2(n)$</span> parts with equal ... | habedi/stack-exchange-dataset |
103,516 | Constructing a PDA with an unequal number of a/b | <p>I'm looking at this pdf for problems: <a href="http://www.public.asu.edu/~ccolbou/src/355hw5solf10.pdf" rel="nofollow noreferrer">http://www.public.asu.edu/~ccolbou/src/355hw5solf10.pdf</a></p>

<p>I found question 3g to construct a pushdown automata for the following:</p>

<p>{<span class="math-cont... | formal languages pushdown automata | 1 | Constructing a PDA with an unequal number of a/b -- (formal languages pushdown automata)
<p>I'm looking at this pdf for problems: <a href="http://www.public.asu.edu/~ccolbou/src/355hw5solf10.pdf" rel="nofollow noreferrer">http://www.public.asu.edu/~ccolbou/src/355hw5solf10.pdf</a></p>

<p>I found question 3g to... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.