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 |
|---|---|---|---|---|---|---|
69,208 | Regular expressions and 'capturing parentheses' with 'backreferences' | <p>We know that regular expressions (RE) are implemented with finite automata (FA). In some language (like JavaScript) in RE there are features like 'capturing parenthesis' with 'backreferences':</p>

<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#special-capturing... | finite automata regular expressions | 1 | Regular expressions and 'capturing parentheses' with 'backreferences' -- (finite automata regular expressions)
<p>We know that regular expressions (RE) are implemented with finite automata (FA). In some language (like JavaScript) in RE there are features like 'capturing parenthesis' with 'backreferences':</p>

... | habedi/stack-exchange-dataset |
69,215 | Can there be 'dead states' in a context-free grammar? | <p>Can a context-free grammar include "dead states" from an automaton, such as</p>

<p>$$G = \big(\{a, b, c\}, \{A, B, C\}, \{A\to aB, B\to b, B\to C, C\to cC\}, A\big)\,?$$</p>

<p>The production rules $B\to C$ and $C\to cC$ will loop forever and never generate a word. Is this allowed or MUST productio... | context free automata formal grammars | 1 | Can there be 'dead states' in a context-free grammar? -- (context free automata formal grammars)
<p>Can a context-free grammar include "dead states" from an automaton, such as</p>

<p>$$G = \big(\{a, b, c\}, \{A, B, C\}, \{A\to aB, B\to b, B\to C, C\to cC\}, A\big)\,?$$</p>

<p>The production rules $B\t... | habedi/stack-exchange-dataset |
69,216 | How to prove an polynomial run time is faster than exponential using definition of big O | <p>This is for homework so feel free to not give me an answer but steer me in the right direction. </p>

<p>The problem states:</p>

<blockquote>
 <p>Prove that $n^{1000000} = O(1.000001^n)$ using the formal definition of Big-O.</p>
</blockquote>

<p>The definition of Big-O is:</p>
... | asymptotics runtime analysis polynomial time | 1 | How to prove an polynomial run time is faster than exponential using definition of big O -- (asymptotics runtime analysis polynomial time)
<p>This is for homework so feel free to not give me an answer but steer me in the right direction. </p>

<p>The problem states:</p>

<blockquote>
 <p>Prove tha... | habedi/stack-exchange-dataset |
69,244 | Matrix chain multiplication and exponentiation | <p>If I have two matrices $A$ and $B$, of dimensions $1000\times2$ and $2\times1000$, respectively, and want to compute $(AB)^{5000}$, it's more efficient to first rewrite the expression as $A(BA)^{4999}B$ and only then evaluate numerically, because $AB$ is of dimension $1000\times1000$ but $BA$ is of dimension $2\time... | optimization dynamic programming linear algebra | 1 | Matrix chain multiplication and exponentiation -- (optimization dynamic programming linear algebra)
<p>If I have two matrices $A$ and $B$, of dimensions $1000\times2$ and $2\times1000$, respectively, and want to compute $(AB)^{5000}$, it's more efficient to first rewrite the expression as $A(BA)^{4999}B$ and only then ... | habedi/stack-exchange-dataset |
69,248 | Are Regular Languages (as we represent by Finite State Machines) Fields? | <p>I am aware that we can do set operations on them, and sets are fields. Are regular languages also mathematical fields?</p>
 | regular languages finite automata | 1 | Are Regular Languages (as we represent by Finite State Machines) Fields? -- (regular languages finite automata)
<p>I am aware that we can do set operations on them, and sets are fields. Are regular languages also mathematical fields?</p>
 | habedi/stack-exchange-dataset |
69,250 | How to evaluate relations in a DAG? | <p>To begin with: what I know of computer science is what friends have told me and what I've read on Wikipedia. Please correct me if I'm using some term wrongly, or if there is something I can clarify.</p>

<p>Let's say I have a directed graph. I want my computer to look at it, and see whether x > y, y > x, or ... | graphs data structures graph traversal database theory databases | 1 | How to evaluate relations in a DAG? -- (graphs data structures graph traversal database theory databases)
<p>To begin with: what I know of computer science is what friends have told me and what I've read on Wikipedia. Please correct me if I'm using some term wrongly, or if there is something I can clarify.</p>

... | habedi/stack-exchange-dataset |
69,255 | Approximation algorithm for the partition problem | <p>In the partition problem we want to partition a set $S$ of positive integers into two sets $S_{1}$ and $S_{2}$ such that the sum of the integers in the two sets is the same.</p>

<p>The optimization version of the problem is NP-Hard, <a href="https://en.wikipedia.org/wiki/Partition_problem#Approximation_algo... | approximation partitions | 1 | Approximation algorithm for the partition problem -- (approximation partitions)
<p>In the partition problem we want to partition a set $S$ of positive integers into two sets $S_{1}$ and $S_{2}$ such that the sum of the integers in the two sets is the same.</p>

<p>The optimization version of the problem is NP-H... | habedi/stack-exchange-dataset |
69,258 | Find K-subset that includes the most W-subsets | <p>I have a set $S$ of $N$ elements, and a set $\Sigma$ of $N$ subsets of $S$: $\sigma_0, \ldots, \sigma_{N - 1} \subset S$, each with $W \ll N$ elements. 
Subsets can overlap partially or totally.</p>

<p>For a given $K < N$ (but $K \gg W$), I want to determine the subset $X_K \subset N$ so that:</p>&#x... | algorithms optimization sets | 1 | Find K-subset that includes the most W-subsets -- (algorithms optimization sets)
<p>I have a set $S$ of $N$ elements, and a set $\Sigma$ of $N$ subsets of $S$: $\sigma_0, \ldots, \sigma_{N - 1} \subset S$, each with $W \ll N$ elements. 
Subsets can overlap partially or totally.</p>

<p>For a given $K < N... | habedi/stack-exchange-dataset |
69,262 | Numerically validate CRC performance | <p><a href="https://users.ece.cmu.edu/~koopman/roses/dsn04/koopman04_crc_poly_embedded.pdf" rel="nofollow noreferrer">Koopman, P., & Chakravarty, T. (2004, June). Cyclic redundancy code (CRC) polynomial selection for embedded networks. In Dependable Systems and Networks, 2004 International Conference on (pp. 145-15... | crc | 1 | Numerically validate CRC performance -- (crc)
<p><a href="https://users.ece.cmu.edu/~koopman/roses/dsn04/koopman04_crc_poly_embedded.pdf" rel="nofollow noreferrer">Koopman, P., & Chakravarty, T. (2004, June). Cyclic redundancy code (CRC) polynomial selection for embedded networks. In Dependable Systems and Networks... | habedi/stack-exchange-dataset |
69,273 | How to write a grammar for this language? | <p>Given the alphabet $Λ = \{a, b, c\}$, i need to write a grammar for this language: </p>

<p>$$L=\{α \mid α∈Λ^+ ∧ aaa \notin α\}$$</p>

<p>I know that in my language the sequence of three consecutive $a$ cannot occur in any string, but how do I make a grammar of it? I'd need the thinking behind the co... | formal languages formal grammars | 1 | How to write a grammar for this language? -- (formal languages formal grammars)
<p>Given the alphabet $Λ = \{a, b, c\}$, i need to write a grammar for this language: </p>

<p>$$L=\{α \mid α∈Λ^+ ∧ aaa \notin α\}$$</p>

<p>I know that in my language the sequence of three consecutive $a$ cannot occur in an... | habedi/stack-exchange-dataset |
69,274 | Data structure for adjacent rectangles | <p>I have a file with a list of non-overlapping rectangles covering the entire space (they are adjacent). I would like to plot efficiently the graph edges that connect each rectangle center point with the adjacents rectangle center points. Which is the best data structure to use to load the rectangle list? Which is the... | data structures computational geometry | 1 | Data structure for adjacent rectangles -- (data structures computational geometry)
<p>I have a file with a list of non-overlapping rectangles covering the entire space (they are adjacent). I would like to plot efficiently the graph edges that connect each rectangle center point with the adjacents rectangle center point... | habedi/stack-exchange-dataset |
69,275 | Is there any problem that is hard to solve, can produce N equiprobable outputs and is easy to verify? | <p>I'm looking for a problem that allows me to generate random instances which:</p>

<ol>
<li><p>Take arbitrary time to compute (i.e., I can generate an instance that I know would take at least 10 days to solve in an Intel I7);</p></li>
<li><p>Is inherently sequential (no matter how many processors you ... | algorithms complexity theory algorithm analysis | 1 | Is there any problem that is hard to solve, can produce N equiprobable outputs and is easy to verify? -- (algorithms complexity theory algorithm analysis)
<p>I'm looking for a problem that allows me to generate random instances which:</p>

<ol>
<li><p>Take arbitrary time to compute (i.e., I can generate an ... | habedi/stack-exchange-dataset |
69,283 | Formulating a recursion using mathematical notation | <p>So I'm assigned a task that involves formulating a quite complex recursion of several variables using 'mathematical notation'. The assignment is quite sparse when it comes to additional information, but below is the code anyway;</p>

<pre><code>int partDist(String w1, String w2, int w1len, int w2len) {
i... | computability recursion mathematical programming | 1 | Formulating a recursion using mathematical notation -- (computability recursion mathematical programming)
<p>So I'm assigned a task that involves formulating a quite complex recursion of several variables using 'mathematical notation'. The assignment is quite sparse when it comes to additional information, but below is... | habedi/stack-exchange-dataset |
69,287 | Size of intersection of two acyclic DFAs A and B is O(|A|+|B|)? | <p>Acyclic DFAs recognize finite languages. For more info, see this Wikipedia page : <a href="https://en.wikipedia.org/wiki/Deterministic_acyclic_finite_state_automaton" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Deterministic_acyclic_finite_state_automaton</a></p>

<p>To explain that the product o... | regular languages automata finite automata | 1 | Size of intersection of two acyclic DFAs A and B is O(|A|+|B|)? -- (regular languages automata finite automata)
<p>Acyclic DFAs recognize finite languages. For more info, see this Wikipedia page : <a href="https://en.wikipedia.org/wiki/Deterministic_acyclic_finite_state_automaton" rel="nofollow noreferrer">https://en.w... | habedi/stack-exchange-dataset |
69,291 | Representation of 8-Puzzle for (A*) Search Algorithm in C | <p>I am trying to complete CS50's hacker edition pset3, where you have to make a program that will solve the game of eight or fifteen from its current state, this must be written in C.
<a href="https://en.wikipedia.org/wiki/15_puzzle" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/15_puzzle</a></p>
&#x... | artificial intelligence game theory board games | 1 | Representation of 8-Puzzle for (A*) Search Algorithm in C -- (artificial intelligence game theory board games)
<p>I am trying to complete CS50's hacker edition pset3, where you have to make a program that will solve the game of eight or fifteen from its current state, this must be written in C.
<a href="https://en.... | habedi/stack-exchange-dataset |
69,295 | Set of all rational numbers less than given computable real number is decidable | <blockquote>
 <p>Prove that set of rational numbers less than given computable real
 number is decidable</p>
</blockquote>

<p>This problem was in my exam yesterday, but I was not able to solve it. However I still want to give it another try.
<br><br>
Same problem can be stated in this way... | computability mathematical analysis | 1 | Set of all rational numbers less than given computable real number is decidable -- (computability mathematical analysis)
<blockquote>
 <p>Prove that set of rational numbers less than given computable real
 number is decidable</p>
</blockquote>

<p>This problem was in my exam yesterday, but I was n... | habedi/stack-exchange-dataset |
69,297 | Is a String with no parantheses considered having balanced parantheses? | <p>Say I have a language over the alphabet {x,y,(,)} . The language's rules are: any string over that alphabet with balanced parentheses.</p>

<p>Clearly x(), (xy) , ()()xxx, ((xx)) are accepted. BUT</p>

<p>My question is, is a string with <strong>no</strong> parentheses considered as having balan... | context free pushdown automata | 1 | Is a String with no parantheses considered having balanced parantheses? -- (context free pushdown automata)
<p>Say I have a language over the alphabet {x,y,(,)} . The language's rules are: any string over that alphabet with balanced parentheses.</p>

<p>Clearly x(), (xy) , ()()xxx, ((xx)) are accepted. BUT... | habedi/stack-exchange-dataset |
69,300 | An infinite subsequence of random numbers in Kolmogorov sense | <p>Is it possible to construct an infinite increasing sequence of random naturals (in Kolmogorov sense) that is a subsequence of another sequence? Ok, in general I suppose not, e.g. for prime numbers. But:</p>

<p>I want to prove that sequence $\{ax+b\}_{x\in\mathbb{N}}$ contains an infinite subsequence of rand... | kolmogorov complexity | 1 | An infinite subsequence of random numbers in Kolmogorov sense -- (kolmogorov complexity)
<p>Is it possible to construct an infinite increasing sequence of random naturals (in Kolmogorov sense) that is a subsequence of another sequence? Ok, in general I suppose not, e.g. for prime numbers. But:</p>

<p>I want to... | habedi/stack-exchange-dataset |
69,301 | Pumping Lemma for irregular language, how to choose and divide the string | <p>The language on the alphabet $\{a,b\}$ is $$L=\{ab^nab^{n+1} |n>0\}$$</p>

<p>so i have to take a string w = xyz:</p>

<p>what's the best string to choose such that $|w| > n$? and then what about the division?</p>

<p>like $ w=ab^nab^{n+1}$ is a correct option? Then how can I divide thi... | formal languages pumping lemma | 1 | Pumping Lemma for irregular language, how to choose and divide the string -- (formal languages pumping lemma)
<p>The language on the alphabet $\{a,b\}$ is $$L=\{ab^nab^{n+1} |n>0\}$$</p>

<p>so i have to take a string w = xyz:</p>

<p>what's the best string to choose such that $|w| > n$? and then ... | habedi/stack-exchange-dataset |
69,305 | Order of argument application in lambda calculus | <p>I encountered the following exercise in a textbook about logic:</p>

<p>$\lambda x \lambda Y(Y(x))(j)(M)$</p>

<p>It seems that the expected result from the textbook should be $M(j)$, since there were some type specifications on the variables. However, if I substitute $M$ for $x$, and $j$ for $Y$, th... | lambda calculus | 1 | Order of argument application in lambda calculus -- (lambda calculus)
<p>I encountered the following exercise in a textbook about logic:</p>

<p>$\lambda x \lambda Y(Y(x))(j)(M)$</p>

<p>It seems that the expected result from the textbook should be $M(j)$, since there were some type specifications on th... | habedi/stack-exchange-dataset |
69,321 | Better word to describe JavaScript "algorithm"? | <p>For my undergraduate senior project, a professor asked me and my partner to design an algorithm to determine true resolution in the browser, unaffected by zooming, multiple screens, viewport size, etc. (tl;dr our implementation was okay, it usually did the job correctly.)</p>

<p>It's super pedantic, but I'v... | algorithms terminology | 1 | Better word to describe JavaScript "algorithm"? -- (algorithms terminology)
<p>For my undergraduate senior project, a professor asked me and my partner to design an algorithm to determine true resolution in the browser, unaffected by zooming, multiple screens, viewport size, etc. (tl;dr our implementation was okay, it ... | habedi/stack-exchange-dataset |
69,324 | Dancing links algorithm solutions | <p>Right now I am working on my implementation of Knuth's DLX algorithm.</p>

<p>I did understand the exact cover problem. But I didn't fully understand how Dancing links works. Here is <a href="https://www.ocf.berkeley.edu/~jchu/publicportal/sudoku/0011047.pdf" rel="nofollow noreferrer">Knuth's paper</a>.
... | algorithms | 1 | Dancing links algorithm solutions -- (algorithms)
<p>Right now I am working on my implementation of Knuth's DLX algorithm.</p>

<p>I did understand the exact cover problem. But I didn't fully understand how Dancing links works. Here is <a href="https://www.ocf.berkeley.edu/~jchu/publicportal/sudoku/0011047.pdf"... | habedi/stack-exchange-dataset |
69,333 | What are advantages / disadvantages of horizontal and vertical microprograms? | <p>Currently I know: </p>

<p>About vertical micro programming: The control signals are not immediately passed to the ALU components, but are rather processed first and passed as an compressed function code. </p>

<p>About horizontal micro programming: There is just one wire connecting all ALU component... | computer architecture cpu | 1 | What are advantages / disadvantages of horizontal and vertical microprograms? -- (computer architecture cpu)
<p>Currently I know: </p>

<p>About vertical micro programming: The control signals are not immediately passed to the ALU components, but are rather processed first and passed as an compressed function c... | habedi/stack-exchange-dataset |
69,336 | how to understand the occurrences of free variables? | <p>I am thinking that many example only takes free variable with one occurrence, such as $(\lambda x.x )y$ where $y$ is free.</p>

<p>can we say $y y $ is a $\lambda$-term and two $y$ are same free variable?
I did not see such examples so far, just wondering. </p>
 | lambda calculus | 1 | how to understand the occurrences of free variables? -- (lambda calculus)
<p>I am thinking that many example only takes free variable with one occurrence, such as $(\lambda x.x )y$ where $y$ is free.</p>

<p>can we say $y y $ is a $\lambda$-term and two $y$ are same free variable?
I did not see such exampl... | habedi/stack-exchange-dataset |
69,342 | What would be acceptable size of list for O(n!) algorithm | <p>I was wondering what the limitations to an algorithm that runs in O(n!). For example lets take an algorithm that generates all permutations of a list. Now what i am wondering is what the upper bound would roughly be for size of list. I understand that this can vary based on ram/memory. Let's say that this would be r... | time complexity | 1 | What would be acceptable size of list for O(n!) algorithm -- (time complexity)
<p>I was wondering what the limitations to an algorithm that runs in O(n!). For example lets take an algorithm that generates all permutations of a list. Now what i am wondering is what the upper bound would roughly be for size of list. I un... | habedi/stack-exchange-dataset |
69,347 | Trying to understand simple bit states | <p>I am trying to understand bits, operations and masking. I have a hard time to get this thing into my head. I have tried to read at many different websites without luck.</p>

<p>I have 8 states, going from 1 to 8:</p>

<pre><code>state 1 = 0001
state 2 = 0010
state 3 = 0011
state 4 = 0100&... | computer architecture | 1 | Trying to understand simple bit states -- (computer architecture)
<p>I am trying to understand bits, operations and masking. I have a hard time to get this thing into my head. I have tried to read at many different websites without luck.</p>

<p>I have 8 states, going from 1 to 8:</p>

<pre><code>state ... | habedi/stack-exchange-dataset |
69,348 | Can we multiply approximation hardness? | <p>Say we have two (NP-)optimization problems $A$, resp. $B$, such that it is NP-hard to approximate within a factor $\alpha$ resp. $\beta$. </p>

<p>Now define problem $C$ whose input consists of pair inputs from $A$ and $B$, and a solution as pair of solutions of $A$ and $B$, but the objective function as the... | complexity theory approximation complexity classes | 1 | Can we multiply approximation hardness? -- (complexity theory approximation complexity classes)
<p>Say we have two (NP-)optimization problems $A$, resp. $B$, such that it is NP-hard to approximate within a factor $\alpha$ resp. $\beta$. </p>

<p>Now define problem $C$ whose input consists of pair inputs from $A... | habedi/stack-exchange-dataset |
69,354 | Can the output value be solved and/or written as Taylor expansion? | <blockquote>
 <p>imho this is not at all a duplicate, because the other question does
 not address the "recursive" case $T(d,n) = ....T(d-1,T(d-1,n))....$,
 which appears to be part of the Taylor expansion of this function.
 Also I don't know how to write this as a Taylor expansion. If I would,
... | time complexity recurrence relation | 1 | Can the output value be solved and/or written as Taylor expansion? -- (time complexity recurrence relation)
<blockquote>
 <p>imho this is not at all a duplicate, because the other question does
 not address the "recursive" case $T(d,n) = ....T(d-1,T(d-1,n))....$,
 which appears to be part of the Taylor e... | habedi/stack-exchange-dataset |
69,360 | Let $ L = \{ \langle M \rangle : L(M) = \Sigma^* -\{\epsilon\} \}$, Show that $L\notin RE$ | <p>Let $ L = \{ \langle M \rangle : L(M) = \Sigma^* -\{\epsilon\} \}$</p>

<p>Determine whether $ L\in RE, \space L\in R, \space L\in co-RE$, or none of the above.</p>

<p>I tried to show a reduction function from $L_{\Sigma^*}$ to $L$ to prove that $L\notin RE$ , here is my attempt:</p>

<p>$\... | turing machines reductions | 1 | Let $ L = \{ \langle M \rangle : L(M) = \Sigma^* -\{\epsilon\} \}$, Show that $L\notin RE$ -- (turing machines reductions)
<p>Let $ L = \{ \langle M \rangle : L(M) = \Sigma^* -\{\epsilon\} \}$</p>

<p>Determine whether $ L\in RE, \space L\in R, \space L\in co-RE$, or none of the above.</p>

<p>I tried ... | habedi/stack-exchange-dataset |
69,372 | Treating undirected graphs as a subcategory of directed graphs | <p>Roughly, an undirected graph is very similar to a directed graph where for each edge (v, w), there is always an edge (w, v). That suggests that it might be acceptable to view undirected graphs as a subset of directed graphs (perhaps with an additional restriction that adding/deleting edges can only be done in matchi... | graphs terminology | 1 | Treating undirected graphs as a subcategory of directed graphs -- (graphs terminology)
<p>Roughly, an undirected graph is very similar to a directed graph where for each edge (v, w), there is always an edge (w, v). That suggests that it might be acceptable to view undirected graphs as a subset of directed graphs (perha... | habedi/stack-exchange-dataset |
69,374 | Smallest number with in a larger number with a certain length | <p>I have a number with $n$ digits. I want to keep only $m$ digits out of it. What is the smallest possible $m$ digit number which can be generated from the larger number so that order of digits is retained. </p>

<p>Ex: 3422509739</p>

<p>I need the smallest 3 digit number by removing 7 digits with ord... | algorithms enumeration number formats | 1 | Smallest number with in a larger number with a certain length -- (algorithms enumeration number formats)
<p>I have a number with $n$ digits. I want to keep only $m$ digits out of it. What is the smallest possible $m$ digit number which can be generated from the larger number so that order of digits is retained. </p>&#x... | habedi/stack-exchange-dataset |
69,381 | Can software itself be encrypted? | <p>Imagine that I need to install my server in a remote location, so my algorithm can do something fancy (collocation of server at a financial exchange is how I thought of this question, but it applies more generally). </p>

<p>Imagine also I don't trust the people I am working with. They will have access to my... | algorithms security encryption | 1 | Can software itself be encrypted? -- (algorithms security encryption)
<p>Imagine that I need to install my server in a remote location, so my algorithm can do something fancy (collocation of server at a financial exchange is how I thought of this question, but it applies more generally). </p>

<p>Imagine also I... | habedi/stack-exchange-dataset |
69,393 | $ADD = {x=y+z}$ with $x, y, z$ binary integers, and $x$ is the sum of $y$ and $z$. Pumping lemma to show that $ADD$ is not regular | <p>Consider the alphabet $\Sigma = \{0, 1, +, =\}$ and the language $ADD = \{x=y+z|x,y$ are binary integers $x$ is the sum of $y$ and $z$ $\}$.</p>

<p>This is the (informal) solution I came up with (not sure about its correctness).
Using the pumping lemma:</p>

<p>Take $s= 1^p=0+1^p$, $s \in ADD$. ... | finite automata pumping lemma check my answer | 1 | $ADD = {x=y+z}$ with $x, y, z$ binary integers, and $x$ is the sum of $y$ and $z$. Pumping lemma to show that $ADD$ is not regular -- (finite automata pumping lemma check my answer)
<p>Consider the alphabet $\Sigma = \{0, 1, +, =\}$ and the language $ADD = \{x=y+z|x,y$ are binary integers $x$ is the sum of $y$ and $z$ ... | habedi/stack-exchange-dataset |
69,396 | Is there any way to get "around" the halting problem? | <p>As I understand it, one proof of the Halting Theorem is done by contradiction; we assume we have program X which can determine if any program terminates. We input program X into program X (with some modifications at the output), and we arrive at a contradiction. However, is it possible for a program Y to exist, wher... | turing machines undecidability halting problem | 1 | Is there any way to get "around" the halting problem? -- (turing machines undecidability halting problem)
<p>As I understand it, one proof of the Halting Theorem is done by contradiction; we assume we have program X which can determine if any program terminates. We input program X into program X (with some modification... | habedi/stack-exchange-dataset |
69,398 | Does integer programming $\in$ NP imply $NP=CoNP$? | <p>Although it is relatively simple to see that integer linear programming is NP-hard, whether it lies in NP is a bit harder. Therefore, I'm wondering whether the following reasoning shows that $ILP\in NP$ implies $NP=CoNP$.</p>

<p>To be precise, I am considering the decision variant of ILP over a non-unary in... | complexity theory np complete np integer programming co np | 1 | Does integer programming $\in$ NP imply $NP=CoNP$? -- (complexity theory np complete np integer programming co np)
<p>Although it is relatively simple to see that integer linear programming is NP-hard, whether it lies in NP is a bit harder. Therefore, I'm wondering whether the following reasoning shows that $ILP\in NP$... | habedi/stack-exchange-dataset |
69,401 | Question on the definition of computable function and non-terminating behaviour | <p>For example on <a href="https://en.wikipedia.org/wiki/Computable_function" rel="nofollow noreferrer">wikipedia</a> a function $f : \mathbb N^k \to \mathbb N$ is defined to be computable, if there exists an algorithm (in form of a Turing machine, as an $\mu$-recursive function or maybe a C++ programm) such that the f... | computability turing machines | 1 | Question on the definition of computable function and non-terminating behaviour -- (computability turing machines)
<p>For example on <a href="https://en.wikipedia.org/wiki/Computable_function" rel="nofollow noreferrer">wikipedia</a> a function $f : \mathbb N^k \to \mathbb N$ is defined to be computable, if there exists... | habedi/stack-exchange-dataset |
69,422 | Two-way Hash Functions | <p>While I'm aware most (good) hash functions are one-way (or at least mostly so), I'm wondering if there's any construct (not necessarily called a hash function) which behaves in many ways like a hash function, but can be easily reversed.</p>

<p>For example, a function $f$ takes an arbitrary string $x$ and ma... | algorithms complexity theory hashing | 1 | Two-way Hash Functions -- (algorithms complexity theory hashing)
<p>While I'm aware most (good) hash functions are one-way (or at least mostly so), I'm wondering if there's any construct (not necessarily called a hash function) which behaves in many ways like a hash function, but can be easily reversed.</p>

<p... | habedi/stack-exchange-dataset |
69,434 | Intuitive explanation of neutral / normal form in lambda calculus | <p>It is possible to distinguish Normal terms which don't contain beta redex as a sub-expression, from others like so </p>

<pre><code>data WithBound a = Var | Other a

data Normal a
 = Neutral (Neutral a)
 | Abstract (Normal (WithBound a))

data Neutral a
 = Variable a
 | Ap... | lambda calculus term rewriting | 1 | Intuitive explanation of neutral / normal form in lambda calculus -- (lambda calculus term rewriting)
<p>It is possible to distinguish Normal terms which don't contain beta redex as a sub-expression, from others like so </p>

<pre><code>data WithBound a = Var | Other a

data Normal a
 = Neutral (Ne... | habedi/stack-exchange-dataset |
69,442 | Algorithm: How to find the number of independent sets in a tree? | <p>I'm thinking that there are two cases for each sub-tree: the root is in the independent set and the root is not in the set. How to write a recursive algorithm for finding the number of independent sets in a tree? The tree is n-ary.</p>
 | algorithms graphs trees | 1 | Algorithm: How to find the number of independent sets in a tree? -- (algorithms graphs trees)
<p>I'm thinking that there are two cases for each sub-tree: the root is in the independent set and the root is not in the set. How to write a recursive algorithm for finding the number of independent sets in a tree? The tree i... | habedi/stack-exchange-dataset |
69,445 | How generate n equidistant points in a n-1 dimensional space | <p>As said, i want to build a program to generate n equidistant points in an euclidian space.
From what i know</p>

<ul>
<li>1d : all couple of points</li>
<li>2d : all equilateral triangles</li>
<li>3d : all equilateral tetrahedra</li>
<li>up to 3d : i suppose it's called an equilateral hyp... | computational geometry | 1 | How generate n equidistant points in a n-1 dimensional space -- (computational geometry)
<p>As said, i want to build a program to generate n equidistant points in an euclidian space.
From what i know</p>

<ul>
<li>1d : all couple of points</li>
<li>2d : all equilateral triangles</li>
<li>3d : al... | habedi/stack-exchange-dataset |
69,446 | If $L\in\mathrm{NP}$ is $\mathrm{coNP}$-complete, then $\mathrm{coNP}=\mathrm{NP}$ | <p>The problem in the title is to be proven, and while proving $\mathrm{coNP}\subset\mathrm{NP}$ is rather clear given the assumptions (see below), I fail to see a way to prove $\mathrm{NP}\subset\mathrm{coNP}$.</p>

<p>My main idea is to prove that $L$ is also $\mathrm{NP}$-complete (or rather $\mathrm{NP}$-ha... | time complexity proof techniques np | 1 | If $L\in\mathrm{NP}$ is $\mathrm{coNP}$-complete, then $\mathrm{coNP}=\mathrm{NP}$ -- (time complexity proof techniques np)
<p>The problem in the title is to be proven, and while proving $\mathrm{coNP}\subset\mathrm{NP}$ is rather clear given the assumptions (see below), I fail to see a way to prove $\mathrm{NP}\subset... | habedi/stack-exchange-dataset |
69,448 | Show that Halting problem $(\mathsf{HP\text{}})$ is $\mathsf{NP\text{-}Hard}$ | <p>Let me define first Halting problem <span class="math-container">$(\mathsf{HP\text{}})$</span>.</p>
<p><strong>Given</strong> : <span class="math-container">$(M , x)$</span>, <span class="math-container">$M$</span> is a turing machine and <span class="math-container">$x$</span> is a input binary string to turi... | complexity theory computability turing machines reductions np hard | 1 | Show that Halting problem $(\mathsf{HP\text{}})$ is $\mathsf{NP\text{-}Hard}$ -- (complexity theory computability turing machines reductions np hard)
<p>Let me define first Halting problem <span class="math-container">$(\mathsf{HP\text{}})$</span>.</p>
<p><strong>Given</strong> : <span class="math-container">$(M ,... | habedi/stack-exchange-dataset |
69,463 | Is the complement of a Max Prefix Sum a Min Suffix Sum? | <p>Given an array <code>A</code> of <code>n</code> real numbers, are the maximum prefix sum and minimum suffix sum (and vice-versa) of A complements?</p>

<p>I.e. Given <code>A[1..n]</code> and its maximum prefix subarray <code>P[1..i]</code>, is its minimum suffix subarray <code>S[j..n]</code> where <code>i+1 ... | arrays maximum subarray | 1 | Is the complement of a Max Prefix Sum a Min Suffix Sum? -- (arrays maximum subarray)
<p>Given an array <code>A</code> of <code>n</code> real numbers, are the maximum prefix sum and minimum suffix sum (and vice-versa) of A complements?</p>

<p>I.e. Given <code>A[1..n]</code> and its maximum prefix subarray <code... | habedi/stack-exchange-dataset |
69,469 | What is the smallest $n$ such that $BB(n) > $Graham's number? | <p>BB represents the busy beaver function here. Do we even have any idea of what order of magnitude $n$ would have? Is it possibly around 10, or more like 1000?</p>
 | turing machines busy beaver | 1 | What is the smallest $n$ such that $BB(n) > $Graham's number? -- (turing machines busy beaver)
<p>BB represents the busy beaver function here. Do we even have any idea of what order of magnitude $n$ would have? Is it possibly around 10, or more like 1000?</p>
 | habedi/stack-exchange-dataset |
69,471 | Is this variant of set cover NP-complete? | <p>Let's say we have a universe $U$ of $n$ elements and a collection $S$ of $m$ subsets of $U$, i.e., $S=\{S_1,\ldots,S_m\}$, and a positive integer $k$. If I ask "is there a set cover of $U$ of size $k$ or less", then this is NP-complete. </p>

<p>Now suppose that I add the following: </p>

<ol>
<l... | np complete set cover | 1 | Is this variant of set cover NP-complete? -- (np complete set cover)
<p>Let's say we have a universe $U$ of $n$ elements and a collection $S$ of $m$ subsets of $U$, i.e., $S=\{S_1,\ldots,S_m\}$, and a positive integer $k$. If I ask "is there a set cover of $U$ of size $k$ or less", then this is NP-complete. </p>
&#... | habedi/stack-exchange-dataset |
69,472 | Why is randomness a problem? (i.e. why do we care about derandomization?) | <p>I'm reading Aaronson's <a href="http://www.scottaaronson.com/papers/pnp.pdf">survey</a> on P vs. NP, and I've come to understand that in CS theory, people <em>really</em> care about derandomization results like P vs. BPP etc. My question is, what's the problem with randomness? If your algorithm is known to only requ... | complexity theory randomized algorithms randomness | 1 | Why is randomness a problem? (i.e. why do we care about derandomization?) -- (complexity theory randomized algorithms randomness)
<p>I'm reading Aaronson's <a href="http://www.scottaaronson.com/papers/pnp.pdf">survey</a> on P vs. NP, and I've come to understand that in CS theory, people <em>really</em> care about deran... | habedi/stack-exchange-dataset |
69,480 | Partial recursive function with no total recursive extension | <p>We define a partial recursive function $f:\{0,1\}^* \longrightarrow \{0,1\}^*$ to be <em>semi-good</em> if we can define a total recursive function $g:\{0,1\}^* \longrightarrow \{0,1\}^*$ from $f$, such for all $x \in \{0,1\}^*$ either $f(x) = g(x)$ or $f(x)\uparrow$.</p>

<p>Now I want to prove that there e... | computability semi decidability | 1 | Partial recursive function with no total recursive extension -- (computability semi decidability)
<p>We define a partial recursive function $f:\{0,1\}^* \longrightarrow \{0,1\}^*$ to be <em>semi-good</em> if we can define a total recursive function $g:\{0,1\}^* \longrightarrow \{0,1\}^*$ from $f$, such for all $x \in \... | habedi/stack-exchange-dataset |
69,488 | Can every r.e. set be obtained by repeated function application? | <p>Is below statement true?</p>

<p>$\forall L \in r.e. \,\, \, \exists f:\{0,1\}^* \longrightarrow \{0,1\}^* \, , \exists x\in \{0,1\}^* \; s.t \, \, L = \{x,f(x),f(f(x)),..\} $ .</p>

<p>My guess is no and I tried to prove this with cantor diagonalization.If we suppose that $L_i$ has this property so... | computability | 1 | Can every r.e. set be obtained by repeated function application? -- (computability)
<p>Is below statement true?</p>

<p>$\forall L \in r.e. \,\, \, \exists f:\{0,1\}^* \longrightarrow \{0,1\}^* \, , \exists x\in \{0,1\}^* \; s.t \, \, L = \{x,f(x),f(f(x)),..\} $ .</p>

<p>My guess is no and I tried to ... | habedi/stack-exchange-dataset |
69,491 | Do we include Transmission delay in Round trip time? | <p>Is RTT = $2*T_{Propagation delay}$ only. Or we include Transmission delay to send packets as well. Some examples include Transmission delay some not. I'm confused. Can anyone help. </p>
 | computer networks | 1 | Do we include Transmission delay in Round trip time? -- (computer networks)
<p>Is RTT = $2*T_{Propagation delay}$ only. Or we include Transmission delay to send packets as well. Some examples include Transmission delay some not. I'm confused. Can anyone help. </p>
 | habedi/stack-exchange-dataset |
69,502 | Is this language recursively enumerable? | <p>Let $P=\{L \mid \exists w\in \Sigma^* s.t. w\in L \wedge \forall z>w\colon z\in L\}$ . </p>

<p>Now denote $L=\{\langle M \rangle \mid L(M) \in P \}$.</p>

<p>That is, $L$ is the set of all TMs $M$ s.t. there exists a $w\in \Sigma^*$ s.t. $w$ is accepted by $M$ and for each $z>w$, $z$ is acc... | computability turing machines reductions undecidability | 1 | Is this language recursively enumerable? -- (computability turing machines reductions undecidability)
<p>Let $P=\{L \mid \exists w\in \Sigma^* s.t. w\in L \wedge \forall z>w\colon z\in L\}$ . </p>

<p>Now denote $L=\{\langle M \rangle \mid L(M) \in P \}$.</p>

<p>That is, $L$ is the set of all TMs... | habedi/stack-exchange-dataset |
69,503 | What is the literature on a sparse matrix encoding of rose trees? | <p>I have 'discovered' a way to encode rose trees (see e.g. <a href="https://cs.stackexchange.com/questions/56081/what-are-the-applications-of-rose-trees">What are the applications of Rose trees?</a> ) as a sparse matrix: if you have a node <em>n</em> with ID <em>i</em> and parent ID <em>p,</em> then you place <em>n</e... | data structures trees sparse matrices | 1 | What is the literature on a sparse matrix encoding of rose trees? -- (data structures trees sparse matrices)
<p>I have 'discovered' a way to encode rose trees (see e.g. <a href="https://cs.stackexchange.com/questions/56081/what-are-the-applications-of-rose-trees">What are the applications of Rose trees?</a> ) as a spar... | habedi/stack-exchange-dataset |
69,507 | How do I define a language from a grammar? | <p>Given an alphabet $ Λ = \{a, b, c\}$, I have the following grammar:</p>

<p>$$ S -> aSb | aAb $$
$$ A -> aaA | aBb $$
$$ B -> Bbb | c $$</p>

<p>Which method should I use to write the definition of the language?</p>
 | formal languages formal grammars | 1 | How do I define a language from a grammar? -- (formal languages formal grammars)
<p>Given an alphabet $ Λ = \{a, b, c\}$, I have the following grammar:</p>

<p>$$ S -> aSb | aAb $$
$$ A -> aaA | aBb $$
$$ B -> Bbb | c $$</p>

<p>Which method should I use to write the definition of the l... | habedi/stack-exchange-dataset |
69,511 | What does "fast-forwarding" mean in the context of CPU simulation? | <p>I'm using a simulator for my thesis and I've come across the term "Fast-forwarding" but I have found no definition anywhere in the documentation or online. From a pdf I've been reading about the simulator I am using (gem5), I've come across this section:</p>

<blockquote>
 <p>The gem5 simulator supports... | terminology computer architecture simulation | 1 | What does "fast-forwarding" mean in the context of CPU simulation? -- (terminology computer architecture simulation)
<p>I'm using a simulator for my thesis and I've come across the term "Fast-forwarding" but I have found no definition anywhere in the documentation or online. From a pdf I've been reading about the simul... | habedi/stack-exchange-dataset |
69,516 | Does "not regular" imply "acceptor needs memory"? | <p>Regular Languages, by definition, can be accepted by finite automata, which do not have memory. But if I know that a language is not regular, does that imply that any mechanism that recognizes the language must have memory?</p>
 | formal languages automata computation models | 1 | Does "not regular" imply "acceptor needs memory"? -- (formal languages automata computation models)
<p>Regular Languages, by definition, can be accepted by finite automata, which do not have memory. But if I know that a language is not regular, does that imply that any mechanism that recognizes the language must have m... | habedi/stack-exchange-dataset |
69,519 | Finding Permutations with Exclusions | <p>Recently, I was given a puzzle by a friend of mine, which has 6 pieces. Giddy to try it out, I took it apart without batting an eye to follow what I was removing or moving or sliding. </p>

<p>I've been struggling with this puzzle for over a year and a half now, and so thought I would write an algorithm that... | algorithms recursion permutations | 1 | Finding Permutations with Exclusions -- (algorithms recursion permutations)
<p>Recently, I was given a puzzle by a friend of mine, which has 6 pieces. Giddy to try it out, I took it apart without batting an eye to follow what I was removing or moving or sliding. </p>

<p>I've been struggling with this puzzle fo... | habedi/stack-exchange-dataset |
69,528 | What is the point of this lambda expression? | <p>Let's take this lambda expression : $\lambda\:x \:\ast\:x\:2$ that "computes" <code>x * 2</code>. </p>

<p>From what I understand, $\ast$ is a constant operator, but since its nothing else than a symbol, how does that let us compute the multiplication <code>x * 2</code>? </p>

<p>I would have thoug... | lambda calculus | 1 | What is the point of this lambda expression? -- (lambda calculus)
<p>Let's take this lambda expression : $\lambda\:x \:\ast\:x\:2$ that "computes" <code>x * 2</code>. </p>

<p>From what I understand, $\ast$ is a constant operator, but since its nothing else than a symbol, how does that let us compute the multi... | habedi/stack-exchange-dataset |
69,541 | Can the following conditions hold all together? | <p>Let $L_1, L_2$ be languages.</p>

<p>Can the following conditions hold:</p>

<ol>
<li><p>$L_1,L_2\notin RE$.</p></li>
<li><p>$L_1\cap L_2\in R$</p></li>
<li><p>$L_1\cup L_2\in R$</p></li>
<li><p>$\overline{L}_1, \overline{L}_2 \in RE / R$</p></li>
</ol>

<p>I believe the a... | formal languages turing machines undecidability | 1 | Can the following conditions hold all together? -- (formal languages turing machines undecidability)
<p>Let $L_1, L_2$ be languages.</p>

<p>Can the following conditions hold:</p>

<ol>
<li><p>$L_1,L_2\notin RE$.</p></li>
<li><p>$L_1\cap L_2\in R$</p></li>
<li><p>$L_1\cup L_2\in R$</p></li>&... | habedi/stack-exchange-dataset |
69,546 | In cycle stealing mode, Does CPU gets blocked for 1 cycle or blocked till DMA transfer completion? | <p>In cycle stealing mode, is CPU idle during data transfer between peripheral devices or idle only for 1 cycle ( during shifting of bus controls ) ? 
Because I'm unable to understand these lines. </p>

<blockquote>
 <p>The DMA module is transferring characters at the rate of 1200 characters per second... | computer architecture cpu | 1 | In cycle stealing mode, Does CPU gets blocked for 1 cycle or blocked till DMA transfer completion? -- (computer architecture cpu)
<p>In cycle stealing mode, is CPU idle during data transfer between peripheral devices or idle only for 1 cycle ( during shifting of bus controls ) ? 
Because I'm unable to understand th... | habedi/stack-exchange-dataset |
69,549 | Is this in-place merge algorithm efficient or not? | <p>I have trouble analyzing the characteristics of <a href="https://xinok.wordpress.com/2014/08/17/in-place-merge-sort-demystified-2/" rel="noreferrer">this algorithm</a> that merges two adjacent sorted lists. Basically it looks at some number of the tail of the first list, and the same number of head elements of the s... | algorithms time complexity sorting space complexity mergesort | 1 | Is this in-place merge algorithm efficient or not? -- (algorithms time complexity sorting space complexity mergesort)
<p>I have trouble analyzing the characteristics of <a href="https://xinok.wordpress.com/2014/08/17/in-place-merge-sort-demystified-2/" rel="noreferrer">this algorithm</a> that merges two adjacent sorted... | habedi/stack-exchange-dataset |
69,554 | Smallest cost in weighted directed graph with combinations | <p>I am trying to develop an algorithm that can traverse a graph with intermediary/all or nothing(?) nodes.</p>

<p>The problem is that there are companies B, C and D that are bidding on projects X, Y and Z. The companies can do individual bids for any of the projects, or they can say that they will complete a... | graphs np hard knapsack problems | 1 | Smallest cost in weighted directed graph with combinations -- (graphs np hard knapsack problems)
<p>I am trying to develop an algorithm that can traverse a graph with intermediary/all or nothing(?) nodes.</p>

<p>The problem is that there are companies B, C and D that are bidding on projects X, Y and Z. The co... | habedi/stack-exchange-dataset |
69,559 | Showing an equivalent definition of $CO-RE$ | <p>Let $L_1$ be a language.</p>

<p>I would like t prove that $L_1\in CO-RE$ if and only if exists a language $L_2$ s.t. $L_1=\{ u\,\, |\,\, \forall_{v\in\Sigma^*} : <u,v>\in L_2 \}$ and $L_2\in R$.</p>

<p>I'm not quite sure on where do I start here from?</p>

<p>I've tried writing down ... | computability semi decidability | 1 | Showing an equivalent definition of $CO-RE$ -- (computability semi decidability)
<p>Let $L_1$ be a language.</p>

<p>I would like t prove that $L_1\in CO-RE$ if and only if exists a language $L_2$ s.t. $L_1=\{ u\,\, |\,\, \forall_{v\in\Sigma^*} : <u,v>\in L_2 \}$ and $L_2\in R$.</p>

<p>I'm not q... | habedi/stack-exchange-dataset |
69,560 | Can I prove that I have x such that f(x) < c without revealing x? | <p>I'm interested in applications to verifiable computing. Let's say Alice would like to find an x such that f(x) < c for some real-valued function f and some c of Alice's choosing, so she hires Bob who has a powerful computer. Bob finds such an x, but he doesn't want to give it away before receiving payment from Al... | optimization distributed systems encryption | 1 | Can I prove that I have x such that f(x) < c without revealing x? -- (optimization distributed systems encryption)
<p>I'm interested in applications to verifiable computing. Let's say Alice would like to find an x such that f(x) < c for some real-valued function f and some c of Alice's choosing, so she hires Bob who... | habedi/stack-exchange-dataset |
69,565 | How to calculate the average of x numbers? | <p>I just started a college course and I'm being asked for a flowchart where I explain how to calculate the average of x quantity of numbers. For this assignment I'm asked to follow the problem solving steps, which are:</p>

<ol>
<li>Identify the problem.</li>
<li>Comprehend the problem. (As in, "is it ... | average case java | 1 | How to calculate the average of x numbers? -- (average case java)
<p>I just started a college course and I'm being asked for a flowchart where I explain how to calculate the average of x quantity of numbers. For this assignment I'm asked to follow the problem solving steps, which are:</p>

<ol>
<li>Identify... | habedi/stack-exchange-dataset |
69,579 | Ambiguity in choosing the best ER model | <p>I am actually little bit confused when I am reading through the text - Database system concepts by Henry F. Korth and others</p>

<p>I won't be able to understand one thing, which one of the following models I have to use when I have to design the ER diagram. </p>

<p><a href="https://i.stack.imgur.c... | database theory databases modelling | 1 | Ambiguity in choosing the best ER model -- (database theory databases modelling)
<p>I am actually little bit confused when I am reading through the text - Database system concepts by Henry F. Korth and others</p>

<p>I won't be able to understand one thing, which one of the following models I have to use when I... | habedi/stack-exchange-dataset |
69,584 | Understanding CLRS BFT lemma | <p>I was reading BFT from CLRS. This is the example given in the book:</p>

<p><a href="https://i.stack.imgur.com/t0cOJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t0cOJ.png" alt="enter image description here"></a>
(Figure:The operation of BFS on an undirected graph. Tree edges are sh... | algorithms graphs graph traversal | 1 | Understanding CLRS BFT lemma -- (algorithms graphs graph traversal)
<p>I was reading BFT from CLRS. This is the example given in the book:</p>

<p><a href="https://i.stack.imgur.com/t0cOJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t0cOJ.png" alt="enter image description here"></a>
(F... | habedi/stack-exchange-dataset |
69,597 | NP Problem that cannot be solved by a quantum computer in polynomial time | <ol>
<li>Is there any NP-Problem that can't be (maybe even proven) solved by quantum computers. I'm not talking about quantum NP-Problems (if that's even a thing), but about normal NP.</li>
<li>If that NP Problem exists could you also use it for cryptography, since I don't want to buy a quantum computer just to... | complexity theory np cryptography quantum computing | 1 | NP Problem that cannot be solved by a quantum computer in polynomial time -- (complexity theory np cryptography quantum computing)
<ol>
<li>Is there any NP-Problem that can't be (maybe even proven) solved by quantum computers. I'm not talking about quantum NP-Problems (if that's even a thing), but about normal NP.<... | habedi/stack-exchange-dataset |
69,598 | Enumerating the List of `nPr` (n Permute r) objects | <p>I have been using MATLAB for a particular project, and have seemed to find a function that may or may not exist. This question isn't MATLAB specific, more algorithm specific. </p>

<p>I have a list of 12 items, indexed from 1 to 12. I want to be able to create a list of all possible permutations of these 12 ... | algorithms permutations | 1 | Enumerating the List of `nPr` (n Permute r) objects -- (algorithms permutations)
<p>I have been using MATLAB for a particular project, and have seemed to find a function that may or may not exist. This question isn't MATLAB specific, more algorithm specific. </p>

<p>I have a list of 12 items, indexed from 1 to... | habedi/stack-exchange-dataset |
69,603 | Is this language $\{0^n1^m | (n+m) \text{is even}\}$ regular or not? | <p>$$L=\{0^n1^m | (n+m) \text{is even}\}$$</p>

<ol>
<li>Using the pumping lemma , 
let me choose a valid string $W=0011$ $(n=2,m=2$ and $4$ is even$)$.</li>
<li>Let the number of states in the DFA ($C$) be $3$ (I find this step to be fishy)</li>
<li>$|W|\ge C$</li>
<li>Let $W=XYZ$</li>
... | formal languages regular languages regular expressions pumping lemma | 1 | Is this language $\{0^n1^m | (n+m) \text{is even}\}$ regular or not? -- (formal languages regular languages regular expressions pumping lemma)
<p>$$L=\{0^n1^m | (n+m) \text{is even}\}$$</p>

<ol>
<li>Using the pumping lemma , 
let me choose a valid string $W=0011$ $(n=2,m=2$ and $4$ is even$)$.</li>
... | habedi/stack-exchange-dataset |
69,610 | Dynamic Programming, Binary Tree: How to factor in depth to recursion? | <p>I have the following problem. </p>

<p>I have a set of elements $x_0,\ldots,x_n$ which must retain their order inside the binary tree: if, given $x_i, x_j, i < j$, $x_i$ must be to the left of $x_j$ if $x_j$ is the root and $x_i$ is part of $x_j$'s subtree. </p>

<p>I also have a set of frequenci... | dynamic programming binary trees | 1 | Dynamic Programming, Binary Tree: How to factor in depth to recursion? -- (dynamic programming binary trees)
<p>I have the following problem. </p>

<p>I have a set of elements $x_0,\ldots,x_n$ which must retain their order inside the binary tree: if, given $x_i, x_j, i < j$, $x_i$ must be to the left of $x_j... | habedi/stack-exchange-dataset |
69,614 | Is every language in PTime also context-sensitive? | <p>Context-sensitive languages are exactly those that can be recognised using linearly bounded automata, i.e., those in NSPACE(O($n$)). This subsumes all languages that can be recognised in linear time, i.e., DTIME(O($n$)), since you can only use n memory cells in n steps.</p>

<p>However, this leaves open the ... | complexity theory polynomial time context sensitive linear bounded automata | 1 | Is every language in PTime also context-sensitive? -- (complexity theory polynomial time context sensitive linear bounded automata)
<p>Context-sensitive languages are exactly those that can be recognised using linearly bounded automata, i.e., those in NSPACE(O($n$)). This subsumes all languages that can be recognised i... | habedi/stack-exchange-dataset |
69,615 | Minimum number of shopping trips for a group of people to buy presents for each other | <p>We have a group of $n$ people. We are given a list of who must buy presents for whom within the group. Each person might need to buy/receive any number of presents, or possibly none at all. In a shopping trip, a subset of the people travel together to the same store, and buy presents for anyone who is not present at... | algorithms graphs set cover | 1 | Minimum number of shopping trips for a group of people to buy presents for each other -- (algorithms graphs set cover)
<p>We have a group of $n$ people. We are given a list of who must buy presents for whom within the group. Each person might need to buy/receive any number of presents, or possibly none at all. In a sho... | habedi/stack-exchange-dataset |
69,625 | NeuroEvolution: NEAT algorithm innovation numbers | <p>I have been reading up on the NeuronEvolution of Augmented Topologies and there's this little thing that's been bothering me. While reading Kenneth Stanley's Paper on NEAT I came on this figure here:</p>

<p><a href="https://i.stack.imgur.com/lIotv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.img... | machine learning neural networks genetic algorithms neural computing | 1 | NeuroEvolution: NEAT algorithm innovation numbers -- (machine learning neural networks genetic algorithms neural computing)
<p>I have been reading up on the NeuronEvolution of Augmented Topologies and there's this little thing that's been bothering me. While reading Kenneth Stanley's Paper on NEAT I came on this figure... | habedi/stack-exchange-dataset |
69,626 | Given a random number generator rand5() generate gen7() | <p>Given a pseudo random number generator rand5() that generates a random integer in the set [0,1,2,3,4], how would someone use this to generate a function rand7() that outputs [0,1,2,3,4,5,6] with equal probability.</p>

<p>I was thinking of approaching it this way: reduce the problem to generate number from 0... | algorithms pseudo random generators | 1 | Given a random number generator rand5() generate gen7() -- (algorithms pseudo random generators)
<p>Given a pseudo random number generator rand5() that generates a random integer in the set [0,1,2,3,4], how would someone use this to generate a function rand7() that outputs [0,1,2,3,4,5,6] with equal probability.</p>&#x... | habedi/stack-exchange-dataset |
69,629 | Context free grammar where number of a's is larger than number of b's in any prefix of the string | <p>The prefixes of the string <code>aabab</code> are <code>a, aa, aab, aaba, aabab</code>.
If the number of a's should be greater or equal to the number of b's, the grammar would be </p>

<p><code>S -> aS | aSbS | e</code>,</p>

<p>but I need it with strictly more a's than b's in any prefix.
... | formal languages formal grammars | 1 | Context free grammar where number of a's is larger than number of b's in any prefix of the string -- (formal languages formal grammars)
<p>The prefixes of the string <code>aabab</code> are <code>a, aa, aab, aaba, aabab</code>.
If the number of a's should be greater or equal to the number of b's, the grammar would b... | habedi/stack-exchange-dataset |
69,638 | RAM can be accessed hundreds of times faster than a hard drive. Explain How? | <ul>
<li>I have been reading this for quiet a long time that "RAM can be
accessed hundreds of times faster than a hard drive". </li>
<li>But, no one has been able to explain it properly.</li>
<li>I searched on Internet and found that "Access time of RAM is faster because they have <strong>less addresses... | computer architecture memory access | 1 | RAM can be accessed hundreds of times faster than a hard drive. Explain How? -- (computer architecture memory access)
<ul>
<li>I have been reading this for quiet a long time that "RAM can be
accessed hundreds of times faster than a hard drive". </li>
<li>But, no one has been able to explain it properly.</li... | habedi/stack-exchange-dataset |
69,640 | For a computational problem, can the set of instances be finite? | <p>A computational problem consists of a set of instances. In most cases the set of instances is infinite. Like the set of all graphs, e.g.:</p>

<blockquote>
 <p>Given a graph $G$, is there a Hamiltonian circuit in $G$?</p>
</blockquote>

<p>Can the set of instances be finite and a problem sti... | complexity theory | 1 | For a computational problem, can the set of instances be finite? -- (complexity theory)
<p>A computational problem consists of a set of instances. In most cases the set of instances is infinite. Like the set of all graphs, e.g.:</p>

<blockquote>
 <p>Given a graph $G$, is there a Hamiltonian circuit in $G$... | habedi/stack-exchange-dataset |
69,650 | How to solve recurrences with transcendental terms? | <p>Problem:</p>

<blockquote>
 <p>A number is said to be a magic number, if the sum of its digits, taken again and again till it becomes a single digit number, is 1.<br>
 Example: $289 => 19 => 10 => 1 => 289$ is a magic number<br>
 but, $20 => 2 =>$ not a magic number.</p>
... | time complexity runtime analysis number theory | 1 | How to solve recurrences with transcendental terms? -- (time complexity runtime analysis number theory)
<p>Problem:</p>

<blockquote>
 <p>A number is said to be a magic number, if the sum of its digits, taken again and again till it becomes a single digit number, is 1.<br>
 Example: $289 => 19 =>... | habedi/stack-exchange-dataset |
69,652 | One rational interval function and one irrational, will they ever collide? | <p>This question may be a little mathy or hardware-y, so I may have to ask elsewhere.</p>

<p>I've recently learned that if a is a positive rational number and b is a positive irrational number, there exists no common multiple between the two.</p>

<p>A common design consideration in threaded or embedde... | concurrency threads | 1 | One rational interval function and one irrational, will they ever collide? -- (concurrency threads)
<p>This question may be a little mathy or hardware-y, so I may have to ask elsewhere.</p>

<p>I've recently learned that if a is a positive rational number and b is a positive irrational number, there exists no c... | habedi/stack-exchange-dataset |
69,660 | Regular expression of a language with two letters, one which number of instances can be divided by three | <p>Let be a language with the following alphabet : $\Sigma=\{a,b\}$</p>

<p>I want to write the regular expression of {$w$ | $w$ containing a number of $a$ that we can divide by $3$ }</p>

<p>A friend of mine thought of $(b^*+ab^*aa+aab^*a)^*$ and it seems alright for me but I said to me today that it w... | formal languages automata regular expressions | 1 | Regular expression of a language with two letters, one which number of instances can be divided by three -- (formal languages automata regular expressions)
<p>Let be a language with the following alphabet : $\Sigma=\{a,b\}$</p>

<p>I want to write the regular expression of {$w$ | $w$ containing a number of $a$ ... | habedi/stack-exchange-dataset |
69,666 | Is there a data structure for efficiently searching a string that contains a given substring? | <p>This question arose from a practical problem: given a set of texts, find one, which contains a given string (not word).</p>

<p>Let $S$ be a set of $n$ strings, and $l$ the length of the longest string in $S$. What will be the best data structure to efficiently search a string that contains a substring of le... | data structures search algorithms strings exact string matching | 1 | Is there a data structure for efficiently searching a string that contains a given substring? -- (data structures search algorithms strings exact string matching)
<p>This question arose from a practical problem: given a set of texts, find one, which contains a given string (not word).</p>

<p>Let $S$ be a set o... | habedi/stack-exchange-dataset |
69,671 | Computer Vision - What is spatial histogram/pyramid feature? | <p>I am trying to re-implement the model in this paper <a href="https://arxiv.org/pdf/1511.02917v2.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1511.02917v2.pdf</a>. But the paper omitted some details in feature extraction (Section 4.1). I am new to computer vision so I am confused when the paper just said they... | machine learning computer vision | 1 | Computer Vision - What is spatial histogram/pyramid feature? -- (machine learning computer vision)
<p>I am trying to re-implement the model in this paper <a href="https://arxiv.org/pdf/1511.02917v2.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1511.02917v2.pdf</a>. But the paper omitted some details in feature e... | habedi/stack-exchange-dataset |
69,685 | Keywords for classification of 2D time series data? | <p>Trying to find the right search terms for literature on classifying 2D time series data.</p>

<p>I am looking at data from positional tracking of a swarm of insects over time. I have example datasets for specific insect behaviors, and I would like to play around with training a classifier on these.</p>
 | machine learning classification clustering time series analysis | 1 | Keywords for classification of 2D time series data? -- (machine learning classification clustering time series analysis)
<p>Trying to find the right search terms for literature on classifying 2D time series data.</p>

<p>I am looking at data from positional tracking of a swarm of insects over time. I have examp... | habedi/stack-exchange-dataset |
69,687 | Prove function in little-oh of a big-theta function | <p>I'm having trouble with this homework question.</p>

<p>Prove if $f(n)$ is $o( g(n) )$ and $g(n)$ is $\Theta( h(n) )$, then $f(n)$ is $o(h(n))$.</p>

<p>I know I need to use the precise definition of a limit, but I'm not sure how to apply it to this proof. Any help would be appreciated.</p>
 | algorithm analysis runtime analysis | 1 | Prove function in little-oh of a big-theta function -- (algorithm analysis runtime analysis)
<p>I'm having trouble with this homework question.</p>

<p>Prove if $f(n)$ is $o( g(n) )$ and $g(n)$ is $\Theta( h(n) )$, then $f(n)$ is $o(h(n))$.</p>

<p>I know I need to use the precise definition of a limit,... | habedi/stack-exchange-dataset |
69,688 | What's relation between Kolmogorov complexity and pseudorandomness? | <p>In a comment on <a href="https://cs.stackexchange.com/questions/9721/what-is-an-example-of-complex-random-string-in-the-kolmogorov-chatin-sense">this question</a>, @Kaveh wondered whether the questioner really wanted to ask "is there a relation between strings with high Kolmogorov complexity and pseudorandomness?" T... | pseudo random generators kolmogorov complexity | 1 | What's relation between Kolmogorov complexity and pseudorandomness? -- (pseudo random generators kolmogorov complexity)
<p>In a comment on <a href="https://cs.stackexchange.com/questions/9721/what-is-an-example-of-complex-random-string-in-the-kolmogorov-chatin-sense">this question</a>, @Kaveh wondered whether the quest... | habedi/stack-exchange-dataset |
69,707 | Problem with Church numerals evaluation | <p>I am trying to understand Church's Numerals for 4:</p>

<p>$$4 = \lambda f.\, \lambda x.\, f f f f x\,.$$</p>

<p>This will be evaluated in the following order:</p>

<p>$$\lambda f.\, \lambda x.\, (f (f (f (f x) ) ) )\,.$$</p>

<p>My question is why the function body will not evaluate... | lambda calculus | 1 | Problem with Church numerals evaluation -- (lambda calculus)
<p>I am trying to understand Church's Numerals for 4:</p>

<p>$$4 = \lambda f.\, \lambda x.\, f f f f x\,.$$</p>

<p>This will be evaluated in the following order:</p>

<p>$$\lambda f.\, \lambda x.\, (f (f (f (f x) ) ) )\,.$$</p>
&... | habedi/stack-exchange-dataset |
69,719 | Kolmogorov complexity of a sequence of prime numbers | <blockquote>
 <p>Let's say $p_1, p_2, p_3, \ldots $ is the increasing sorted sequence of all prime numbers. Prove that there exists a constant $n_0 \in \mathbb{N}$, so that for all $n \ge n_0$:
 $$K(p_n) < \log_2(p_n) − 2.$$
 Hint: Prime number theorem: $p_n \in \Theta (n \ln n)$.</p>
</blockquot... | kolmogorov complexity | 1 | Kolmogorov complexity of a sequence of prime numbers -- (kolmogorov complexity)
<blockquote>
 <p>Let's say $p_1, p_2, p_3, \ldots $ is the increasing sorted sequence of all prime numbers. Prove that there exists a constant $n_0 \in \mathbb{N}$, so that for all $n \ge n_0$:
 $$K(p_n) < \log_2(p_n) − 2.$$&#x... | habedi/stack-exchange-dataset |
69,720 | Discrete assignment problem with penalties | <p>I came across a problem were you have to plan an optimal assignment pattern. Let's say you have $j=1,\ldots,n$ tasks during $i=1,\ldots,m$ time periods. </p>

<p>It's an single agent problem where we have to assign agent to perform exactly one task $j$ during each period $i$, i.e., $\sum_{j=1}^n x_{ij} = 1$ ... | algorithms optimization dynamic programming integer programming assignment problem | 1 | Discrete assignment problem with penalties -- (algorithms optimization dynamic programming integer programming assignment problem)
<p>I came across a problem were you have to plan an optimal assignment pattern. Let's say you have $j=1,\ldots,n$ tasks during $i=1,\ldots,m$ time periods. </p>

<p>It's an single a... | habedi/stack-exchange-dataset |
69,725 | Understanding implemetation of the Toffoli gate using other gates | <p>I have a system with three qubits as input and I want to demonstrate this equality:
<a href="https://i.stack.imgur.com/bmB2e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bmB2e.png" alt="Toffoli gate"></a></p>

<p>where the left part of the equal is the circuit representation of the ... | quantum computing | 1 | Understanding implemetation of the Toffoli gate using other gates -- (quantum computing)
<p>I have a system with three qubits as input and I want to demonstrate this equality:
<a href="https://i.stack.imgur.com/bmB2e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bmB2e.png" alt="Toffoli gate"></... | habedi/stack-exchange-dataset |
69,735 | Why it converts to T | <p>The AND function in the lambda is:</p>

<pre><code>and = (λ a. λ b. a b F)
</code></pre>

<p>I have following expression:</p>

<pre><code>and T T
</code></pre>

<p>then the result will become <code>T</code> and I am asking me why? </p>

<p>When I do the beta reduction,... | lambda calculus | 1 | Why it converts to T -- (lambda calculus)
<p>The AND function in the lambda is:</p>

<pre><code>and = (λ a. λ b. a b F)
</code></pre>

<p>I have following expression:</p>

<pre><code>and T T
</code></pre>

<p>then the result will become <code>T</code> and I am asking me why? </p>... | habedi/stack-exchange-dataset |
69,747 | Non linear neural networks? | <p>The activation of a perceptron style neuron is:</p>

<p>$DotProduct(Inputs, Weights)+Bias > 0$</p>

<p>That is essentially classifying what side of a (hyper)plane a point is on (positive or negative side), like the below:</p>

<p>$DotProduct(Point, Normal)+D > 0$</p>

<p>Looking... | machine learning neural networks | 1 | Non linear neural networks? -- (machine learning neural networks)
<p>The activation of a perceptron style neuron is:</p>

<p>$DotProduct(Inputs, Weights)+Bias > 0$</p>

<p>That is essentially classifying what side of a (hyper)plane a point is on (positive or negative side), like the below:</p>
&#... | habedi/stack-exchange-dataset |
69,757 | how to approximate a very complex optimal policy when the distance function is unknown | <p>A policy $P$ is defined as a set of parameters. We want to know the optimal policy $O$, which certainly exists but unfortunately unknown.</p>

<p>$D(P)$ shows how far $P$ is from $O$. The function $D$ itself is unfortunately not known. However, $D(P) - D(Q)$ is known. That is, one can always know which among... | machine learning artificial intelligence | 1 | how to approximate a very complex optimal policy when the distance function is unknown -- (machine learning artificial intelligence)
<p>A policy $P$ is defined as a set of parameters. We want to know the optimal policy $O$, which certainly exists but unfortunately unknown.</p>

<p>$D(P)$ shows how far $P$ is fr... | habedi/stack-exchange-dataset |
69,758 | Breaking down CNF clauses | <p>I have an assignment where i have to encode certain problem to conjunctive normal form so i can solve it by using SAT solver. I have been able to encode my problem correctly but the solver is quite slow and most likely the cause for this is the length of some clauses which i have. </p>

<p>So my question is:... | optimization propositional logic | 1 | Breaking down CNF clauses -- (optimization propositional logic)
<p>I have an assignment where i have to encode certain problem to conjunctive normal form so i can solve it by using SAT solver. I have been able to encode my problem correctly but the solver is quite slow and most likely the cause for this is the length o... | habedi/stack-exchange-dataset |
69,763 | Selecting a random 'bad' element from an array of $n$ values in $O(n)$ time and $O(1)$ space without knowing how many bad elements or where they are | <p>I have an array of elements $A = [x_0, x_1, \ldots, x_n]$, such that for some $0 \leq k \leq \frac{n}{2}$, there are $k$ 'bad' elements in $A$, but I don't know what indices they are at, or indeed, how many there are aside from the given bounds. I have a function which can, in $O(1)$ time, check if something is 'bad... | algorithms arrays randomized algorithms | 1 | Selecting a random 'bad' element from an array of $n$ values in $O(n)$ time and $O(1)$ space without knowing how many bad elements or where they are -- (algorithms arrays randomized algorithms)
<p>I have an array of elements $A = [x_0, x_1, \ldots, x_n]$, such that for some $0 \leq k \leq \frac{n}{2}$, there are $k$ 'b... | habedi/stack-exchange-dataset |
69,772 | Which one should I report as total network I/O bytes among Sum(InBound) or Sum(InBound + OutBound)? | <p>I have a set of experiments with distributed environments. </p>

<p>I am planning to present a total network I/O bytes usage of the system for each run.</p>

<p>Which one should I report as total network I/O bytes among Sum(InBound Traffic) or Sum(InBound Traffic + OutBound Traffic)?</p>

<p>... | computer networks experimental analysis | 1 | Which one should I report as total network I/O bytes among Sum(InBound) or Sum(InBound + OutBound)? -- (computer networks experimental analysis)
<p>I have a set of experiments with distributed environments. </p>

<p>I am planning to present a total network I/O bytes usage of the system for each run.</p>
&#x... | habedi/stack-exchange-dataset |
69,777 | Remove from black/red tree subtree with red root, red sibling and black parent in $O(\lg n)$ | <p>How can i remove from a red/black tree a subtree whose root and its sibling are red, and their parent is black, in $O(\lg n)$ time, while keeping the red/black properties at the end of the process?</p>

<p>In other words: 
I have a black/red tree with $n$ nodes, a given black node $y$, and his two red ch... | data structures binary search trees | 1 | Remove from black/red tree subtree with red root, red sibling and black parent in $O(\lg n)$ -- (data structures binary search trees)
<p>How can i remove from a red/black tree a subtree whose root and its sibling are red, and their parent is black, in $O(\lg n)$ time, while keeping the red/black properties at the end o... | habedi/stack-exchange-dataset |
69,779 | Recurrence relation of the coin change problem | <p>I'm trying to wrap my head around the coin change problem, where you try to find the total number of ways $N$ cents can be exchanged using $M$ coins $\{C_1, C_2, ..., C_m\}$.</p>

<p>The recurrence relation is this:</p>

<p><a href="https://i.stack.imgur.com/sgwiR.png" rel="nofollow noreferrer"><img ... | recurrence relation dynamic programming coin change | 1 | Recurrence relation of the coin change problem -- (recurrence relation dynamic programming coin change)
<p>I'm trying to wrap my head around the coin change problem, where you try to find the total number of ways $N$ cents can be exchanged using $M$ coins $\{C_1, C_2, ..., C_m\}$.</p>

<p>The recurrence relatio... | habedi/stack-exchange-dataset |
69,788 | Lambda calculus application | <p>I have a function application:</p>

<pre><code>E1 E2
</code></pre>

<p>Can someone please show me an example, how to execute function?</p>
 | lambda calculus | 1 | Lambda calculus application -- (lambda calculus)
<p>I have a function application:</p>

<pre><code>E1 E2
</code></pre>

<p>Can someone please show me an example, how to execute function?</p>
 | habedi/stack-exchange-dataset |
69,790 | Difference between beta reduction and substitution | <p>I can not see the difference between beta reduction and substitution.</p>

<p>For example:</p>

<pre><code>(+ x 1) [x -> 2]
</code></pre>

<p>Here I can do the substitution, replace the variable x through 2(lambda expression) and result is:</p>

<pre><code>(+ 2 1)
</code></... | lambda calculus | 1 | Difference between beta reduction and substitution -- (lambda calculus)
<p>I can not see the difference between beta reduction and substitution.</p>

<p>For example:</p>

<pre><code>(+ x 1) [x -> 2]
</code></pre>

<p>Here I can do the substitution, replace the variable x through 2(lambda ... | habedi/stack-exchange-dataset |
69,799 | Sum of k smallest values of affine functions | <p>Assume we have a fixed number of $n$ one-dimensional affine functions of the form $f_i(x) = a_i x + b_i$ for $i \in N = \{1,\ldots,n\}$.</p>

<p>Consider some fixed value $k \in \{0,\ldots,n\}$. Let $S_k : \mathbb{R} \mapsto 2^N$ (power set) denote a function mapping some value $x \in \mathbb{R}$ to the set ... | combinatorics | 1 | Sum of k smallest values of affine functions -- (combinatorics)
<p>Assume we have a fixed number of $n$ one-dimensional affine functions of the form $f_i(x) = a_i x + b_i$ for $i \in N = \{1,\ldots,n\}$.</p>

<p>Consider some fixed value $k \in \{0,\ldots,n\}$. Let $S_k : \mathbb{R} \mapsto 2^N$ (power set) den... | habedi/stack-exchange-dataset |
69,805 | Reduction from PARTITION to 3PARTITION | <p>I'm considering the problem (a variant of 3-PARTITION, see <a href="https://en.wikipedia.org/wiki/3-partition_problem" rel="nofollow noreferrer">here</a>) with description</p>

<blockquote>
 <p><strong>Instance:</strong> Set of positive integers $A={w_{1},...,w_{n}}$ with $S(A)=\sum\limits_{i=1}^{n}w_{... | complexity theory np complete reductions partitions | 1 | Reduction from PARTITION to 3PARTITION -- (complexity theory np complete reductions partitions)
<p>I'm considering the problem (a variant of 3-PARTITION, see <a href="https://en.wikipedia.org/wiki/3-partition_problem" rel="nofollow noreferrer">here</a>) with description</p>

<blockquote>
 <p><strong>Insta... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.