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 |
|---|---|---|---|---|---|---|
63,874 | What questions can denotational semantics answer that operational semantics can't? | <p>I am familiar with operational semantics (both small-step and big-step) for defining programming languages. I'm interested in learning denotational semantics as well, but I'm not sure if it will be worth the effort. Will I just be learning the same material from a different point of view, or are there insights I can... | semantics operational semantics denotational semantics | 1 | What questions can denotational semantics answer that operational semantics can't? -- (semantics operational semantics denotational semantics)
<p>I am familiar with operational semantics (both small-step and big-step) for defining programming languages. I'm interested in learning denotational semantics as well, but I'm... | habedi/stack-exchange-dataset |
63,881 | To build a special unary regular expression | <p>Say that there's a prime number P, 
And we can easily build an unary regular expression [E0]for every number that is divisible by P:
E0::= (aaaa...a)*,with p "a", </p>

<p>The question is, how do we build the opposite unary regular expression [E1], for every number that isn't divisible by P? </p>
... | regular languages regular expressions | 1 | To build a special unary regular expression -- (regular languages regular expressions)
<p>Say that there's a prime number P, 
And we can easily build an unary regular expression [E0]for every number that is divisible by P:
E0::= (aaaa...a)*,with p "a", </p>

<p>The question is, how do we build the oppos... | habedi/stack-exchange-dataset |
63,894 | Software mutexes and consensus number 1 | <p>There are numerous possibilities to implement a software mutex using only shared memory (e.g. <a href="https://en.wikipedia.org/wiki/Dekker%27s_algorithm" rel="noreferrer">Dekker's algorithm</a>).</p>

<p>Recently I've read the following from a paper <a href="http://www.cs.brown.edu/~mph/Herlihy91/p124-herli... | concurrency mutual exclusion | 1 | Software mutexes and consensus number 1 -- (concurrency mutual exclusion)
<p>There are numerous possibilities to implement a software mutex using only shared memory (e.g. <a href="https://en.wikipedia.org/wiki/Dekker%27s_algorithm" rel="noreferrer">Dekker's algorithm</a>).</p>

<p>Recently I've read the followi... | habedi/stack-exchange-dataset |
63,898 | "Functorial" reductions? | <p>If I understand correctly, $\mathsf{NC}^0$ reductions are taken as the formalization of the concept of "local" reduction, i.e., a reduction that acts locally on substructures of the instances of the problem to be reduced: they map fixed-size "gadgets" of the source problem to fixed-size structures of the target prob... | complexity theory reductions | 1 | "Functorial" reductions? -- (complexity theory reductions)
<p>If I understand correctly, $\mathsf{NC}^0$ reductions are taken as the formalization of the concept of "local" reduction, i.e., a reduction that acts locally on substructures of the instances of the problem to be reduced: they map fixed-size "gadgets" of the... | habedi/stack-exchange-dataset |
63,900 | Algorithm Complexity Analysis on functional programming language implementations | <p>I've learned <a href="https://cs.stackexchange.com/questions/63889/is-there-a-decision-algorithm-with-time-complexity-of-%d3%a8n%c2%b2?noredirect=1#comment135296_63889">today</a> that algorithm analysis differs based on computational model. It is something I've never thought about or heard of. </p>

<p>An ex... | complexity theory algorithm analysis computability computation models lambda calculus | 1 | Algorithm Complexity Analysis on functional programming language implementations -- (complexity theory algorithm analysis computability computation models lambda calculus)
<p>I've learned <a href="https://cs.stackexchange.com/questions/63889/is-there-a-decision-algorithm-with-time-complexity-of-%d3%a8n%c2%b2?noredirect... | habedi/stack-exchange-dataset |
63,904 | Enumerating sets in a random order | <p>I have multiples arrays. I'd like to enumerate all sets containing exactly one item from each array in a (pseudo-)random order, without explicitly building the array of all sets. </p>

<p>Any solution, even with poor pseudo-randomization, is welcome.</p>

<p>EDIT: Example for clarity:</p>

<p... | algorithms sets randomness enumeration | 1 | Enumerating sets in a random order -- (algorithms sets randomness enumeration)
<p>I have multiples arrays. I'd like to enumerate all sets containing exactly one item from each array in a (pseudo-)random order, without explicitly building the array of all sets. </p>

<p>Any solution, even with poor pseudo-random... | habedi/stack-exchange-dataset |
63,911 | Unique triangulation duals of simple polygons | <p>Given a triangulation (without Steiner points) of a simple polygon $P$, one can consider the dual of this triangulation, which is defined as follows. We create a vertex for every triangle in our triangulation, and we connect two vertices if the corresponding triangles share an edge. The dual graph is known to be a t... | reference request computational geometry | 1 | Unique triangulation duals of simple polygons -- (reference request computational geometry)
<p>Given a triangulation (without Steiner points) of a simple polygon $P$, one can consider the dual of this triangulation, which is defined as follows. We create a vertex for every triangle in our triangulation, and we connect ... | habedi/stack-exchange-dataset |
63,919 | Why complement of most negative number in octal does not turn out to be itself | <p>I know the range of the $n$ digit numbers in $r$'s complement system is given as </p>

<blockquote>
 <p>$r^{n-1}-1$ to 0 to $-r^{n-1}$.</p>
</blockquote>

<p>So for 3 bit 2's complement, its:</p>

<blockquote>
 <p>$(2^2-1)$ to $0$ to $-(2^2)$<br>
 that is<br>
 $3$ to $... | arithmetic number formats | 1 | Why complement of most negative number in octal does not turn out to be itself -- (arithmetic number formats)
<p>I know the range of the $n$ digit numbers in $r$'s complement system is given as </p>

<blockquote>
 <p>$r^{n-1}-1$ to 0 to $-r^{n-1}$.</p>
</blockquote>

<p>So for 3 bit 2's complem... | habedi/stack-exchange-dataset |
63,922 | Why do depth-limited search algorithm and BFS have different memory complexity? | <p>Let be $b$ the branching factor of the tree.</p>

<p>Let be $d$ the depth of the shallowest solution.</p>

<p>Let be $l$ the limit given to depth-limited search algorithm</p>

<p>Why is depth-limited search algorithm memory complexity $\mathcal O(b)$ times something (which is actually $\mathc... | algorithm analysis space analysis searching | 1 | Why do depth-limited search algorithm and BFS have different memory complexity? -- (algorithm analysis space analysis searching)
<p>Let be $b$ the branching factor of the tree.</p>

<p>Let be $d$ the depth of the shallowest solution.</p>

<p>Let be $l$ the limit given to depth-limited search algorithm</... | habedi/stack-exchange-dataset |
63,928 | How to show that a language {w|ww^R in A} is regular, A being regular? | <p>Been working on my homework and I've been stuck on a question for over a week now. Not really asking for a solution but if someone could point me towards the right direction that would be great, as I have literally no idea of how to go about this. A previous question asked us to show that for any DFA that accepts A,... | formal languages regular languages closure properties | 1 | How to show that a language {w|ww^R in A} is regular, A being regular? -- (formal languages regular languages closure properties)
<p>Been working on my homework and I've been stuck on a question for over a week now. Not really asking for a solution but if someone could point me towards the right direction that would be... | habedi/stack-exchange-dataset |
63,929 | Proving that quantum circuits not involving entanglement are inefficient | <p>I heard in a video that it can be proven that quantum circuits not involving entanglement can be efficiently simulated on a classical computer; i.e., that there is no point to building quantum circuits not involving entanglement. I have heard this referenced elsewhere in google searches, but nowhere can I find this ... | proof techniques quantum computing circuits | 1 | Proving that quantum circuits not involving entanglement are inefficient -- (proof techniques quantum computing circuits)
<p>I heard in a video that it can be proven that quantum circuits not involving entanglement can be efficiently simulated on a classical computer; i.e., that there is no point to building quantum ci... | habedi/stack-exchange-dataset |
63,931 | What is the advantage of heaps over sorted arrays? | <p>I'm fairly new to heaps and am trying to wrap my head around why min and max heaps are represented as trees when a sorted array appears to both provide min / max properties by default.</p>

<p>And a follow up: what is the advantage of dealing with the complexity of inserting into a heap given an algorithm li... | data structures arrays heaps | 1 | What is the advantage of heaps over sorted arrays? -- (data structures arrays heaps)
<p>I'm fairly new to heaps and am trying to wrap my head around why min and max heaps are represented as trees when a sorted array appears to both provide min / max properties by default.</p>

<p>And a follow up: what is the ad... | habedi/stack-exchange-dataset |
63,945 | What happens internally when you remove an object from a treemap | <p>I am wondering what happens if you remove an object in the middle of a treemap. 
If the treemap would look something like this:</p>

<p><a href="https://i.stack.imgur.com/mAUkN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mAUkN.png" alt="enter image description here"></a></p>
&#... | data structures search trees dictionaries binary search trees | 1 | What happens internally when you remove an object from a treemap -- (data structures search trees dictionaries binary search trees)
<p>I am wondering what happens if you remove an object in the middle of a treemap. 
If the treemap would look something like this:</p>

<p><a href="https://i.stack.imgur.com/mA... | habedi/stack-exchange-dataset |
63,949 | Creating a decision tree? | <p>So I'm trying to split on an attribute "Color" that has possible values (Blue,Green,Red,Orange,Pink). </p>

<p>I'm splitting on <a href="http://homes.cs.washington.edu/~shapiro/EE596/notes/InfoGain.pdf" rel="nofollow">entropy</a> values, and the best split can either be Multi-Way 5, Multi-Way 4, Multi-Way 3,... | trees enumeration bdd | 1 | Creating a decision tree? -- (trees enumeration bdd)
<p>So I'm trying to split on an attribute "Color" that has possible values (Blue,Green,Red,Orange,Pink). </p>

<p>I'm splitting on <a href="http://homes.cs.washington.edu/~shapiro/EE596/notes/InfoGain.pdf" rel="nofollow">entropy</a> values, and the best split... | habedi/stack-exchange-dataset |
63,954 | Best improvements to do to the DPLL SAT algorithm | <p>As part of a college class, I'm asked to improve the performance of a basic DPLL sat solver. I'm already provided a basic, slow working version (essentially the DPLL algorithm; furthermore, to select the next variable, it just loops an array and gets the next unused one). I have been reading papers on ways to impro... | algorithms satisfiability sat solvers program optimization | 1 | Best improvements to do to the DPLL SAT algorithm -- (algorithms satisfiability sat solvers program optimization)
<p>As part of a college class, I'm asked to improve the performance of a basic DPLL sat solver. I'm already provided a basic, slow working version (essentially the DPLL algorithm; furthermore, to select the... | habedi/stack-exchange-dataset |
63,959 | A Dead-lock in an Operating System is | <p>A Dead-lock in an Operating System is</p>

<ol>
<li>Desirable process</li>
<li>Undesirable process</li>
<li>Definite waiting process</li>
<li>All of the above</li>
</ol>

<hr>

<p>My attempt:</p>

<p>As "If a process is unable to change its state indefinitely becau... | operating systems process scheduling deadlocks | 1 | A Dead-lock in an Operating System is -- (operating systems process scheduling deadlocks)
<p>A Dead-lock in an Operating System is</p>

<ol>
<li>Desirable process</li>
<li>Undesirable process</li>
<li>Definite waiting process</li>
<li>All of the above</li>
</ol>

<hr>

<p>My ... | habedi/stack-exchange-dataset |
63,961 | Why are some programming languages Turing complete but lack some abilities of other languages? | <p>I came across an odd problem when writing an interpreter that (should) hooks to external programs/functions: Functions in 'C' and 'C++' can't hook <a href="https://en.wikipedia.org/wiki/Variadic_function" rel="noreferrer">variadic functions</a>, e.g. I can't make a function that calls 'printf' with the exact same ar... | computability programming languages turing completeness | 1 | Why are some programming languages Turing complete but lack some abilities of other languages? -- (computability programming languages turing completeness)
<p>I came across an odd problem when writing an interpreter that (should) hooks to external programs/functions: Functions in 'C' and 'C++' can't hook <a href="https... | habedi/stack-exchange-dataset |
63,972 | Compute equality comparison without comparison operators | <p>Is there a possibility to compute the result of an integer equality comparison by only using arithmetic or bitwise operations? Negative values use the two-complement representation. </p>

<p>I am looking for a generic algorithm, which results in two possible values for equality and inequality but not using c... | algorithms arithmetic | 1 | Compute equality comparison without comparison operators -- (algorithms arithmetic)
<p>Is there a possibility to compute the result of an integer equality comparison by only using arithmetic or bitwise operations? Negative values use the two-complement representation. </p>

<p>I am looking for a generic algorit... | habedi/stack-exchange-dataset |
63,973 | Can we have a poly time reduction from 2-SAT to 2-Coloring problem? | <p>I know that given a 2-Coloring instance we can easily convert it into a 2-Sat instance in polynomial time . Is the reverse possible? i.e given a 2-sat instance can we convert it into an 2-Coloring instance in poly time?</p>
 | reductions satisfiability | 1 | Can we have a poly time reduction from 2-SAT to 2-Coloring problem? -- (reductions satisfiability)
<p>I know that given a 2-Coloring instance we can easily convert it into a 2-Sat instance in polynomial time . Is the reverse possible? i.e given a 2-sat instance can we convert it into an 2-Coloring instance in poly time... | habedi/stack-exchange-dataset |
63,983 | Big-O comparison different arrangements of similar code | <p>The following code should have a run time of $O(N)$,</p>

<pre><code>int min = INTEGER.MAX_VALUE;
int max = INTEGER.MIN_VALUE;

for (int x : array) {
 if (x < min) min = x;
 if (x > min) max = x;
}
</code></pre>

<p>but what about the following code?</p>
&#... | algorithms runtime analysis loops | 1 | Big-O comparison different arrangements of similar code -- (algorithms runtime analysis loops)
<p>The following code should have a run time of $O(N)$,</p>

<pre><code>int min = INTEGER.MAX_VALUE;
int max = INTEGER.MIN_VALUE;

for (int x : array) {
 if (x < min) min = x;
 if (x > ... | habedi/stack-exchange-dataset |
63,988 | Context Free Grammar for Try-Catch-Finally Statement and Throw | <p>I am currently working on a problem that is asking me to write the grammar productions for the try-catch-finally and throw C# statements. It states that "you can assume that there are nonterminals "Type", "Expression", and "Statement", as well as a terminal "Ident". I do not understand how this is possible using so ... | formal grammars parsers | 1 | Context Free Grammar for Try-Catch-Finally Statement and Throw -- (formal grammars parsers)
<p>I am currently working on a problem that is asking me to write the grammar productions for the try-catch-finally and throw C# statements. It states that "you can assume that there are nonterminals "Type", "Expression", and "S... | habedi/stack-exchange-dataset |
63,990 | Reference request: Category theory as it applies to type systems | <p>I keep hearing about how one must learn category theory to truly understand programming language theory. So far, I've learned a good deal of PL without ever stepping foot into the realm of categories. However, I figured it was time to take the leap to see what I had been missing.</p>

<p>Unfortunately, none ... | reference request programming languages type theory category theory | 1 | Reference request: Category theory as it applies to type systems -- (reference request programming languages type theory category theory)
<p>I keep hearing about how one must learn category theory to truly understand programming language theory. So far, I've learned a good deal of PL without ever stepping foot into the... | habedi/stack-exchange-dataset |
64,006 | Relation between Type Assignment system (TA) and Hindley-Milner system | <p>Recently I started my studies in type theory/type systems and Lambda Calculus.</p>

<p>I have already read about Simple Typed Lambda Calculus in Church and Curry style. The last one is also known as Type Assignment system (TA).</p>

<p>I'm thinking about the relations between TA and Hindley-Milner (H... | type theory type checking type inference | 1 | Relation between Type Assignment system (TA) and Hindley-Milner system -- (type theory type checking type inference)
<p>Recently I started my studies in type theory/type systems and Lambda Calculus.</p>

<p>I have already read about Simple Typed Lambda Calculus in Church and Curry style. The last one is also kn... | habedi/stack-exchange-dataset |
64,012 | Asymptotic growth of search algorithms | <p>I have 2 search algorithms and I have derived the following tight bound representations:</p>

<p>$$ nlog(n)+mlog(n) $$</p>

<p>$$ m∗n $$</p>

<p>Now i want to find a function $f(n)$ so that when $m$ is an element of tight bound $f(n)$, both algorithms have equal asymptotic run time.</p>
&... | asymptotics search algorithms | 1 | Asymptotic growth of search algorithms -- (asymptotics search algorithms)
<p>I have 2 search algorithms and I have derived the following tight bound representations:</p>

<p>$$ nlog(n)+mlog(n) $$</p>

<p>$$ m∗n $$</p>

<p>Now i want to find a function $f(n)$ so that when $m$ is an element of tig... | habedi/stack-exchange-dataset |
64,023 | What does $\mathbf{Q}^+$ mean in approximation texts? | <p>Often, in a lot of texts concerning approximation algorithms I see the following notation (for example, <a href="http://www.cc.gatech.edu/fac/Vijay.Vazirani/book.pdf" rel="nofollow">here</a> in page 19 of the PDF or the first page of the introduction):</p>

<blockquote>
 <p>... and a cost function on ve... | algorithms optimization approximation notation | 1 | What does $\mathbf{Q}^+$ mean in approximation texts? -- (algorithms optimization approximation notation)
<p>Often, in a lot of texts concerning approximation algorithms I see the following notation (for example, <a href="http://www.cc.gatech.edu/fac/Vijay.Vazirani/book.pdf" rel="nofollow">here</a> in page 19 of the PD... | habedi/stack-exchange-dataset |
64,037 | Solve Travelling Salesman once you know the distance of the shortest possible route | <p>I am trying to solve the <code>TSP (Travelling Salesman Problem)</code>, but not in a traditional way. I am following these steps.</p>

<blockquote>
 <p><strong>1)</strong> First I change the TSP to a <strong>true / false</strong> problem.</p>
</blockquote>

<p>The definition of this problem... | algorithms np traveling salesman | 1 | Solve Travelling Salesman once you know the distance of the shortest possible route -- (algorithms np traveling salesman)
<p>I am trying to solve the <code>TSP (Travelling Salesman Problem)</code>, but not in a traditional way. I am following these steps.</p>

<blockquote>
 <p><strong>1)</strong> First I c... | habedi/stack-exchange-dataset |
64,056 | Prove if $L = \{0^m1^n \mid m \neq n\}$ is regular or not | <p>I am trying to show whether this language is regular or not:</p>

<p><span class="math-container">$$L = \{0^m1^n \mid m \neq n\}$$</span></p>

<p>Since I cannot create or think of an automaton that recognizes <span class="math-container">$L$</span>, I am suspecting that <span class="math-container">... | computability automata finite automata pumping lemma | 1 | Prove if $L = \{0^m1^n \mid m \neq n\}$ is regular or not -- (computability automata finite automata pumping lemma)
<p>I am trying to show whether this language is regular or not:</p>

<p><span class="math-container">$$L = \{0^m1^n \mid m \neq n\}$$</span></p>

<p>Since I cannot create or think of an a... | habedi/stack-exchange-dataset |
64,060 | Mergesort recurssion tree depth...logs | <p>I think some of the log properties are flying over my head but I'm trying to understand how the depth of mergesort is...</p>

<p>$1 + \log_2 n$</p>

<p>I understand that to get the depth, you would have to divide $n$ by $2^x$ but I don't how this leads to the above.</p>

<p>It's probably some... | algorithms | 1 | Mergesort recurssion tree depth...logs -- (algorithms)
<p>I think some of the log properties are flying over my head but I'm trying to understand how the depth of mergesort is...</p>

<p>$1 + \log_2 n$</p>

<p>I understand that to get the depth, you would have to divide $n$ by $2^x$ but I don't how this... | habedi/stack-exchange-dataset |
64,064 | I have a problem understanding a solution for number theory problem from SPOJ | <p>Problem statement can be found <a href="http://www.spoj.com/problems/PRIME1/" rel="nofollow">here</a> or down below.</p>

<p>The solution which I'm trying to understand can be found <a href="http://jamie-wong.com/2009/11/12/spoj-problem-2-prime-generator/" rel="nofollow">here</a> or down below.</p>

... | algorithms primes | 1 | I have a problem understanding a solution for number theory problem from SPOJ -- (algorithms primes)
<p>Problem statement can be found <a href="http://www.spoj.com/problems/PRIME1/" rel="nofollow">here</a> or down below.</p>

<p>The solution which I'm trying to understand can be found <a href="http://jamie-wong... | habedi/stack-exchange-dataset |
64,075 | how type checking fails? | <p>I was doing a type checking example in system f sub on paper to understand how it works.</p>

<p>according to Pierce's book <a href="https://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow">Types and Programming Languages</a>, numbers and their types are following in system f sub. (see chapter 26.3, page 39... | lambda calculus type theory type checking polymorphisms | 1 | how type checking fails? -- (lambda calculus type theory type checking polymorphisms)
<p>I was doing a type checking example in system f sub on paper to understand how it works.</p>

<p>according to Pierce's book <a href="https://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow">Types and Programming Languages<... | habedi/stack-exchange-dataset |
64,088 | Find the Unambiguous Grammar | <p>Consider the following grammar:
S->A.<br>
A->A+A|B++.<br>
B->y</p>

<p>Check whether grammar is Ambiguous or not?
Also ,unambiguate the grammar.Now please tell me what will be the grammar after removing the ambiguity. </p>

<p>I have worked over here and i am able to draw two parse tr... | formal grammars compilers ambiguity | 1 | Find the Unambiguous Grammar -- (formal grammars compilers ambiguity)
<p>Consider the following grammar:
S->A.<br>
A->A+A|B++.<br>
B->y</p>

<p>Check whether grammar is Ambiguous or not?
Also ,unambiguate the grammar.Now please tell me what will be the grammar after removing the ambiguity. </p>&... | habedi/stack-exchange-dataset |
64,089 | How to change the algorithm implication by changing the invariant? | <p>I have this specification in GCL:</p>

<p>$[Ctx C: n\geqslant 0\ \wedge\ b:[0..n-1]\ \text{of int}$</p>

<p>$\{Q:\text{True}\}$</p>

<p>$sum,i:=0,0;$</p>

<p>$\{\text{Invariant}\ P: 0\leqslant i \leqslant n\ \wedge sum=\sum_{j=0}^{i-1} b[j]\}$</p>

<p>$\{T:n-i\}$</p>

... | algorithms hoare logic | 1 | How to change the algorithm implication by changing the invariant? -- (algorithms hoare logic)
<p>I have this specification in GCL:</p>

<p>$[Ctx C: n\geqslant 0\ \wedge\ b:[0..n-1]\ \text{of int}$</p>

<p>$\{Q:\text{True}\}$</p>

<p>$sum,i:=0,0;$</p>

<p>$\{\text{Invariant}\ P: 0\leqsla... | habedi/stack-exchange-dataset |
64,093 | Algorithm to find maximum number of floors you can check with N eggs and D maximum drops | <p>Question: You are given access to a multistory building. You have N eggs and are allowed D maximum drops from their window.</p>

<p>Rules: If a egg is dropped from window of floor F and it breaks, it will break for all floors > F.</p>

<p>If an egg is dropped from window of floor F and survives, i... | algorithms recursion | 1 | Algorithm to find maximum number of floors you can check with N eggs and D maximum drops -- (algorithms recursion)
<p>Question: You are given access to a multistory building. You have N eggs and are allowed D maximum drops from their window.</p>

<p>Rules: If a egg is dropped from window of floor F and it br... | habedi/stack-exchange-dataset |
64,099 | Algebraic data types - unions | <p>Are there any programming languages where algebraic data types can be expressed not only by using intersection and disjoint union but also a standard set union (intersection + disjoint union)?</p>

<p>Do such types even make sense?</p>

<p>If so, could you provide practical example of use?</p>
 | type theory type checking | 1 | Algebraic data types - unions -- (type theory type checking)
<p>Are there any programming languages where algebraic data types can be expressed not only by using intersection and disjoint union but also a standard set union (intersection + disjoint union)?</p>

<p>Do such types even make sense?</p>

<p>... | habedi/stack-exchange-dataset |
64,105 | A question about type rule | <p>I realized that almost no one explained how to selected the type variable T1</p>

<pre><code> Γ ⊢ e1 : T1 -> T , Γ ⊢ e2 : T1
 -------------------------------- T-APP 
 Γ ⊢ e1 e2 : T
</code></pre>

<p>when doing type checking (from bottom to top).</p>

<p>So, the question is ho... | programming languages type theory | 1 | A question about type rule -- (programming languages type theory)
<p>I realized that almost no one explained how to selected the type variable T1</p>

<pre><code> Γ ⊢ e1 : T1 -> T , Γ ⊢ e2 : T1
 -------------------------------- T-APP 
 Γ ⊢ e1 e2 : T
</code></pre>

<p>when doing type che... | habedi/stack-exchange-dataset |
64,113 | Is the following extension of finite state automata studied? | <p>Consider a finite state machine as usual, but every transition, it can also update an integer counter by adding or subtracting a number.
Say, a transition function of the form
$\delta(q,a) = (p,k)$
moves to the new state $p$, and add $k$ to the counter, where $k \in \mathbb{Z}$ (so $k$ can be positive, n... | finite automata | 1 | Is the following extension of finite state automata studied? -- (finite automata)
<p>Consider a finite state machine as usual, but every transition, it can also update an integer counter by adding or subtracting a number.
Say, a transition function of the form
$\delta(q,a) = (p,k)$
moves to the new state $p... | habedi/stack-exchange-dataset |
64,115 | Abs(sum of differences of elements in a sorted array) = array.Max()-array.Min() Why? | <p>I just found out by luck that</p>

<pre><code> Abs(sum of differences of elements in a sorted array) = array.Max()-array.Min() 
</code></pre>

<p>For example,
Consider a sorted array, {1 43 65 97 98 99 101}</p>

<p>Abs(1-43-55-97-98-99-101)= 101-1</p>

<p>Does anyone know why?... | arrays mathematical analysis mathematical programming | 1 | Abs(sum of differences of elements in a sorted array) = array.Max()-array.Min() Why? -- (arrays mathematical analysis mathematical programming)
<p>I just found out by luck that</p>

<pre><code> Abs(sum of differences of elements in a sorted array) = array.Max()-array.Min() 
</code></pre>

<p>For exa... | habedi/stack-exchange-dataset |
64,127 | How do I interpret this formal languages definition? | <p>Given the formal language</p>

<p>$L_1 = \{wcw | w\in \{a,b\}^+\} $</p>

<p>Does this definition requires $w$ to be exactly the same before and after the terminal character $c$ or can it be different?</p>

<p>Example: </p>

<p>Are $aabca$ or $abca$ accepted words of $L_1$, or only wor... | formal languages | 1 | How do I interpret this formal languages definition? -- (formal languages)
<p>Given the formal language</p>

<p>$L_1 = \{wcw | w\in \{a,b\}^+\} $</p>

<p>Does this definition requires $w$ to be exactly the same before and after the terminal character $c$ or can it be different?</p>

<p>Example: ... | habedi/stack-exchange-dataset |
64,130 | What is induction-induction? | <p>What is <em>induction-induction</em>?</p>

<p>The resources I found are:</p>

<ul>
<li><a href="https://homotopytypetheory.org/book/">the HoTT book</a>, at the end of chapter 5.7.</li>
<li><a href="https://ncatlab.org/homotopytypetheory/show/inductive-inductive+type">nLab's article</a></li>&#... | type theory induction inductive datatypes | 1 | What is induction-induction? -- (type theory induction inductive datatypes)
<p>What is <em>induction-induction</em>?</p>

<p>The resources I found are:</p>

<ul>
<li><a href="https://homotopytypetheory.org/book/">the HoTT book</a>, at the end of chapter 5.7.</li>
<li><a href="https://ncatlab.org... | habedi/stack-exchange-dataset |
64,136 | "Regular languages over a common alphabet are closed under union." | <p>I just want to make sure I understand what this means. I am new to Formal Languages and this is my first week of courses. </p>

<p>Suppose we have two regular languages, $L_1$ and $L_2$, with a common alphabet. </p>

<p>The <code>union</code> of $L_1, L_2$ is $\{x:x∈L_1∨x∈L_2\}$</p>

<p>Does ... | regular languages sets mathematical foundations | 1 | "Regular languages over a common alphabet are closed under union." -- (regular languages sets mathematical foundations)
<p>I just want to make sure I understand what this means. I am new to Formal Languages and this is my first week of courses. </p>

<p>Suppose we have two regular languages, $L_1$ and $L_2$, wi... | habedi/stack-exchange-dataset |
64,137 | How many range are completely inside a given range | <p>I have a list of ranges <em>a<sub>i</sub> , b<sub>i</sub></em>. And I have many queries in the form of a range <em>c, d</em>, which asks how many ranges ( a<sub>i</sub>, b<sub>i</sub> ) are completely inside <em>c, d</em>.</p>

<p>c <= a<sub>i</sub> & b<sub>i</sub> <= d</p>

<p>There are ... | algorithms data structures intervals | 1 | How many range are completely inside a given range -- (algorithms data structures intervals)
<p>I have a list of ranges <em>a<sub>i</sub> , b<sub>i</sub></em>. And I have many queries in the form of a range <em>c, d</em>, which asks how many ranges ( a<sub>i</sub>, b<sub>i</sub> ) are completely inside <em>c, d</em>.<... | habedi/stack-exchange-dataset |
64,153 | How does lack of deadlock relate to computability in process calculi? | <p>I'm interested in knowing things about the computability of concurrent programs. If you had a Turing complete language that also let you branch off new programs but had no means of communication between them there would be programs that you couldn't write. Namely those that required communication between concurrentl... | computability reference request concurrency deadlocks process algebras | 1 | How does lack of deadlock relate to computability in process calculi? -- (computability reference request concurrency deadlocks process algebras)
<p>I'm interested in knowing things about the computability of concurrent programs. If you had a Turing complete language that also let you branch off new programs but had no... | habedi/stack-exchange-dataset |
64,164 | Implementing Do keyword in a compiler | <p>I'm writting a compiler implementation for a language that you can see defined <a href="http://lara.epfl.ch/w/cc16:tool" rel="nofollow">here</a>. I having problems designing how the do keyword should be handled. You can find the code I'm referring to in <a href="https://dl.dropboxusercontent.com/u/92679781/Evaluator... | programming languages compilers syntax | 1 | Implementing Do keyword in a compiler -- (programming languages compilers syntax)
<p>I'm writting a compiler implementation for a language that you can see defined <a href="http://lara.epfl.ch/w/cc16:tool" rel="nofollow">here</a>. I having problems designing how the do keyword should be handled. You can find the code I... | habedi/stack-exchange-dataset |
64,172 | Complexity Theory - Why can't you use diagonalization to seperate classes A and B when an orcale O exists under which A=B? | <p>In a recent lecture the professor stated that given two complexity classes A and B, and given the existance of an oracle O such that $$A^o=B^o$$
(As I understand, meaning that a problem in A with can be reduced to a problem in B with the oracle O), It can be shown that classes A and B can not be seperated using ... | complexity theory oracle machines | 1 | Complexity Theory - Why can't you use diagonalization to seperate classes A and B when an orcale O exists under which A=B? -- (complexity theory oracle machines)
<p>In a recent lecture the professor stated that given two complexity classes A and B, and given the existance of an oracle O such that $$A^o=B^o$$
(As I ... | habedi/stack-exchange-dataset |
64,178 | How exactly is this equation for insertion sort time complexity solved so that it shows it is linear? | <h1>Background</h1>

<p>I am currently taking an Algorithm and Analysis course and doing some extra studying on my own from the text book. This is not a homework question or exercise even. I am just trying to understand completely how the authors are doing the combining of terms in the time/cost equation for In... | algorithm analysis | 1 | How exactly is this equation for insertion sort time complexity solved so that it shows it is linear? -- (algorithm analysis)
<h1>Background</h1>

<p>I am currently taking an Algorithm and Analysis course and doing some extra studying on my own from the text book. This is not a homework question or exercise eve... | habedi/stack-exchange-dataset |
64,188 | k-nearest neighbors (Euclidean distance): How to process multiple attributes? | <p>Given this sample:</p>

<p>$$\begin{array}{|c|c|c|} \hline
X1 & X2 (Kg/m^2) & \text{Class} \\ \hline
8 & 4 & A \\ \hline
4 & 5 & B \\ \hline
4 & 6 & B \\ \hline
7 & 7 & A \\ \hline
5 & 6 & B \\ \hline
6 & 5 & A \\ \hline
... | machine learning nearest neighbour | 1 | k-nearest neighbors (Euclidean distance): How to process multiple attributes? -- (machine learning nearest neighbour)
<p>Given this sample:</p>

<p>$$\begin{array}{|c|c|c|} \hline
X1 & X2 (Kg/m^2) & \text{Class} \\ \hline
8 & 4 & A \\ \hline
4 & 5 & B \\ \hline
4 & 6 ... | habedi/stack-exchange-dataset |
64,193 | Why the need for TSP solvers when there are SAT solvers? | <p>Concorde TSP is a solver for TSP. SAT solvers are solvers for boolean satisfiability. TSP and SAT are NP-complete.</p>

<p>Hence, why spent the time to develop Concorde TSP when there is an abundance of SAT solvers in the market back then?</p>
 | np complete satisfiability p vs np traveling salesman sat solvers | 1 | Why the need for TSP solvers when there are SAT solvers? -- (np complete satisfiability p vs np traveling salesman sat solvers)
<p>Concorde TSP is a solver for TSP. SAT solvers are solvers for boolean satisfiability. TSP and SAT are NP-complete.</p>

<p>Hence, why spent the time to develop Concorde TSP when th... | habedi/stack-exchange-dataset |
64,215 | Why does the following Backus-Naur form reflect the following syntax diagram? | <p>The definition of the variable </p>

<p>< number>::=< digit > | < digit >< number > </p>

<p>where < digit > is defined as</p>

<p>< digit > ::= 1|2|3|4|5</p>

<p>Apparently reflects the following syntax diagram</p>

<p><a href="https://i.stack.imgur.com/7C6... | syntax | 1 | Why does the following Backus-Naur form reflect the following syntax diagram? -- (syntax)
<p>The definition of the variable </p>

<p>< number>::=< digit > | < digit >< number > </p>

<p>where < digit > is defined as</p>

<p>< digit > ::= 1|2|3|4|5</p>

<p>Apparently re... | habedi/stack-exchange-dataset |
64,234 | Determining a minimal-state regular language $A$ such that $A \cap B = C$ given regular languages $B$ and $C$ | <p>Suppose I have a regular language $B$ and a regular language $C$ such that $C \subseteq B$.</p>

<p>How do I find a regular language $A$ such that $A \cap B = C$, where $A$ is represented by a DFA with as few states as possible?</p>

<p>I don't really know where to start looking for research on this,... | regular languages finite automata | 1 | Determining a minimal-state regular language $A$ such that $A \cap B = C$ given regular languages $B$ and $C$ -- (regular languages finite automata)
<p>Suppose I have a regular language $B$ and a regular language $C$ such that $C \subseteq B$.</p>

<p>How do I find a regular language $A$ such that $A \cap B = C... | habedi/stack-exchange-dataset |
64,235 | In any finite simple graph with more than one vertex, there is at least one pair of vertices that have the same degree? | <p>Recently, I am reading the book [1]. I am trying to solve the following problem:</p>
<blockquote>
<p><strong>1.2 Pigeons and holes.</strong> Properly speaking, we should call our representation of Königsberg a <em>multigraph</em>, since some pairs of vertices are connected to each other by more than one edge... | graphs | 1 | In any finite simple graph with more than one vertex, there is at least one pair of vertices that have the same degree? -- (graphs)
<p>Recently, I am reading the book [1]. I am trying to solve the following problem:</p>
<blockquote>
<p><strong>1.2 Pigeons and holes.</strong> Properly speaking, we should call ou... | habedi/stack-exchange-dataset |
64,253 | How to understand these exposure algorithm rules for System F sub? | <p>The book "Types and Programming Languages" said System F sub type checking introduce exposure typing rules alongside algorithmic typing and sub-typing rules.</p>

<pre><code> exposure algorithm

 X<:T ∈ Γ Γ |- T ⇑ T'
 --------------------------- (XA-PROMOTE)
 ... | type theory type checking | 1 | How to understand these exposure algorithm rules for System F sub? -- (type theory type checking)
<p>The book "Types and Programming Languages" said System F sub type checking introduce exposure typing rules alongside algorithmic typing and sub-typing rules.</p>

<pre><code> exposure algorithm

 ... | habedi/stack-exchange-dataset |
64,261 | $\{a^n b^n\} \cap \{a^*b^*\}$ regular or not? | <p>I have been asked a very interesting question in preparation for my exam coming up. The question is as follows:</p>

<p>Is $L=\{a^n b^n : n \geq 0\} \cap \{a^*b^*\}$ regular or not?</p>

<p>Assume $L$ is regular. Then, $L^c$ should be regular as well. Thus, $L^c = \{a^n b^n : n \lt 0\} = \{\}$, so if... | formal languages regular languages | 1 | $\{a^n b^n\} \cap \{a^*b^*\}$ regular or not? -- (formal languages regular languages)
<p>I have been asked a very interesting question in preparation for my exam coming up. The question is as follows:</p>

<p>Is $L=\{a^n b^n : n \geq 0\} \cap \{a^*b^*\}$ regular or not?</p>

<p>Assume $L$ is regular. Th... | habedi/stack-exchange-dataset |
64,264 | Dovetailing in Turing Machines? | <p>I was going through TM <a href="https://courses.engr.illinois.edu/cs373/sp2009/lectures/lect_24.pdf" rel="nofollow">here</a> and encountered a term "<strong>Dovetailing</strong>".</p>

<p><strong>What is exactly the dovetailing in Turing Machines?</strong></p>

<p>Can anyone mind to provide a good ex... | turing machines undecidability semi decidability | 1 | Dovetailing in Turing Machines? -- (turing machines undecidability semi decidability)
<p>I was going through TM <a href="https://courses.engr.illinois.edu/cs373/sp2009/lectures/lect_24.pdf" rel="nofollow">here</a> and encountered a term "<strong>Dovetailing</strong>".</p>

<p><strong>What is exactly the dovetai... | habedi/stack-exchange-dataset |
64,268 | Recurrence for quaternary search algorithm | <p>I have to come up with the recurrence for the quaternary search algorithm. </p>

<p>My initial thought is $T(n)=4T(\frac{n}{4})+c$ because the algorithm examines all four subproblems, and each is one quarter the size of the entire array. But this can't be right because that yields a complexity of $O(n)$. I l... | algorithm analysis asymptotics | 1 | Recurrence for quaternary search algorithm -- (algorithm analysis asymptotics)
<p>I have to come up with the recurrence for the quaternary search algorithm. </p>

<p>My initial thought is $T(n)=4T(\frac{n}{4})+c$ because the algorithm examines all four subproblems, and each is one quarter the size of the entire... | habedi/stack-exchange-dataset |
64,272 | What are the gates used to implement Shor's algorithm? | <p>I understand theoretically how Shor's algorithm works, but I don't know what specific gates are used (or would be used) to implement it. What would the quantum circuit look like? </p>
 | algorithms quantum computing circuits | 1 | What are the gates used to implement Shor's algorithm? -- (algorithms quantum computing circuits)
<p>I understand theoretically how Shor's algorithm works, but I don't know what specific gates are used (or would be used) to implement it. What would the quantum circuit look like? </p>
 | habedi/stack-exchange-dataset |
64,273 | Is it or is it not correct to say that the expected runtime of an algorithm is its runtime on the expected problem size? Why? | <p>Say we have an algorithm that takes time $T$ to process a problem of size $n$.</p>

<p>Is $\langle T(n)\rangle $ = $T(\langle n\rangle)$? </p>
 | algorithm analysis runtime analysis | 1 | Is it or is it not correct to say that the expected runtime of an algorithm is its runtime on the expected problem size? Why? -- (algorithm analysis runtime analysis)
<p>Say we have an algorithm that takes time $T$ to process a problem of size $n$.</p>

<p>Is $\langle T(n)\rangle $ = $T(\langle n\rangle)$? </p>... | habedi/stack-exchange-dataset |
64,292 | Why would total comparison of functions solve the Halting problem? | <blockquote>
 <p>Why would total comparison of procedures solve the Halting problem?</p>
</blockquote>

<p>I've read that if all procedures could be represented syntactical e.g. in Scheme, then they could be compared structurally using the predicate <code>=</code>, and this would in turn solve the Halt... | complexity theory halting problem | 1 | Why would total comparison of functions solve the Halting problem? -- (complexity theory halting problem)
<blockquote>
 <p>Why would total comparison of procedures solve the Halting problem?</p>
</blockquote>

<p>I've read that if all procedures could be represented syntactical e.g. in Scheme, then the... | habedi/stack-exchange-dataset |
64,293 | Does throughput includes CPU idle time also? | <p>I have 3 processes P1,P2,P3 having gantt chart as follows =></p>

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

<p>Now, CPU remains idle in 0 - 2 sec and 44 - 47 seconds as I/O is ... | operating systems process scheduling | 1 | Does throughput includes CPU idle time also? -- (operating systems process scheduling)
<p>I have 3 processes P1,P2,P3 having gantt chart as follows =></p>

<p><a href="https://i.stack.imgur.com/LrJp0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LrJp0.jpg" alt="enter image description here"... | habedi/stack-exchange-dataset |
64,296 | Using B trees to search inside dynamically changing array segments | <p>Let $A$ be a sorted array. Suppose that this array is huge and can only be stored in a disk. In the I/O model and algorithms built in this model, every time we access the disk we spend an I/O and we get $B$ elements to the RAM. Since accessing the disk is much more expensive than accessing the main memory, we assume... | algorithms algorithm analysis data structures search algorithms | 1 | Using B trees to search inside dynamically changing array segments -- (algorithms algorithm analysis data structures search algorithms)
<p>Let $A$ be a sorted array. Suppose that this array is huge and can only be stored in a disk. In the I/O model and algorithms built in this model, every time we access the disk we sp... | habedi/stack-exchange-dataset |
64,309 | Z-score relations to perceptrons | <p>I am learning about preceptrons and my professor noted that z-scores are a commmon pre-processing step to normalizing input variables. Following this, I am having trouble understanding why z-scores are useful when training a preceptron? </p>

<p>My current understanding is that z-scores allows us to calculat... | machine learning neural networks statistics perceptron | 1 | Z-score relations to perceptrons -- (machine learning neural networks statistics perceptron)
<p>I am learning about preceptrons and my professor noted that z-scores are a commmon pre-processing step to normalizing input variables. Following this, I am having trouble understanding why z-scores are useful when training a... | habedi/stack-exchange-dataset |
64,322 | how to use type application rule (T-TAPP)? | <p>In the following rule,</p>

<p>$$\dfrac{ \Gamma \vdash t_1 : \forall X.T_{12} }
 { \Gamma \vdash t_1 \ [T_2] : [X \mapsto T_2]T_{12} }
 \textsf{ (T-TApp)}$$ </p>

<p>whend doing type checking, how do know what is $X$?</p>

<p>Also, type checking will not give you a ter... | type theory type checking | 1 | how to use type application rule (T-TAPP)? -- (type theory type checking)
<p>In the following rule,</p>

<p>$$\dfrac{ \Gamma \vdash t_1 : \forall X.T_{12} }
 { \Gamma \vdash t_1 \ [T_2] : [X \mapsto T_2]T_{12} }
 \textsf{ (T-TApp)}$$ </p>

<p>whend doing type checking, how do kno... | habedi/stack-exchange-dataset |
64,330 | Can we define an ε deterministic finite automaton? | <p>I am studying automata and I was wandering if there is a definition of ε-DFA automaton. Is it feasible to define it?</p>
 | automata finite automata | 1 | Can we define an ε deterministic finite automaton? -- (automata finite automata)
<p>I am studying automata and I was wandering if there is a definition of ε-DFA automaton. Is it feasible to define it?</p>
 | habedi/stack-exchange-dataset |
64,331 | Complexity class of integer factorization | <p>Is integer factorization confirmed to be an NP-complete problem? If not, then if one could transform IF into an equivalent problem which is already proved to be NP-complete, would it mean that IF is itself NP-complete as well? Would such a thing have any practical meaning?</p>
 | complexity theory integers factoring | 1 | Complexity class of integer factorization -- (complexity theory integers factoring)
<p>Is integer factorization confirmed to be an NP-complete problem? If not, then if one could transform IF into an equivalent problem which is already proved to be NP-complete, would it mean that IF is itself NP-complete as well? Would ... | habedi/stack-exchange-dataset |
64,334 | N songs, M instruments, how to pick K instruments to cover maximal amount of songs | <p>I have $N$ songs, $M$ instruments.</p>

<p>Each song requires one or more of the $M$ instruments in order to be played.</p>

<p>My $K-1$ friends and I want to learn to play $K$ different instruments, and we want to pick them such that we maximize the amount of songs we will can play.</p>

<p>... | algorithms sets | 1 | N songs, M instruments, how to pick K instruments to cover maximal amount of songs -- (algorithms sets)
<p>I have $N$ songs, $M$ instruments.</p>

<p>Each song requires one or more of the $M$ instruments in order to be played.</p>

<p>My $K-1$ friends and I want to learn to play $K$ different instrument... | habedi/stack-exchange-dataset |
64,335 | How to find the symmetry group of a polynomial | <p>Say I have a polynomial in $n$ variables of maximum degree $m$. I define its symmetry group to be the subgroup of the permutation group which fixes the polynomial when it acts on the variables. Example: $x^2+y^2+z$ has the subgroup $\langle(x,y)\rangle$. Given such a polynomial, what is the best way to find such a p... | algorithms polynomials group theory | 1 | How to find the symmetry group of a polynomial -- (algorithms polynomials group theory)
<p>Say I have a polynomial in $n$ variables of maximum degree $m$. I define its symmetry group to be the subgroup of the permutation group which fixes the polynomial when it acts on the variables. Example: $x^2+y^2+z$ has the subgro... | habedi/stack-exchange-dataset |
64,339 | How can I find spans where the distance between two poly-lines is more or less than some threshold? | <p>I have two poly-lines. I would like to find segments of these lines where the minimum distance between them is higher (or lower) than some threshold. </p>

<p>I.e. I want to find the parts of the lines highlighted in squiggly pink here: </p>

<p><a href="https://i.stack.imgur.com/IAkFF.png" rel="nofo... | computational geometry dynamic programming | 1 | How can I find spans where the distance between two poly-lines is more or less than some threshold? -- (computational geometry dynamic programming)
<p>I have two poly-lines. I would like to find segments of these lines where the minimum distance between them is higher (or lower) than some threshold. </p>

<p>I.... | habedi/stack-exchange-dataset |
64,352 | Nonuniform input distributions in average case analysis | <p>When we perform average case analysis of algorithms, we assume that the inputs to the algorithm are sampled uniformly from some underlying space. For example, the average case analysis of <a href="https://courses.cs.washington.edu/courses/cse312/11wi/slides/08sort.pdf" rel="nofollow">quicksort </a> assumes that the... | time complexity average case | 1 | Nonuniform input distributions in average case analysis -- (time complexity average case)
<p>When we perform average case analysis of algorithms, we assume that the inputs to the algorithm are sampled uniformly from some underlying space. For example, the average case analysis of <a href="https://courses.cs.washington... | habedi/stack-exchange-dataset |
64,356 | How to find whether a grammar is ambiguous? | <p>$$S\rightarrow aAB$$
$$A\rightarrow bBb$$
$$B\rightarrow A|\epsilon$$</p>

<p>I'm choosing the string abbbb.</p>

<p>First left most derivation is the following:</p>

<p>$$S\Rightarrow aAB\Rightarrow abBbB\Rightarrow abebB\Rightarrow abebA\Rightarrow abebbBb\Rightarrow abebbeb = abbbb... | formal languages automata formal grammars ambiguity | 1 | How to find whether a grammar is ambiguous? -- (formal languages automata formal grammars ambiguity)
<p>$$S\rightarrow aAB$$
$$A\rightarrow bBb$$
$$B\rightarrow A|\epsilon$$</p>

<p>I'm choosing the string abbbb.</p>

<p>First left most derivation is the following:</p>

<p>$$S\Rightarrow... | habedi/stack-exchange-dataset |
64,367 | Heap-like notation of a BST (BFT bit-vectors) for succinct representation | <p>I'm researching the topic of succinct tree representations right now and came across <a href="https://www.imsc.res.in/~dsmeet/trees-recent.ppt" rel="nofollow">this presentation</a>. On slide 17 there is an example of heap-like notation of a BST (using BFT bit-vectors) and the author claims that the amount of bits ne... | binary trees search trees succinct data structures | 1 | Heap-like notation of a BST (BFT bit-vectors) for succinct representation -- (binary trees search trees succinct data structures)
<p>I'm researching the topic of succinct tree representations right now and came across <a href="https://www.imsc.res.in/~dsmeet/trees-recent.ppt" rel="nofollow">this presentation</a>. On sl... | habedi/stack-exchange-dataset |
64,368 | Complexity of parity game solving compared to PLS, PPA, and PPAD | <p>Since <a href="https://en.wikipedia.org/wiki/Parity_game" rel="nofollow noreferrer">parity game</a> solving is in <a href="https://en.wikipedia.org/wiki/TFNP" rel="nofollow noreferrer">TFNP ("Total Function Nondeterministic Polynomial")</a> (and the decision version is is NP ∩ coNP), I wonder whether it is contained... | complexity theory game theory game semantics | 1 | Complexity of parity game solving compared to PLS, PPA, and PPAD -- (complexity theory game theory game semantics)
<p>Since <a href="https://en.wikipedia.org/wiki/Parity_game" rel="nofollow noreferrer">parity game</a> solving is in <a href="https://en.wikipedia.org/wiki/TFNP" rel="nofollow noreferrer">TFNP ("Total Func... | habedi/stack-exchange-dataset |
64,372 | Regular expressions with backreferences over unary alphabet | <p>Setting:</p>

<ul>
<li>regular expressions with backreferences</li>
<li>unary language (1-symbol alphabet)</li>
</ul>

<p>Is the following problem decidable in this setting:</p>

<ul>
<li>Given a regular expression with backreferences, does it define a regular language?</li>&#... | formal languages computability regular languages undecidability regular expressions | 1 | Regular expressions with backreferences over unary alphabet -- (formal languages computability regular languages undecidability regular expressions)
<p>Setting:</p>

<ul>
<li>regular expressions with backreferences</li>
<li>unary language (1-symbol alphabet)</li>
</ul>

<p>Is the following p... | habedi/stack-exchange-dataset |
64,374 | Inputting a superposition into a cNOT gate | <p>I am unsure how to calculate what happens when you put a superposition as the control qubit into a cNOT gate or what happens when you put a superposition as the target qubit into a cNOT gate. I know what matrix represents the cNOT and I know that each superposition would be represented by $\alpha |00\rangle + \beta... | logic quantum computing linear algebra | 1 | Inputting a superposition into a cNOT gate -- (logic quantum computing linear algebra)
<p>I am unsure how to calculate what happens when you put a superposition as the control qubit into a cNOT gate or what happens when you put a superposition as the target qubit into a cNOT gate. I know what matrix represents the cNO... | habedi/stack-exchange-dataset |
64,384 | Expected versus Randomized | <p>Is there any difference between expected polynomial time and randomized polynomial time algorithm?</p>
 | algorithms randomized algorithms | 1 | Expected versus Randomized -- (algorithms randomized algorithms)
<p>Is there any difference between expected polynomial time and randomized polynomial time algorithm?</p>
 | habedi/stack-exchange-dataset |
64,385 | Do finite state machines need transitions for all symbols? | <p>I want to know if I want to draw up a finite state machine, say for example binary strings and I want a finite state machine that accepts only one kind of binary string e.g: 0110. Do I, for each state have to account for another symbol of the binary language being read during transition. Like for the first transitio... | automata finite automata | 1 | Do finite state machines need transitions for all symbols? -- (automata finite automata)
<p>I want to know if I want to draw up a finite state machine, say for example binary strings and I want a finite state machine that accepts only one kind of binary string e.g: 0110. Do I, for each state have to account for another... | habedi/stack-exchange-dataset |
64,393 | Showing that u#v with u a substring of v is not context-free | <p>I need to find whether this language is context-free or not:</p>

<pre><code>{u#v | u,v belong to {a,b,c}* and u is a substring of v}, over alphabet {a,b,c,#}
</code></pre>

<p>I suspect that it's not, and am trying to approach it via Pumping Lemma, but then I noticed that: any examples like a^n#... | formal languages context free | 1 | Showing that u#v with u a substring of v is not context-free -- (formal languages context free)
<p>I need to find whether this language is context-free or not:</p>

<pre><code>{u#v | u,v belong to {a,b,c}* and u is a substring of v}, over alphabet {a,b,c,#}
</code></pre>

<p>I suspect that it's not,... | habedi/stack-exchange-dataset |
64,396 | What problems are solvable in Datalog? | <p>Datalog is not Turing complete. It does however have the wonderful property of not being order sensitive. What problems can be solved in Datalog? Where does it fit in the Chomsky hierarchy, i.e. what abstract machine does it model?</p>
 | computation models chomsky hierarchy | 1 | What problems are solvable in Datalog? -- (computation models chomsky hierarchy)
<p>Datalog is not Turing complete. It does however have the wonderful property of not being order sensitive. What problems can be solved in Datalog? Where does it fit in the Chomsky hierarchy, i.e. what abstract machine does it model?</p>&... | habedi/stack-exchange-dataset |
64,397 | Does every DFA contain a loop? | <p>Is there a rule that either every DFA contains or not, a loop(cycle in graph terminology)?</p>

<p>I do not seem to be able to generalize this idea in either direction.</p>

<p>Also if either of these is true, can we assume through DFA - NFA equivalence that the same is true for NFAs?</p>
 | automata finite automata | 1 | Does every DFA contain a loop? -- (automata finite automata)
<p>Is there a rule that either every DFA contains or not, a loop(cycle in graph terminology)?</p>

<p>I do not seem to be able to generalize this idea in either direction.</p>

<p>Also if either of these is true, can we assume through DFA - NF... | habedi/stack-exchange-dataset |
64,404 | What crossover operator should I use for arranging students in classrooms? | <p>I am building a genetic algorithm to solve a "classroom map" problem. The goal is to place correctly students depending on several factors (shortsighted students, turbulent students...).<br>
Here, the genomes is the classroom layout, each classroom has a fixed blackboard and tables positions, what varies is the ... | algorithms optimization genetic algorithms | 1 | What crossover operator should I use for arranging students in classrooms? -- (algorithms optimization genetic algorithms)
<p>I am building a genetic algorithm to solve a "classroom map" problem. The goal is to place correctly students depending on several factors (shortsighted students, turbulent students...).<br>
... | habedi/stack-exchange-dataset |
64,408 | How does the CPU form the binary representation for a number? | <p>More generally, how those translating softwares, for example, an assembler, like <em>nasm</em>, know how to transform in machine code the number "10", from this command: <code>add marks, 10</code>.</p>

<p>I know there is other things that needs to be comprehended about compilers, but I can't find some intui... | computer architecture arithmetic number formats | 1 | How does the CPU form the binary representation for a number? -- (computer architecture arithmetic number formats)
<p>More generally, how those translating softwares, for example, an assembler, like <em>nasm</em>, know how to transform in machine code the number "10", from this command: <code>add marks, 10</code>.</p>&... | habedi/stack-exchange-dataset |
64,410 | How can a stack-based VM be Turing-Complete? | <p>I was trying to implement a stack-based Virtual Machine (e.g. like JVM or some early version of Lua) for some benchmarks in order to test its performance against a Register-based VM.</p>

<p>I originally implemented it as having a global stack for all values and an array of instructions, where for the sake o... | turing completeness interpreters | 1 | How can a stack-based VM be Turing-Complete? -- (turing completeness interpreters)
<p>I was trying to implement a stack-based Virtual Machine (e.g. like JVM or some early version of Lua) for some benchmarks in order to test its performance against a Register-based VM.</p>

<p>I originally implemented it as havi... | habedi/stack-exchange-dataset |
64,412 | Why is the running time for BFS $O(b^{d+1})$? | <p>In my Artificial Intelligence class, in a section on Uninformed Search Algorithms, the textbook for the class (and as was discussed in lecture) the running time for Breadth First Search is listed as being: $O(b^{d+1})$ with the following explanation:</p>

<p><a href="https://i.stack.imgur.com/ALTSO.png" rel=... | algorithm analysis runtime analysis search algorithms trees graph traversal | 1 | Why is the running time for BFS $O(b^{d+1})$? -- (algorithm analysis runtime analysis search algorithms trees graph traversal)
<p>In my Artificial Intelligence class, in a section on Uninformed Search Algorithms, the textbook for the class (and as was discussed in lecture) the running time for Breadth First Search is l... | habedi/stack-exchange-dataset |
64,416 | Using existential quantifier within implication | <p>I had used an existential quantifier within an implication, as below:</p>

<p>$$\exists ~ \sigma_{opt}~~~ \wedge~~~ n \in R^{+}~ ,~0<n<1 \rightarrow ~~ \sigma_{opt} = n$$</p>

<p>I've, recently, found that it is illegal to do that and just universal quantifier could be used in this situation. ... | logic first order logic | 1 | Using existential quantifier within implication -- (logic first order logic)
<p>I had used an existential quantifier within an implication, as below:</p>

<p>$$\exists ~ \sigma_{opt}~~~ \wedge~~~ n \in R^{+}~ ,~0<n<1 \rightarrow ~~ \sigma_{opt} = n$$</p>

<p>I've, recently, found that it is illeg... | habedi/stack-exchange-dataset |
64,422 | A dynamic programming problema on containers and product | <p>We have two production lines - product and container (two integer arrays product_list[N] and container_list[M]).
If the volume of a container is equal or larger than that of a product, then we could put the product into that container.</p>

<p>We want to put as many products into containers as possible.<... | algorithms dynamic programming linear programming | 1 | A dynamic programming problema on containers and product -- (algorithms dynamic programming linear programming)
<p>We have two production lines - product and container (two integer arrays product_list[N] and container_list[M]).
If the volume of a container is equal or larger than that of a product, then we could pu... | habedi/stack-exchange-dataset |
64,440 | (Possibly Easy) Formal Language Question | <p>I am looking at a "practice test" for a Theory of Computation class. It was a test in a previous year.</p>

<p>I am asked to prove that, given L1 and L2 are regular, the union and difference are both regular.</p>

<p>It seems to me that for the union, since all the members of each separate set are r... | formal languages | 1 | (Possibly Easy) Formal Language Question -- (formal languages)
<p>I am looking at a "practice test" for a Theory of Computation class. It was a test in a previous year.</p>

<p>I am asked to prove that, given L1 and L2 are regular, the union and difference are both regular.</p>

<p>It seems to me that ... | habedi/stack-exchange-dataset |
64,441 | The extension of a code is itself a code | <p>I'm reading Cover's "Elements of Information Theory" and I have a problem with the definition of uniquely decodable code. </p>

<blockquote>
 <p>A code is said to be singular if there exist two elements that map to
 the same string. In other case it is said to be non singular.</p>
 
 <p>L... | information theory coding theory | 1 | The extension of a code is itself a code -- (information theory coding theory)
<p>I'm reading Cover's "Elements of Information Theory" and I have a problem with the definition of uniquely decodable code. </p>

<blockquote>
 <p>A code is said to be singular if there exist two elements that map to
 the ... | habedi/stack-exchange-dataset |
64,448 | Equivalent definitions for subgraph | <p>I know that a graph G' is a subgraph for G if V(G')⊆V(G) and E(G')⊆E(G).</p>

<p>Today my professor wrote that G' is a subgraph for G if G' is a graph and V(G')⊆V(G), and then he told us that this definition is equivalent to the one we've seen before (= the first line in this post).</p>

<p>However, ... | graphs | 1 | Equivalent definitions for subgraph -- (graphs)
<p>I know that a graph G' is a subgraph for G if V(G')⊆V(G) and E(G')⊆E(G).</p>

<p>Today my professor wrote that G' is a subgraph for G if G' is a graph and V(G')⊆V(G), and then he told us that this definition is equivalent to the one we've seen before (= the fir... | habedi/stack-exchange-dataset |
64,460 | Is it possible to get information from websites as a human? | <p>If I want to read any websites and get some information as names (or dates) on some part of the site as a human. What solution I could use in order to get these datas using deep learning or machine learning?. Is it possible?.. it is not necessary artificial inteligence? .... or maybe it might be as a part of a Phd t... | machine learning artificial intelligence natural language processing research | 1 | Is it possible to get information from websites as a human? -- (machine learning artificial intelligence natural language processing research)
<p>If I want to read any websites and get some information as names (or dates) on some part of the site as a human. What solution I could use in order to get these datas using d... | habedi/stack-exchange-dataset |
64,464 | Does it matter for this function if the set we check membership of is finite? | <p>I have the following problem.</p>

<blockquote>
 <p>Let $\Phi$ be an admissible numbering of the single-parameter partially-recursive functions. That is, $\Phi(i, x) = f_i(x)$ with $f_i$ the $i$th partially-recusive function with one parameter. Denote with $f(x)\!\uparrow$ that $f(x)$ is undefined in th... | computability semi decidability mu recursion | 1 | Does it matter for this function if the set we check membership of is finite? -- (computability semi decidability mu recursion)
<p>I have the following problem.</p>

<blockquote>
 <p>Let $\Phi$ be an admissible numbering of the single-parameter partially-recursive functions. That is, $\Phi(i, x) = f_i(x)$ ... | habedi/stack-exchange-dataset |
64,470 | More details on a language decided in $\Theta(\log \log n)$ space | <p>In <a href="https://cs.stackexchange.com/questions/22676/language-with-log-log-n-space-complexity">Language with $\log \log n$ space complexity?</a>, the following non-regular language is described:</p>

<p>$$L = \{b(0) \# b(1) \# \dots \# b(2^k-1) \mid k\in \mathbb{N}\}$$</p>

<p>where $b(i)$ is the... | complexity theory space complexity | 1 | More details on a language decided in $\Theta(\log \log n)$ space -- (complexity theory space complexity)
<p>In <a href="https://cs.stackexchange.com/questions/22676/language-with-log-log-n-space-complexity">Language with $\log \log n$ space complexity?</a>, the following non-regular language is described:</p>

... | habedi/stack-exchange-dataset |
64,471 | Computer Security versions of the Halting Problem | <p>I'm plenty familiar with the Halting Problem for Turing Machines. It occurred to me after reading several posts on this site that it would be interesting, educational and useful to start a list of equivalents to the Halting Problem in terms of Computer Security. I think this might help students of computer science a... | computability reference request halting problem security | 1 | Computer Security versions of the Halting Problem -- (computability reference request halting problem security)
<p>I'm plenty familiar with the Halting Problem for Turing Machines. It occurred to me after reading several posts on this site that it would be interesting, educational and useful to start a list of equivale... | habedi/stack-exchange-dataset |
64,499 | Reducing max flow to bipartite matching? | <p>There's a famous and elegant reduction from the maximum bipartite matching problem to the max-flow problem: we create a network with a source node $s$, a terminal node $t$, and one node for each item to be matched, then add appropriate edges.</p>

<p>There's certainly a way to reduce maximum flow to maximum ... | reductions network flow bipartite matching | 1 | Reducing max flow to bipartite matching? -- (reductions network flow bipartite matching)
<p>There's a famous and elegant reduction from the maximum bipartite matching problem to the max-flow problem: we create a network with a source node $s$, a terminal node $t$, and one node for each item to be matched, then add appr... | habedi/stack-exchange-dataset |
64,501 | How to efficiently determine whether a relation is total? | <p>I have a set $S$ of pairs $(x_1,x_2)$ with $x_1,x_2 \in X$ for some set $X$. </p>

<p>I want to know whether this defines a total relation on $X$. In other words, whether:</p>

<ul>
<li>If $(a,b)$ in $S$ and $(b,c)$ in $S$, then $(a,c)$ in $S$. (<em>transitivity</em>)</li>
<li>Exactly one of ... | algorithms partial order | 1 | How to efficiently determine whether a relation is total? -- (algorithms partial order)
<p>I have a set $S$ of pairs $(x_1,x_2)$ with $x_1,x_2 \in X$ for some set $X$. </p>

<p>I want to know whether this defines a total relation on $X$. In other words, whether:</p>

<ul>
<li>If $(a,b)$ in $S$ and $... | habedi/stack-exchange-dataset |
64,505 | Dynamic programming: how to solve a problem with multiple constraints? | <p>I've got a real-world issue that I'm trying to come up with a dynamic programming algorithm to solve. It's similar in appearance to the knapsack problem, but it has more constraints, which has got me stumped. A simplified version of the problem:</p>

<p>Suppose I need to fill a basket with an arbitrary numbe... | algorithms optimization dynamic programming | 1 | Dynamic programming: how to solve a problem with multiple constraints? -- (algorithms optimization dynamic programming)
<p>I've got a real-world issue that I'm trying to come up with a dynamic programming algorithm to solve. It's similar in appearance to the knapsack problem, but it has more constraints, which has got ... | habedi/stack-exchange-dataset |
64,530 | What is the expansion of the regular expression $(a^*b^*)^*$ | <p>Consider the regular expression $(a^*b^*)^*$</p>

<p>Does this mean that there are zero or more occurences of the term $(a^*b^*)$ before the term is expanded or that there are zero of more occurences of the term $(a^*b^*)$ after the term itself has been expanded?</p>

<p>Here is an example of what I'... | formal languages regular expressions | 1 | What is the expansion of the regular expression $(a^*b^*)^*$ -- (formal languages regular expressions)
<p>Consider the regular expression $(a^*b^*)^*$</p>

<p>Does this mean that there are zero or more occurences of the term $(a^*b^*)$ before the term is expanded or that there are zero of more occurences of the... | habedi/stack-exchange-dataset |
64,544 | Can languages that are not closed against the Kleene star be regular? | <p>I've been working on finding a regular expression for the following language for quite some time now ($\Sigma =\text{{0, 1}}$):</p>

<blockquote>
 <p>$
\text{L = {w | the difference between the number of 0's and 1's in each prefix of the word is less than or equal to 1}}$</p>
</blockquote>
&... | formal languages regular languages | 1 | Can languages that are not closed against the Kleene star be regular? -- (formal languages regular languages)
<p>I've been working on finding a regular expression for the following language for quite some time now ($\Sigma =\text{{0, 1}}$):</p>

<blockquote>
 <p>$
\text{L = {w | the difference between ... | habedi/stack-exchange-dataset |
64,555 | Parsing CFLs (simulating PDA vs CYK algorithm) | <p>We can simulate the PDA and parse the language with the following operations (vaguely):</p>

<blockquote>
 <ol>
 <li>Read the input symbol and top of stack - $O(1)$</li>
 <li>Check all the transition rules (must check all for non-determinism) - $O(|Transition rules|)$</li>
 <li>Update the... | pushdown automata efficiency parsers | 1 | Parsing CFLs (simulating PDA vs CYK algorithm) -- (pushdown automata efficiency parsers)
<p>We can simulate the PDA and parse the language with the following operations (vaguely):</p>

<blockquote>
 <ol>
 <li>Read the input symbol and top of stack - $O(1)$</li>
 <li>Check all the transition rules... | habedi/stack-exchange-dataset |
64,560 | Algorithm to build a "hand" calculation for riichi mahjong game | <p>I would like to discuss an algorithm to build a "hand" calculation for riichi mahjong game. </p>

<p>I will simplify terms to focus on the algorithm and not on the game specific terms.</p>

<p>Let's imagine that we have a card deck with three suits. Each suit contains cards from 1 to 9 and each card ... | algorithms graphs recursion | 1 | Algorithm to build a "hand" calculation for riichi mahjong game -- (algorithms graphs recursion)
<p>I would like to discuss an algorithm to build a "hand" calculation for riichi mahjong game. </p>

<p>I will simplify terms to focus on the algorithm and not on the game specific terms.</p>

<p>Let's imagi... | habedi/stack-exchange-dataset |
64,569 | unambiguous grammar that produce equal number of a and b | <p>is there any <strong>unambiguous grammar</strong> on alphabet={a,b} that can produce strings which have equal number of a and b (e.g. "aabb" , "baba" , "abba") ? </p>
 | formal grammars ambiguity | 1 | unambiguous grammar that produce equal number of a and b -- (formal grammars ambiguity)
<p>is there any <strong>unambiguous grammar</strong> on alphabet={a,b} that can produce strings which have equal number of a and b (e.g. "aabb" , "baba" , "abba") ? </p>
 | habedi/stack-exchange-dataset |
64,578 | How do computers remember where they store things? | <p>When a computer stores a variable, when a program needs to get the variable's value, how does the computer know where to look in memory for that variable's value?</p>
 | compilers memory access variable binding | 1 | How do computers remember where they store things? -- (compilers memory access variable binding)
<p>When a computer stores a variable, when a program needs to get the variable's value, how does the computer know where to look in memory for that variable's value?</p>
 | habedi/stack-exchange-dataset |
64,580 | Pascal FOR loop with context free gramar | <p>In Pascal <a href="https://www.tutorialspoint.com/pascal/pascal_for_do_loop.htm" rel="nofollow noreferrer">For-do loops</a>, there is a rule stating that one cannot modify the counter variable inside the body of the loop. </p>

<p>To exemplify the rule, take the following Pascal <code>for-do</code>, which <s... | formal languages context free formal grammars programming languages | 1 | Pascal FOR loop with context free gramar -- (formal languages context free formal grammars programming languages)
<p>In Pascal <a href="https://www.tutorialspoint.com/pascal/pascal_for_do_loop.htm" rel="nofollow noreferrer">For-do loops</a>, there is a rule stating that one cannot modify the counter variable inside the... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.