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 |
|---|---|---|---|---|---|---|
81,141 | To show that any language $L \in NP$ is many one reducible to HP | <blockquote>
 <p>Question : To show that any language $L \in NP$ is <a href="https://en.wikipedia.org/wiki/Many-one_reduction" rel="nofollow noreferrer">many one reducible</a> to <a href="https://en.wikipedia.org/wiki/Halting_problem" rel="nofollow noreferrer">HP</a>.</p>
</blockquote>

<p>Let $L$ be a... | complexity theory reductions np | 1 | To show that any language $L \in NP$ is many one reducible to HP -- (complexity theory reductions np)
<blockquote>
 <p>Question : To show that any language $L \in NP$ is <a href="https://en.wikipedia.org/wiki/Many-one_reduction" rel="nofollow noreferrer">many one reducible</a> to <a href="https://en.wikipedia.org/... | habedi/stack-exchange-dataset |
81,150 | Determine whether a variable has positive influence in Boolean function | <p>Given a Boolean function $f$ over the set of variables $X =\{ x_1,...,x_n \}$, the influence of $x_i$ is defined as the probability that changing only $x_i$ on random input changes $f$.<br>
Given a function $f$ presented in $\text{CNF}$, and a coordinate, are there any known methods for determine if the coordina... | complexity theory discrete mathematics boolean algebra | 1 | Determine whether a variable has positive influence in Boolean function -- (complexity theory discrete mathematics boolean algebra)
<p>Given a Boolean function $f$ over the set of variables $X =\{ x_1,...,x_n \}$, the influence of $x_i$ is defined as the probability that changing only $x_i$ on random input changes $f$.... | habedi/stack-exchange-dataset |
81,154 | Question on Predicates and Quantifiers | <p>I am reading from <em>"Discrete Mathematics and Its applications"</em> by Kenneth H. Rosen, 7th edition. Consider the <strong>highlighted part</strong> in the following example taken from the same book:</p>

<blockquote>
 <p><strong>Question</strong> Use predicates and quantifiers to express the system ... | discrete mathematics propositional logic | 1 | Question on Predicates and Quantifiers -- (discrete mathematics propositional logic)
<p>I am reading from <em>"Discrete Mathematics and Its applications"</em> by Kenneth H. Rosen, 7th edition. Consider the <strong>highlighted part</strong> in the following example taken from the same book:</p>

<blockquote>
... | habedi/stack-exchange-dataset |
81,170 | range / interval query algorithm | <p>I've an hash (base 32 for what it's worth):</p>

<pre><code>hash = 'ab352eghjhngd4'
</code></pre>

<p>And I've subscribers that want to listen to new hashes in a <strong>range</strong>.</p>

<pre><code> listener = { startAt: 'ab31', endAt: 'ab40', obj } 
 listener2 = { startAt: '... | algorithms hash searching | 1 | range / interval query algorithm -- (algorithms hash searching)
<p>I've an hash (base 32 for what it's worth):</p>

<pre><code>hash = 'ab352eghjhngd4'
</code></pre>

<p>And I've subscribers that want to listen to new hashes in a <strong>range</strong>.</p>

<pre><code> listener = { startAt... | habedi/stack-exchange-dataset |
81,178 | Is an infinite tape alphabet for TM valid? | <p>Can I use an infinite alphabet for the tape in a turing machine? </p>

<p>e.g. with input string as (1, 0)* 
can I define the symbol 1j as the symbol 1 with j marks on top of it where j in a natural number, to be used on the tape?</p>
 | turing machines | 1 | Is an infinite tape alphabet for TM valid? -- (turing machines)
<p>Can I use an infinite alphabet for the tape in a turing machine? </p>

<p>e.g. with input string as (1, 0)* 
can I define the symbol 1j as the symbol 1 with j marks on top of it where j in a natural number, to be used on the tape?</p>
 | habedi/stack-exchange-dataset |
81,179 | TM that finds the middle of an input string in O(n) time | <p>Is it possible to find a TM with O(n) complexity that finds the middle of an input string?
Or at least to prove that it cannot be done?</p>

<p>I can use a two-taped TM if it helps.</p>
 | complexity theory turing machines | 1 | TM that finds the middle of an input string in O(n) time -- (complexity theory turing machines)
<p>Is it possible to find a TM with O(n) complexity that finds the middle of an input string?
Or at least to prove that it cannot be done?</p>

<p>I can use a two-taped TM if it helps.</p>
 | habedi/stack-exchange-dataset |
81,187 | Example of Minimum Test Collection Problem | <p>I'm studying the <strong>Minimum Test Collection</strong> problem and I can't find an example of some instance of the problem, given values to the sets. The Garey and Johnson book only contains the proof of its NP-Completeness.</p>

<p>I hope someone can give me an example in order to understand in a better... | complexity theory np complete reductions | 1 | Example of Minimum Test Collection Problem -- (complexity theory np complete reductions)
<p>I'm studying the <strong>Minimum Test Collection</strong> problem and I can't find an example of some instance of the problem, given values to the sets. The Garey and Johnson book only contains the proof of its NP-Completeness.... | habedi/stack-exchange-dataset |
81,196 | Do we know something about this refutation method for SAT? | <p>Let we have a formula $\varphi(x_1,x_2...x_k)$. Now we apply a refutation method: $\varphi(x_1,x_2...x_k)\Leftrightarrow(\varphi(x_1=1,x_2...x_k)\lor\varphi(x_1=0,x_2...x_k))$. Latter formula seems to be longer, but no, good algorithm reduces number of literal occurences. On each step we can modify the formula witho... | np complete satisfiability | 1 | Do we know something about this refutation method for SAT? -- (np complete satisfiability)
<p>Let we have a formula $\varphi(x_1,x_2...x_k)$. Now we apply a refutation method: $\varphi(x_1,x_2...x_k)\Leftrightarrow(\varphi(x_1=1,x_2...x_k)\lor\varphi(x_1=0,x_2...x_k))$. Latter formula seems to be longer, but no, good a... | habedi/stack-exchange-dataset |
81,198 | Examples of sets $A$ and $B$ such that $A \leq_m B$ but not $B \leq_m A$ | <p>I know that such sets exist and they are called sets that are not m-complete, but I am not sure how to find them. Can someone give examples?</p>
 | computability turing machines reductions | 1 | Examples of sets $A$ and $B$ such that $A \leq_m B$ but not $B \leq_m A$ -- (computability turing machines reductions)
<p>I know that such sets exist and they are called sets that are not m-complete, but I am not sure how to find them. Can someone give examples?</p>
 | habedi/stack-exchange-dataset |
81,213 | Is a non-deterministic turing machine that both accepts and rejects the same input valid? | <p>I.e. - if a TM accepts the word 0011100 on one path, while on another the same word is rejected. Do we say that 0011100 is part of the language, or do we say that it is not a valid TM?</p>
 | turing machines nondeterminism | 1 | Is a non-deterministic turing machine that both accepts and rejects the same input valid? -- (turing machines nondeterminism)
<p>I.e. - if a TM accepts the word 0011100 on one path, while on another the same word is rejected. Do we say that 0011100 is part of the language, or do we say that it is not a valid TM?</p>&#x... | habedi/stack-exchange-dataset |
81,216 | What are all the decidable languages that can be constructed using a turing machine with only the Reject and Accept states? | <p>What languages can be decided by a two-state TM that has two states: one accepting and one rejecting?</p>

<p>As a newbie in TMs, there are some definitions I am not familiar with, of which the answer is obviously dependent, like:</p>

<ul>
<li>Can we draw an outgoing arrow from the Accept or Re... | turing machines | 1 | What are all the decidable languages that can be constructed using a turing machine with only the Reject and Accept states? -- (turing machines)
<p>What languages can be decided by a two-state TM that has two states: one accepting and one rejecting?</p>

<p>As a newbie in TMs, there are some definitions I am no... | habedi/stack-exchange-dataset |
81,218 | Oracle Turing Machine EXP^EXP | <p>I'm reading Arora Barak and in that it is written that when <span class="math-container">$O \in \mathrm{P}$</span>, then <span class="math-container">$\mathrm{P}^O = \mathrm{P}$</span>. Can this be generalized?
Intuitively, I think that <span class="math-container">$\mathrm{NP}^\mathrm{NP} \neq \mathrm{NP}$</sp... | complexity theory time complexity complexity classes oracle machines | 1 | Oracle Turing Machine EXP^EXP -- (complexity theory time complexity complexity classes oracle machines)
<p>I'm reading Arora Barak and in that it is written that when <span class="math-container">$O \in \mathrm{P}$</span>, then <span class="math-container">$\mathrm{P}^O = \mathrm{P}$</span>. Can this be generalized?&#x... | habedi/stack-exchange-dataset |
81,234 | Are Epsilon-NFAs a way to make designing NFAs easier? | <p>It seems that their purpose is in making designing certain NFAs less onerous? Does this mean that no automata that are implemented have Epsilon-transitions, and that they are kind of a mathematical conceit we adopt for our own ease of design? I'm having a lot of trouble understanding what is "happening" when an Epsi... | finite automata | 1 | Are Epsilon-NFAs a way to make designing NFAs easier? -- (finite automata)
<p>It seems that their purpose is in making designing certain NFAs less onerous? Does this mean that no automata that are implemented have Epsilon-transitions, and that they are kind of a mathematical conceit we adopt for our own ease of design?... | habedi/stack-exchange-dataset |
81,235 | Is there a formalization of the computational model for quantum computers? | <p>There are several equivalent computation models, each capable of simulating each other. For example, the lambda calculus or the SKI calculus which are based on rewriting, Cardelli's object calculus, Hoare's communicating sequential processes, and of course the universal Turing machine, all of them formally defined.<... | computation models quantum computing mathematical foundations | 1 | Is there a formalization of the computational model for quantum computers? -- (computation models quantum computing mathematical foundations)
<p>There are several equivalent computation models, each capable of simulating each other. For example, the lambda calculus or the SKI calculus which are based on rewriting, Card... | habedi/stack-exchange-dataset |
81,240 | Closure operator and set of fixpoint | <p>In chapter 2.2 of</p>

<p><em>Giacobazzi, Roberto; Ranzato, Francesco</em>, <a href="http://dx.doi.org/10.1006/inco.1998.2724" rel="nofollow noreferrer"><strong>Uniform closures: Order-theoretically reconstructing logic program semantics and abstract domain refinements</strong></a>, Inf. Comput. 145, No.2, 1... | closure properties lattices | 1 | Closure operator and set of fixpoint -- (closure properties lattices)
<p>In chapter 2.2 of</p>

<p><em>Giacobazzi, Roberto; Ranzato, Francesco</em>, <a href="http://dx.doi.org/10.1006/inco.1998.2724" rel="nofollow noreferrer"><strong>Uniform closures: Order-theoretically reconstructing logic program semantics a... | habedi/stack-exchange-dataset |
81,245 | Merging sorted arrays and finding Big O bounds | <p>Say we have $x$ amount of sorted arrays, each with $n$ elements, and we combine them one at a time. So merging the first two arrays would give us $2n$ in terms of cost, and $3n$ for the next array, all the way until $xn$ for the cost of merging. How would one go about finding the tightest possible Big-O bound for th... | algorithm analysis runtime analysis arrays | 1 | Merging sorted arrays and finding Big O bounds -- (algorithm analysis runtime analysis arrays)
<p>Say we have $x$ amount of sorted arrays, each with $n$ elements, and we combine them one at a time. So merging the first two arrays would give us $2n$ in terms of cost, and $3n$ for the next array, all the way until $xn$ f... | habedi/stack-exchange-dataset |
81,248 | Is it possible to prove closure of decidable languages under union and intersection, using enumerators? | <p>We can use multi-tape enumerators. 
<em>(Of course it is not valid to use turing machines albeit the fact that any enumerator has an equivalent TM)</em></p>

<p>What we need is to prove that if $A$ and $B$ are decidable then $A\cup B$ and $A\cap B$ are also decidable.</p>

<p>Can it be done? If s... | undecidability closure properties enumeration | 1 | Is it possible to prove closure of decidable languages under union and intersection, using enumerators? -- (undecidability closure properties enumeration)
<p>We can use multi-tape enumerators. 
<em>(Of course it is not valid to use turing machines albeit the fact that any enumerator has an equivalent TM)</em></p>&#... | habedi/stack-exchange-dataset |
81,254 | What can't be done with a neural network | <p><a href="ftp://ftp.sas.com/pub/neural/FAQ.html#A_cando" rel="nofollow noreferrer">This</a> reference from the german wikipedia article on neural networks states:</p>

<blockquote>
 <p>There are also many other important problems that are so difficult that a neural network will be unable to learn them wi... | complexity theory artificial intelligence neural networks | 1 | What can't be done with a neural network -- (complexity theory artificial intelligence neural networks)
<p><a href="ftp://ftp.sas.com/pub/neural/FAQ.html#A_cando" rel="nofollow noreferrer">This</a> reference from the german wikipedia article on neural networks states:</p>

<blockquote>
 <p>There are also m... | habedi/stack-exchange-dataset |
81,271 | Points at distance $k$ or less in 2D grid | <p>How can we prove that the total number of mesh points k or fewer jumps away from an arbitrary point in a 2D mesh is: $2k^2 + 2k + 1$.</p>

<p>I tried making a $3 \times 3$ mesh. </p>

<pre><code> a --- b --- c
 | | |
 d --- e --- f
 | | |
 g --- h -... | combinatorics | 1 | Points at distance $k$ or less in 2D grid -- (combinatorics)
<p>How can we prove that the total number of mesh points k or fewer jumps away from an arbitrary point in a 2D mesh is: $2k^2 + 2k + 1$.</p>

<p>I tried making a $3 \times 3$ mesh. </p>

<pre><code> a --- b --- c
 | | |
... | habedi/stack-exchange-dataset |
81,276 | Approximating maximal independent set with a minimal vertex cover approximation | <p>The minimal vertex cover problem has a <a href="http://tandy.cs.illinois.edu/dartmouth-cs-approx.pdf" rel="nofollow noreferrer">2-approximation algorithm</a>.</p>

<p>We can reduce the maximal independent set problem to the minimal vertex cover problem as shown <a href="https://en.wikipedia.org/wiki/Maximal_... | algorithms graphs algorithm analysis approximation | 1 | Approximating maximal independent set with a minimal vertex cover approximation -- (algorithms graphs algorithm analysis approximation)
<p>The minimal vertex cover problem has a <a href="http://tandy.cs.illinois.edu/dartmouth-cs-approx.pdf" rel="nofollow noreferrer">2-approximation algorithm</a>.</p>

<p>We can... | habedi/stack-exchange-dataset |
81,277 | reducing $CLIQUE$ from decision to search problem | <p>consider the language:$$CLIQUE = \left\{\langle G,k\rangle \ |\ \text{ $G$ is a graph containing a clique of size at least $k$ } \right\}$$</p>

<blockquote>
 <p>Suppose there's a polynomial time algorithm for $CLIQUE$. I need to show a polynomial time algorithm for finding a clique of size $k$.</p>
... | algorithms time complexity polynomial time clique | 1 | reducing $CLIQUE$ from decision to search problem -- (algorithms time complexity polynomial time clique)
<p>consider the language:$$CLIQUE = \left\{\langle G,k\rangle \ |\ \text{ $G$ is a graph containing a clique of size at least $k$ } \right\}$$</p>

<blockquote>
 <p>Suppose there's a polynomial time alg... | habedi/stack-exchange-dataset |
81,279 | De Casteljau's algorithm without temporaries / stack | <p>De Casteljau's algorithm is a method for calculating a point on an order $N$ Bezier curve at time $t$ by performing a linear interpolation between two order $N-1$ Bezier curves at time $t$. You do this recursively until you reach order 0 which is single point / data value.</p>

<p>Calculating a point on an ... | algorithms | 1 | De Casteljau's algorithm without temporaries / stack -- (algorithms)
<p>De Casteljau's algorithm is a method for calculating a point on an order $N$ Bezier curve at time $t$ by performing a linear interpolation between two order $N-1$ Bezier curves at time $t$. You do this recursively until you reach order 0 which is ... | habedi/stack-exchange-dataset |
81,290 | Girth of Undirected Graph with Positive Integer Weights | <p>Let $G = (V, E)$ be an undirected graph without self loops and with edge weights $w: E \to \mathbb{N}$. The girth $g(G)$ of $G$ is defined as the length of the shortest cycle in $G$, i.e.</p>

<p>$g(G) := \min\left\{ n \in \mathbb{N} \mid \exists \text{ cycle }(e_1, e_2, \dots, e_k) \text{ in $G$ satisfying ... | algorithms graphs graph traversal weighted graphs | 1 | Girth of Undirected Graph with Positive Integer Weights -- (algorithms graphs graph traversal weighted graphs)
<p>Let $G = (V, E)$ be an undirected graph without self loops and with edge weights $w: E \to \mathbb{N}$. The girth $g(G)$ of $G$ is defined as the length of the shortest cycle in $G$, i.e.</p>

<p>$g... | habedi/stack-exchange-dataset |
81,304 | Algorithm to estimate the probability that a "0 and 1 matrix" fills up following the bootstrap percolation rules | <p><strong>Presentation of the model:</strong> we consider the regular lattice created from $\mathbb{Z}^2$ (It's no more, no less a square lattice).</p>

<ul>
<li>At $t=0$, each site is said "active" independently with a probability $p$, "inactive" otherwise.</li>
<li>At $t$, if a site is inactive, it b... | algorithms graphs randomized algorithms cellular automata | 1 | Algorithm to estimate the probability that a "0 and 1 matrix" fills up following the bootstrap percolation rules -- (algorithms graphs randomized algorithms cellular automata)
<p><strong>Presentation of the model:</strong> we consider the regular lattice created from $\mathbb{Z}^2$ (It's no more, no less a square latti... | habedi/stack-exchange-dataset |
81,306 | STCON is NL complete - but why is the reduction in L? | <p>I saw the proof for STCON being NL complete here : <a href="https://en.wikipedia.org/wiki/St-connectivity" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/St-connectivity</a> </p>

<p>I understand the reduction, but how is it logspace?</p>

<p>I understand each state is of $O(\log(n))$ space.... | complexity theory space complexity nondeterminism | 1 | STCON is NL complete - but why is the reduction in L? -- (complexity theory space complexity nondeterminism)
<p>I saw the proof for STCON being NL complete here : <a href="https://en.wikipedia.org/wiki/St-connectivity" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/St-connectivity</a> </p>

<p>I unders... | habedi/stack-exchange-dataset |
81,309 | Does DPDA accept all regular languages? | <p>A DPDA which accepts by empty stack cannot accept all Regular Languages?
Is it true that the DPDA cannot accept all regular languages?</p>

<p>I am not able to understand this.As per my knowledge DPDA are more powerful than regular languages as they have finite automate and also the stack.So finite autom... | formal languages regular languages pushdown automata | 1 | Does DPDA accept all regular languages? -- (formal languages regular languages pushdown automata)
<p>A DPDA which accepts by empty stack cannot accept all Regular Languages?
Is it true that the DPDA cannot accept all regular languages?</p>

<p>I am not able to understand this.As per my knowledge DPDA are mo... | habedi/stack-exchange-dataset |
81,310 | Shortest paths when edge weight depends on previous edge | <p>I have a directed graph with non-negative weights on the edges. 
I can divide the nodes in two "classes", X (roughly 1700 nodes) and Y (~300).
I want to collect all the shortest paths from x in X to y in Y.</p>

<p>The weight of the edges depend on the previous edge in the path I am currently on.
... | algorithms graphs shortest path weighted graphs | 1 | Shortest paths when edge weight depends on previous edge -- (algorithms graphs shortest path weighted graphs)
<p>I have a directed graph with non-negative weights on the edges. 
I can divide the nodes in two "classes", X (roughly 1700 nodes) and Y (~300).
I want to collect all the shortest paths from x in X to ... | habedi/stack-exchange-dataset |
81,316 | Can loops like this one be algorithmically transformed into multiplication | <p>Are there known techniques for converting a loop like the following to an <code>if</code> and a multiplication?</p>

<pre><code>while (x < 0) {
 x += 60;
}
</code></pre>

<p>It seems clear that this could be replaced with something like the following</p>

<pre><code>if (x &l... | formal languages optimization programming languages program optimization | 1 | Can loops like this one be algorithmically transformed into multiplication -- (formal languages optimization programming languages program optimization)
<p>Are there known techniques for converting a loop like the following to an <code>if</code> and a multiplication?</p>

<pre><code>while (x < 0) {
 x... | habedi/stack-exchange-dataset |
81,320 | Signed and Unsigned Loads in a 32-bit Registers | <p>I have a question over this quote directly out of <a href="https://books.google.com/books?id=EVhgAAAAQBAJ&lpg=PA76&ots=OjoYHP59NM&dq=%22when%20loading%20a%2032-bit%20word%20into%20a%2032-bit%20register%22&pg=PA77#v=onepage&q=%22when%20loading%20a%2032-bit%20word%20into%20a%2032-bit%20register%22&... | computer architecture operating systems arithmetic memory hardware | 1 | Signed and Unsigned Loads in a 32-bit Registers -- (computer architecture operating systems arithmetic memory hardware)
<p>I have a question over this quote directly out of <a href="https://books.google.com/books?id=EVhgAAAAQBAJ&lpg=PA76&ots=OjoYHP59NM&dq=%22when%20loading%20a%2032-bit%20word%20into%20a%203... | habedi/stack-exchange-dataset |
81,333 | What does $k$ mean in regular expressions? | <p>From what I have learned in <em>Introduction to Automata Theory, Languages, and Computation</em>, regular expressions can be represented with $R^{(k)}_{ij}$.</p>

<p>I understand that $i$ and $j$ represent the starting state and the closing state respectively. However, I am still trying to understand the pur... | formal languages regular expressions | 1 | What does $k$ mean in regular expressions? -- (formal languages regular expressions)
<p>From what I have learned in <em>Introduction to Automata Theory, Languages, and Computation</em>, regular expressions can be represented with $R^{(k)}_{ij}$.</p>

<p>I understand that $i$ and $j$ represent the starting state... | habedi/stack-exchange-dataset |
81,339 | Why $\operatorname{gap-A}[1.5a, 1.5b + 1/4]$ has an efficient solution? | <blockquote>
 <p>Let $0<a < b<1/2$. Suppose that there's an efficient $a/b$-approximation for $A$, where $A$ is a maximization problem. Why does $\operatorname{gap-A}[1.5a, 1.5b +1/4]$ also has a polynomial solution?</p>
</blockquote>

<p>We've learned in class that if $gap-A[a,b]$ has a polyn... | complexity theory approximation | 1 | Why $\operatorname{gap-A}[1.5a, 1.5b + 1/4]$ has an efficient solution? -- (complexity theory approximation)
<blockquote>
 <p>Let $0<a < b<1/2$. Suppose that there's an efficient $a/b$-approximation for $A$, where $A$ is a maximization problem. Why does $\operatorname{gap-A}[1.5a, 1.5b +1/4]$ also has a p... | habedi/stack-exchange-dataset |
81,342 | $C_1 \subseteq C_2$ implies $C_1^A\subseteq C_2^A$? | <blockquote>
 <p>$C_1 \subseteq C_2$ implies $C_1^A\subseteq C_2^A$?</p>
</blockquote>

<p>I've given a caveat that one shouldn't make this implication blindly and it shall be justified.</p>

<p>I can think of examples such that $C_1^A \subsetneq C_2^A$ and examples such that $C_1^A = C_2^A$.</... | complexity theory | 1 | $C_1 \subseteq C_2$ implies $C_1^A\subseteq C_2^A$? -- (complexity theory)
<blockquote>
 <p>$C_1 \subseteq C_2$ implies $C_1^A\subseteq C_2^A$?</p>
</blockquote>

<p>I've given a caveat that one shouldn't make this implication blindly and it shall be justified.</p>

<p>I can think of examples s... | habedi/stack-exchange-dataset |
81,345 | Tree with branching factor 1 | <p>Something that has been bothering me for a while is the formula for the maximum amount of nodes of a tree with height d and branching factor of b. </p>

<p>$$(b^{d+1}-1)/(b-1)$$</p>

<p>This holds true for all positive integer values of b, including 0, with the exception of b=1. </p>

<p>If b... | graphs trees | 1 | Tree with branching factor 1 -- (graphs trees)
<p>Something that has been bothering me for a while is the formula for the maximum amount of nodes of a tree with height d and branching factor of b. </p>

<p>$$(b^{d+1}-1)/(b-1)$$</p>

<p>This holds true for all positive integer values of b, including 0, w... | habedi/stack-exchange-dataset |
81,347 | Regular Expression for {W | W contains an even number of As and an odd number of Bs, but doesn't contains AB} | <p>While studying Automata at my University, I faced the following problem from SIPSER, M textbook:</p>

<blockquote>
 <p>Consider D = { w | w contains an even number of as and an odd number of bs and doesn't contains the chain ab}. Draw an DFA with 5 states that recognizes D and a Regular Expression that ... | formal languages regular languages finite automata regular expressions | 1 | Regular Expression for {W | W contains an even number of As and an odd number of Bs, but doesn't contains AB} -- (formal languages regular languages finite automata regular expressions)
<p>While studying Automata at my University, I faced the following problem from SIPSER, M textbook:</p>

<blockquote>
 <p... | habedi/stack-exchange-dataset |
81,348 | LTL to GBA versus LTL to BA | <p>Let's assume that I have an LTL formula and I want to convert it to a Buchi automaton. For which fragment of LTL, GBA is more succinct and for which fragment BA has the same size as GBA. </p>
 | automata model checking software verification linear temporal logic buchi automata | 1 | LTL to GBA versus LTL to BA -- (automata model checking software verification linear temporal logic buchi automata)
<p>Let's assume that I have an LTL formula and I want to convert it to a Buchi automaton. For which fragment of LTL, GBA is more succinct and for which fragment BA has the same size as GBA. </p>
 | habedi/stack-exchange-dataset |
81,349 | prove that l={w ∈ {0, 1}*: n0(w) ≠ n1(w)} is a non regular language? | <p>I tried doing this, but kept failing to prove. I know how to prove that the language is nonregular when n0(w) = n1(w). The following is the proof for n0(w) = n1(w) using pumping lemma: </p>

<pre><code>Assume L is regular. Then, by the Pumping Lemma, there is a natural number m such
that any w ∈ L with ... | formal languages regular languages context free pumping lemma | 1 | prove that l={w ∈ {0, 1}*: n0(w) ≠ n1(w)} is a non regular language? -- (formal languages regular languages context free pumping lemma)
<p>I tried doing this, but kept failing to prove. I know how to prove that the language is nonregular when n0(w) = n1(w). The following is the proof for n0(w) = n1(w) using pumping le... | habedi/stack-exchange-dataset |
81,354 | When LRU is NOT the optimal replacement policy | <p>I've been googling this topic but still couldnt get a legit answer. So can someone explain with some examples that if we were to use cache memory instead of LRU we would have lower miss rate (better peformance). Or simply when LRU is not an optimal choise.</p>
 | computer architecture cpu cache | 1 | When LRU is NOT the optimal replacement policy -- (computer architecture cpu cache)
<p>I've been googling this topic but still couldnt get a legit answer. So can someone explain with some examples that if we were to use cache memory instead of LRU we would have lower miss rate (better peformance). Or simply when LRU is... | habedi/stack-exchange-dataset |
81,360 | Why k- Vertex Cover is not in PTIME when it can be expressed in FO-logic | <p>We can express property that graph has vertex cover of size at most k with first order formula:</p>

<p>$$\exists x_1 \exists x_2...\exists x_k (\forall y \forall z (E(z,y) \ \rightarrow \ \bigvee_{1 \leq i \leq k} y=x_i \ \vee \ \bigvee_{1 \leq i \leq k} z=x_i))$$</p>

<p>But, there is also theorem ... | complexity theory graphs time complexity first order logic | 1 | Why k- Vertex Cover is not in PTIME when it can be expressed in FO-logic -- (complexity theory graphs time complexity first order logic)
<p>We can express property that graph has vertex cover of size at most k with first order formula:</p>

<p>$$\exists x_1 \exists x_2...\exists x_k (\forall y \forall z (E(z,y)... | habedi/stack-exchange-dataset |
81,371 | nlp: phonetic edit distance between a word and the closest of a set of words | <p>Let's say someone is using Dragon Dictation, Google Speech, or some other free form dictation software (it will recognize anything they say to the best of its ability). I have some reasonably large set of words and I'm certain the speaker is trying to say one of these words. However, the voice recognition system is ... | algorithms graphs search algorithms natural language processing | 1 | nlp: phonetic edit distance between a word and the closest of a set of words -- (algorithms graphs search algorithms natural language processing)
<p>Let's say someone is using Dragon Dictation, Google Speech, or some other free form dictation software (it will recognize anything they say to the best of its ability). I ... | habedi/stack-exchange-dataset |
81,375 | how to find upper bound and lower bound of quadratic equation | <p>I am relatively new to algorithms, I wrote one pattern matching algorithm and its running time is $O(n^2)$, I tried it by step count method, direct method and also the constant method which all yields same results. Anyhow now I am writing the upper and lower bound for that, the equation which I get is</p>

<... | algorithm analysis asymptotics lower bounds upper bound | 1 | how to find upper bound and lower bound of quadratic equation -- (algorithm analysis asymptotics lower bounds upper bound)
<p>I am relatively new to algorithms, I wrote one pattern matching algorithm and its running time is $O(n^2)$, I tried it by step count method, direct method and also the constant method which all ... | habedi/stack-exchange-dataset |
81,379 | TRNG by hamming distance of processor tics | <p>I hardly remember on a lecture, where it was told, that the distance of the practical actual running-speed of a processor to the previous tic is used, to generated a true random entropy for seeding. But I cannot find any source for proving this memory right. </p>

<p>So my question arises: Is this a way to g... | computer architecture randomness random number generator | 1 | TRNG by hamming distance of processor tics -- (computer architecture randomness random number generator)
<p>I hardly remember on a lecture, where it was told, that the distance of the practical actual running-speed of a processor to the previous tic is used, to generated a true random entropy for seeding. But I cannot ... | habedi/stack-exchange-dataset |
81,384 | Analysis of komi values for increasing Go board sizes and agents strength | <p><a href="https://en.wikipedia.org/wiki/Komidashi" rel="nofollow noreferrer">Komi</a> is the additional number of points given to the non-starting player in the game of Go. </p>

<p>For 19x19 board, currently it is 6.5 under Japanese rules, 7.5 points under Chinese rules. In the past it was lower, even 2.5 po... | artificial intelligence game theory board games | 1 | Analysis of komi values for increasing Go board sizes and agents strength -- (artificial intelligence game theory board games)
<p><a href="https://en.wikipedia.org/wiki/Komidashi" rel="nofollow noreferrer">Komi</a> is the additional number of points given to the non-starting player in the game of Go. </p>

<p>F... | habedi/stack-exchange-dataset |
81,386 | Basic approximation algorithms understanding | <p><strong>Question:</strong></p>

<p>Suppose we have 2 algorithms $Alg1$ and $Alg2$ for the same minimization problem. We know that $Alg1$ is a $2$-approximation algorithm and $Alg2$ a $4$-approximation algorithm.</p>

<p>Is the following statement true?</p>

<p>There must be an input $I$ such ... | algorithms proof techniques approximation | 1 | Basic approximation algorithms understanding -- (algorithms proof techniques approximation)
<p><strong>Question:</strong></p>

<p>Suppose we have 2 algorithms $Alg1$ and $Alg2$ for the same minimization problem. We know that $Alg1$ is a $2$-approximation algorithm and $Alg2$ a $4$-approximation algorithm.</p>&#... | habedi/stack-exchange-dataset |
81,395 | Is n!=O(2^(n lg n))? | <p>By Stirling's Approximation $n! = \sqrt{2*\pi*n} * [n/e]^n * e^\alpha$</p>

<p>Therefore $T(n!) = O(n^n)$</p>

<p>$O(n^n) \neq O(2^{n \lg n})$</p>

<p>Is this correct? Is there another way to get this result if it is correct? Thanks.</p>
 | asymptotics | 1 | Is n!=O(2^(n lg n))? -- (asymptotics)
<p>By Stirling's Approximation $n! = \sqrt{2*\pi*n} * [n/e]^n * e^\alpha$</p>

<p>Therefore $T(n!) = O(n^n)$</p>

<p>$O(n^n) \neq O(2^{n \lg n})$</p>

<p>Is this correct? Is there another way to get this result if it is correct? Thanks.</p>
 | habedi/stack-exchange-dataset |
81,401 | Linear/affine lifetimes without subtyping | <p>Are there any type systems similar to rust that don't depend on subtyping ? Can we express that one value must be consumed or dropped before another? For instance if I had an array of huge values on the heap and I would like to operate on a single item using a reference to it, the compiler would need to be sure I ha... | type theory type checking | 1 | Linear/affine lifetimes without subtyping -- (type theory type checking)
<p>Are there any type systems similar to rust that don't depend on subtyping ? Can we express that one value must be consumed or dropped before another? For instance if I had an array of huge values on the heap and I would like to operate on a sin... | habedi/stack-exchange-dataset |
81,404 | Is Goedel's 1st theorem not algorithmically derivable? | <p>First let me explain what I mean by algorithmically derivable.
An algorithm must be able to come up with the proof without prior knowledge of the proof, in the same way mathematicians and computer scientists are able to create new proofs without prior knowledge of the proofs.</p>

<p>Our proof deriver en... | proof assistants check my answer incompleteness | 1 | Is Goedel's 1st theorem not algorithmically derivable? -- (proof assistants check my answer incompleteness)
<p>First let me explain what I mean by algorithmically derivable.
An algorithm must be able to come up with the proof without prior knowledge of the proof, in the same way mathematicians and computer scientis... | habedi/stack-exchange-dataset |
81,408 | What's the difference between Computer Science and Informatics? | <p>The Terms are much used in actual IT (Information Technology). Is it possible to make a difference or are this terms nearly synonyms for the same fact? </p>
 | terminology | 1 | What's the difference between Computer Science and Informatics? -- (terminology)
<p>The Terms are much used in actual IT (Information Technology). Is it possible to make a difference or are this terms nearly synonyms for the same fact? </p>
 | habedi/stack-exchange-dataset |
81,414 | Prove that palindromes are not regular language without using pumping lemma | <p>I came across this question. Palindromes are not regular: It is easy to prove it using pumping lemma. The problem is I want an explicit proof without pumping lemma. I came up with a solution. It goes like this. 
Let us assume a language L which is palindrome so L can be expressed as x.xR where xR is reverse of x... | formal languages finite automata | 1 | Prove that palindromes are not regular language without using pumping lemma -- (formal languages finite automata)
<p>I came across this question. Palindromes are not regular: It is easy to prove it using pumping lemma. The problem is I want an explicit proof without pumping lemma. I came up with a solution. It goes lik... | habedi/stack-exchange-dataset |
81,416 | NTM's and the halting problem | <p>It is often stated that nondeterministic Turing machines cannot recognize any more languages than ordinary Turing machines. In particular, it is stated that there is no NTM that can take as input a DTM/input string and state whether that DTM will halt.</p>

<p>Is this proven, or is this an assumption under t... | algorithms computability halting problem nondeterminism | 1 | NTM's and the halting problem -- (algorithms computability halting problem nondeterminism)
<p>It is often stated that nondeterministic Turing machines cannot recognize any more languages than ordinary Turing machines. In particular, it is stated that there is no NTM that can take as input a DTM/input string and state w... | habedi/stack-exchange-dataset |
81,418 | Infinite Boolean circuits as a model of computation | <p>Boolean circuits are non-uniform models of computation in that they require a different circuit for each length of input. The typical way of uniformizing a family of Boolean circuits is to define a Turing machine that can output, for some input length N, the correct Boolean circuit for that N.</p>

<p>Howeve... | computation models circuits boolean algebra turing completeness | 1 | Infinite Boolean circuits as a model of computation -- (computation models circuits boolean algebra turing completeness)
<p>Boolean circuits are non-uniform models of computation in that they require a different circuit for each length of input. The typical way of uniformizing a family of Boolean circuits is to define ... | habedi/stack-exchange-dataset |
81,427 | Protocols for "almost equality" with one-sided error | <p>In the well-known communication task <em>EQUALITY</em>, Alice has a string $x$ of $n$ bits, Bob has a string $y$ of $n$ bits, and their task is to determine whether $x = y$. In the public coin model, there is a probabilistic protocol which uses 2 bits, is always correct when $x = y$, and is correct with constant pro... | communication complexity | 1 | Protocols for "almost equality" with one-sided error -- (communication complexity)
<p>In the well-known communication task <em>EQUALITY</em>, Alice has a string $x$ of $n$ bits, Bob has a string $y$ of $n$ bits, and their task is to determine whether $x = y$. In the public coin model, there is a probabilistic protocol ... | habedi/stack-exchange-dataset |
81,437 | Longest increasing subsequence on pairs | <p>Given a sequence of pairs $(a_1, b_1), (a_2, b_2), ..., (a_n, b_n)$ such that $a_1 \le a_2 \le ... \le a_n$ (i.e, sorted in ascending order by $a$'s), we solve the longest increasing subsequence problem for $b$'s. Now suppose the length of the longest increasing subsequence is $X$.</p>

<p>If we now sort the... | algorithms subsequences | 1 | Longest increasing subsequence on pairs -- (algorithms subsequences)
<p>Given a sequence of pairs $(a_1, b_1), (a_2, b_2), ..., (a_n, b_n)$ such that $a_1 \le a_2 \le ... \le a_n$ (i.e, sorted in ascending order by $a$'s), we solve the longest increasing subsequence problem for $b$'s. Now suppose the length of the long... | habedi/stack-exchange-dataset |
81,466 | Algorithm to calculate average weight from every pair of nodes | <p>I'm trying to solve a puzzle where I need to calculate the average weight between every node in the graph.</p>

<p>For example, for the following graph:</p>

<p><a href="https://i.stack.imgur.com/F36RB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F36RB.png" alt="enter image desc... | time complexity weighted graphs | 1 | Algorithm to calculate average weight from every pair of nodes -- (time complexity weighted graphs)
<p>I'm trying to solve a puzzle where I need to calculate the average weight between every node in the graph.</p>

<p>For example, for the following graph:</p>

<p><a href="https://i.stack.imgur.com/F36RB... | habedi/stack-exchange-dataset |
81,469 | What is structural complexity theory? | <p>I am new to complexity theory and want to know what is structural complexity theory? what are problems theorists try to solve in this field and what is its future?
From the wikipedia:</p>

<blockquote>
 <p>The structural complexity theory or simply structural complexity is the study of complexity cl... | complexity theory reference request | 1 | What is structural complexity theory? -- (complexity theory reference request)
<p>I am new to complexity theory and want to know what is structural complexity theory? what are problems theorists try to solve in this field and what is its future?
From the wikipedia:</p>

<blockquote>
 <p>The structural ... | habedi/stack-exchange-dataset |
81,482 | Linear programming with inequality constraints treated lexicographically | <p>I'm trying to solve optimization problems of the form: $\min\{cx|Ax\preceq b,\;x\geq 0\}$, where $\preceq$ means lexicographic order; that is, the set of linear inequalities need only to be satisfied lexicographically. I'm guessing these inequalities are treated conditionally by means of binary variables thus transf... | linear programming integer programming | 1 | Linear programming with inequality constraints treated lexicographically -- (linear programming integer programming)
<p>I'm trying to solve optimization problems of the form: $\min\{cx|Ax\preceq b,\;x\geq 0\}$, where $\preceq$ means lexicographic order; that is, the set of linear inequalities need only to be satisfied ... | habedi/stack-exchange-dataset |
81,483 | Minimum number of cuts to divide a rectangle | <p>We're given a big rectangle, and a list of small rectangles contained inside it, with their vertex coordinates.</p>

<p>We want a list of the minimum number of lines defined by a pair of points (x,y) that cut up the big rectangle into the small ones.</p>

<hr>

<p>For example for this case:<... | algorithms minimum cuts | 1 | Minimum number of cuts to divide a rectangle -- (algorithms minimum cuts)
<p>We're given a big rectangle, and a list of small rectangles contained inside it, with their vertex coordinates.</p>

<p>We want a list of the minimum number of lines defined by a pair of points (x,y) that cut up the big rectangle into... | habedi/stack-exchange-dataset |
81,487 | Is there an NP-complete problem that can be solved in $O(n^{\log n})$ time? | <p>I'm following an online course which has the following (multiple-choice) quiz question:</p>

<blockquote>
 <p>Which of the following statements cannot be true, given the current
 state of knowledge?</p>
 
 <ol>
 <li>Some NP-complete problems are polynomial-time solvable, and some NP-... | complexity theory np complete asymptotics np | 1 | Is there an NP-complete problem that can be solved in $O(n^{\log n})$ time? -- (complexity theory np complete asymptotics np)
<p>I'm following an online course which has the following (multiple-choice) quiz question:</p>

<blockquote>
 <p>Which of the following statements cannot be true, given the current&... | habedi/stack-exchange-dataset |
81,497 | How to prove that this defined language is regular? | <p>Suppose that $L$ is a regular language and $0<\alpha<1$ and $\alpha \in Q$. Define $L_\alpha$ as</p>

<p>$$L_\alpha = \{\omega \in \Sigma^* \mid \exists \omega_1 \in \Sigma^* .\omega\omega_1 \in L,\frac{|\omega|}{|\omega\omega_1|}=\alpha\}$$</p>

<p>How do I prove that $L_\alpha$ is regular?</... | formal languages regular languages finite automata | 1 | How to prove that this defined language is regular? -- (formal languages regular languages finite automata)
<p>Suppose that $L$ is a regular language and $0<\alpha<1$ and $\alpha \in Q$. Define $L_\alpha$ as</p>

<p>$$L_\alpha = \{\omega \in \Sigma^* \mid \exists \omega_1 \in \Sigma^* .\omega\omega_1 \in... | habedi/stack-exchange-dataset |
81,499 | Cardinality of ordered n-grams and subsets of those n-grams from a given set | <p>Given a set T={A,B,C}, I need to know the cardinality of all ordered sequential n-grams and the total cardinality of all subsets of those n-grams. To be clear, the subsets MUST retain order as they appear in the original set.</p>
<ol>
<li><p>The ordered sequential n-grams of the set T above are {{A},{B},{C}... | combinatorics | 1 | Cardinality of ordered n-grams and subsets of those n-grams from a given set -- (combinatorics)
<p>Given a set T={A,B,C}, I need to know the cardinality of all ordered sequential n-grams and the total cardinality of all subsets of those n-grams. To be clear, the subsets MUST retain order as they appear in the original... | habedi/stack-exchange-dataset |
81,500 | How come identity encodes absurdity | <p>From P5 in this paper: <a href="https://hal.inria.fr/hal-01094195/file/CIC.pdf" rel="nofollow noreferrer">https://hal.inria.fr/hal-01094195/file/CIC.pdf</a></p>

<blockquote>
 <p>Using this purely functional part, it is possible to encode many int
 eresting notions. For instance
 ∀
 C
... | programming languages logic proof assistants | 1 | How come identity encodes absurdity -- (programming languages logic proof assistants)
<p>From P5 in this paper: <a href="https://hal.inria.fr/hal-01094195/file/CIC.pdf" rel="nofollow noreferrer">https://hal.inria.fr/hal-01094195/file/CIC.pdf</a></p>

<blockquote>
 <p>Using this purely functional part, it i... | habedi/stack-exchange-dataset |
81,508 | Any Non-trivial Logic System Defined with only Equality | <h3>Preface</h3>
<p>We can define a system of logic by conjunctions of rules that system must follow. For example, if we wanted to define transitivity of numbers:
<span class="math-container">$$F_1: \forall a,b,c. a < b \land b < c \rightarrow a < c$$</span>
We could similarly define associativity:... | logic first order logic | 1 | Any Non-trivial Logic System Defined with only Equality -- (logic first order logic)
<h3>Preface</h3>
<p>We can define a system of logic by conjunctions of rules that system must follow. For example, if we wanted to define transitivity of numbers:
<span class="math-container">$$F_1: \forall a,b,c. a < b \lan... | habedi/stack-exchange-dataset |
81,510 | What does instantiating existential variables with out of scope variable imply? | <p>I have following unfinished proof of a lemma:</p>

<pre><code>Goal forall (P : Type -> Prop) (Q : Prop),
 ((forall x, (P x)) -> Q) -> (exists x, P x -> Q).
Proof.
 intros. 
 eapply ex_intro. intros. apply H. intros. eapply H0.
</code></pre>

<p>The problem is the la... | logic coq | 1 | What does instantiating existential variables with out of scope variable imply? -- (logic coq)
<p>I have following unfinished proof of a lemma:</p>

<pre><code>Goal forall (P : Type -> Prop) (Q : Prop),
 ((forall x, (P x)) -> Q) -> (exists x, P x -> Q).
Proof.
 intros. 
 eapply ex... | habedi/stack-exchange-dataset |
81,511 | Even, Itai & Shamir's limited backtracking algorithm for 2-SAT: is it really linear? | <p>I have read in Wikipedia (and other sources) about the limited backtracking algorithm of Even, Itai & Shamir for solving 2-SAT problem in a linear time, but the approach doesn't seem to be linear, there is no demonstration nor algorithm implementation to check it.</p>

<p>Here is the algorithm descriptio... | algorithms time complexity satisfiability 2 sat | 1 | Even, Itai & Shamir's limited backtracking algorithm for 2-SAT: is it really linear? -- (algorithms time complexity satisfiability 2 sat)
<p>I have read in Wikipedia (and other sources) about the limited backtracking algorithm of Even, Itai & Shamir for solving 2-SAT problem in a linear time, but the approach doesn... | habedi/stack-exchange-dataset |
81,536 | Why does the time/space tradeoff exist | <p>I'd like to know why when choosing how to optimize an algorithm that there almost always (always?) exists a time/space tradeoff. </p>

<p>Definition: <a href="https://simple.wikipedia.org/wiki/Space-time_tradeoff" rel="nofollow noreferrer">https://simple.wikipedia.org/wiki/Space-time_tradeoff</a>.</p>
&#... | computability optimization information theory | 1 | Why does the time/space tradeoff exist -- (computability optimization information theory)
<p>I'd like to know why when choosing how to optimize an algorithm that there almost always (always?) exists a time/space tradeoff. </p>

<p>Definition: <a href="https://simple.wikipedia.org/wiki/Space-time_tradeoff" rel="... | habedi/stack-exchange-dataset |
81,537 | Are there any countable sets that are not computably enumerable? | <p>A set is <em>countable</em> if it has a bijection with the natural numbers, and is <em>computably enumerable (c.e.)</em> if there exists an algorithm that enumerates its members.</p>

<p>Any non-finite computably enumerable set must be countable since we can construct a bijection from the enumeration.</p>&#x... | computability semi decidability | 1 | Are there any countable sets that are not computably enumerable? -- (computability semi decidability)
<p>A set is <em>countable</em> if it has a bijection with the natural numbers, and is <em>computably enumerable (c.e.)</em> if there exists an algorithm that enumerates its members.</p>

<p>Any non-finite compu... | habedi/stack-exchange-dataset |
81,542 | Undecidable Problem for Regular Languages | <p>It might seems weird, but, Are there any <strong>undecidable</strong> problems concerning regular languages? I mean questions concerning the regular languages, not the problems like "Is the language of a TM regular?".</p>

<p>Clarification: By the questions regarding regular languages, I mean that the proble... | computability regular languages undecidability | 1 | Undecidable Problem for Regular Languages -- (computability regular languages undecidability)
<p>It might seems weird, but, Are there any <strong>undecidable</strong> problems concerning regular languages? I mean questions concerning the regular languages, not the problems like "Is the language of a TM regular?".</p>&#... | habedi/stack-exchange-dataset |
81,550 | Gale Shapley - Everyone ends up with second choice of partner | <p>So I was asked to prove (or not) whether, in gale shapley algorithm, everyone can end up married to their second partner of choice or not. I think not but then I am not able to come up with a proof.</p>

<p>Thanks! :)</p>
 | algorithms data structures | 1 | Gale Shapley - Everyone ends up with second choice of partner -- (algorithms data structures)
<p>So I was asked to prove (or not) whether, in gale shapley algorithm, everyone can end up married to their second partner of choice or not. I think not but then I am not able to come up with a proof.</p>

<p>Thanks! ... | habedi/stack-exchange-dataset |
81,556 | Simple (non-mathematical) definition of polynomial time? | <p>Computational Complexity Theory is complex. My understanding of polynomial time is in relation to other time complexity classes, such as non-deterministic polynomial time. This is fine for engineers and mathematicians, but I'm looking for a simple definition of the term, suitable for laypeople. </p>

<ul>&... | complexity theory terminology time complexity | 1 | Simple (non-mathematical) definition of polynomial time? -- (complexity theory terminology time complexity)
<p>Computational Complexity Theory is complex. My understanding of polynomial time is in relation to other time complexity classes, such as non-deterministic polynomial time. This is fine for engineers and math... | habedi/stack-exchange-dataset |
81,567 | Do exponents have higher time complexity than factorials? | <p>My professor said exponentials will always have higher time complexity compared to polynomials. My question is, do exponentials also have higher time complexity than factorials?</p>

<p>I plotted a chart in Matlab to check it myself.</p>

<p>When range of x is small, from 1 to 10, I get the following... | asymptotics | 1 | Do exponents have higher time complexity than factorials? -- (asymptotics)
<p>My professor said exponentials will always have higher time complexity compared to polynomials. My question is, do exponentials also have higher time complexity than factorials?</p>

<p>I plotted a chart in Matlab to check it myself.<... | habedi/stack-exchange-dataset |
81,575 | Not able to devise a concrete solution for the given graph query | <p>I was trying to solve the following problem:</p>

<p>You are given a grid of size N×N that has the following specifications:</p>

<p>Each cell in the grid contains either a policeman or a thief.</p>

<p>A policeman can only catch a thief if both of them are in the same row. Each policeman can... | graphs data structures | 1 | Not able to devise a concrete solution for the given graph query -- (graphs data structures)
<p>I was trying to solve the following problem:</p>

<p>You are given a grid of size N×N that has the following specifications:</p>

<p>Each cell in the grid contains either a policeman or a thief.</p>

... | habedi/stack-exchange-dataset |
81,576 | How to find n-1 complete matches for bipartite graphs that are related (speed-date)? | <p>How can one assign <strong>n</strong> people pairwise to <strong>n-1</strong> tables, in a speed-date fashion, such that no two persons meet twice and each person is at each table exactly once? Does this problem have a name?</p>

<h3>The problem in full</h3>

<p>Given <strong>n</strong> people (<stro... | algorithms graphs bipartite matching | 1 | How to find n-1 complete matches for bipartite graphs that are related (speed-date)? -- (algorithms graphs bipartite matching)
<p>How can one assign <strong>n</strong> people pairwise to <strong>n-1</strong> tables, in a speed-date fashion, such that no two persons meet twice and each person is at each table exactly on... | habedi/stack-exchange-dataset |
81,578 | Smallest integer with k 1-bits that is the sum of two integers with g,h 1-bits respectively | <p>Given integers $g, h, k, n$ how to find the smallest integer with $k\ 1$-bits that is the sum of two integers with $g, h\ 1$-bits respectively. Moreover, all three numbers (summands and sum) can have at most $n$ bits, i.e. the result is the n-bit number with $k\ 1$'s and $(k - n)$ zeros, for instance $\underbrace{0... | algorithms dynamic programming | 1 | Smallest integer with k 1-bits that is the sum of two integers with g,h 1-bits respectively -- (algorithms dynamic programming)
<p>Given integers $g, h, k, n$ how to find the smallest integer with $k\ 1$-bits that is the sum of two integers with $g, h\ 1$-bits respectively. Moreover, all three numbers (summands and sum... | habedi/stack-exchange-dataset |
81,579 | Check if current interval is overlapping some intervals, or is being overlapped | <p>Let's say we have array of $K$ integers, and we have given $N$ intervals in the form $l_{i}, r_{i}$, both inclusive, the interval $i$ means that all elements in the range $[l_i, r_i]$ are covered. Our task is to check for any of those $N$ intervals is the interval $i$, or the range $[l_i, r_i]$ being covered twice o... | search algorithms arrays search trees intervals | 1 | Check if current interval is overlapping some intervals, or is being overlapped -- (search algorithms arrays search trees intervals)
<p>Let's say we have array of $K$ integers, and we have given $N$ intervals in the form $l_{i}, r_{i}$, both inclusive, the interval $i$ means that all elements in the range $[l_i, r_i]$ ... | habedi/stack-exchange-dataset |
81,582 | Closed (visited) list in state-space search - How do I make it efficient? | <p>As part of an assignment for an AI class that I'm taking, I'm need to solve a puzzle on a 4x4 grid using breadth-first search (each element can take on 12 different values). There is a maximum of 4 moves for each state. Needless to say, after 30-or-so moves, the number of nodes (each representing a state) in the que... | graphs trees artificial intelligence | 1 | Closed (visited) list in state-space search - How do I make it efficient? -- (graphs trees artificial intelligence)
<p>As part of an assignment for an AI class that I'm taking, I'm need to solve a puzzle on a 4x4 grid using breadth-first search (each element can take on 12 different values). There is a maximum of 4 mov... | habedi/stack-exchange-dataset |
81,591 | How is the definition of monads in category theory equivalent to the definition in functional programming? | <p>In Haskell, <code>Monad</code> is a class of type constructors which act on types that have the following functions implemented:</p>

<pre><code>(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
return :: a -> m a
</code></pre>
... | functional programming category theory | 1 | How is the definition of monads in category theory equivalent to the definition in functional programming? -- (functional programming category theory)
<p>In Haskell, <code>Monad</code> is a class of type constructors which act on types that have the following functions implemented:</p>

<pre><code>(>>=) ... | habedi/stack-exchange-dataset |
81,597 | Big O - Equivalence: "Standard" definition vs Limit definition | <p>This question is related to: <a href="https://cs.stackexchange.com/questions/10531/landau-notation-definitions-limits-vs-cormans?rq=1">Landau Notation, Definitions: Limits vs. Cormen's</a>. </p>

<p>Consider functions $f, \ g : N \rightarrow R^{\geq0}$.</p>

<p>For small-$o$, the definition:
$$f(... | terminology asymptotics landau notation | 1 | Big O - Equivalence: "Standard" definition vs Limit definition -- (terminology asymptotics landau notation)
<p>This question is related to: <a href="https://cs.stackexchange.com/questions/10531/landau-notation-definitions-limits-vs-cormans?rq=1">Landau Notation, Definitions: Limits vs. Cormen's</a>. </p>

<p>Co... | habedi/stack-exchange-dataset |
81,605 | Aggregate planning with inventory | <p>I am lost in formulating a mathematical model for my linear integer program. My problem is; how to include inventory and backlogging.</p>

<p>The following is given:</p>

<ul>
<li>1100 units can be produced each month</li>
<li>Unit production cost = \$7</li>
<li>Inventory unit cost = \$2<... | optimization linear programming integer programming planning | 1 | Aggregate planning with inventory -- (optimization linear programming integer programming planning)
<p>I am lost in formulating a mathematical model for my linear integer program. My problem is; how to include inventory and backlogging.</p>

<p>The following is given:</p>

<ul>
<li>1100 units can be... | habedi/stack-exchange-dataset |
81,608 | proving that $P\ne NP$ under an assumption | <p>Suppose that $P^{SAT} \not\subseteq coNP$. Prove that $P\ne NP$.</p>

<p>What I did:</p>

<p>Suppose that $P=NP$. Then, $P = coP = NP = coNP$.</p>

<p>We know that $P^P = P$.</p>

<p>Then, by assumption: $P^{NP} = NP = coNP$</p>

<p>Since $SAT$ is $NP$-complete we get: $P^{SAT... | complexity theory p vs np | 1 | proving that $P\ne NP$ under an assumption -- (complexity theory p vs np)
<p>Suppose that $P^{SAT} \not\subseteq coNP$. Prove that $P\ne NP$.</p>

<p>What I did:</p>

<p>Suppose that $P=NP$. Then, $P = coP = NP = coNP$.</p>

<p>We know that $P^P = P$.</p>

<p>Then, by assumption: $P^{NP}... | habedi/stack-exchange-dataset |
81,627 | positivity condition in Coq/CIC | <p>I am recently learning the theory behind Coq and learnt that positivity condition guarantees termination of the program. But my question is, what would you think of the following definition?</p>

<pre><code>Inductive t : Set := b : t | c : ((t -> unit) -> unit) -> t.
</code></pre>

<p>Su... | programming languages logic coq | 1 | positivity condition in Coq/CIC -- (programming languages logic coq)
<p>I am recently learning the theory behind Coq and learnt that positivity condition guarantees termination of the program. But my question is, what would you think of the following definition?</p>

<pre><code>Inductive t : Set := b : t | c : ... | habedi/stack-exchange-dataset |
81,636 | Print maximum frequency number in an array(with slight modification) | <p>There is an integer array and 2 variables Q and M.The output required is the number which has the maximum frequency in the array, but the catch is that each number in the array can be increased/decreased by M and that too Q number of times.</p>

<p>In case of multiple answers print the first one.</p>
&#x... | algorithms arrays hash tables c++ | 1 | Print maximum frequency number in an array(with slight modification) -- (algorithms arrays hash tables c++)
<p>There is an integer array and 2 variables Q and M.The output required is the number which has the maximum frequency in the array, but the catch is that each number in the array can be increased/decreased by M ... | habedi/stack-exchange-dataset |
81,657 | In Coq, what does it mean to have an inductive type where the right-hand side of ":" is Prop? | <p>I'm new to Coq, and my (rather limited) understanding is that inductive types are like algebraic datatypes in Haskell, so there is a constructor <code>data T = A a</code> with some arguments, and the result <code>A a</code> is a <code>T</code>: specifically a <code>T</code>, so I understand stuff like this:</p>
... | coq inductive datatypes | 1 | In Coq, what does it mean to have an inductive type where the right-hand side of ":" is Prop? -- (coq inductive datatypes)
<p>I'm new to Coq, and my (rather limited) understanding is that inductive types are like algebraic datatypes in Haskell, so there is a constructor <code>data T = A a</code> with some arguments, an... | habedi/stack-exchange-dataset |
81,664 | Pseudo random, unqiue integer numbers in a given range | <p>I need an algorithm that gives me integer numbers with the following features:</p>

<ul>
<li><p>Numbers must be in a given range $[n..m]$;</p></li>
<li><p>Numbers must be returned in pseudo-random order (random at visual inspection is enough; it is more important that numbers are well distributed ove... | pseudo random generators random number generator | 1 | Pseudo random, unqiue integer numbers in a given range -- (pseudo random generators random number generator)
<p>I need an algorithm that gives me integer numbers with the following features:</p>

<ul>
<li><p>Numbers must be in a given range $[n..m]$;</p></li>
<li><p>Numbers must be returned in pseudo-ra... | habedi/stack-exchange-dataset |
81,665 | How is $L$ = {$ { a^nsb^n : s \in L(a^*b^*) ,\ n \ge 1 } $} a regular language? | <p>My understanding is that a machine with finite states cannot keep track of the n's being the same in $L$ = {$ { a^nsb^n : s \in L(a^*b^*) ,\ n \ge 1 } $}, similar to the case with how $a^nb^n$ is not a regular language. For instance, if we take a string $aaaa ab bb$, where the fifth a and the following b are $s$, h... | regular languages pumping lemma | 1 | How is $L$ = {$ { a^nsb^n : s \in L(a^*b^*) ,\ n \ge 1 } $} a regular language? -- (regular languages pumping lemma)
<p>My understanding is that a machine with finite states cannot keep track of the n's being the same in $L$ = {$ { a^nsb^n : s \in L(a^*b^*) ,\ n \ge 1 } $}, similar to the case with how $a^nb^n$ is not... | habedi/stack-exchange-dataset |
81,672 | Practicality of compressing data with hashing algorithms | <p>I want to compress the string <strong>0cc175b9c0f1b6a831c399e269772661</strong>. I can do so by storing the string <strong>a</strong>, and, when decompressing, using <strong>a</strong> as input for the <strong>MD5</strong> hash algorithm to get the original string.</p>

<p>I realize it's impossible to repres... | information theory data compression hashing | 1 | Practicality of compressing data with hashing algorithms -- (information theory data compression hashing)
<p>I want to compress the string <strong>0cc175b9c0f1b6a831c399e269772661</strong>. I can do so by storing the string <strong>a</strong>, and, when decompressing, using <strong>a</strong> as input for the <strong>M... | habedi/stack-exchange-dataset |
81,674 | The optimal way to reverse engineer a binary classification problem | <p>I am not sure if this question is more suitable for CS, theoretical CS or math so feel free to improve the description and migrate it.</p>

<p>In a scenario very similar to popular binary classification machine learning contests, competitors are required to submit their answers to the test set containing N d... | algorithms optimization combinatorics probability theory information theory | 1 | The optimal way to reverse engineer a binary classification problem -- (algorithms optimization combinatorics probability theory information theory)
<p>I am not sure if this question is more suitable for CS, theoretical CS or math so feel free to improve the description and migrate it.</p>

<p>In a scenario ver... | habedi/stack-exchange-dataset |
81,679 | How to prove this language is not regular (via Fooling Set) | <p><a href="https://i.stack.imgur.com/3Zx4N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3Zx4N.png" alt="genQ"></a></p>

<p>By using this fooling set, I am able to prove that the concatenation of <em>bz</em> is in the language <em>L</em>, but I still need to prove that <em>az</em> is not i... | formal languages regular languages check my answer | 1 | How to prove this language is not regular (via Fooling Set) -- (formal languages regular languages check my answer)
<p><a href="https://i.stack.imgur.com/3Zx4N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3Zx4N.png" alt="genQ"></a></p>

<p>By using this fooling set, I am able to prove that... | habedi/stack-exchange-dataset |
81,694 | Why encoding of graph in adjacency matrix is $\Omega (\sqrt n)$? | <p>in the textbook of CLRS, p.1062 he says the following:</p>

<blockquote>
 <p>if we use "reasonable" encoding of a graph as its adjacency matrix, the number m of vertices in the graph is $\Omega (\sqrt n)$, where n = |$\langle G\rangle|$ is the length of the encoding of G. </p>
</blockquote>

... | algorithms graphs encoding scheme | 1 | Why encoding of graph in adjacency matrix is $\Omega (\sqrt n)$? -- (algorithms graphs encoding scheme)
<p>in the textbook of CLRS, p.1062 he says the following:</p>

<blockquote>
 <p>if we use "reasonable" encoding of a graph as its adjacency matrix, the number m of vertices in the graph is $\Omega (\sqrt... | habedi/stack-exchange-dataset |
81,697 | How to build a PDA that accepts strings which have odd numbers of a and even numbers of b and has only 2 states? | <p>How can i draw a PDA which has <strong>only 2</strong> states and accepts strings which have odd number of a and even number of b? </p>

<p>the alphabet is {a,b}, and the PDA has to be only 2 states?</p>
 | automata pushdown automata | 1 | How to build a PDA that accepts strings which have odd numbers of a and even numbers of b and has only 2 states? -- (automata pushdown automata)
<p>How can i draw a PDA which has <strong>only 2</strong> states and accepts strings which have odd number of a and even number of b? </p>

<p>the alphabet is {a,b}, ... | habedi/stack-exchange-dataset |
81,704 | Can we make a PDA with only 1 state which accepts a^n and n is odd? | <p>We can have acceptance with empty stack, but in that case our stack at the start has to have a A in it, otherwise this machine will accept the empty string which is wrong</p>

<p>But can we have a non empty stack at the start? is my method right?</p>
 | automata pushdown automata | 1 | Can we make a PDA with only 1 state which accepts a^n and n is odd? -- (automata pushdown automata)
<p>We can have acceptance with empty stack, but in that case our stack at the start has to have a A in it, otherwise this machine will accept the empty string which is wrong</p>

<p>But can we have a non empty st... | habedi/stack-exchange-dataset |
81,708 | is this a Context free Language : $L=\{W_1W_2 \mid W_1 \ne W_2 \: \text{and} \: |W_1|=|W_2|\}$ | <p>$L=\{W_1W_2 \mid W_1 \ne W_2 \: \text{and} \: |W_1|=|W_2|\}$</p>

<p>Alphabet = { a , b }* </p>

<p>Considering L={WW} is not context free, shouldn't this be non context free as well? otherwise can you provide a machine or grammar which accepts this?</p>
 | automata context free pushdown automata | 1 | is this a Context free Language : $L=\{W_1W_2 \mid W_1 \ne W_2 \: \text{and} \: |W_1|=|W_2|\}$ -- (automata context free pushdown automata)
<p>$L=\{W_1W_2 \mid W_1 \ne W_2 \: \text{and} \: |W_1|=|W_2|\}$</p>

<p>Alphabet = { a , b }* </p>

<p>Considering L={WW} is not context free, shouldn't this be non... | habedi/stack-exchange-dataset |
81,720 | Computer Networks: Does integrity depend on confidentiality? | <p>I'm taking the course computer networks and we currently had our second lecture. We got the following question:</p>

<blockquote>
 <p>What are the differences between integrity and confidentiality of a message? Is confidentiality possible without integrity? What about integrity without confidentiality? ... | computer networks integrity | 1 | Computer Networks: Does integrity depend on confidentiality? -- (computer networks integrity)
<p>I'm taking the course computer networks and we currently had our second lecture. We got the following question:</p>

<blockquote>
 <p>What are the differences between integrity and confidentiality of a message?... | habedi/stack-exchange-dataset |
81,733 | VC Dimension of Origin-Centered Circle | <p>Is the VC dimension of an origin-centered circle 1 or 2?</p>

<p>It seems to me that the VC dimension of an origin centered circle should be 1, because for two points with distances from the origin r1 <= r2, r2 will never be able to be labeled 1 without r1 also being labeled 1, so the r1 = 0, r2 = 1 label... | machine learning vc dimension | 1 | VC Dimension of Origin-Centered Circle -- (machine learning vc dimension)
<p>Is the VC dimension of an origin-centered circle 1 or 2?</p>

<p>It seems to me that the VC dimension of an origin centered circle should be 1, because for two points with distances from the origin r1 <= r2, r2 will never be able to... | habedi/stack-exchange-dataset |
81,740 | Figuring out the language accepted by a DFA? | <p>I have been asked to give a formal description of a finite state machine. I have tried for over five hours to minimize it, to understand what gets accepted, and what gets refused, to no avail. I really am in need of help. If solving the problem does not seem reasonable, I would really appreciate any tips to attack t... | automata finite automata | 1 | Figuring out the language accepted by a DFA? -- (automata finite automata)
<p>I have been asked to give a formal description of a finite state machine. I have tried for over five hours to minimize it, to understand what gets accepted, and what gets refused, to no avail. I really am in need of help. If solving the probl... | habedi/stack-exchange-dataset |
81,743 | modular arithmetic in rolling hash algorithm | <p>My question was around the rolling hash function in <a href="https://www.youtube.com/watch?v=wsgUh0w49Nc" rel="nofollow noreferrer">RobinKarp algorithm</a>. It is intuitive for me to understand how to get from xi to xi+1 without the mod, however with the mod i am not sure how we still get the right answer. Is there ... | modular arithmetic rolling hash | 1 | modular arithmetic in rolling hash algorithm -- (modular arithmetic rolling hash)
<p>My question was around the rolling hash function in <a href="https://www.youtube.com/watch?v=wsgUh0w49Nc" rel="nofollow noreferrer">RobinKarp algorithm</a>. It is intuitive for me to understand how to get from xi to xi+1 without the mo... | habedi/stack-exchange-dataset |
81,758 | Polynomial by the size of the output and the input | <p>I wounder why the complexity of algorithms always depend on the size of the input, but not on the size of the output.</p>

<p>For example, in a problem that I have solve, the size of the input is exponentially smaller than the size of output. In addition, the complexity of the algorithm is polynomial by the ... | time complexity | 1 | Polynomial by the size of the output and the input -- (time complexity)
<p>I wounder why the complexity of algorithms always depend on the size of the input, but not on the size of the output.</p>

<p>For example, in a problem that I have solve, the size of the input is exponentially smaller than the size of ou... | habedi/stack-exchange-dataset |
81,760 | Example of decidable set whose preimage is not decidable | <p>I know that if a set is a decidable, there exists an algorithm that enumerates it and prints value 1 if a given element belongs to the set and 0 otherwise. Therefore, its image is decidable, too. I think, though, that this is not true for the preimage of of the set under a partially computable function. Can someone ... | computability | 1 | Example of decidable set whose preimage is not decidable -- (computability)
<p>I know that if a set is a decidable, there exists an algorithm that enumerates it and prints value 1 if a given element belongs to the set and 0 otherwise. Therefore, its image is decidable, too. I think, though, that this is not true for th... | habedi/stack-exchange-dataset |
81,764 | Enumerable disjoint subsets whose union is equal to the union of the sets | <p>I'm given that two sets, $A$ and $B$ are enumerable. I have to show that there exist subsets $A \supset C$ and $B \supset D$ ($C$ and $D$ also enumerable) such that $C$ and $D$ are disjoint and $A\cup B = C \cup D$. I was thinking to take $A=B=\{0,1\}$ and define $C=\{n : f(n)=1\}$, $D=\{n: f(n)=0\}$. 
Do you th... | computability semi decidability | 1 | Enumerable disjoint subsets whose union is equal to the union of the sets -- (computability semi decidability)
<p>I'm given that two sets, $A$ and $B$ are enumerable. I have to show that there exist subsets $A \supset C$ and $B \supset D$ ($C$ and $D$ also enumerable) such that $C$ and $D$ are disjoint and $A\cup B = C... | habedi/stack-exchange-dataset |
81,776 | Recursion Tree Analysis by Leaves | <h3>Assumptions</h3>
<p>Let's say we have any recurrence relation (however this is perhaps more applicable to "unpredictable" recurrence relations):</p>
<p><span class="math-container">$$T(n) = \;?$$</span></p>
<p>For example:
<span class="math-container">$$T(n) = aT\left(\frac{n}{b}\right) + ... | computability asymptotics recurrence relation | 1 | Recursion Tree Analysis by Leaves -- (computability asymptotics recurrence relation)
<h3>Assumptions</h3>
<p>Let's say we have any recurrence relation (however this is perhaps more applicable to "unpredictable" recurrence relations):</p>
<p><span class="math-container">$$T(n) = \;?$$</span></p>
<p... | habedi/stack-exchange-dataset |
81,784 | Variable size and CPU performance | <p>When you learn programming they tell you choose data types that suffice for the concepts you're expressing, i.e. not too small because then your data won't fit and not too big because you don't want nonsensical values stored.</p>

<p><strong>Table of unsigned integers</strong></p>

<ul>
<li>8-bit... | data structures memory hardware cpu performance | 1 | Variable size and CPU performance -- (data structures memory hardware cpu performance)
<p>When you learn programming they tell you choose data types that suffice for the concepts you're expressing, i.e. not too small because then your data won't fit and not too big because you don't want nonsensical values stored.</p>&... | habedi/stack-exchange-dataset |
81,787 | Inferring used fields in return type | <p>A common issue in app development is avoiding over-fetching of data, such as in this naive (pseudocode) example:</p>

<pre><code>get_user(id) {
 return sql_query("SELECT * FROM users WHERE id=$1", id);
}

render_some_webpage() {
 // ...
 print get_user(session.user_id).username;&#x... | compilers databases type inference data flow analysis | 1 | Inferring used fields in return type -- (compilers databases type inference data flow analysis)
<p>A common issue in app development is avoiding over-fetching of data, such as in this naive (pseudocode) example:</p>

<pre><code>get_user(id) {
 return sql_query("SELECT * FROM users WHERE id=$1", id);
}&... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.