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 |
|---|---|---|---|---|---|---|
79,515 | Is writing a compiler for a compact language easier? | <p>I am contemplating the project of writing a compiler. I am wondering if, aside from the availability of easy google results, it is easier to write a compiler for a more explicit/verbose language such as ada, compared to a very compact language such as APL, for example.</p>

<p>I should add that i am especial... | programming languages compilers program optimization | 1 | Is writing a compiler for a compact language easier? -- (programming languages compilers program optimization)
<p>I am contemplating the project of writing a compiler. I am wondering if, aside from the availability of easy google results, it is easier to write a compiler for a more explicit/verbose language such as ada... | habedi/stack-exchange-dataset |
79,540 | Closure property and undecidability | <p>I know that if a language class is closed under operation X then the problem is decidable.</p>

<p>for eg: "Intersection of two CSL is CSL"? this problem is decidable because it is already proved that CSL follow intersection closure property.</p>

<p>But what if language is not closed under the oper... | undecidability | 1 | Closure property and undecidability -- (undecidability)
<p>I know that if a language class is closed under operation X then the problem is decidable.</p>

<p>for eg: "Intersection of two CSL is CSL"? this problem is decidable because it is already proved that CSL follow intersection closure property.</p>
&... | habedi/stack-exchange-dataset |
79,542 | Find $i$-th number in unsorted sequence in logspace (deterministic turing machine) | <blockquote>
 <p>There is given input - words is sequence of numbers: $w_i$ is number
 in sequence, $i$ is position. All of them are in written in binary
 system. </p>
 
 <p>$$w_1\#,...\#w_k\#i$$ Prove that there exists deterministic
 Turing machine which find $i$-th number in sorte... | algorithms complexity theory turing machines space complexity | 1 | Find $i$-th number in unsorted sequence in logspace (deterministic turing machine) -- (algorithms complexity theory turing machines space complexity)
<blockquote>
 <p>There is given input - words is sequence of numbers: $w_i$ is number
 in sequence, $i$ is position. All of them are in written in binary
... | habedi/stack-exchange-dataset |
79,552 | Algorithm to find the optimal strategy to feed your cousin (Long question) | <p>I have a programming problem, instead of describing the whole domain it's easier for me to create an analogy. The numbers I use in this example are completely arbitrary.</p>

<p>Your cousin is coming over later and you must feed him dinner. He will only eat what he randomly decides he wants when he gets to y... | graphs knapsack problems game theory | 1 | Algorithm to find the optimal strategy to feed your cousin (Long question) -- (graphs knapsack problems game theory)
<p>I have a programming problem, instead of describing the whole domain it's easier for me to create an analogy. The numbers I use in this example are completely arbitrary.</p>

<p>Your cousin is... | habedi/stack-exchange-dataset |
79,553 | Chernoff bound when we only have a lower bound of expecation | <p>This question: <a href="https://cs.stackexchange.com/questions/41908/chernoff-bound-when-we-only-have-upper-bound-of-expectation">Chernoff bound when we only have upper bound of expectation</a> is similar, but for an upper bound of expectation.</p>

<p>The standard Chernoff bound says that is $X$ is a sum o... | probability theory chernoff bounds | 1 | Chernoff bound when we only have a lower bound of expecation -- (probability theory chernoff bounds)
<p>This question: <a href="https://cs.stackexchange.com/questions/41908/chernoff-bound-when-we-only-have-upper-bound-of-expectation">Chernoff bound when we only have upper bound of expectation</a> is similar, but for a... | habedi/stack-exchange-dataset |
79,562 | Enumerate partitions of a set with blocks of equal size | <p>Given a set $\{1,\ldots,ck\}$, is there a known algorithm to efficiently list all partitions in with $c$ blocks of cardinality $k$?</p>

<p>In <em>The art of computer programming (Fascicle 3B)</em> by Knuth, there's a mention of an algorithm by Ruskey that can list all partitions with $c$ blocks. I could jus... | algorithms combinatorics enumeration partitions | 1 | Enumerate partitions of a set with blocks of equal size -- (algorithms combinatorics enumeration partitions)
<p>Given a set $\{1,\ldots,ck\}$, is there a known algorithm to efficiently list all partitions in with $c$ blocks of cardinality $k$?</p>

<p>In <em>The art of computer programming (Fascicle 3B)</em> by... | habedi/stack-exchange-dataset |
79,563 | Writing a Context-Free-Grammar using Backus Naur Form for a for-loop? | <p>I'm pretty new to CFG, and I've tried out some samples as well. As of now I'm trying this <code>for-loop</code> to write it in CFG using BNF:</p>

<pre><code>Start{
 int z = 20;
 for(int b = 0; b < 5; b++) 
 {
 //some statement
 }
}
</code></pre>

<p... | formal languages context free formal grammars attribute grammars | 1 | Writing a Context-Free-Grammar using Backus Naur Form for a for-loop? -- (formal languages context free formal grammars attribute grammars)
<p>I'm pretty new to CFG, and I've tried out some samples as well. As of now I'm trying this <code>for-loop</code> to write it in CFG using BNF:</p>

<pre><code>Start{
... | habedi/stack-exchange-dataset |
79,570 | How many different trees can we form from given graph? | <p>I'm trying to practice some combinatorics and I faced this problem, let's say we have given graph with N nodes and M edges. $$N\leq500, M \leq N\cdot(N - 1)/2$$</p>

<p>In this graph I want to count the sub-sets of edges such that each subset will have exactly $N-1$ edges and the edges forming the subset wil... | algorithms graphs trees counting | 1 | How many different trees can we form from given graph? -- (algorithms graphs trees counting)
<p>I'm trying to practice some combinatorics and I faced this problem, let's say we have given graph with N nodes and M edges. $$N\leq500, M \leq N\cdot(N - 1)/2$$</p>

<p>In this graph I want to count the sub-sets of e... | habedi/stack-exchange-dataset |
79,572 | Inclusion of points in rectangles using a sweepline algorithm | <p>Given is a set of points $P_{1},....,P_{n}$ with $P_{i} = (x_{i},y_{i})$. No two points have the same x and y coordinates. Given is also a set of m axis-parallel rechtangles $R_{1},...,R_{m}$ in a plane, described by their bottom left corner $(l_{j},b_{j})$ and upper right corner $(r_{j},u_{j})$. No two rechtangles ... | algorithms computational geometry | 1 | Inclusion of points in rectangles using a sweepline algorithm -- (algorithms computational geometry)
<p>Given is a set of points $P_{1},....,P_{n}$ with $P_{i} = (x_{i},y_{i})$. No two points have the same x and y coordinates. Given is also a set of m axis-parallel rechtangles $R_{1},...,R_{m}$ in a plane, described by... | habedi/stack-exchange-dataset |
79,577 | Function that enumerates a recursively enumerable language | <p>I have an exercise where one is supposed to give a function that will enumerate the following language:</p>

<p>$L_1 = \{ a^pb^p \hspace{1mm} |\hspace{1mm} p \in \mathbb{N} \hspace{1mm} \wedge \text{ (P is a prime number )} \}$. </p>

<p>The solution is the following function: $f: \mathbb{N} \right... | computability turing machines enumeration | 1 | Function that enumerates a recursively enumerable language -- (computability turing machines enumeration)
<p>I have an exercise where one is supposed to give a function that will enumerate the following language:</p>

<p>$L_1 = \{ a^pb^p \hspace{1mm} |\hspace{1mm} p \in \mathbb{N} \hspace{1mm} \wedge \text{ (P... | habedi/stack-exchange-dataset |
79,581 | A Turing machine going to the right by the first $2 |w|$ steps | <p>A single-tape Turing machine $M$ has the property that, for every input $w$, during the first $2 |w|$ steps, the head of $M$ moves only right (it does not move left nor stays in place); the machine is also allowed to halt at any moment during these first $2|w|$ steps.
Prove that the language of $M$ is in $DTIME(... | turing machines | 1 | A Turing machine going to the right by the first $2 |w|$ steps -- (turing machines)
<p>A single-tape Turing machine $M$ has the property that, for every input $w$, during the first $2 |w|$ steps, the head of $M$ moves only right (it does not move left nor stays in place); the machine is also allowed to halt at any mome... | habedi/stack-exchange-dataset |
79,589 | Min spanning tree that preserves total weight of original graph | <p>I have a directed, weighted graph with no double edges. Each node represents a person, and each edge represents a debt. I want to reduce the total number of transactions required to settle all debt, i.e. have the smallest number of edges while maintaining fairness.</p>

<p>I've noticed that you can eliminate... | graphs shortest path spanning trees | 1 | Min spanning tree that preserves total weight of original graph -- (graphs shortest path spanning trees)
<p>I have a directed, weighted graph with no double edges. Each node represents a person, and each edge represents a debt. I want to reduce the total number of transactions required to settle all debt, i.e. have the... | habedi/stack-exchange-dataset |
79,595 | How to find the closest N to the power of X to the given number? | <p>Let's say we have number 4920 and we want to find the closest $n^x$ to 4920</p>

<p>2 ^ 12 = 4096 but it's not the closest possible $n^x$, for example 17 ^ 3 = 4913 is closer to 4920</p>

<p>The question is, how do we find the closest $n^x$, where $n$ and $x$ are less than 2 digits long? (because $49... | algorithms arithmetic number theory integers | 1 | How to find the closest N to the power of X to the given number? -- (algorithms arithmetic number theory integers)
<p>Let's say we have number 4920 and we want to find the closest $n^x$ to 4920</p>

<p>2 ^ 12 = 4096 but it's not the closest possible $n^x$, for example 17 ^ 3 = 4913 is closer to 4920</p>
&#x... | habedi/stack-exchange-dataset |
79,599 | How is integer factoring not in $P$? | <p>Everyone keeps claiming that integer factoring is in $NP$ but I just don't get it... Even with the simplest algorithm (division with all integers up to $\sqrt{n}$) the complexity should be $\sqrt{n}\log(n)$... How is that not in $P$? Is there something I'm missing?</p>
 | complexity theory factoring pseudo polynomial | 1 | How is integer factoring not in $P$? -- (complexity theory factoring pseudo polynomial)
<p>Everyone keeps claiming that integer factoring is in $NP$ but I just don't get it... Even with the simplest algorithm (division with all integers up to $\sqrt{n}$) the complexity should be $\sqrt{n}\log(n)$... How is that not in ... | habedi/stack-exchange-dataset |
79,612 | Does Amdahl's law apply to modern multi-code processors? | <p>I was reading about Amdahl's law and it state that value of Amdahl's law always lies between 0 and 1. My question is, is it still true in today's case/scenario? When we have system like core i7?</p>
 | computer architecture parallel computing | 1 | Does Amdahl's law apply to modern multi-code processors? -- (computer architecture parallel computing)
<p>I was reading about Amdahl's law and it state that value of Amdahl's law always lies between 0 and 1. My question is, is it still true in today's case/scenario? When we have system like core i7?</p>
 | habedi/stack-exchange-dataset |
79,617 | Do NPDA work in parallel? | <p>Assume my language is 
$$
L= ww^{r}\
$$</p>

<p>Now when we use NPDA for this,we will guess middle every time. It may be actual middle or it may not, so a new branch is created every time as I have a choice here. Now each branch will get the current stack contents and start its operation. </p>&#x... | context free automata pushdown automata nondeterminism | 1 | Do NPDA work in parallel? -- (context free automata pushdown automata nondeterminism)
<p>Assume my language is 
$$
L= ww^{r}\
$$</p>

<p>Now when we use NPDA for this,we will guess middle every time. It may be actual middle or it may not, so a new branch is created every time as I have a choice here... | habedi/stack-exchange-dataset |
79,618 | Math courses for machine learning | <p>I have a few math courses to pick from in my studies, and I would love some insights on which math courses from the following list are the most relevant for machine learning. I will note - to avoid this question being closed on "opinion based" cause, that my question does not involve which math courses I like or int... | machine learning education | 1 | Math courses for machine learning -- (machine learning education)
<p>I have a few math courses to pick from in my studies, and I would love some insights on which math courses from the following list are the most relevant for machine learning. I will note - to avoid this question being closed on "opinion based" cause, ... | habedi/stack-exchange-dataset |
79,624 | Is data received after transmission immediately stored and can that be recovered? | <p>When I send a message from one device to another, during the process during which the other device is receiving the data, is that data stored temporarily on some place on the device or is it immediately stored on the hard-drive of the device. and while using TCP when you receive an ACK does this mean that that data ... | communication protocols | 1 | Is data received after transmission immediately stored and can that be recovered? -- (communication protocols)
<p>When I send a message from one device to another, during the process during which the other device is receiving the data, is that data stored temporarily on some place on the device or is it immediately sto... | habedi/stack-exchange-dataset |
79,625 | Check if given language is CFL | <p>Assume language $L$ as follow:-
$$
L = \{ a^n b^x c^m d^y | (n=m) \lor (x=y)\}
$$
Is it possible to design DPDA/NPDA for this? I know if the condition would have been "and" then it is not possible. But is it possible with "or"?</p>

<p>My approach:- 1. Push all $a$'s to the stack.</p>
&#x... | formal languages context free pushdown automata | 1 | Check if given language is CFL -- (formal languages context free pushdown automata)
<p>Assume language $L$ as follow:-
$$
L = \{ a^n b^x c^m d^y | (n=m) \lor (x=y)\}
$$
Is it possible to design DPDA/NPDA for this? I know if the condition would have been "and" then it is not possible. But is it possible ... | habedi/stack-exchange-dataset |
79,628 | What is the largest possible minimal 3CNF formula as function of the number of variables? | <p>I have already defined <a href="https://cs.stackexchange.com/questions/78052/what-is-the-set-of-all-minimal-3cnf-formulas">here</a> what is minimal 3CNF formula.</p>

<p>In the answer to the question, D.W. answered:</p>

<blockquote>What you are thinking is wrong. A minimal, unsatisfiable formula can... | logic first order logic propositional logic | 1 | What is the largest possible minimal 3CNF formula as function of the number of variables? -- (logic first order logic propositional logic)
<p>I have already defined <a href="https://cs.stackexchange.com/questions/78052/what-is-the-set-of-all-minimal-3cnf-formulas">here</a> what is minimal 3CNF formula.</p>

<p>... | habedi/stack-exchange-dataset |
79,629 | number of subsegments that contain A[i] as the minimum | <p>I've recently been thinking about this problem.</p>

<p>Given an array $A$ containing $n$ integers and an index $i$, find the number of subgements of $A$ containing $A[i]$ as their minimum.</p>

<p>To better illustrate the problem, consider the array $A = [5, 1, 7]$ and we want to find the number of ... | optimization time complexity asymptotics combinatorics arrays | 1 | number of subsegments that contain A[i] as the minimum -- (optimization time complexity asymptotics combinatorics arrays)
<p>I've recently been thinking about this problem.</p>

<p>Given an array $A$ containing $n$ integers and an index $i$, find the number of subgements of $A$ containing $A[i]$ as their minimu... | habedi/stack-exchange-dataset |
79,639 | creditcard validation - why does nit not fail for 7 digits? | <p>using luhns credit card check algorithm why is digits with 7 length allowed ? for example 1111111 is a verfied credit card number meaningly if it has only six digits its not. this does not look like a credit card number to me, am i missing something ?</p>

<p>go to any online credit card validation site and... | algorithms | 1 | creditcard validation - why does nit not fail for 7 digits? -- (algorithms)
<p>using luhns credit card check algorithm why is digits with 7 length allowed ? for example 1111111 is a verfied credit card number meaningly if it has only six digits its not. this does not look like a credit card number to me, am i missing ... | habedi/stack-exchange-dataset |
79,642 | How do you represent LISP as mathematical / logical model? | <p>I asked this in stackoverflow, but the question probably fits here better.</p>

<p>This question arose from the objection that LISP is regarded as a functional language with some simple principles, namely functions, variables, and operators that roughly correspond to predicates, propositional variables, and ... | logic functional programming mathematical foundations lisp | 1 | How do you represent LISP as mathematical / logical model? -- (logic functional programming mathematical foundations lisp)
<p>I asked this in stackoverflow, but the question probably fits here better.</p>

<p>This question arose from the objection that LISP is regarded as a functional language with some simple ... | habedi/stack-exchange-dataset |
79,647 | Traverse Matrix in Reverse Diagonal strips | <p>I thought this problem had a trivial solution, couple of for loops and some fancy counters, but apparently it is rather more complicated.</p>

<p>So my question is, how would you write (in C) a function traversal of a square matrix in diagonal strips.</p>

<p>Example:</p>



<pre><cod... | algorithms data structures c adjacency matrix | 1 | Traverse Matrix in Reverse Diagonal strips -- (algorithms data structures c adjacency matrix)
<p>I thought this problem had a trivial solution, couple of for loops and some fancy counters, but apparently it is rather more complicated.</p>

<p>So my question is, how would you write (in C) a function traversal of... | habedi/stack-exchange-dataset |
79,664 | Can counting problems have optimal substructure? | <p>I understand that for a problem to be solvable using dynamic programming, it needs to have the following properties:</p>

<ol>
<li>optimal substructure</li>
<li>overlapping subproblems</li>
</ol>

<p>I stumbled upon <a href="https://wcipeg.com/wiki/Dynamic_programming#Disjoint_and_exhaust... | dynamic programming counting coin change | 1 | Can counting problems have optimal substructure? -- (dynamic programming counting coin change)
<p>I understand that for a problem to be solvable using dynamic programming, it needs to have the following properties:</p>

<ol>
<li>optimal substructure</li>
<li>overlapping subproblems</li>
</ol>
&#... | habedi/stack-exchange-dataset |
79,665 | In the beginning, computable functions were always total, but when where the partial functions included | <p>The modern definition of computable functions <span class="math-container">$f\colon \mathbb N \to \mathbb N$</span> as given on <a href="https://en.wikipedia.org/wiki/Computable_function#Definition" rel="nofollow noreferrer">Wikipedia</a> quite naturally describes partial functions, and not just total functions. Now... | formal languages computability | 1 | In the beginning, computable functions were always total, but when where the partial functions included -- (formal languages computability)
<p>The modern definition of computable functions <span class="math-container">$f\colon \mathbb N \to \mathbb N$</span> as given on <a href="https://en.wikipedia.org/wiki/Computable... | habedi/stack-exchange-dataset |
79,668 | Minimum difference of sums | <p>So hey, I've recently found this problem online and I tried hard to solve but couldn't found an efficient solution. The problem statement is:</p>

<p>Given and two integers $n$ and $k$ and an array $A$ containing $n$ pairs of integers of the form $(a, b)$ and $d$ defined as $d = |\sum_{x \in E} x[1] -x[0]| $... | algorithms optimization time complexity asymptotics | 1 | Minimum difference of sums -- (algorithms optimization time complexity asymptotics)
<p>So hey, I've recently found this problem online and I tried hard to solve but couldn't found an efficient solution. The problem statement is:</p>

<p>Given and two integers $n$ and $k$ and an array $A$ containing $n$ pairs of... | habedi/stack-exchange-dataset |
79,674 | Residual graph of a graph with bidirectional edges? | <p>Let's suppose we have a directed graph $G$ which has at least a pair of vertices $v,w$ such that $(v,w) \in E, (w,v) \in E$. </p>

<p>$e.g:$ </p>

<p><a href="https://i.stack.imgur.com/azpEp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/azpEp.png" alt="enter image description her... | graphs network flow | 1 | Residual graph of a graph with bidirectional edges? -- (graphs network flow)
<p>Let's suppose we have a directed graph $G$ which has at least a pair of vertices $v,w$ such that $(v,w) \in E, (w,v) \in E$. </p>

<p>$e.g:$ </p>

<p><a href="https://i.stack.imgur.com/azpEp.png" rel="nofollow noreferrer"><i... | habedi/stack-exchange-dataset |
79,678 | Why we can't use non-deterministic turing machines in this case? | <p>Can you explain me why we can't show decidability of problem using non-determinism ? I know that this problem (described below) is not decidability, however I can't understand why following reasoning is not working.</p>

<p>Problem
Given a context free grammar $G$, does there exists a word $w∈Σ^∗$ such t... | complexity theory turing machines nondeterminism | 1 | Why we can't use non-deterministic turing machines in this case? -- (complexity theory turing machines nondeterminism)
<p>Can you explain me why we can't show decidability of problem using non-determinism ? I know that this problem (described below) is not decidability, however I can't understand why following reasonin... | habedi/stack-exchange-dataset |
79,680 | Reduction from Clique to something else | <p><strong>Given</strong> $G(V,E)$ and $k$.
Is there a clique with size $k$?</p>

<p><strong>Given</strong> set $X = \{x_1,x_2,\dots,x_n \}$, and collection $A = \{A_1,A_2,...,A_n\}$ of sub-sets of $X$ and $k$.
Are there are $k$ different elements in $A$, that every two of them has intersection that isn... | algorithms np complete reductions np hard clique | 1 | Reduction from Clique to something else -- (algorithms np complete reductions np hard clique)
<p><strong>Given</strong> $G(V,E)$ and $k$.
Is there a clique with size $k$?</p>

<p><strong>Given</strong> set $X = \{x_1,x_2,\dots,x_n \}$, and collection $A = \{A_1,A_2,...,A_n\}$ of sub-sets of $X$ and $k$.
... | habedi/stack-exchange-dataset |
79,681 | Can two minimum spanning trees for a same graph has different number edges? | <p>(1) Let's say $T_1$ has $r$ number of edges and $T_2$ has $s$ number of edges; where $r \ne s$ but two trees has same weight since they both are MST.</p>

<p>I kind feel this kind not be true because to span $n$ vertices with minimum number of edges, we need $n-1$ edges. so MST must have at least $n-1$ edges... | graphs | 1 | Can two minimum spanning trees for a same graph has different number edges? -- (graphs)
<p>(1) Let's say $T_1$ has $r$ number of edges and $T_2$ has $s$ number of edges; where $r \ne s$ but two trees has same weight since they both are MST.</p>

<p>I kind feel this kind not be true because to span $n$ vertices ... | habedi/stack-exchange-dataset |
79,687 | What are drawbacks of Tree Sort algorithm (with balanced tree) vs Tree Sort (with unbalanced tree)? | <p><a href="https://en.wikipedia.org/wiki/Tree_sort" rel="nofollow noreferrer">Tree Sort</a> algorithm with unbalanced tree may yield $O(n^2)$ worst-case time complexity/performance. But Tree Sort algorithm with balanced tree guarantees $O(n\log n)$ worst-case time performance. </p>

<p>So I do not see any prac... | sorting binary trees search trees | 1 | What are drawbacks of Tree Sort algorithm (with balanced tree) vs Tree Sort (with unbalanced tree)? -- (sorting binary trees search trees)
<p><a href="https://en.wikipedia.org/wiki/Tree_sort" rel="nofollow noreferrer">Tree Sort</a> algorithm with unbalanced tree may yield $O(n^2)$ worst-case time complexity/performance... | habedi/stack-exchange-dataset |
79,691 | how to express an intertemporal implication constraint in integer linear programming (ILP)? | <p>I want to express the following locigal expression in an IP:</p>

<p>$$x_{di} \wedge x_{d'j} \Rightarrow \sum_{\substack{d'' \in D\\ i < k <j}} x_{d''k} = \sum_{i<k<j} a_{k} \ \forall \ d, d' \in D, i,j \in T, i<j$$</p>

<p>where $x_{dt}$ is a binary decision variable ($x_{dt} \in \{0,... | optimization integer programming | 1 | how to express an intertemporal implication constraint in integer linear programming (ILP)? -- (optimization integer programming)
<p>I want to express the following locigal expression in an IP:</p>

<p>$$x_{di} \wedge x_{d'j} \Rightarrow \sum_{\substack{d'' \in D\\ i < k <j}} x_{d''k} = \sum_{i<k<j}... | habedi/stack-exchange-dataset |
79,694 | Is this possible to solve boolean satisfiablility by using karnaugh maps to simplify the whole given boolean formula by simplifying subformulas? | <p>Building karnaugh map for the whole given boolean formula always costs Θ(2<sup>n</sup>) both time and space complexities, where $n$ is the number of boolean variables in the given boolean formula.</p>

<p>It is recommended to do this if $n$ is small, but if $n$ is large, then practically this is not po... | algorithms logic satisfiability propositional logic karnaugh map | 1 | Is this possible to solve boolean satisfiablility by using karnaugh maps to simplify the whole given boolean formula by simplifying subformulas? -- (algorithms logic satisfiability propositional logic karnaugh map)
<p>Building karnaugh map for the whole given boolean formula always costs Θ(2<sup>n</sup>) both tim... | habedi/stack-exchange-dataset |
79,701 | Is genetic programming relevant today? | <p>My main concern is whether the genetic programming is an active field of research, with some promising applications in practice. It seems like in field of machine learning, the neural networks are the main buzzword, with mentions in mainstream news today, but I have never heard of similar genetic programming "succes... | machine learning evolutionary computing | 1 | Is genetic programming relevant today? -- (machine learning evolutionary computing)
<p>My main concern is whether the genetic programming is an active field of research, with some promising applications in practice. It seems like in field of machine learning, the neural networks are the main buzzword, with mentions in ... | habedi/stack-exchange-dataset |
79,702 | Someone explain the venn diagram for the logic equation A*(B+C) | <p>So, I am studying logic circuits and how to prove them with Venn diagrams. When drawing a Venn diagram for the equation A*(B+C) I figured it would look something like this:
<a href="https://i.stack.imgur.com/mXTGz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mXTGz.png" alt="enter image desc... | logic circuits | 1 | Someone explain the venn diagram for the logic equation A*(B+C) -- (logic circuits)
<p>So, I am studying logic circuits and how to prove them with Venn diagrams. When drawing a Venn diagram for the equation A*(B+C) I figured it would look something like this:
<a href="https://i.stack.imgur.com/mXTGz.png" rel="nofol... | habedi/stack-exchange-dataset |
79,711 | Someone explain the Venn diagram for the logic equation (A+B)(B+C) | <p>I posted a similar question <a href="https://cs.stackexchange.com/questions/79702/someone-explain-the-venn-diagram-for-the-logic-equation-abc/79704#79704">here</a>, however I have another question regarding Venn diagrams and logic circuits...</p>

<p>In this problem:</p>

<p>$$(A+B)(B+C)$$</p>
&... | logic circuits karnaugh map | 1 | Someone explain the Venn diagram for the logic equation (A+B)(B+C) -- (logic circuits karnaugh map)
<p>I posted a similar question <a href="https://cs.stackexchange.com/questions/79702/someone-explain-the-venn-diagram-for-the-logic-equation-abc/79704#79704">here</a>, however I have another question regarding Venn diag... | habedi/stack-exchange-dataset |
79,717 | Powerset generation using recursion and time complexity | <p>I have a program that generates power set of a given string, the set being the characters of the string.</p>

<pre><code>public static Set subsets(String s) {
 Set subsets = new HashSet();
 if (s.length() == 0) {
 subsets.add("");
 } else if (s.length() == 1) {
 sub... | algorithms time complexity | 1 | Powerset generation using recursion and time complexity -- (algorithms time complexity)
<p>I have a program that generates power set of a given string, the set being the characters of the string.</p>

<pre><code>public static Set subsets(String s) {
 Set subsets = new HashSet();
 if (s.length() ==... | habedi/stack-exchange-dataset |
79,728 | Prove the recursive enumerability of the class of NP-hard context-free languages | <p>I was asked to prove that the next language is recursive enumerable : </p>

<p>$$L= \{ \langle G \rangle \mid SAT<L(G) \} $$</p>

<p>where $G$ is a context free grammar and there is a polynomial reduction from the SAT problem to the language that's accepted by $G$.</p>

<p>I can't seem to ... | complexity theory context free np complete reductions decision problem | 1 | Prove the recursive enumerability of the class of NP-hard context-free languages -- (complexity theory context free np complete reductions decision problem)
<p>I was asked to prove that the next language is recursive enumerable : </p>

<p>$$L= \{ \langle G \rangle \mid SAT<L(G) \} $$</p>

<p>where $G... | habedi/stack-exchange-dataset |
79,733 | strange choice of constant when showing $an + b = O(n^2)$ ("Introduction to Algorithms" book) | <p>In the third edition of <a href="https://mitpress.mit.edu/books/introduction-algorithms" rel="nofollow noreferrer">Introduction to Algorithms</a>, the authors state:</p>

<blockquote>
 <p>... when $a$ > 0, any linear function $an+b$ is $O(n^2)$, which is
 easily verified by taking $c = a + |b|$ and... | algorithm analysis asymptotics | 1 | strange choice of constant when showing $an + b = O(n^2)$ ("Introduction to Algorithms" book) -- (algorithm analysis asymptotics)
<p>In the third edition of <a href="https://mitpress.mit.edu/books/introduction-algorithms" rel="nofollow noreferrer">Introduction to Algorithms</a>, the authors state:</p>

<blockqu... | habedi/stack-exchange-dataset |
79,739 | Convert conjunctive normal form to equivalent boolean formula with only NAND gates | <p>Let $\varphi$ be a boolean formula in 3-CNF form (conjunctive normal form with three literals at most per clause). I want to convert it to an equivalent boolean formula that uses only NAND gates with fan-in 2, without introducing any new dummy boolean variables. I'm wondering how much this will increase the size of... | logic space complexity first order logic propositional logic | 1 | Convert conjunctive normal form to equivalent boolean formula with only NAND gates -- (logic space complexity first order logic propositional logic)
<p>Let $\varphi$ be a boolean formula in 3-CNF form (conjunctive normal form with three literals at most per clause). I want to convert it to an equivalent boolean formul... | habedi/stack-exchange-dataset |
79,741 | NFA-epsilon: epsilon loops, and how do I deal with them? | <p>I am currently studying Automatons and have one, albeit simple, question about NFA-epsilon 'loops'<br>
I know that a string can advance using epsilon without having anything read. So my first question would be, if you had a chain of epsilon-arches, would you just jump to the end of the chain instantaneously (Fig... | finite automata nondeterminism | 1 | NFA-epsilon: epsilon loops, and how do I deal with them? -- (finite automata nondeterminism)
<p>I am currently studying Automatons and have one, albeit simple, question about NFA-epsilon 'loops'<br>
I know that a string can advance using epsilon without having anything read. So my first question would be, if you ha... | habedi/stack-exchange-dataset |
79,754 | Complement of context free language | <p>If a language X regular, then is the complement of X also a regular language? If yes, then thank you, else can you please explain why</p>
 | context free | 1 | Complement of context free language -- (context free)
<p>If a language X regular, then is the complement of X also a regular language? If yes, then thank you, else can you please explain why</p>
 | habedi/stack-exchange-dataset |
79,758 | Show that run time complexity of operations on 2-4 tree is $O(\lg n)$ | <p>I just studied about this 2-4 tree which is a self-balanced tree. Various sources and textbook often mentioned that the insertion, deleting and searching of this tree is $O(\lg n)$.</p>

<p>However, none of them explain the detailed reasons for that run-time complexity. Neither of them also explains them mat... | trees | 1 | Show that run time complexity of operations on 2-4 tree is $O(\lg n)$ -- (trees)
<p>I just studied about this 2-4 tree which is a self-balanced tree. Various sources and textbook often mentioned that the insertion, deleting and searching of this tree is $O(\lg n)$.</p>

<p>However, none of them explain the deta... | habedi/stack-exchange-dataset |
79,760 | Sorting networks hybrid sort | <p>I saw an answer about the fastest way to sort an array with 6 elements. Turns out that using a sorting network is the best choice. If sorting networks are the fastest way to sort a small(< 16 elements) fixed size array, would it make sense to use them in quicksort or mergesort when the recursive call is for an ar... | algorithms sorting performance | 1 | Sorting networks hybrid sort -- (algorithms sorting performance)
<p>I saw an answer about the fastest way to sort an array with 6 elements. Turns out that using a sorting network is the best choice. If sorting networks are the fastest way to sort a small(< 16 elements) fixed size array, would it make sense to use th... | habedi/stack-exchange-dataset |
79,761 | How can blank be written on the tape if it is not part of input alphabet? | <p>I have read that input alphabet of Turing machine is subset of tape symbols because in input alphabet we don't allow blank symbol. But when ever there is a transition to final state the transition as (Blank,Blank,R/L) (First parameter here is input,second is what machine will write on tape,third is direction).It mea... | turing machines computation models | 1 | How can blank be written on the tape if it is not part of input alphabet? -- (turing machines computation models)
<p>I have read that input alphabet of Turing machine is subset of tape symbols because in input alphabet we don't allow blank symbol. But when ever there is a transition to final state the transition as (Bl... | habedi/stack-exchange-dataset |
79,767 | Prove Partition is NP-Complete using that SubsetSum so is it | <p>The <em>SubsetSum problem</em> decides whether a set $S = \{s_1, s_2,..., s_n\}$ and $k \in \mathbb{N}_0$ contains a subset of $S$ such that its summation is $k$ or not. This problem is NP-Complete. </p>

<p>The <em>Partition problem</em> decides whether a set $S = \{s_1, s_2,..., s_n\}$ can be partitionated... | complexity theory np complete decision problem | 1 | Prove Partition is NP-Complete using that SubsetSum so is it -- (complexity theory np complete decision problem)
<p>The <em>SubsetSum problem</em> decides whether a set $S = \{s_1, s_2,..., s_n\}$ and $k \in \mathbb{N}_0$ contains a subset of $S$ such that its summation is $k$ or not. This problem is NP-Complete. </p>&... | habedi/stack-exchange-dataset |
79,775 | Solve T(n) = T(n-1)*n with repeated substitution | <p>I'm trying to solve T(n) = T(n-1)*n using repeated substitution.</p>

<p>I can expand it, but I'm having trouble with geometric sequences for any problem. I find I'm just memorizing solutions to typical problems. It's sometimes hard for me to go from the expanded equation to a general equation that I can sim... | complexity theory recurrence relation | 1 | Solve T(n) = T(n-1)*n with repeated substitution -- (complexity theory recurrence relation)
<p>I'm trying to solve T(n) = T(n-1)*n using repeated substitution.</p>

<p>I can expand it, but I'm having trouble with geometric sequences for any problem. I find I'm just memorizing solutions to typical problems. It's... | habedi/stack-exchange-dataset |
79,778 | Generalization of Horn clauses in logic programming? | <p>As far as I understand, Prolog and related languages are restricted to inference rules of the form
$$ p_1 \land \dots \land p_n \rightarrow q$$
which is equivalent to the Horn clause
$$ \neg p_1 \lor \dots \lor \neg p_n \lor q$$
I'm wondering if there are languages that relax this constraint to allow... | logic logic programming prolog | 1 | Generalization of Horn clauses in logic programming? -- (logic logic programming prolog)
<p>As far as I understand, Prolog and related languages are restricted to inference rules of the form
$$ p_1 \land \dots \land p_n \rightarrow q$$
which is equivalent to the Horn clause
$$ \neg p_1 \lor \dots \lor \neg ... | habedi/stack-exchange-dataset |
79,781 | Run time of recurrence with five uneven calls | <p>I am trying to figure how to find an upper bound for the running time of a given recurrence relation (without proving the bound) using the Iteration method. The recurrence is:</p>

<p>$$T(n)=2T\left(\frac{n}{5}\right)+3T\left(\frac{n}{10}\right)+n$$</p>

<p>I tried to iterate over it and got:</p>
... | asymptotics recurrence relation | 1 | Run time of recurrence with five uneven calls -- (asymptotics recurrence relation)
<p>I am trying to figure how to find an upper bound for the running time of a given recurrence relation (without proving the bound) using the Iteration method. The recurrence is:</p>

<p>$$T(n)=2T\left(\frac{n}{5}\right)+3T\left(... | habedi/stack-exchange-dataset |
79,796 | Unique ID from date and rotating offset | <p>Hopefully this is the right board for my question, We are facing an issue creating a unique ID from the following inputs : </p>

<ul>
<li>datetime (can be present more than once in the same set, cannot not be present in 2 different sets)</li>
<li>offset ( an integer representing each line position in... | hashing | 1 | Unique ID from date and rotating offset -- (hashing)
<p>Hopefully this is the right board for my question, We are facing an issue creating a unique ID from the following inputs : </p>

<ul>
<li>datetime (can be present more than once in the same set, cannot not be present in 2 different sets)</li>
<li>o... | habedi/stack-exchange-dataset |
79,801 | Proving that language $ L = \{ a^{2n}: n \geq 1\}$ is regular | <p>I was asked to prove that language described by $$ L =\{ a^{2n}: n\ge1\}$$ is regular using pumping lemma. Pumping Lemma states that for regular language we can break down language described by language into $xyz$ where pumping length $p \ge 1$ such that</p>

<ol>
<li>$|y|>0$</li>
<li>$|x.y| \le p... | formal languages regular languages pumping lemma | 1 | Proving that language $ L = \{ a^{2n}: n \geq 1\}$ is regular -- (formal languages regular languages pumping lemma)
<p>I was asked to prove that language described by $$ L =\{ a^{2n}: n\ge1\}$$ is regular using pumping lemma. Pumping Lemma states that for regular language we can break down language described by languag... | habedi/stack-exchange-dataset |
79,811 | Does this A-Star heuristic already exist? | <p>I've been thinking about <a href="https://en.wikipedia.org/wiki/A*_search_algorithm" rel="nofollow noreferrer">the A* algorithm</a> recently. For context, A* is a graph-navigating algorithm most often used to solve problems that go "What is the shortest path from point A to point B?". It's based on a distance-estima... | algorithms heuristics searching | 1 | Does this A-Star heuristic already exist? -- (algorithms heuristics searching)
<p>I've been thinking about <a href="https://en.wikipedia.org/wiki/A*_search_algorithm" rel="nofollow noreferrer">the A* algorithm</a> recently. For context, A* is a graph-navigating algorithm most often used to solve problems that go "What ... | habedi/stack-exchange-dataset |
79,824 | Constant folding vs. Constant propogation | <p>What is the difference between constant folding and constant propogation? They both seem to do the same thing, instead of saving constants into stack or evaluating a full arithmetic expression, they simply replace it with the result which can be obtained at compile time. What is the difference between two?</p>
 | compilers program optimization | 1 | Constant folding vs. Constant propogation -- (compilers program optimization)
<p>What is the difference between constant folding and constant propogation? They both seem to do the same thing, instead of saving constants into stack or evaluating a full arithmetic expression, they simply replace it with the result which ... | habedi/stack-exchange-dataset |
79,828 | Why does the reduction from 3SAT to IS work? | <p>I was reading about the reduction from <em>3SAT</em> (input: formula) to <em>Independent set</em> (input (graph, k)) in order to prove that the latter is in NP-Complete. The reduction i've seen follow the next steps:</p>

<ol>
<li>For each clause at the input, create a node for every variable it contains... | complexity theory reductions 3 sat | 1 | Why does the reduction from 3SAT to IS work? -- (complexity theory reductions 3 sat)
<p>I was reading about the reduction from <em>3SAT</em> (input: formula) to <em>Independent set</em> (input (graph, k)) in order to prove that the latter is in NP-Complete. The reduction i've seen follow the next steps:</p>

<o... | habedi/stack-exchange-dataset |
79,830 | Reduction problem to another problem | <p>I would like to show that a problem $A$ is $NP\text{-complete}$. So, I am trying to reduce 3-SAT problem to $A$. Reduction is kind of function, let say $f$. What is necessary complexity of $f$? Probably, it has be in $NP$. But, does it mean that $f$ must be a non-deterministic Turing machine working in polynomial ti... | complexity theory np complete reductions | 1 | Reduction problem to another problem -- (complexity theory np complete reductions)
<p>I would like to show that a problem $A$ is $NP\text{-complete}$. So, I am trying to reduce 3-SAT problem to $A$. Reduction is kind of function, let say $f$. What is necessary complexity of $f$? Probably, it has be in $NP$. But, does i... | habedi/stack-exchange-dataset |
79,837 | Globally-optimized nearest neighbors lookup | <p>I have a set $\mathcal{A}$ of $\mathcal{m}$ vectors in $\mathbb{R}^a$. I also have a different set $\mathcal{B}$ of $\mathcal{n}$ vectors in $\mathbb{R}^a$. These two sets are disjoint: $\mathcal{A}\cap\mathcal{B} = \varnothing$.</p>

<p>My goal is to find a set $\mathcal{C}$ such that $\mathcal{C} \subset... | optimization search algorithms np greedy algorithms | 1 | Globally-optimized nearest neighbors lookup -- (optimization search algorithms np greedy algorithms)
<p>I have a set $\mathcal{A}$ of $\mathcal{m}$ vectors in $\mathbb{R}^a$. I also have a different set $\mathcal{B}$ of $\mathcal{n}$ vectors in $\mathbb{R}^a$. These two sets are disjoint: $\mathcal{A}\cap\mathcal{B} ... | habedi/stack-exchange-dataset |
79,839 | Domino tiling of a 2xN rectangle in O(ln n) | <p>I solved this problem using Dynamic Programming in $\mathcal{O}(n)$ time. I found that is equivalent to the Fibonacci Numbers.</p>

<p>$F(0) = F(1) = 1$</p>

<p>$F(n) = F(n-1)+F(n-2)$</p>

<p>Where the $F(n-1)$ term is from fixing the left most domino vertically, and the $F(n-2)$ from fixing ... | dynamic programming tiling | 1 | Domino tiling of a 2xN rectangle in O(ln n) -- (dynamic programming tiling)
<p>I solved this problem using Dynamic Programming in $\mathcal{O}(n)$ time. I found that is equivalent to the Fibonacci Numbers.</p>

<p>$F(0) = F(1) = 1$</p>

<p>$F(n) = F(n-1)+F(n-2)$</p>

<p>Where the $F(n-1)$ term i... | habedi/stack-exchange-dataset |
79,840 | Identifying class of language | <p>Let L1 be the recursive language. Let L2 and L3 be languages that are recursively enumerable but not recursive. Which of the following statements is not necessarily true?</p>

<p>a.) L2−L1 is recursively enumerable.</p>

<p>b.)L1−L3is recursively enumerable.</p>

<p>c.)L2∩L3is recursively enu... | turing machines | 1 | Identifying class of language -- (turing machines)
<p>Let L1 be the recursive language. Let L2 and L3 be languages that are recursively enumerable but not recursive. Which of the following statements is not necessarily true?</p>

<p>a.) L2−L1 is recursively enumerable.</p>

<p>b.)L1−L3is recursively enu... | habedi/stack-exchange-dataset |
79,845 | Can Chomsky Normal Form have more than one terminal? | <p>In formal language theory, a context-free grammar G is said to be in Chomsky normal form if
$$ S → A B$$
$$ A → a $$
$$S → ε $$</p>

<p>My question is that if $B$ in the the form of
$$ B → abcd $$</p>

<p>where $abcd$ are terminal symbol, is this still in Chomsky Normal Form? ?</p>&#... | formal languages context free automata | 1 | Can Chomsky Normal Form have more than one terminal? -- (formal languages context free automata)
<p>In formal language theory, a context-free grammar G is said to be in Chomsky normal form if
$$ S → A B$$
$$ A → a $$
$$S → ε $$</p>

<p>My question is that if $B$ in the the form of
$$ B → abcd $... | habedi/stack-exchange-dataset |
79,847 | implementing permutation and combination recursively | <p>I am still in the early phase of getting comfortable with solving recursive problems. I was given<br>
<code>int p(int n) // number of permutations of n objects</code><br>
<code>int c(int n, int k) // number of unique combinations of k elements out of n elemnts</code> </p>

<p>For instance, {"abc"}... | algorithms | 1 | implementing permutation and combination recursively -- (algorithms)
<p>I am still in the early phase of getting comfortable with solving recursive problems. I was given<br>
<code>int p(int n) // number of permutations of n objects</code><br>
<code>int c(int n, int k) // number of unique combinations of k eleme... | habedi/stack-exchange-dataset |
79,850 | About independent set in triangle free graphs | <p>From Wikipedia :</p>

<blockquote>
 <p>An independent set of $\sqrt{n}$ vertices in an $n$-vertex triangle-free graph is easy to find: either there is a vertex with more than $\sqrt{n}$ neighbors (in which case those neighbors are an independent set) or all vertices have less than $\sqrt{n}$ neighbors (... | graphs | 1 | About independent set in triangle free graphs -- (graphs)
<p>From Wikipedia :</p>

<blockquote>
 <p>An independent set of $\sqrt{n}$ vertices in an $n$-vertex triangle-free graph is easy to find: either there is a vertex with more than $\sqrt{n}$ neighbors (in which case those neighbors are an independent ... | habedi/stack-exchange-dataset |
79,857 | Generating numbers to be averaged efficiently | <p>During my research, I had encountered the following issue. Consider the equation
$$\sum_{k=1}^K\alpha_k P_k = P$$</p>

<p>where $\sum_{k=1}^K\alpha_k=1$, $\alpha_k > 0$, $P_k > 0, P>0$.</p>

<p>So you are given $\{\alpha_k\}$, $K$ and $P$. The task is to generate randomly $\{P_k\}$ such ... | algorithms pseudo random generators | 1 | Generating numbers to be averaged efficiently -- (algorithms pseudo random generators)
<p>During my research, I had encountered the following issue. Consider the equation
$$\sum_{k=1}^K\alpha_k P_k = P$$</p>

<p>where $\sum_{k=1}^K\alpha_k=1$, $\alpha_k > 0$, $P_k > 0, P>0$.</p>

<p>So you ... | habedi/stack-exchange-dataset |
79,859 | 01 Knapsack with selection of items with minimum total weight | <p>I have a slightly modified version of a classical 01 knapsack problem. Specifically, the problem has an additional constraint which requires that if more than one feasible selection with equal value exists then the selection with minimum total weight be selected. For example, consider a knapsack with size 3 and the ... | knapsack problems | 1 | 01 Knapsack with selection of items with minimum total weight -- (knapsack problems)
<p>I have a slightly modified version of a classical 01 knapsack problem. Specifically, the problem has an additional constraint which requires that if more than one feasible selection with equal value exists then the selection with mi... | habedi/stack-exchange-dataset |
79,860 | Building segment tree without adding extra elements to its size | <p>I recently learned about segment trees as data structures, and what I learned was that we are always building segment tree with size $N$ such that $N$ is power of two. If $N$ is not power of two we can add more elements to the end of the tree.</p>

<p>However, I was wondering is the segment tree going to wor... | data structures trees | 1 | Building segment tree without adding extra elements to its size -- (data structures trees)
<p>I recently learned about segment trees as data structures, and what I learned was that we are always building segment tree with size $N$ such that $N$ is power of two. If $N$ is not power of two we can add more elements to the... | habedi/stack-exchange-dataset |
79,865 | Simulating DFA operations on non-regular languages with finite final state set | <p>A language I'm investigating is not regular since the minimal DFA for the language grows depending on input string size. However, while the number of non-final states increases, the final states are the same small strictly finite core which include the initial state.</p>

<p>Another <a href="https://cstheory... | regular languages finite automata | 1 | Simulating DFA operations on non-regular languages with finite final state set -- (regular languages finite automata)
<p>A language I'm investigating is not regular since the minimal DFA for the language grows depending on input string size. However, while the number of non-final states increases, the final states are ... | habedi/stack-exchange-dataset |
79,870 | Complexity of membership testing for finite-regular languages | <p>A language <span class="math-container">$L \subseteq \Sigma^*$</span> is <em>finite-regular</em> if there exists <span class="math-container">$C$</span> such that for all <span class="math-container">$n$</span>, <span class="math-container">$L \cap \Sigma^n$</span> is accepted by some DFA with at most <span class="m... | time complexity regular languages finite automata | 1 | Complexity of membership testing for finite-regular languages -- (time complexity regular languages finite automata)
<p>A language <span class="math-container">$L \subseteq \Sigma^*$</span> is <em>finite-regular</em> if there exists <span class="math-container">$C$</span> such that for all <span class="math-container">... | habedi/stack-exchange-dataset |
79,878 | What is the correct FSA representation of the following string sequence? | <p>Based on <a href="http://blog.burntsushi.net/transducers/#construction" rel="nofollow noreferrer">this</a> article, i am trying to imagine how i would construct an FSA based index for the following string sequence:</p>

<ol>
<li>ABCDEF</li>
<li>ABDDDF</li>
<li>ABDDEFGHI</li>
</ol>

<p... | automata finite automata | 1 | What is the correct FSA representation of the following string sequence? -- (automata finite automata)
<p>Based on <a href="http://blog.burntsushi.net/transducers/#construction" rel="nofollow noreferrer">this</a> article, i am trying to imagine how i would construct an FSA based index for the following string sequence:... | habedi/stack-exchange-dataset |
79,885 | Solving $UCYCLE$ in logspace - two possible approaches ? Why can't we one of them use to solve connectivity? | <p>$$UCYLE = \mathcal \{ <G> ~:~ G \text{ is an undirected graph that contains a simple cycle}\}.$$<br>
There are two possible approaches to this exercise:
<a href="https://cs.stackexchange.com/questions/41391/solving-cycle-in-undirected-graph-in-log-space">Solving cycle in undirected graph in log space?<... | complexity theory graphs space complexity | 1 | Solving $UCYCLE$ in logspace - two possible approaches ? Why can't we one of them use to solve connectivity? -- (complexity theory graphs space complexity)
<p>$$UCYLE = \mathcal \{ <G> ~:~ G \text{ is an undirected graph that contains a simple cycle}\}.$$<br>
There are two possible approaches to this exercise... | habedi/stack-exchange-dataset |
79,886 | What is the branching factor for nondeterministic games? | <p>Given a nondeterministic game how could one know the branching factor of it? Is it the number of all possible outcomes?</p>

<p>I have an example game in which you have some cards. The goal is to get rid of all of them. At the start of the game you get 7 random cards. There is a draw pile from which you take... | trees search trees | 1 | What is the branching factor for nondeterministic games? -- (trees search trees)
<p>Given a nondeterministic game how could one know the branching factor of it? Is it the number of all possible outcomes?</p>

<p>I have an example game in which you have some cards. The goal is to get rid of all of them. At the s... | habedi/stack-exchange-dataset |
79,887 | Is deciding whether or not a graph is bipartite in $L$? | <p>Let's consider the problem:</p>

<blockquote>
 <p>Prove that decision whether a graph is bipartite is in $LOGSPACE$. </p>
</blockquote>

<p>I am convinced that I should use Reingold's theorem. I know that I test whether graph contains an odd-length cycle. </p>

<p>For a given graph $... | complexity theory | 1 | Is deciding whether or not a graph is bipartite in $L$? -- (complexity theory)
<p>Let's consider the problem:</p>

<blockquote>
 <p>Prove that decision whether a graph is bipartite is in $LOGSPACE$. </p>
</blockquote>

<p>I am convinced that I should use Reingold's theorem. I know that I test w... | habedi/stack-exchange-dataset |
79,890 | Cross Edge and Back Edge when doing BFS | <p>I was asking to prove that </p>

<blockquote>
 <p>For any directed graph, when we perform BFS, for each cross edge $(u,v)$,
 there is some time when both vertices $u$ and $v$ appear in the queue.
 (In other words, we have a queue like this: $Q = \langle v_1,v_2,..u,..,v,..v_k \rangle$.)</p>&#x... | graphs | 1 | Cross Edge and Back Edge when doing BFS -- (graphs)
<p>I was asking to prove that </p>

<blockquote>
 <p>For any directed graph, when we perform BFS, for each cross edge $(u,v)$,
 there is some time when both vertices $u$ and $v$ appear in the queue.
 (In other words, we have a queue like this: $... | habedi/stack-exchange-dataset |
79,893 | Procedure to automatically solve field theorems in a SMT solver | <p>I'm working with the <a href="https://github.com/epfl-lara/welder/" rel="nofollow noreferrer">Welder proof assistant</a>. Basically, this system uses basic inference rules to modify the goal one wants to proof. At a latter step, the modified goals are passed to a SMT solver to see if it can prove them. I have alread... | logic proof assistants automated theorem proving | 1 | Procedure to automatically solve field theorems in a SMT solver -- (logic proof assistants automated theorem proving)
<p>I'm working with the <a href="https://github.com/epfl-lara/welder/" rel="nofollow noreferrer">Welder proof assistant</a>. Basically, this system uses basic inference rules to modify the goal one want... | habedi/stack-exchange-dataset |
79,907 | Any algorithm polynomial time with infinite space? | <p>If I had an arbitrary amount of space at my disposal, couldn't I vectorize/parallelize any program in such a way that it would only need one step? For example, I could let my CPU have an inbuilt look-up-table for the function (x+y)/z with 3 input values instead of doing the calculation in 2 steps.<br>
Does there... | complexity theory time complexity space complexity | 1 | Any algorithm polynomial time with infinite space? -- (complexity theory time complexity space complexity)
<p>If I had an arbitrary amount of space at my disposal, couldn't I vectorize/parallelize any program in such a way that it would only need one step? For example, I could let my CPU have an inbuilt look-up-table f... | habedi/stack-exchange-dataset |
79,913 | How do confluently persistent data structures handle merge conflicts? | <p>From my limited understanding fully persistent data structures allow changes to be made to previous nodes, with new nodes creating a branch rooted at the changed node, resulting in a tree of nodes and also disallowing the remerging of these branches.</p>

<pre><code> o o o
 /
o o o o o o o... | persistent data structure | 1 | How do confluently persistent data structures handle merge conflicts? -- (persistent data structure)
<p>From my limited understanding fully persistent data structures allow changes to be made to previous nodes, with new nodes creating a branch rooted at the changed node, resulting in a tree of nodes and also disallowin... | habedi/stack-exchange-dataset |
79,918 | An efficient method to compute a minimum set of sets that form the union of these sets? | <p>Let's say we have a set of sets:</p>

<p>$$\mathfrak S = \lbrace S_1, S_2, ... , S_n\rbrace$$</p>

<p>And the union of the all the sets in this set:</p>

<p>$$\mathfrak U = \bigcup\limits_{i=1}^{n} S_{i}$$</p>

<p>And so there is at least one minimum set of sets that is identical to t... | algorithms sets | 1 | An efficient method to compute a minimum set of sets that form the union of these sets? -- (algorithms sets)
<p>Let's say we have a set of sets:</p>

<p>$$\mathfrak S = \lbrace S_1, S_2, ... , S_n\rbrace$$</p>

<p>And the union of the all the sets in this set:</p>

<p>$$\mathfrak U = \bigcup\lim... | habedi/stack-exchange-dataset |
79,920 | Proving this language is not context free using the pumping lemma | <p>I am trying to prove why the below language is not context free. Note: this should be carried out by applying the pumping lemma for context free languages.</p>

<p><img src="https://latex.codecogs.com/gif.latex?L&space;=&space;%5Cleft&space;%5C%7B&space;ww%5E%7BR%7Dww%5E%7BR%7Dw&space;|w%5Cepsilon&space;%5Cl... | formal languages context free pumping lemma | 1 | Proving this language is not context free using the pumping lemma -- (formal languages context free pumping lemma)
<p>I am trying to prove why the below language is not context free. Note: this should be carried out by applying the pumping lemma for context free languages.</p>

<p><img src="https://latex.codeco... | habedi/stack-exchange-dataset |
79,924 | NP-complete language as a result of xoring two PTIME languages | <blockquote>
 <p>We define xor operation on languages $L,M\subseteq \{0,1\}^*$:<br>
 $$L\oplus M = \{u\oplus v :|u|=|v|, u\in L, v\in M\}$$ $\oplus$ is
 defined as xor on postions, for example: $001\oplus 100=101$ Show
 that there exist languages $L,M\in PTIME$ such that $L\oplus M\in
 NP ... | complexity theory np complete xor | 1 | NP-complete language as a result of xoring two PTIME languages -- (complexity theory np complete xor)
<blockquote>
 <p>We define xor operation on languages $L,M\subseteq \{0,1\}^*$:<br>
 $$L\oplus M = \{u\oplus v :|u|=|v|, u\in L, v\in M\}$$ $\oplus$ is
 defined as xor on postions, for example: $001\o... | habedi/stack-exchange-dataset |
79,925 | Solve X(n) = 2X(n-1) + 2 recurrence relation | <p>I'm trying to solve the excersice from Knuth's "Concrete
Mathematics":</p>

<pre><code>A Double Tower of Hanoi contains 2n disks of n different sizes, two of
each size. As usual, we're required to move only one disk at a time, 
without putting a larger one over a smaller one.

How many mo... | recurrence relation | 1 | Solve X(n) = 2X(n-1) + 2 recurrence relation -- (recurrence relation)
<p>I'm trying to solve the excersice from Knuth's "Concrete
Mathematics":</p>

<pre><code>A Double Tower of Hanoi contains 2n disks of n different sizes, two of
each size. As usual, we're required to move only one disk at a time, 
... | habedi/stack-exchange-dataset |
79,927 | Are there any proofs that BQP is not in P? | <p><strong>Are there any proofs that BQP is not in P?</strong> In laymen's terms, I am asking if there is any formal proof separating the complexity class that quantum computers are presently assumed to solve efficiently from the complexity class that non-quantum computers are presently known to solve efficiently.</p>... | complexity theory quantum computing | 1 | Are there any proofs that BQP is not in P? -- (complexity theory quantum computing)
<p><strong>Are there any proofs that BQP is not in P?</strong> In laymen's terms, I am asking if there is any formal proof separating the complexity class that quantum computers are presently assumed to solve efficiently from the compl... | habedi/stack-exchange-dataset |
79,928 | Choose N pairs of (job, time slot) with a constraint on the number of different jobs | <p>I am making a solver to choose the best assignment to a set of people for an event, given their availability (chosen in a set $T$ of time slots), jobs preferences (among $J$ possible jobs) and some of other predefined constraints. We refer to a particular pair of <em>(job, time slot)</em> as a "shift".</p>

... | optimization linear programming integer programming | 1 | Choose N pairs of (job, time slot) with a constraint on the number of different jobs -- (optimization linear programming integer programming)
<p>I am making a solver to choose the best assignment to a set of people for an event, given their availability (chosen in a set $T$ of time slots), jobs preferences (among $J$ p... | habedi/stack-exchange-dataset |
79,934 | Lower bound on space of DFS keeping the running time linear | <p>$\mathsf{DFS(G, u) \text{}}$, $G = (V,E)$</p>

<p><strong>Input</strong> : A Directed graph $G$ and a source vertex $u$.</p>

<p><strong>Find</strong> : Is $v$ reachable from vertex $u$ for all $v \in V$ ?</p>

<p><strong>Model of computation</strong> : Word RAM , one can represent a vector... | algorithms complexity theory lower bounds | 1 | Lower bound on space of DFS keeping the running time linear -- (algorithms complexity theory lower bounds)
<p>$\mathsf{DFS(G, u) \text{}}$, $G = (V,E)$</p>

<p><strong>Input</strong> : A Directed graph $G$ and a source vertex $u$.</p>

<p><strong>Find</strong> : Is $v$ reachable from vertex $u$ for al... | habedi/stack-exchange-dataset |
79,938 | Chomsky or Greibach Normal Form? | <p>I tried to solve this exercise:</p>

<p><em>Discuss the normal forms (CNF or GNF) of a grammar with productions:</em></p>

<p>$S\rightarrow BC | CB$</p>

<p>$B\rightarrow cB | c$</p>

<p>$C\rightarrow cC | \epsilon$</p>

<p><em>Same request with the following grammar:</em></p>... | context free formal grammars normal forms | 1 | Chomsky or Greibach Normal Form? -- (context free formal grammars normal forms)
<p>I tried to solve this exercise:</p>

<p><em>Discuss the normal forms (CNF or GNF) of a grammar with productions:</em></p>

<p>$S\rightarrow BC | CB$</p>

<p>$B\rightarrow cB | c$</p>

<p>$C\rightarrow cC |... | habedi/stack-exchange-dataset |
79,942 | Can the "divide" step in a merge sort be avoided? | <p><img src="https://s3.amazonaws.com/ka-cs-algorithms/merge_sort_recursion.png" alt="Merge sort"></p>

<p>So merge sort is a divide and conquer algorithm. While I was looking at the above diagram, I was thinking if it was possible to basically bypass all the divide steps.</p>

<p>If you iterated over t... | algorithms sorting efficiency mergesort | 1 | Can the "divide" step in a merge sort be avoided? -- (algorithms sorting efficiency mergesort)
<p><img src="https://s3.amazonaws.com/ka-cs-algorithms/merge_sort_recursion.png" alt="Merge sort"></p>

<p>So merge sort is a divide and conquer algorithm. While I was looking at the above diagram, I was thinking if i... | habedi/stack-exchange-dataset |
79,946 | Definition of space complexity when algorithm cycles. | <p>I'm reading side by side my class notes and Papadimitrious' Computational Complexity book. At this point they are talking about space complexity. They give rules for computing space employed in an algorithm that runs on a multi-tape Turing machine:</p>

<ol>
<li>We count the cells used.</li>
<li>If w... | turing machines space complexity | 1 | Definition of space complexity when algorithm cycles. -- (turing machines space complexity)
<p>I'm reading side by side my class notes and Papadimitrious' Computational Complexity book. At this point they are talking about space complexity. They give rules for computing space employed in an algorithm that runs on a mul... | habedi/stack-exchange-dataset |
79,947 | Is generating MIN-3-UNSAT $\mathsf{NP}$-hard? | <p>Input: amount of variables (with minimum of $10$ since otherwise problem is unsolvable).</p>

<p>Output: unsatisfiable formula.</p>

<p>Restrictions:</p>

<ol>
<li>Every clause contains exactly 3 variables.</li>
<li>Every clause differs by at least one variable. For example, a pair o... | np hard satisfiability boolean algebra 3 sat | 1 | Is generating MIN-3-UNSAT $\mathsf{NP}$-hard? -- (np hard satisfiability boolean algebra 3 sat)
<p>Input: amount of variables (with minimum of $10$ since otherwise problem is unsolvable).</p>

<p>Output: unsatisfiable formula.</p>

<p>Restrictions:</p>

<ol>
<li>Every clause contains exactly... | habedi/stack-exchange-dataset |
79,954 | Is a finite Solomonoff learner worse than human learning? | <p>An elegant program for a bitstring is the shortest program on a universal Turing machine that outputs this bitstring. According to Kolmogorov complexity, the length of the elegant program is independent of the Turing machine implementation.</p>

<p><a href="https://en.wikipedia.org/wiki/Solomonoff%27s_theor... | machine learning computer vs human | 1 | Is a finite Solomonoff learner worse than human learning? -- (machine learning computer vs human)
<p>An elegant program for a bitstring is the shortest program on a universal Turing machine that outputs this bitstring. According to Kolmogorov complexity, the length of the elegant program is independent of the Turing m... | habedi/stack-exchange-dataset |
79,955 | Is the language A decidable? | <p>Is the language $A$ decidable ? Please help me get the proof right !!</p>

<p>$A = \{ \langle M \rangle | M \text{ is } TM \text{ such that } L(M) \neq \Sigma^* \}$</p>

<p>My proof is by contradiction. Assume $A$ is decidable and let $R$ be decider for it. I will construct decider $S$ for $A_{tm}... | turing machines undecidability | 1 | Is the language A decidable? -- (turing machines undecidability)
<p>Is the language $A$ decidable ? Please help me get the proof right !!</p>

<p>$A = \{ \langle M \rangle | M \text{ is } TM \text{ such that } L(M) \neq \Sigma^* \}$</p>

<p>My proof is by contradiction. Assume $A$ is decidable and le... | habedi/stack-exchange-dataset |
79,958 | Three Partition-Function Algorithms Comparison | <p>I have implemented three algorithms codes, in Swift:</p>

<p>1- Polynomial coefficient:</p>

<pre><code> // create polynomial
func arrangePoly(ofTerms term: Int, toLength len: Int) -> [Int] {
 var a = Array(repeating: 0, count: len+1)

 for i in stride(from: 0, to: a.count, b... | algorithms complexity theory algorithm analysis time complexity | 1 | Three Partition-Function Algorithms Comparison -- (algorithms complexity theory algorithm analysis time complexity)
<p>I have implemented three algorithms codes, in Swift:</p>

<p>1- Polynomial coefficient:</p>

<pre><code> // create polynomial
func arrangePoly(ofTerms term: Int, toLength len: Int) ... | habedi/stack-exchange-dataset |
79,960 | Logarithmic reduction to another LOGSPACE problem | <p>For words of the same length $u = u_1..u_n, v = v_1..v_n$ over an alphabet $A$ let $$u \circ v = u_1v_1...u_nv_n$$</p>

<p>Prove that if $L$ over $A \times A$ in in LOGSPACE then $$L' = \{uv : u \circ v \in L\}$$
is also in LOGSPACE</p>

<p>My solution:
We try to log-reduce $L'$ to $L$. So, I... | complexity theory reductions | 1 | Logarithmic reduction to another LOGSPACE problem -- (complexity theory reductions)
<p>For words of the same length $u = u_1..u_n, v = v_1..v_n$ over an alphabet $A$ let $$u \circ v = u_1v_1...u_nv_n$$</p>

<p>Prove that if $L$ over $A \times A$ in in LOGSPACE then $$L' = \{uv : u \circ v \in L\}$$
is also ... | habedi/stack-exchange-dataset |
79,963 | Prove that checking if context free grammar generates word with all symbols is NP-complete - unclear statement about encoing probem in exercise | <blockquote>
<p>Prove that following problem is complete in NP in sense of Karp.</p>
<p>Given: context free grammar <span class="math-container">$G$</span></p>
<p>Check if <span class="math-container">$G$</span> generates word containing
all symbols from alphabet</p>
<p><strong>Remark</strong>
A... | complexity theory context free np complete np | 1 | Prove that checking if context free grammar generates word with all symbols is NP-complete - unclear statement about encoing probem in exercise -- (complexity theory context free np complete np)
<blockquote>
<p>Prove that following problem is complete in NP in sense of Karp.</p>
<p>Given: context free grammar <... | habedi/stack-exchange-dataset |
79,965 | Question about NP problem certificates and P=NP | <p>From my understanding a problem is considered to be in NP time if it can be solved in polynomial time with a non-deterministic Turing machine and verified in polynomial time with a certificate.</p>

<p>My question is whether or not creating an algorithm to determine values accepted by a certificate for an NP... | complexity theory np complete np polynomial time nondeterminism | 1 | Question about NP problem certificates and P=NP -- (complexity theory np complete np polynomial time nondeterminism)
<p>From my understanding a problem is considered to be in NP time if it can be solved in polynomial time with a non-deterministic Turing machine and verified in polynomial time with a certificate.</p>&#x... | habedi/stack-exchange-dataset |
79,979 | Number of minimal unsatisfiable partial assignments in 2-SAT/3-SAT | <p>A minimal unsatisfiable partial assignment for 3-CNF is a partial assignment that:</p>

<ol>
<li>There exist a clause where all variables are unsatisfied.</li>
<li>Unfixing any variable make every clause contain at least one free variable.</li>
</ol>

<p>Particularly for 2-SAT and 3-SAT i... | satisfiability counting | 1 | Number of minimal unsatisfiable partial assignments in 2-SAT/3-SAT -- (satisfiability counting)
<p>A minimal unsatisfiable partial assignment for 3-CNF is a partial assignment that:</p>

<ol>
<li>There exist a clause where all variables are unsatisfied.</li>
<li>Unfixing any variable make every clause c... | habedi/stack-exchange-dataset |
79,981 | Why do we use dynamic memory allocation in general and why did we use it in this particular example? | <p>Dynamic Programming C/C++ implementation of LIS(Longest Increasing Subsequence) problem</p>

<pre><code>/* lis() returns the length of the longest increasing
subsequence in arr[] of size n */

int lis( int arr[], int n )
{
int *lis, i, j, max = 0;
lis = (int*) malloc ( sizeof( int ) *... | dynamic programming memory allocation | 1 | Why do we use dynamic memory allocation in general and why did we use it in this particular example? -- (dynamic programming memory allocation)
<p>Dynamic Programming C/C++ implementation of LIS(Longest Increasing Subsequence) problem</p>

<pre><code>/* lis() returns the length of the longest increasing
sub... | habedi/stack-exchange-dataset |
79,984 | What does $n^{O(1)}$ mean? | <p>I read an example that said explain what "$f(n)$ is $n^{O(1)}$" means.</p>

<p>I can't interpret the $n^{O(1)}$ syntax. I know what Big $O$ notation is, its just that this example looks odd to me.</p>
 | asymptotics landau notation notation | 1 | What does $n^{O(1)}$ mean? -- (asymptotics landau notation notation)
<p>I read an example that said explain what "$f(n)$ is $n^{O(1)}$" means.</p>

<p>I can't interpret the $n^{O(1)}$ syntax. I know what Big $O$ notation is, its just that this example looks odd to me.</p>
 | habedi/stack-exchange-dataset |
79,986 | Why do we need Gibbs sampling (and MCMC)? | <p>I just learned about Gibbs Sampling which is an MCMC method. Given a distribution $\pi$, we want to sample an item according to $\pi$.</p>

<p>Maybe my alternative suggestion would sound somewhat naive (even stupid) but why can't we just draw a number in random from $[0,M]$ for some sufficiently large enough... | algorithms randomness sampling markov chains | 1 | Why do we need Gibbs sampling (and MCMC)? -- (algorithms randomness sampling markov chains)
<p>I just learned about Gibbs Sampling which is an MCMC method. Given a distribution $\pi$, we want to sample an item according to $\pi$.</p>

<p>Maybe my alternative suggestion would sound somewhat naive (even stupid) b... | habedi/stack-exchange-dataset |
79,990 | Can quantum computer compute the sum of $n$ natural numbers in $\Theta(\log n)$ time? | <p>Classical computer <strong>always</strong> requires no matter what $\Theta(n)$ time to compute the sum of $n$ natural numbers, <strong>but</strong> can quantum computer do that in $\Theta(\log n)$ time?</p>

<p>Given that $a$ is an infinite sequence of natural numbers defined either iteratively or recursivel... | complexity theory time complexity runtime analysis quantum computing | 1 | Can quantum computer compute the sum of $n$ natural numbers in $\Theta(\log n)$ time? -- (complexity theory time complexity runtime analysis quantum computing)
<p>Classical computer <strong>always</strong> requires no matter what $\Theta(n)$ time to compute the sum of $n$ natural numbers, <strong>but</strong> can quant... | habedi/stack-exchange-dataset |
79,992 | Does an algorithm with complexity $\Theta(2^\sqrt{n})$ to solve any NP problem count as "good" and practical as any other polynomial algorithm? | <p>If the complexity of an arbitrary algorithm to solve any NP problem after analysis is $\Theta(2^\sqrt{n})$ then is this algorithm considered as "good" and practical algorithm?</p>

<p>I know that in algorithm analysis and computational complexity theory every algorithm with any polynomial complexity is consi... | complexity theory | 1 | Does an algorithm with complexity $\Theta(2^\sqrt{n})$ to solve any NP problem count as "good" and practical as any other polynomial algorithm? -- (complexity theory)
<p>If the complexity of an arbitrary algorithm to solve any NP problem after analysis is $\Theta(2^\sqrt{n})$ then is this algorithm considered as "good"... | habedi/stack-exchange-dataset |
80,002 | Finding k-nearest neighbors to a set of nodes in a large graph | <p>Given a large graph $G=(V,E)$, a set of nodes $S\subseteq V$, the problem is finding the $k$-nearest nodes in $V$ to the nodes in $S$.</p>

<p>Given a pair of nodes $(u,v)$, the distance $d(u,v)$ between $u$ and $v$ is defined as the length of the shortest path between them. Hence, the lower the distance is,... | algorithms graphs optimization approximation nearest neighbour | 1 | Finding k-nearest neighbors to a set of nodes in a large graph -- (algorithms graphs optimization approximation nearest neighbour)
<p>Given a large graph $G=(V,E)$, a set of nodes $S\subseteq V$, the problem is finding the $k$-nearest nodes in $V$ to the nodes in $S$.</p>

<p>Given a pair of nodes $(u,v)$, the ... | habedi/stack-exchange-dataset |
80,005 | Is this a correct approch of finding expected runtime of an algorithm? | <p>Consider two algorithms; we analysis their run time only by counting the number of comparisons</p>

<pre><code>TwoMax1(A): 
 S = negative infinite
 L = negative infinite
 loop through the array A
 if A[i] > L:
 S = L
 L = A[i]
 ... | runtime analysis average case | 1 | Is this a correct approch of finding expected runtime of an algorithm? -- (runtime analysis average case)
<p>Consider two algorithms; we analysis their run time only by counting the number of comparisons</p>

<pre><code>TwoMax1(A): 
 S = negative infinite
 L = negative infinite
 loop t... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.