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 |
|---|---|---|---|---|---|---|
70,393 | Which language is accepted by this Muller Automaton? | <p><a href="https://i.stack.imgur.com/iMF9D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iMF9D.png" alt="enter image description here"></a></p>

<p>In my opinon the Language recognised is this:</p>

<p>$(a + b)^* (ab)^ω$
but the solution provided is: $(a + b)^* (a + b)^ω$</p>&#... | automata regular expressions buchi automata | 1 | Which language is accepted by this Muller Automaton? -- (automata regular expressions buchi automata)
<p><a href="https://i.stack.imgur.com/iMF9D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iMF9D.png" alt="enter image description here"></a></p>

<p>In my opinon the Language recognised is ... | habedi/stack-exchange-dataset |
70,405 | How to get the quick answer to the "Is there AT LEAST ONE subset that contains all given elements?" question if the set of subsets is very large? | <p>I have a very large amount of objects that look like this: </p>

<pre><code>DataDict = {
id1: {"a": true, "b": true, "bc": true, "hgf": true},
id2: {"bcwe": true, "nKNNn": true, "mjj": true, "AAt": true},
id3: {"h": true, "a": true, "mjj": true, "ABwAU": true},
id4: {"wvzy": true, "zzba": tr... | algorithms data structures optimization search algorithms performance | 1 | How to get the quick answer to the "Is there AT LEAST ONE subset that contains all given elements?" question if the set of subsets is very large? -- (algorithms data structures optimization search algorithms performance)
<p>I have a very large amount of objects that look like this: </p>

<pre><code>DataDict = ... | habedi/stack-exchange-dataset |
70,406 | Language to regular expression | <p>Having difficulty grasping the concept of how a language and a regular expression are related. For example: </p>

<p>(In all cases, the alphabet is $\{0,1\}$)</p>

<p>The language $L = \{100,10,011\}$ ------> Regular expression. </p>

<p>So far, I have:</p>

<p>$(0+1)$ since you can h... | regular languages regular expressions | 1 | Language to regular expression -- (regular languages regular expressions)
<p>Having difficulty grasping the concept of how a language and a regular expression are related. For example: </p>

<p>(In all cases, the alphabet is $\{0,1\}$)</p>

<p>The language $L = \{100,10,011\}$ ------> Regular expression... | habedi/stack-exchange-dataset |
70,408 | Show that the class of regular languages is closed under shuffle | <p>For languages A and B, let the shuffle of A and B be the language<br>
$ \{w| w = a_1b_1···a_kb_k,$ where $a_1···a_k ∈ A$ and $b_1···b_k ∈ B,$ each$ a_i,b_i ∈ Σ^∗\}$.<br>
Show that the class of regular languages is closed under shuffle.</p>

<p>Approach: If A and B are regular, then there exists an NFA ... | regular languages finite automata | 1 | Show that the class of regular languages is closed under shuffle -- (regular languages finite automata)
<p>For languages A and B, let the shuffle of A and B be the language<br>
$ \{w| w = a_1b_1···a_kb_k,$ where $a_1···a_k ∈ A$ and $b_1···b_k ∈ B,$ each$ a_i,b_i ∈ Σ^∗\}$.<br>
Show that the class of regular langu... | habedi/stack-exchange-dataset |
70,415 | Is $2^{1+\sqrt{mn}}$ an upper bound for the size of the DFA resulting from the determinisation of n DFAs of size m | <p><i>(all automata sizes are expressed in number of states in this question)</i></p>

<p>There exist NFAs of size $n$ for which the smallest DFA recognizing the same language is of size at least $2^n$.</p>

<p>Let $\Sigma$ be a vocabulary, and let's consider $n$ regular languages $L_i \subseteq \Sigma^... | automata finite automata | 1 | Is $2^{1+\sqrt{mn}}$ an upper bound for the size of the DFA resulting from the determinisation of n DFAs of size m -- (automata finite automata)
<p><i>(all automata sizes are expressed in number of states in this question)</i></p>

<p>There exist NFAs of size $n$ for which the smallest DFA recognizing the same ... | habedi/stack-exchange-dataset |
70,416 | Counting the nodes of a unidirectional graph | <p><a href="https://i.stack.imgur.com/9M6v7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9M6v7.jpg" alt="Initial Graph"></a></p>

<p>Suppose that we have the above graph. The graph is directed and is <strong>unidirectional</strong>; that is, we can only traverse it from <em>top</em> to <em... | algorithms graphs data structures | 1 | Counting the nodes of a unidirectional graph -- (algorithms graphs data structures)
<p><a href="https://i.stack.imgur.com/9M6v7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9M6v7.jpg" alt="Initial Graph"></a></p>

<p>Suppose that we have the above graph. The graph is directed and is <stron... | habedi/stack-exchange-dataset |
70,417 | Insertion of n consecutive keys in an initially empty B-Tree | <p>Consider this question ( 18.2-4 of CLRS) which states that: </p>

<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>

<p>My approach:<br>
We add each element one by one. We'll need 3 elements at first (nam... | trees | 1 | Insertion of n consecutive keys in an initially empty B-Tree -- (trees)
<p>Consider this question ( 18.2-4 of CLRS) which states that: </p>

<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>

<p>My approach:<br>... | habedi/stack-exchange-dataset |
70,422 | From CNF to ILP? | <p>Can we transform a CNF to ILP without introducing new variables?</p>

<p>My question can be seen as a follow up to <a href="https://cs.stackexchange.com/questions/12102/express-boolean-logic-operations-in-zero-one-integer-linear-programming-ilp">Express boolean logic operations in zero-one integer linear pro... | integer programming | 1 | From CNF to ILP? -- (integer programming)
<p>Can we transform a CNF to ILP without introducing new variables?</p>

<p>My question can be seen as a follow up to <a href="https://cs.stackexchange.com/questions/12102/express-boolean-logic-operations-in-zero-one-integer-linear-programming-ilp">Express boolean logic... | habedi/stack-exchange-dataset |
70,427 | Special term for a cycle containing a single vertex and edge | <p>Is there a special term for a cycle containing a single vertex and edge? I feel like I read "self-cycle" somewhere, but can't find where.</p>
 | graphs terminology | 1 | Special term for a cycle containing a single vertex and edge -- (graphs terminology)
<p>Is there a special term for a cycle containing a single vertex and edge? I feel like I read "self-cycle" somewhere, but can't find where.</p>
 | habedi/stack-exchange-dataset |
70,434 | How is RANSAC used to estimate a homography given the descriptors of both images computed with SIFT? | <p>Let image <span class="math-container">$x$</span> be an original (non-warped) image. Let <span class="math-container">$I_1$</span> be <span class="math-container">$I_1'$</span> having suffered some projective transformation and possibly some noise.
Suppose we have computed SIFT descriptors for both images.</p>&#... | computer vision | 1 | How is RANSAC used to estimate a homography given the descriptors of both images computed with SIFT? -- (computer vision)
<p>Let image <span class="math-container">$x$</span> be an original (non-warped) image. Let <span class="math-container">$I_1$</span> be <span class="math-container">$I_1'$</span> having suffered so... | habedi/stack-exchange-dataset |
70,443 | Pumping Lemma String Choice | <p>Let $A = \{ uu \text{ } | \text{ } u \in \{a,b\}^* \}$ be a language. Suppose that we want to prove that A is not regular via the pumping lemma, why is the string w = $a^{p} a^{p}$ not valid to derive a contradiction?</p>
 | formal languages regular languages pumping lemma | 1 | Pumping Lemma String Choice -- (formal languages regular languages pumping lemma)
<p>Let $A = \{ uu \text{ } | \text{ } u \in \{a,b\}^* \}$ be a language. Suppose that we want to prove that A is not regular via the pumping lemma, why is the string w = $a^{p} a^{p}$ not valid to derive a contradiction?</p>
 | habedi/stack-exchange-dataset |
70,450 | Is this problem NP-hard? select k sets from a collection of sets such that each selected set has an empty intersection with the non selected ones | <p>select k sets from a collection of sets such that each selected set has an empty intersection with the non selected ones</p>
 | np complete | 1 | Is this problem NP-hard? select k sets from a collection of sets such that each selected set has an empty intersection with the non selected ones -- (np complete)
<p>select k sets from a collection of sets such that each selected set has an empty intersection with the non selected ones</p>
 | habedi/stack-exchange-dataset |
70,459 | Is thread in operating system = thread function in programming languages? | <p>I'm new to Operating System, just learnt about process and now is about to learn about threads. From what I understand,</p>

<ol>
<li><p>a program is an executable file, program code</p></li>
<li><p>a process is a program in execution</p></li>
<li><p>a thread is part of a process</p></li>
<li... | operating systems | 1 | Is thread in operating system = thread function in programming languages? -- (operating systems)
<p>I'm new to Operating System, just learnt about process and now is about to learn about threads. From what I understand,</p>

<ol>
<li><p>a program is an executable file, program code</p></li>
<li><p>a pro... | habedi/stack-exchange-dataset |
70,461 | Can Strassen's multiplication algorithm be improved if we divide matrices to 3x3 or axa in general? | <p>Strassen's algorithm uses the divide and conquer approach to divide the matrix multiplication of two nxn matrices to multiplication of 7 2x2 matrices to get an overall complexity O(n^c) where c=log_2(7). I also read a paper which proved that it was impossible to multiply two 2x2 matrices in less than 7 multiplicati... | algorithms algorithm analysis divide and conquer multiplication | 1 | Can Strassen's multiplication algorithm be improved if we divide matrices to 3x3 or axa in general? -- (algorithms algorithm analysis divide and conquer multiplication)
<p>Strassen's algorithm uses the divide and conquer approach to divide the matrix multiplication of two nxn matrices to multiplication of 7 2x2 matric... | habedi/stack-exchange-dataset |
70,463 | $(max,+)$ matrix product with limited number of values | <p>I read that there is a $\Omega(n^3)$ lower bound for $(max,+)$ matrix multiplication (with $n\times n$ matrices). This is the matrix product defined as: $(A\cdot B)_{ij}:=\max^n_{k=1}\{A_{ik}+B_{kj}\}$, for some $n\times n$ matrices $A$ and $B$. This lower bound means that the trivial algorithm is the best one.</p>&... | reference request matrices multiplication | 1 | $(max,+)$ matrix product with limited number of values -- (reference request matrices multiplication)
<p>I read that there is a $\Omega(n^3)$ lower bound for $(max,+)$ matrix multiplication (with $n\times n$ matrices). This is the matrix product defined as: $(A\cdot B)_{ij}:=\max^n_{k=1}\{A_{ik}+B_{kj}\}$, for some $n\... | habedi/stack-exchange-dataset |
70,476 | How to calculate the number of tag, index and offset bits of 2 different caches? | <p>I have two exercises:
<br>1) A 128KB direct-mapped cache, with lines from 32bytes/lines and 36-bit address.
<br>2) A 512KB 2-way associative cache, with lines from 64bytes/lines and 36-bit address.
<br>For both exercises i have to find the number of bits needed for the tag,index and offset fields.
<b... | computer architecture cpu cache | 1 | How to calculate the number of tag, index and offset bits of 2 different caches? -- (computer architecture cpu cache)
<p>I have two exercises:
<br>1) A 128KB direct-mapped cache, with lines from 32bytes/lines and 36-bit address.
<br>2) A 512KB 2-way associative cache, with lines from 64bytes/lines and 36-bit ad... | habedi/stack-exchange-dataset |
70,477 | Basic notation in lambda calculus | <p>I have started learning lambda calculus from the book by Hindley and Seldin.</p>

<p>It brought up the concept with the function $x-y$, first as a function of $x$ and then as a function of $y$. In a way, it emphasized the difference between treating the expression as a function of $x$ and function of $y$, gi... | lambda calculus | 1 | Basic notation in lambda calculus -- (lambda calculus)
<p>I have started learning lambda calculus from the book by Hindley and Seldin.</p>

<p>It brought up the concept with the function $x-y$, first as a function of $x$ and then as a function of $y$. In a way, it emphasized the difference between treating the ... | habedi/stack-exchange-dataset |
70,478 | Upper bound for the union of $n$ DFAs of size at most $m$? | <p>Let $\Sigma$ be an alphabet of size $2$, and let's consider $n$ regular languages $L_i \subseteq \Sigma^*$ respectively recognized by $n$ minimal DFAs $D_i$ whose size are bounded by $m$. As the number $k$ of minimal DFAs of size at most $m$ is finite, there exists a function $f$ that returns this number $k=f(m)$.</... | automata finite automata pushdown automata | 1 | Upper bound for the union of $n$ DFAs of size at most $m$? -- (automata finite automata pushdown automata)
<p>Let $\Sigma$ be an alphabet of size $2$, and let's consider $n$ regular languages $L_i \subseteq \Sigma^*$ respectively recognized by $n$ minimal DFAs $D_i$ whose size are bounded by $m$. As the number $k$ of m... | habedi/stack-exchange-dataset |
70,484 | Is UNIQUE-X3C a US-complete problem? | <p>The problem: Exact Cover by 3-Sets (X3C)</p>

<p>The definition: Given a set X, with |X| = 3q (so, the size of X is a multiple of 3), and a collection C of 3-element subsets of X. Can we find a subset C’ of C where every element of X occurs in exactly one member of C’? (So, C’ is an “exact cover” of X).</p... | complexity theory np complete complexity classes | 1 | Is UNIQUE-X3C a US-complete problem? -- (complexity theory np complete complexity classes)
<p>The problem: Exact Cover by 3-Sets (X3C)</p>

<p>The definition: Given a set X, with |X| = 3q (so, the size of X is a multiple of 3), and a collection C of 3-element subsets of X. Can we find a subset C’ of C where ev... | habedi/stack-exchange-dataset |
70,490 | Minimizing transportation cost through a network, multiple source/sinks | <p>I have the following problem:</p>
<blockquote>
<p>Inputs:</p>
<ul>
<li>A finite collection <span class="math-container">$V$</span> of vertices</li>
<li>A metric cost function <span class="math-container">$c:V^2\to\Bbb R$</span> (interpreted as the edge cost of a complete graph on <span class="mat... | algorithms complexity theory optimization | 1 | Minimizing transportation cost through a network, multiple source/sinks -- (algorithms complexity theory optimization)
<p>I have the following problem:</p>
<blockquote>
<p>Inputs:</p>
<ul>
<li>A finite collection <span class="math-container">$V$</span> of vertices</li>
<li>A metric cost function <sp... | habedi/stack-exchange-dataset |
70,494 | $\lambda x. \lambda x.x$ vs $\lambda y. \lambda x.x$ | <p>Several times, I saw $\lambda$-terms such as $\lambda x. \lambda x.x$, where $x$ is bound by the inner lambda, which I agree. </p>

<p>why not just write it as $\lambda y. \lambda x.x$, so it is clear and you don't need to comment such as "where $x$ is bound by the inner lambda".</p>

<ol>
<li><p... | lambda calculus | 1 | $\lambda x. \lambda x.x$ vs $\lambda y. \lambda x.x$ -- (lambda calculus)
<p>Several times, I saw $\lambda$-terms such as $\lambda x. \lambda x.x$, where $x$ is bound by the inner lambda, which I agree. </p>

<p>why not just write it as $\lambda y. \lambda x.x$, so it is clear and you don't need to comment such... | habedi/stack-exchange-dataset |
70,500 | Is selecting some of the sets such that their intersection is of size k NP-hard? | <p>Given collection of sets S1,...,Sn and a positive number k. Is the problem of selecting some of the sets such that their intersection is of size k NP-hard?</p>

<p>So far, I tend to believe it is so I tried to find a reduction (unsuccessful so far),
I have tried is to replace intersection by union (which... | np complete np hard | 1 | Is selecting some of the sets such that their intersection is of size k NP-hard? -- (np complete np hard)
<p>Given collection of sets S1,...,Sn and a positive number k. Is the problem of selecting some of the sets such that their intersection is of size k NP-hard?</p>

<p>So far, I tend to believe it is so I tr... | habedi/stack-exchange-dataset |
70,501 | Formal specification; Logical formula | <p><strong>* Initial Question *</strong></p>

<p>I'm trying to write a logical formula consists of three Boolean variable C1, C2, C3. </p>

<p>My program takes graph as input and checks properties about them. C1 represents presence of some <strong>structural properties</strong> of the input graph (graph... | satisfiability formal methods first order logic automated theorem proving c | 1 | Formal specification; Logical formula -- (satisfiability formal methods first order logic automated theorem proving c)
<p><strong>* Initial Question *</strong></p>

<p>I'm trying to write a logical formula consists of three Boolean variable C1, C2, C3. </p>

<p>My program takes graph as input and checks... | habedi/stack-exchange-dataset |
70,507 | Is that would be better approach to naive algorithm? | <p>I was studying about naive pattern search algorithm and found that it requires two loops to match the pattern present in a string or not. That time an Idea stuck in my mind and I think it would be a better approach because I used only one loop to find out the pattern in string. Here is </p>

<p>Pseudocode </... | algorithms algorithm analysis time complexity search algorithms | 1 | Is that would be better approach to naive algorithm? -- (algorithms algorithm analysis time complexity search algorithms)
<p>I was studying about naive pattern search algorithm and found that it requires two loops to match the pattern present in a string or not. That time an Idea stuck in my mind and I think it would b... | habedi/stack-exchange-dataset |
70,511 | $A, B$ --- enumerable sets, is $A \times B$ enumerable? | <p>$A, B$ – enumerable sets, is $A \times B$ enumerable?
I have some thoughts, that maybe it can be done using something like the proof of countability of $\mathbb{N} \times \mathbb{N}$, but I don't know how to prove this more proper.</p>
 | computability discrete mathematics | 1 | $A, B$ --- enumerable sets, is $A \times B$ enumerable? -- (computability discrete mathematics)
<p>$A, B$ – enumerable sets, is $A \times B$ enumerable?
I have some thoughts, that maybe it can be done using something like the proof of countability of $\mathbb{N} \times \mathbb{N}$, but I don't know how to prove thi... | habedi/stack-exchange-dataset |
70,512 | Number of $1$'s in a Kolmogorov-random number | <p>The problem I'm trying to tackle is to show that for a Kolmogorov-random number of length $n$, the amount of $1$'s in its binary representation is greater than $n/4$.</p>

<p>My only idea so far, is to use a Turing machine that takes indices of $1$'s as an argument and produces a binary sequence accordingly.... | kolmogorov complexity | 1 | Number of $1$'s in a Kolmogorov-random number -- (kolmogorov complexity)
<p>The problem I'm trying to tackle is to show that for a Kolmogorov-random number of length $n$, the amount of $1$'s in its binary representation is greater than $n/4$.</p>

<p>My only idea so far, is to use a Turing machine that takes in... | habedi/stack-exchange-dataset |
70,516 | Number of times statement is executed in complex nested loop | <p>I am trying to find out how many times the "statement" is executed by finding its formula based on these loops:</p>

<pre><code>int s = 0;
for(int k = n; k > 0; k /= 2)
{
 for(int l = k; l < n; l++)
 {
 s++; // statement
 }
}
</code></pre>

<p>I have been s... | algorithm analysis time complexity asymptotics runtime analysis | 1 | Number of times statement is executed in complex nested loop -- (algorithm analysis time complexity asymptotics runtime analysis)
<p>I am trying to find out how many times the "statement" is executed by finding its formula based on these loops:</p>

<pre><code>int s = 0;
for(int k = n; k > 0; k /= 2)
... | habedi/stack-exchange-dataset |
70,518 | Why do we use the log in gradient-based reinforcement algorithms? | <p>I've been reading some papers on reinforcement learning.</p>

<p><span class="math-container">$$\Delta w=\frac{\partial ln\ p_w}{\partial w}r$$</span></p>

<p>I often see expressions, similar to the above one, where the weights (denoted by <span class="math-container">$w$</span>) are updated followin... | machine learning artificial intelligence reinforcement learning gradient descent | 1 | Why do we use the log in gradient-based reinforcement algorithms? -- (machine learning artificial intelligence reinforcement learning gradient descent)
<p>I've been reading some papers on reinforcement learning.</p>

<p><span class="math-container">$$\Delta w=\frac{\partial ln\ p_w}{\partial w}r$$</span></p>&#x... | habedi/stack-exchange-dataset |
70,521 | Selecting optimal order of questions to minimize total time | <p>Suppose there is a tutorial session at a university.
We have a set of $k$ questions $Q = \{ q_1 \ldots q_k \}$ and a set of $n$
students $S = \{ s_1 \ldots s_n \}$. Each student has a doubt in a certain subset of questions, i.e. for each student $s_j$, let $Q_j \subseteq Q$ be
the set of questions that a... | algorithms greedy algorithms | 1 | Selecting optimal order of questions to minimize total time -- (algorithms greedy algorithms)
<p>Suppose there is a tutorial session at a university.
We have a set of $k$ questions $Q = \{ q_1 \ldots q_k \}$ and a set of $n$
students $S = \{ s_1 \ldots s_n \}$. Each student has a doubt in a certain subset of qu... | habedi/stack-exchange-dataset |
70,529 | Determining whether $ L = \{ 0^n1^{n^2} | n \ge 0 \} $ is a CFL | <p>Assuming $L$ is defined as follows:</p>

<p>$$ L = \{ 0^n1^{n^2} | n \ge 0 \} $$</p>

<p>I'm trying to either prove/disprove whether $L$ is CFL or not.</p>

<p>My intuition tells me its not CFL since I cannot express the power $n^2$ by itself using CFL, but I'm having trouble proving so using... | automata pumping lemma pushdown automata | 1 | Determining whether $ L = \{ 0^n1^{n^2} | n \ge 0 \} $ is a CFL -- (automata pumping lemma pushdown automata)
<p>Assuming $L$ is defined as follows:</p>

<p>$$ L = \{ 0^n1^{n^2} | n \ge 0 \} $$</p>

<p>I'm trying to either prove/disprove whether $L$ is CFL or not.</p>

<p>My intuition tells me i... | habedi/stack-exchange-dataset |
70,530 | Distributive property with sum types and product types | <p>In <a href="https://www.infoq.com/presentations/category-theory-propositions-principle" rel="nofollow noreferrer">Philip Wadler's presentation, "Category Theory for the Working Hacker",</a> something confused me. At about 30:52, he says:</p>

<blockquote>
 <p>We need this additional construct which is c... | type theory | 1 | Distributive property with sum types and product types -- (type theory)
<p>In <a href="https://www.infoq.com/presentations/category-theory-propositions-principle" rel="nofollow noreferrer">Philip Wadler's presentation, "Category Theory for the Working Hacker",</a> something confused me. At about 30:52, he says:</p>
... | habedi/stack-exchange-dataset |
70,531 | Reduction 3SAT and CLIQUE | <p>Hello everyone this is my first question ever and I apologize if I ask in the wrong manner causing this post to be either closed or deleted. I'm learning Reductions and my professor has asked us to write a paper on reductions (3SAT)</p>

<p>When doing the Reduction from the Clique Problem to 3SAT, I understa... | algorithms reductions 3 sat | 1 | Reduction 3SAT and CLIQUE -- (algorithms reductions 3 sat)
<p>Hello everyone this is my first question ever and I apologize if I ask in the wrong manner causing this post to be either closed or deleted. I'm learning Reductions and my professor has asked us to write a paper on reductions (3SAT)</p>

<p>When doin... | habedi/stack-exchange-dataset |
70,537 | Proving that $f(n) = o(g(n))$ implies $2^{f(n)} = o(2^{g(n)})$ | <p>I can't find a counterexample to
$$f(n) = o(g(n)) \text{ implies } 2^{f(n)} = o(2^{g(n)})\,,$$ 
but I do not know a formal way of proving it. Can anyone lead me in the right direction? I asked this exact question yesterday in Stack Overflow by accident (meant to post here) but no one could come up with a val... | algorithms asymptotics | 1 | Proving that $f(n) = o(g(n))$ implies $2^{f(n)} = o(2^{g(n)})$ -- (algorithms asymptotics)
<p>I can't find a counterexample to
$$f(n) = o(g(n)) \text{ implies } 2^{f(n)} = o(2^{g(n)})\,,$$ 
but I do not know a formal way of proving it. Can anyone lead me in the right direction? I asked this exact question yeste... | habedi/stack-exchange-dataset |
70,539 | What is the O time complexity for this algorithm? | <p>is the Big-O for this O(1) or some asymptotic like 1/n?</p>

<p>Saying that because if it defaults, the time limits at about 1000000 ns, but if it returns while in the loop, it is about a fraction of that. The time seems to increase very slightly as the inputs increase.</p>

<pre><code>public static ... | time complexity java | 1 | What is the O time complexity for this algorithm? -- (time complexity java)
<p>is the Big-O for this O(1) or some asymptotic like 1/n?</p>

<p>Saying that because if it defaults, the time limits at about 1000000 ns, but if it returns while in the loop, it is about a fraction of that. The time seems to increase ... | habedi/stack-exchange-dataset |
70,540 | Push-down Automata Construction | <p>Construct a push-down automata to recognize the language $ A = \{u\#v \in \{0,1,\#\}^{*} | u = v^{\complement} \} $. Here, $v^{\complement}$ is the bit-complement of v.</p>

<p>I don't see how to perform this with a LIFO stack. I would like some hints (not a solution) if possible.</p>

<p>Thanks,</p>... | formal languages context free pushdown automata | 1 | Push-down Automata Construction -- (formal languages context free pushdown automata)
<p>Construct a push-down automata to recognize the language $ A = \{u\#v \in \{0,1,\#\}^{*} | u = v^{\complement} \} $. Here, $v^{\complement}$ is the bit-complement of v.</p>

<p>I don't see how to perform this with a LIFO sta... | habedi/stack-exchange-dataset |
70,554 | Exponential time local search heuristics for Weighted MAX-CUT-Flip | <p>I have read multiple times [Theorem 5.15, 1][End of page 2, 2] that local search heuristics for $\textsf{Weighted Max-Cut}$ with $\textsf{Flip}$ neighbourhood takes an exponential time in some cases.</p>

<p>In particular, the problem is as follows. Given a partition $(V1,V2)$, its neighbours are partitions ... | complexity theory runtime analysis | 1 | Exponential time local search heuristics for Weighted MAX-CUT-Flip -- (complexity theory runtime analysis)
<p>I have read multiple times [Theorem 5.15, 1][End of page 2, 2] that local search heuristics for $\textsf{Weighted Max-Cut}$ with $\textsf{Flip}$ neighbourhood takes an exponential time in some cases.</p>
&#... | habedi/stack-exchange-dataset |
70,563 | The fastest way to check if a move is a winning move in Tic Tac Toe | <p>I'm creating a tic tac toe game, there will be two players: <code>X</code> and <code>O</code>. <code>X</code> will be a human, and <code>O</code> is an AI which will always choose the best move to play. My board is an 11x11 board and the winning condition is 5 in a row. </p>

<p>How do I know if a board is... | algorithms complexity theory artificial intelligence search algorithms | 1 | The fastest way to check if a move is a winning move in Tic Tac Toe -- (algorithms complexity theory artificial intelligence search algorithms)
<p>I'm creating a tic tac toe game, there will be two players: <code>X</code> and <code>O</code>. <code>X</code> will be a human, and <code>O</code> is an AI which will always ... | habedi/stack-exchange-dataset |
70,569 | Choosing a production with $\lambda$ in Context-Free Grammars | <p>Given the context-free grammar</p>

<p>\begin{align*}
& S \rightarrow AA \\
& A \rightarrow xA \\
& A \rightarrow B \\
& B \rightarrow yB \\
& B \rightarrow \lambda
\end{align*}
What is the meaning of $\lambda$? $\lambda$ itself means the empty string and will ... | formal grammars parsers | 1 | Choosing a production with $\lambda$ in Context-Free Grammars -- (formal grammars parsers)
<p>Given the context-free grammar</p>

<p>\begin{align*}
& S \rightarrow AA \\
& A \rightarrow xA \\
& A \rightarrow B \\
& B \rightarrow yB \\
& B \rightarrow \lambda
\end{alig... | habedi/stack-exchange-dataset |
70,591 | Probabilistic Substring Match | <p>I'm looking for an algorithm that will help me determine substring matches at scale.</p>

<p>I have a pool of 100+ million "needles" (strings). I can do as much pre-processing on them as I want, and storage is cheap.</p>

<p>On detection side, I have both a very large pool (hundreds of TB) of strings... | probabilistic algorithms substrings longest common substring | 1 | Probabilistic Substring Match -- (probabilistic algorithms substrings longest common substring)
<p>I'm looking for an algorithm that will help me determine substring matches at scale.</p>

<p>I have a pool of 100+ million "needles" (strings). I can do as much pre-processing on them as I want, and storage is che... | habedi/stack-exchange-dataset |
70,595 | Algorithm to allocate resources to minimize the maximum of any party | <p>I was given the following algorithms problem:</p>

<blockquote>
 <p>Suppose you have $n$ cities. Each city $c_i$ has population $p_i$. You
 want to construct $m \geq n$ schools, where each school can only serve students of its city, and fulfill two objectives:</p>
 
 <ol>
 <li><p>Eve... | algorithms optimization | 1 | Algorithm to allocate resources to minimize the maximum of any party -- (algorithms optimization)
<p>I was given the following algorithms problem:</p>

<blockquote>
 <p>Suppose you have $n$ cities. Each city $c_i$ has population $p_i$. You
 want to construct $m \geq n$ schools, where each school can o... | habedi/stack-exchange-dataset |
70,600 | Bidirectional Encryption | <p>I would like a way to hide a piece of information from Alice and Bob. Let's say this piece of information lets Alice and Bob vote me off the island. If Alice had this information she could vote me off even if Bob did not want that. Likewise if Bob had this information he could vote me off the island even if Alice di... | cryptography | 1 | Bidirectional Encryption -- (cryptography)
<p>I would like a way to hide a piece of information from Alice and Bob. Let's say this piece of information lets Alice and Bob vote me off the island. If Alice had this information she could vote me off even if Bob did not want that. Likewise if Bob had this information he co... | habedi/stack-exchange-dataset |
70,611 | lower bound for Renyi–Ulam Game with lies | <p>Player $A$ thinks of number between 1 and $n$ and ask $B$ to guess the number with minimum number of decision queries (yes or no type ).</p>

<p><strong>Game</strong> : </p>

<ol>
<li><p>$A$ chooses an element in {1,2....,n}</p></li>
<li><p>$B$ tries to guess this number by asking Yes/No
... | algorithms algorithm analysis combinatorics lower bounds binary search | 1 | lower bound for Renyi–Ulam Game with lies -- (algorithms algorithm analysis combinatorics lower bounds binary search)
<p>Player $A$ thinks of number between 1 and $n$ and ask $B$ to guess the number with minimum number of decision queries (yes or no type ).</p>

<p><strong>Game</strong> : </p>

<ol>
... | habedi/stack-exchange-dataset |
70,612 | How to determine the carry vector of an integer addition | <p>An integer addition can be represented as following:</p>

<p>$A + B = A \oplus B \oplus carry_{vector}$</p>

<p>My question is how to determine the carry vector from $A$ and $B$ (not from the result)?</p>
 | arithmetic integers | 1 | How to determine the carry vector of an integer addition -- (arithmetic integers)
<p>An integer addition can be represented as following:</p>

<p>$A + B = A \oplus B \oplus carry_{vector}$</p>

<p>My question is how to determine the carry vector from $A$ and $B$ (not from the result)?</p>
 | habedi/stack-exchange-dataset |
70,614 | Combining Runtime Complexity Expressions with respect to Dijkstra | <p>If I have an algorithm that fills out an $|V| \times |V|$ table with for loops and an $O(1)$ sub-problem <strong>after</strong> running Dijkstra twice (outside the loop), I think I get the following runtime complexity statement: </p>

<p>$$
O(\text{my algorithm}) = O(|V|\mathop{log}|V| + |E|\mathop{log}|... | algorithms time complexity shortest path | 1 | Combining Runtime Complexity Expressions with respect to Dijkstra -- (algorithms time complexity shortest path)
<p>If I have an algorithm that fills out an $|V| \times |V|$ table with for loops and an $O(1)$ sub-problem <strong>after</strong> running Dijkstra twice (outside the loop), I think I get the following runtim... | habedi/stack-exchange-dataset |
70,615 | Looping and branching with Algorithmic Differentiation | <p>Algorithmic (aka <em>Automatic</em>) Differentiation is a wonderful technique for numerical computation of derivatives. I understand how it relates to the fact that we know how to deal with every elementary operation in a computer program, but I am not sure to get how this applies to <em>every</em> computer program.... | algorithm analysis approximation turing completeness loops | 1 | Looping and branching with Algorithmic Differentiation -- (algorithm analysis approximation turing completeness loops)
<p>Algorithmic (aka <em>Automatic</em>) Differentiation is a wonderful technique for numerical computation of derivatives. I understand how it relates to the fact that we know how to deal with every el... | habedi/stack-exchange-dataset |
70,627 | How can I restructure matrices to have non-zero elements close to the diagonal? | <p>I have a matrix $C \in \mathbb{N}^{n \times n}$. Semantically, it is a confusion matrix where the element $c_{ij}$ denotes how often members of class $i$ are predicted by a given classifier as members of class $j$.</p>

<p>The order of elements does not matter, but $c_{ii}$ has to be the correct predction of... | optimization matrices | 1 | How can I restructure matrices to have non-zero elements close to the diagonal? -- (optimization matrices)
<p>I have a matrix $C \in \mathbb{N}^{n \times n}$. Semantically, it is a confusion matrix where the element $c_{ij}$ denotes how often members of class $i$ are predicted by a given classifier as members of class ... | habedi/stack-exchange-dataset |
70,640 | Randomly select a uniform subsample from a nonuniform dataset | <p>I have a dataset of events with timestamps spanning several months. The event rate is "bursty", i.e. there are periods of much higher and lower rate than the average. I would like to randomly select a subset of these events having approximately uniform time distribution. What weight should be applied to the random ... | algorithms randomness sampling | 1 | Randomly select a uniform subsample from a nonuniform dataset -- (algorithms randomness sampling)
<p>I have a dataset of events with timestamps spanning several months. The event rate is "bursty", i.e. there are periods of much higher and lower rate than the average. I would like to randomly select a subset of these e... | habedi/stack-exchange-dataset |
70,642 | Most Efficient Way to List All $n$-bit Permutations | <p>Suppose we are tasked with expressing a randomized list of all numbers up to but excluding <span class="math-container">$2^n$</span> (ie. a random list of all n-bit numbers). What are some efficient ways to do such a listing using as few bits as possible?</p>

<p><strong>Attempt:</strong> My thought is that... | efficiency permutations storage | 1 | Most Efficient Way to List All $n$-bit Permutations -- (efficiency permutations storage)
<p>Suppose we are tasked with expressing a randomized list of all numbers up to but excluding <span class="math-container">$2^n$</span> (ie. a random list of all n-bit numbers). What are some efficient ways to do such a listing us... | habedi/stack-exchange-dataset |
70,647 | Question involving regular expressions | <p>I've been playing around with converting regular languages to regular expressions and was wondering if my thinking is correct for this one. </p>

<p>Question: </p>

<p><b>The set of all strings that begin or end with a doubled digit, either 11 or 00. </b> <i>(In all cases assume the alphabet is {0,1}... | regular languages regular expressions | 1 | Question involving regular expressions -- (regular languages regular expressions)
<p>I've been playing around with converting regular languages to regular expressions and was wondering if my thinking is correct for this one. </p>

<p>Question: </p>

<p><b>The set of all strings that begin or end with a ... | habedi/stack-exchange-dataset |
70,683 | Vertex cover algorithms for directed graphs? | <p>I've recently been working on a problem that I believe can be expressed as a vertex cover problem over a <em>directed</em> graph. </p>

<p>Formally, I have a graph $G = (V,E)$ where $V$ is a vertex set and $E$ is a set of edges between vertices. The edges are directed so we can have $e_{ij} = 1$ but $e_{ji} ... | graphs greedy algorithms set cover | 1 | Vertex cover algorithms for directed graphs? -- (graphs greedy algorithms set cover)
<p>I've recently been working on a problem that I believe can be expressed as a vertex cover problem over a <em>directed</em> graph. </p>

<p>Formally, I have a graph $G = (V,E)$ where $V$ is a vertex set and $E$ is a set of ed... | habedi/stack-exchange-dataset |
70,684 | When an ISAM index is built, how is the number of leaf nodes per index node (the "fan-out") calculated? | <p>I asked this question on DB.SE but it didn't get any traction, so I'll ask it here...</p>

<p>The following statement is in the Ramakrishnan text (2nd ed. page 252):</p>

<p>(emphasis in bold is mine)</p>

<blockquote>
 <p>The non-leaf pages direct a search to the correct leaf page. <str... | trees search trees database theory | 1 | When an ISAM index is built, how is the number of leaf nodes per index node (the "fan-out") calculated? -- (trees search trees database theory)
<p>I asked this question on DB.SE but it didn't get any traction, so I'll ask it here...</p>

<p>The following statement is in the Ramakrishnan text (2nd ed. page 252):... | habedi/stack-exchange-dataset |
70,687 | How is pre-computation handled by complexity notation? | <p>Suppose I have an algorithm that runs in $O(n)$ for every input of size $n$, but only after a pre-computation step of $O(n^2)$ for that given size $n.$ Is the algorithm considered $O(n)$ still, with $O(n^2)$ amortized? Or does big O only consider one "run" of the algorithm at size $n$, and so the pre-computation ste... | algorithms time complexity | 1 | How is pre-computation handled by complexity notation? -- (algorithms time complexity)
<p>Suppose I have an algorithm that runs in $O(n)$ for every input of size $n$, but only after a pre-computation step of $O(n^2)$ for that given size $n.$ Is the algorithm considered $O(n)$ still, with $O(n^2)$ amortized? Or does big... | habedi/stack-exchange-dataset |
70,693 | Multiplication function BDD size lower bounds | <p>Randal Bryant developed an exponential size lower bound for any BDD encoding the middle bit output of the multiplication function, regardless of variable permutation.</p>

<p>But at the same time the multiplication function is decidable in logarithmic space. Of course related to P versus NP, the lower bounds... | complexity theory bdd | 1 | Multiplication function BDD size lower bounds -- (complexity theory bdd)
<p>Randal Bryant developed an exponential size lower bound for any BDD encoding the middle bit output of the multiplication function, regardless of variable permutation.</p>

<p>But at the same time the multiplication function is decidable... | habedi/stack-exchange-dataset |
70,696 | Convert PEG to BNF | <p><a href="https://en.wikipedia.org/wiki/Parsing_expression_grammar" rel="noreferrer">Parsing expression grammars (PEGs)</a> are unambiguous and have a superficially similar syntax to <a href="https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form" rel="noreferrer">BNF</a>, but include three important differe... | context free formal grammars normal forms | 1 | Convert PEG to BNF -- (context free formal grammars normal forms)
<p><a href="https://en.wikipedia.org/wiki/Parsing_expression_grammar" rel="noreferrer">Parsing expression grammars (PEGs)</a> are unambiguous and have a superficially similar syntax to <a href="https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_f... | habedi/stack-exchange-dataset |
70,698 | In a DFA, does the restriction for a total transition function apply to accepting states? | <p>I recently discovered the idea of a <em>total transition function</em> in Automata Theory. To my understanding this means that every state has at least one outgoing state.</p>

<p>My question is whether this restriction <strong>applies to accepting states</strong>, since my initial intuition tells me that th... | automata finite automata | 1 | In a DFA, does the restriction for a total transition function apply to accepting states? -- (automata finite automata)
<p>I recently discovered the idea of a <em>total transition function</em> in Automata Theory. To my understanding this means that every state has at least one outgoing state.</p>

<p>My questi... | habedi/stack-exchange-dataset |
70,699 | How can context switch affect the modification of a variable? | <pre><code>float myTotalAmount=0;
void update(float amt){
 myTotalAmount+= amt;
}
</code></pre>

<p>Task A called <code>update(10);</code></p>

<p>Calculated <code>myTotalAmount+= amt;</code></p>

<p>Didn't store the value for <code>myTotalAmount;</code> -------X</p>

... | operating systems threads | 1 | How can context switch affect the modification of a variable? -- (operating systems threads)
<pre><code>float myTotalAmount=0;
void update(float amt){
 myTotalAmount+= amt;
}
</code></pre>

<p>Task A called <code>update(10);</code></p>

<p>Calculated <code>myTotalAmount+= amt;</code><... | habedi/stack-exchange-dataset |
70,700 | Why are Chess, Mario, and Go not NP-complete? | <p>I have a hole in my understanding of what makes a problem NP.</p>

<p>I understand that Mario, for example, is NP-hard - it can be reduced to the NP-complete problem of 3SAT (see <a href="https://www.youtube.com/watch?v=mr1FMrwi6Ew" rel="noreferrer">https://www.youtube.com/watch?v=mr1FMrwi6Ew</a>)</p>
&#... | complexity theory decision problem np | 1 | Why are Chess, Mario, and Go not NP-complete? -- (complexity theory decision problem np)
<p>I have a hole in my understanding of what makes a problem NP.</p>

<p>I understand that Mario, for example, is NP-hard - it can be reduced to the NP-complete problem of 3SAT (see <a href="https://www.youtube.com/watch?v=... | habedi/stack-exchange-dataset |
70,710 | Quantification in pumping lemma for regular languages | <p>The <a href="https://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages#Use_of_the_lemma" rel="nofollow noreferrer">Wikipedia article on the pumping lemma</a>
states:</p>

<blockquote>
 <p>We now pump $y$ up: $xy^2z$ has more instances of the letter $a$ than the letter $b$, since we have adde... | regular languages pumping lemma | 1 | Quantification in pumping lemma for regular languages -- (regular languages pumping lemma)
<p>The <a href="https://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages#Use_of_the_lemma" rel="nofollow noreferrer">Wikipedia article on the pumping lemma</a>
states:</p>

<blockquote>
 <p>We now pump $... | habedi/stack-exchange-dataset |
70,722 | Proving that a problem is in NP | <p>I have an assignment in which the problem, $D$, is simple but, once found, easy to check. Is it enough to prove that a solution $x$ can be checked in polynomial time to prove that $D \in NP$? (The problem $D$ is a decision problem)</p>

<p>Edit: Changed $P$ to $D$</p>
 | np complete proof techniques decision problem np | 1 | Proving that a problem is in NP -- (np complete proof techniques decision problem np)
<p>I have an assignment in which the problem, $D$, is simple but, once found, easy to check. Is it enough to prove that a solution $x$ can be checked in polynomial time to prove that $D \in NP$? (The problem $D$ is a decision problem)... | habedi/stack-exchange-dataset |
70,738 | Worst case using the first fit $2$-approximation for the bin packing problem | <p>I am with the phone so I would be more verbose when I will have a pc on hand, if you desire.</p>

<p>The first fit algorithm for approximating the bin packing problem (NP-hard) is a $2$-approximation for the optimum. Can you show me a concrete worst case showing that $2$ is a good (or bad) extimate for the b... | optimization np hard approximation | 1 | Worst case using the first fit $2$-approximation for the bin packing problem -- (optimization np hard approximation)
<p>I am with the phone so I would be more verbose when I will have a pc on hand, if you desire.</p>

<p>The first fit algorithm for approximating the bin packing problem (NP-hard) is a $2$-approx... | habedi/stack-exchange-dataset |
70,745 | Is it computable if a particular number follows the Collatz conjecture? | <p>I was attempting to write a computer algorithm to determine if a particular number breaks the Collatz conjecture. It is very easy to determine if a particular number falls into a loop, however I cannot think of any way to determine if a particular number is on an infinite divergent trajectory. </p>

<p>Is ... | computability number theory | 1 | Is it computable if a particular number follows the Collatz conjecture? -- (computability number theory)
<p>I was attempting to write a computer algorithm to determine if a particular number breaks the Collatz conjecture. It is very easy to determine if a particular number falls into a loop, however I cannot think of ... | habedi/stack-exchange-dataset |
70,747 | Prove that this language is decidable or undecidable | <p>Is the following language decidable?</p>

<p>L = {(M) : M performs at least 100 steps on every accepted input.}</p>

<p>I tried to use reduction from the halting problem, but still no dice.</p>
 | formal languages turing machines | 1 | Prove that this language is decidable or undecidable -- (formal languages turing machines)
<p>Is the following language decidable?</p>

<p>L = {(M) : M performs at least 100 steps on every accepted input.}</p>

<p>I tried to use reduction from the halting problem, but still no dice.</p>
 | habedi/stack-exchange-dataset |
70,757 | Restricted traversal on an undirected graph | <p>Given a undirected graph $G=(V,E)$.</p>

<p>Imagine traversing the Graph was restricted; following an edge $a$ over a node $v$ to an edge $b$ is allowed if and only if a function $w: ( a, v, b ) \rightarrow \{0,1\}$ returns $1$.</p>

<p>Is there a effective solution to find the shortest path between ... | graph traversal | 1 | Restricted traversal on an undirected graph -- (graph traversal)
<p>Given a undirected graph $G=(V,E)$.</p>

<p>Imagine traversing the Graph was restricted; following an edge $a$ over a node $v$ to an edge $b$ is allowed if and only if a function $w: ( a, v, b ) \rightarrow \{0,1\}$ returns $1$.</p>

<p... | habedi/stack-exchange-dataset |
70,765 | Computing with number of stack items | <p>For <a href="https://en.wikipedia.org/wiki/Stack-oriented_programming_language" rel="noreferrer">stack-oriented programming language</a>, how many top-most items of the stack are needed to be accessible in order to be Turing complete?</p>

<p>Is it enough to be able to access just the top-most item? Two item... | formal languages programming languages computation models stacks | 1 | Computing with number of stack items -- (formal languages programming languages computation models stacks)
<p>For <a href="https://en.wikipedia.org/wiki/Stack-oriented_programming_language" rel="noreferrer">stack-oriented programming language</a>, how many top-most items of the stack are needed to be accessible in orde... | habedi/stack-exchange-dataset |
70,770 | DFA with less states than NFA | <p>Is it possible for a DFA to have less states than its equivalent NFA? Number of transitions does not matter. If possible also give an example.</p>
 | automata finite automata | 1 | DFA with less states than NFA -- (automata finite automata)
<p>Is it possible for a DFA to have less states than its equivalent NFA? Number of transitions does not matter. If possible also give an example.</p>
 | habedi/stack-exchange-dataset |
70,771 | What is the different between Dijsktra's algorithm and KNN? | <p>I am implementing machine learning software and in my case, I am using K-nearest neighbour classifier to get the task done. 
 
So far, I am trying to understand how Dijkstra's algorithm that has been used to solve salesman travel problem is different from K-nearest neighbour algorithm? </p>
 | machine learning classification | 1 | What is the different between Dijsktra's algorithm and KNN? -- (machine learning classification)
<p>I am implementing machine learning software and in my case, I am using K-nearest neighbour classifier to get the task done. 
 
So far, I am trying to understand how Dijkstra's algorithm that has been used to solv... | habedi/stack-exchange-dataset |
70,778 | Show that if Automata $A$ recognize language $L$, there also exists an automata $A′$ that recognize $Double(L)$ | <p>I don't know if this question should have better been on math.Stackexchange</p>

<p>Let be the operation $Double$ on the words on an $\Sigma$ alphabet which inserts after each character a copy of this character. Thus, $D(ab) = aabb$, $D(abaab) = aabbaaaabb$, etc... We had to prove that these regular expressi... | automata | 1 | Show that if Automata $A$ recognize language $L$, there also exists an automata $A′$ that recognize $Double(L)$ -- (automata)
<p>I don't know if this question should have better been on math.Stackexchange</p>

<p>Let be the operation $Double$ on the words on an $\Sigma$ alphabet which inserts after each charact... | habedi/stack-exchange-dataset |
70,779 | Newbie Random NFA DFA questions | <p>Can't seem to answer these questions, I'm sure the answers are out there somewhere but I don't really know what keywords to use to find them. Any answers or good sites/ documentation would be much appreciated. And please don't say wikipedia, the language used is a bit out of my comprehension at this moment. </p>
... | finite automata | 1 | Newbie Random NFA DFA questions -- (finite automata)
<p>Can't seem to answer these questions, I'm sure the answers are out there somewhere but I don't really know what keywords to use to find them. Any answers or good sites/ documentation would be much appreciated. And please don't say wikipedia, the language used is a... | habedi/stack-exchange-dataset |
70,796 | Can we prove that a time machine is impossible using the Halting Problem? | <p>Let us take a hypothetical machine <code>i</code> which halts on the <code>ith</code> day of the month if it rains on the <code>ith</code> day of the month. Basically it describes the present.</p>

<p>If we put this machine in a Halting Machine it should say whether the machine would halt. i.e. whether it wo... | halting problem | 1 | Can we prove that a time machine is impossible using the Halting Problem? -- (halting problem)
<p>Let us take a hypothetical machine <code>i</code> which halts on the <code>ith</code> day of the month if it rains on the <code>ith</code> day of the month. Basically it describes the present.</p>

<p>If we put thi... | habedi/stack-exchange-dataset |
70,807 | Under which operations is the class of non-recursive languages a closure? | <p>I am currently studying turing computability and related problems such as the halting problem with a background in formal languages.</p>

<p>I know that the class of recursive (decidable) languages is a closure under union, intersection and complement, and that recursively enumerable languages (semi-decidabl... | formal languages turing machines closure properties halting problem | 1 | Under which operations is the class of non-recursive languages a closure? -- (formal languages turing machines closure properties halting problem)
<p>I am currently studying turing computability and related problems such as the halting problem with a background in formal languages.</p>

<p>I know that the class... | habedi/stack-exchange-dataset |
70,809 | If P = NP, then how not cannot solve NP-hardness (the one that doesn't intersect with NP-complete) in polynomial-time? | <p>My question is that if P = NP, then we can solve any NP-hard problems (the one which is NP-complete and the one which is not-NP-complete) by saying that since we have a polynomial time algorithm to solve the NP problems and since the reduction works in polynomial time. Therefore, polynomial to polynomial is polynomi... | complexity theory np hard p vs np | 1 | If P = NP, then how not cannot solve NP-hardness (the one that doesn't intersect with NP-complete) in polynomial-time? -- (complexity theory np hard p vs np)
<p>My question is that if P = NP, then we can solve any NP-hard problems (the one which is NP-complete and the one which is not-NP-complete) by saying that since ... | habedi/stack-exchange-dataset |
70,818 | Class of languages that are equivalent to the lambda calculus | <p>It is well known that all computable functions can be expressed as terms of the lambda calculus and computed according to its rules. It is also more or less obvious that many classical formal languages (i.e. languages with formalized semantics) can be translated into the lambda calculus (e.g. using a Church encoding... | computability terminology lambda calculus | 1 | Class of languages that are equivalent to the lambda calculus -- (computability terminology lambda calculus)
<p>It is well known that all computable functions can be expressed as terms of the lambda calculus and computed according to its rules. It is also more or less obvious that many classical formal languages (i.e. ... | habedi/stack-exchange-dataset |
70,829 | What do `i` and `Number` represent in the Bakery Algorithm? | <p>I am studying the bakery algorithm, and I am unsure of what the variable <code>i</code> represents in it. I understand that <code>Entering</code> represents a <code>bool</code> value to protect <code>Nummber</code> while it is updating, but I'm having a hard time finding clear explanations as to what variable is doi... | threads | 1 | What do `i` and `Number` represent in the Bakery Algorithm? -- (threads)
<p>I am studying the bakery algorithm, and I am unsure of what the variable <code>i</code> represents in it. I understand that <code>Entering</code> represents a <code>bool</code> value to protect <code>Nummber</code> while it is updating, but I'm... | habedi/stack-exchange-dataset |
70,832 | In the Resolution equivalence ($\neg A \implies B, B \implies C \models \neg A \implies C$) must $A$ be negated? | <p>The sheet of equivalences given to us in class provides the the equivalences</p>

<p>\begin{array}{|c|c|c|}
\hline
\text{Resolution} & A \vee B, \neg B \vee C \models A \vee C & 
\neg A \implies B, B \implies C \models \neg A \implies C \\ 
\hline
\end{array}</p>

<p>I not... | logic first order logic propositional logic | 1 | In the Resolution equivalence ($\neg A \implies B, B \implies C \models \neg A \implies C$) must $A$ be negated? -- (logic first order logic propositional logic)
<p>The sheet of equivalences given to us in class provides the the equivalences</p>

<p>\begin{array}{|c|c|c|}
\hline
\text{Resolution} & ... | habedi/stack-exchange-dataset |
70,833 | Expected weight of euclidean minimum spanning tree on a unit square | <p>Suppose I randomly generate $n$ points from the unit square $[0,1]^2$, form a complete graph in which the weight of each edge is just the Euclidean distance between its endpoints, and compute the minimum spanning tree. I noticed empirically that the expected weight scales like $\sqrt{n}$. Using only back of the enve... | minimum spanning tree random graphs | 1 | Expected weight of euclidean minimum spanning tree on a unit square -- (minimum spanning tree random graphs)
<p>Suppose I randomly generate $n$ points from the unit square $[0,1]^2$, form a complete graph in which the weight of each edge is just the Euclidean distance between its endpoints, and compute the minimum span... | habedi/stack-exchange-dataset |
70,834 | How would a CPU know if a piece of data is in cache or RAM or on disk? | <p>How would a CPU know if a piece of data is in cache or RAM or on disk? </p>

<p>This would imply there's some sort of meta addressing scheme on where everything is.</p>
 | cpu cache | 1 | How would a CPU know if a piece of data is in cache or RAM or on disk? -- (cpu cache)
<p>How would a CPU know if a piece of data is in cache or RAM or on disk? </p>

<p>This would imply there's some sort of meta addressing scheme on where everything is.</p>
 | habedi/stack-exchange-dataset |
70,835 | Error solving the next recurrence: $T(n)=7T(n/2)+n^2$ | <p>Hello I'm trying to solve this recurrence with the method that says the teacher that when you get to 
\begin{align*} 
T\bigg(\frac{n}{2^{k}} \bigg)
\end{align*} you do
\begin{align*} 
\frac{n}{2^{k}} &= 1 \qquad (\text{by definition})\\
k &= \log_{2}(n)
\end{align*}</p>

<... | algorithms algorithm analysis recurrence relation | 1 | Error solving the next recurrence: $T(n)=7T(n/2)+n^2$ -- (algorithms algorithm analysis recurrence relation)
<p>Hello I'm trying to solve this recurrence with the method that says the teacher that when you get to 
\begin{align*} 
T\bigg(\frac{n}{2^{k}} \bigg)
\end{align*} you do
\begin{align*} 
\fra... | habedi/stack-exchange-dataset |
70,838 | Explanation of proof of why connectedness is not conjunctively local of any order $k$ | <p>I was reading Minsky's and Papert's book on perceptrons and I was reading theorem 0.6.1 and I was having a hard time understanding it. The theorem was about proving that the property "connected" was not a local property i.e. that you somehow had to see the whole picture to know if something was connected or not. In ... | algorithms logic artificial intelligence proof assistants | 1 | Explanation of proof of why connectedness is not conjunctively local of any order $k$ -- (algorithms logic artificial intelligence proof assistants)
<p>I was reading Minsky's and Papert's book on perceptrons and I was reading theorem 0.6.1 and I was having a hard time understanding it. The theorem was about proving tha... | habedi/stack-exchange-dataset |
70,847 | Why is the quantity of sentences not finite? | <p>I'm currently studying formal languages. My lecture states that, while the words of a language are finite, the sentences build with the underlying grammar are not. But I don't get why this should be <em>generally</em> true. I can imagine grammar which leaves me with a finite amount of sentences.</p>

<p>I ag... | formal languages | 1 | Why is the quantity of sentences not finite? -- (formal languages)
<p>I'm currently studying formal languages. My lecture states that, while the words of a language are finite, the sentences build with the underlying grammar are not. But I don't get why this should be <em>generally</em> true. I can imagine grammar whic... | habedi/stack-exchange-dataset |
70,854 | Should I describe automata before describing grammar? | <p>Let's say I want to describe some new grammar formalism, which doesn't coincide with known grammar sets. Should I always previously describe corresponding equivalent automata and why?</p>
 | formal grammars | 1 | Should I describe automata before describing grammar? -- (formal grammars)
<p>Let's say I want to describe some new grammar formalism, which doesn't coincide with known grammar sets. Should I always previously describe corresponding equivalent automata and why?</p>
 | habedi/stack-exchange-dataset |
70,858 | What is a quotient structure? | <p>I was reading a paper <a href="http://www.chargueraud.org/research/2009/ln/main.pdf" rel="nofollow noreferrer">here</a>, and it mentioned "quotient structure" in the following sentence (third page, second paragraph of the paper)</p>

<blockquote>
 <p>In order to obtain a representation of terms truly is... | formal languages lambda calculus proof assistants | 1 | What is a quotient structure? -- (formal languages lambda calculus proof assistants)
<p>I was reading a paper <a href="http://www.chargueraud.org/research/2009/ln/main.pdf" rel="nofollow noreferrer">here</a>, and it mentioned "quotient structure" in the following sentence (third page, second paragraph of the paper)</p>... | habedi/stack-exchange-dataset |
70,861 | Is the exponent in floating point numbers signed or unsigned | <p>This may be sound like a stupid question, because, of course, it can be negative and, <a href="https://en.wikipedia.org/wiki/Signedness" rel="nofollow noreferrer">as Wikipedia states</a>:</p>

<blockquote>
 <p>A numeric variable is signed if it can represent both positive and negative numbers, and unsig... | floating point | 1 | Is the exponent in floating point numbers signed or unsigned -- (floating point)
<p>This may be sound like a stupid question, because, of course, it can be negative and, <a href="https://en.wikipedia.org/wiki/Signedness" rel="nofollow noreferrer">as Wikipedia states</a>:</p>

<blockquote>
 <p>A numeric var... | habedi/stack-exchange-dataset |
70,867 | Support of a codeword in a binary linear code proof | <p>Let $C$ be the binary linear code with the following generator matrix</p>

<p>$G= \begin{bmatrix}
 1 & 1 & 0 & 1 & 0 & 0 & 0 \\
 0 & 1 & 1 & 0 & 1 & 0 & 0 \\
 0 & 0 & 1 & 1 & 0 & 1 & 0 \\
0 & 0 & 0 &... | proof techniques coding theory error correcting codes | 1 | Support of a codeword in a binary linear code proof -- (proof techniques coding theory error correcting codes)
<p>Let $C$ be the binary linear code with the following generator matrix</p>

<p>$G= \begin{bmatrix}
 1 & 1 & 0 & 1 & 0 & 0 & 0 \\
 0 & 1 & 1 & 0 &... | habedi/stack-exchange-dataset |
70,874 | How to find the minimum number of states required by a DFA | <p>Given a language $L = \left\{ a^{nk+1} | n > 0 \right\}$ and $k$ is an integer constant. </p>

<p>How to show that a DFA for this language must have $k+2$ states or more states using minimum state lemma.</p>

<p>By minimum state lemma I mean the number of minimum state a DFA has is the number of p... | formal languages finite automata | 1 | How to find the minimum number of states required by a DFA -- (formal languages finite automata)
<p>Given a language $L = \left\{ a^{nk+1} | n > 0 \right\}$ and $k$ is an integer constant. </p>

<p>How to show that a DFA for this language must have $k+2$ states or more states using minimum state lemma.</p>&#... | habedi/stack-exchange-dataset |
70,879 | Is 'double max-$k$ vertex-cover' NP-hard? | <p>Consider the following problem, which I have called '$\mathsf{\text{double max $k$-vertex-cover}}$':</p>

<blockquote>
 <p>Given an undirected graph $G=(V,E)$ and integers $k$ and $t$, does there exist a set of vertices $V'\subseteq V$ of size at most $k$ such that the set $\{(u,v)\in E\mid u\in V' \wed... | algorithms graphs np hard set cover | 1 | Is 'double max-$k$ vertex-cover' NP-hard? -- (algorithms graphs np hard set cover)
<p>Consider the following problem, which I have called '$\mathsf{\text{double max $k$-vertex-cover}}$':</p>

<blockquote>
 <p>Given an undirected graph $G=(V,E)$ and integers $k$ and $t$, does there exist a set of vertices $... | habedi/stack-exchange-dataset |
70,880 | Can CPU's 'shortcut' adding 0, multiplying by 1, and multiplying by 0? | <p>I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts' (drops), these operations. I'm a CS student and this hasn't been brought up ever.</p>

<p>Can a CPU do this? What are the trade-offs in designing a CPU that ... | arithmetic cpu | 1 | Can CPU's 'shortcut' adding 0, multiplying by 1, and multiplying by 0? -- (arithmetic cpu)
<p>I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts' (drops), these operations. I'm a CS student and this hasn't been brought u... | habedi/stack-exchange-dataset |
70,886 | Boolean absorption | <blockquote>
 <p>A and ( A or C ) = A</p>
</blockquote>

<p>And </p>

<blockquote>
 <p>A or A and C = A</p>
</blockquote>

<p>How do these identities work?</p>

<p>Using the rule</p>

<blockquote>
 <p>A and ( B or C ) = A and B or A and C</p>
</blockquo... | boolean algebra | 1 | Boolean absorption -- (boolean algebra)
<blockquote>
 <p>A and ( A or C ) = A</p>
</blockquote>

<p>And </p>

<blockquote>
 <p>A or A and C = A</p>
</blockquote>

<p>How do these identities work?</p>

<p>Using the rule</p>

<blockquote>
 <p>A and ( B or C )... | habedi/stack-exchange-dataset |
70,888 | Algorithms for "mostly-SAT?" | <p>This is third-hand, so please bear with me. A collaborator was at a review meeting where he heard another participant make the claim that given an assignment for a SAT problem that satisfies (some high percentage) of clauses, there are polynomial time algorithms that finish the problem.</p>

<p>Is this true... | reference request satisfiability | 1 | Algorithms for "mostly-SAT?" -- (reference request satisfiability)
<p>This is third-hand, so please bear with me. A collaborator was at a review meeting where he heard another participant make the claim that given an assignment for a SAT problem that satisfies (some high percentage) of clauses, there are polynomial ti... | habedi/stack-exchange-dataset |
70,894 | Linear programming formulation for the single-source shortest path problem | <p>In this <a href="http://www.cs.yale.edu/homes/aspnes/pinewiki/LinearProgramming.html" rel="nofollow noreferrer">course lecture; section 5.1</a>, single-source shortest path (SSSP) is formulated as the following linear program (LP):</p>

<p>\begin{align}
\max &\sum d_u \\
\text{subject to} & \... | shortest path linear programming modelling | 1 | Linear programming formulation for the single-source shortest path problem -- (shortest path linear programming modelling)
<p>In this <a href="http://www.cs.yale.edu/homes/aspnes/pinewiki/LinearProgramming.html" rel="nofollow noreferrer">course lecture; section 5.1</a>, single-source shortest path (SSSP) is formulated ... | habedi/stack-exchange-dataset |
70,895 | Example of typed lambda term with recomputed argument | <p>What is an example of a typed lambda term $\lambda x.\phi : A \to B$ and a term $a : A$ such that, when $\beta$-reducing the term $(\lambda x.\phi)(a)$, the argument $a$ must be repeated/recomputed several times?</p>
 | lambda calculus | 1 | Example of typed lambda term with recomputed argument -- (lambda calculus)
<p>What is an example of a typed lambda term $\lambda x.\phi : A \to B$ and a term $a : A$ such that, when $\beta$-reducing the term $(\lambda x.\phi)(a)$, the argument $a$ must be repeated/recomputed several times?</p>
 | habedi/stack-exchange-dataset |
70,900 | Term of System F whose type-erasure is $2(2)$ | <p>If $2$ is the Church numeral $\lambda fx. f(f(x))$, then is there a closed term $t$ of System F of type $\forall \alpha ((\alpha \to \alpha) \to (\alpha \to \alpha))$ such that the type-erasure of $t$ is the untyped term $2(2)$?</p>
 | lambda calculus | 1 | Term of System F whose type-erasure is $2(2)$ -- (lambda calculus)
<p>If $2$ is the Church numeral $\lambda fx. f(f(x))$, then is there a closed term $t$ of System F of type $\forall \alpha ((\alpha \to \alpha) \to (\alpha \to \alpha))$ such that the type-erasure of $t$ is the untyped term $2(2)$?</p>
 | habedi/stack-exchange-dataset |
70,901 | Given a prime power, is it possible to efficiently compute the prime | <p>Suppose that I am given as input the number $p^i$ for some prime $p$ and some positive integer $i$. I wish to find $p$ and $i$.</p>

<p>Is there an algorithm to do this that works in time polynomial in the number of digits of $p^i$?</p>
 | algorithms primes | 1 | Given a prime power, is it possible to efficiently compute the prime -- (algorithms primes)
<p>Suppose that I am given as input the number $p^i$ for some prime $p$ and some positive integer $i$. I wish to find $p$ and $i$.</p>

<p>Is there an algorithm to do this that works in time polynomial in the number of d... | habedi/stack-exchange-dataset |
70,903 | Showing that Hadamard is its own inverse | <p>Im trying to work out that a Hadamard transform H (a unitary matrix) is its own inverse by applying it twice to an arbitrary state $|x⟩$:</p>

<p>$$H|x⟩ = \frac{1}{\sqrt{2^n}}\sum_{y \in \{0,1\}^n}(-1)^{x \cdot y}|y⟩\,.$$</p>

<p>Then
\begin{align*}
H\left(\frac{1}{\sqrt{2^n}}\sum_{y \in \{0,... | quantum computing | 1 | Showing that Hadamard is its own inverse -- (quantum computing)
<p>Im trying to work out that a Hadamard transform H (a unitary matrix) is its own inverse by applying it twice to an arbitrary state $|x⟩$:</p>

<p>$$H|x⟩ = \frac{1}{\sqrt{2^n}}\sum_{y \in \{0,1\}^n}(-1)^{x \cdot y}|y⟩\,.$$</p>

<p>Then&#x... | habedi/stack-exchange-dataset |
70,904 | Finding a partition with minimum "maximal length" | <p>We're given $n^2$ different points in $(0,1)$ : $x_1< x_2 < \dots < x_{n^2}$.</p>

<p>We are required to choose $n$ points $x_{i_1}<\dots<x_{i_n}$ such that the value of $\max\,\{x_{i_1}, x_{i_2}-x_{i_1}, x_{i_3}-x_{i_2},\dots,x_{i_n} - x_{i_{n-1}}, 1-x_{i_n}\} $ is minimal.</p>

<p>I... | algorithms dynamic programming | 1 | Finding a partition with minimum "maximal length" -- (algorithms dynamic programming)
<p>We're given $n^2$ different points in $(0,1)$ : $x_1< x_2 < \dots < x_{n^2}$.</p>

<p>We are required to choose $n$ points $x_{i_1}<\dots<x_{i_n}$ such that the value of $\max\,\{x_{i_1}, x_{i_2}-x_{i_1}, x_... | habedi/stack-exchange-dataset |
70,910 | In which direction should I carry out a reduction when proving decidability/recognizability? | <blockquote>
 <p><strong>Definition:</strong></p>
 
 <p>$\text{A fuction}\ f: \Sigma^* \to \Sigma^*\ \text{is a reduction from
Language A to language B if}\ w\in A \iff f(w) \in B\ \text{for every}\ w \in \Sigma^*$.</p>
</blockquote>

<p><strong>My question is which direction should I tak... | turing machines reductions | 1 | In which direction should I carry out a reduction when proving decidability/recognizability? -- (turing machines reductions)
<blockquote>
 <p><strong>Definition:</strong></p>
 
 <p>$\text{A fuction}\ f: \Sigma^* \to \Sigma^*\ \text{is a reduction from
Language A to language B if}\ w\in A \iff f(w) \i... | habedi/stack-exchange-dataset |
70,913 | Regular Expression Problem | <p>Question is </p>

<p>$$\left\{ w | w \text{ contains an even number of } 0\text{s or exactly two }1\text{s} \right\}$$</p>

<p>I need to confirm my answer but i don't from where to ask someone.</p>

<p>My answer is</p>

<pre><code>1*(01*0)*+11
</code></pre>

<p>but i don't... | automata regular languages regular expressions | 1 | Regular Expression Problem -- (automata regular languages regular expressions)
<p>Question is </p>

<p>$$\left\{ w | w \text{ contains an even number of } 0\text{s or exactly two }1\text{s} \right\}$$</p>

<p>I need to confirm my answer but i don't from where to ask someone.</p>

<p>My answer is... | habedi/stack-exchange-dataset |
70,920 | Is it always enough to prove that a subset $L'$ of a language $L$ is unprovable in order to prove that $L$ is undecidable? | <p>Given a language $L$, I sometimes try to find a subset of $L' \subseteq L$ which I can prove is undecidable. I conclude that if a subset of $L$ is undecidable, then $L$ must be undecidable as well. Is this correct for arbitrary languages $L$ and $L' \subseteq L$?</p>

<p>What if someone said: $L'$ could be e... | formal languages turing machines reductions undecidability | 1 | Is it always enough to prove that a subset $L'$ of a language $L$ is unprovable in order to prove that $L$ is undecidable? -- (formal languages turing machines reductions undecidability)
<p>Given a language $L$, I sometimes try to find a subset of $L' \subseteq L$ which I can prove is undecidable. I conclude that if a ... | habedi/stack-exchange-dataset |
70,928 | Name for the "starting vertex" and "ending vertex" of a directed edge | <p>Say a graph contains a directed edge <strong>e</strong> from vertex <strong>a</strong> to vertex <strong>b</strong>. Is there a standard name for vertex <strong>a</strong> relative to edge <strong>e</strong>? And similarly for vertex <strong>b</strong>?</p>

<p>Something akin to vectors in high school phys... | graphs | 1 | Name for the "starting vertex" and "ending vertex" of a directed edge -- (graphs)
<p>Say a graph contains a directed edge <strong>e</strong> from vertex <strong>a</strong> to vertex <strong>b</strong>. Is there a standard name for vertex <strong>a</strong> relative to edge <strong>e</strong>? And similarly for vertex... | habedi/stack-exchange-dataset |
70,938 | How to draw (intuitively) the first and second principal component in PCA methods? | <p><a href="https://i.stack.imgur.com/dTOJr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dTOJr.png" alt=""></a>Assume I have some data in 2D. How to draw the first and second principal component in PCA method?</p>

<p>By referring to the image: the plot on the right is confusing, how I can... | machine learning | 1 | How to draw (intuitively) the first and second principal component in PCA methods? -- (machine learning)
<p><a href="https://i.stack.imgur.com/dTOJr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dTOJr.png" alt=""></a>Assume I have some data in 2D. How to draw the first and second principal componen... | habedi/stack-exchange-dataset |
70,946 | The complexity of $A^{k \cdot log_{x} (n)}$ is exponential? | <p>The complexity of $A^{k \cdot log_{x}(n)}$ is exponential? ($k$ and $x$ is constants, $A$ is defined constant base, $n$ is the size of the task).</p>

<p>It is in a class of polynomial complexity?</p>
 | complexity theory time complexity | 1 | The complexity of $A^{k \cdot log_{x} (n)}$ is exponential? -- (complexity theory time complexity)
<p>The complexity of $A^{k \cdot log_{x}(n)}$ is exponential? ($k$ and $x$ is constants, $A$ is defined constant base, $n$ is the size of the task).</p>

<p>It is in a class of polynomial complexity?</p>
 | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.