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 |
|---|---|---|---|---|---|---|
111,617 | Sensitivity and block sensitivity of specific problem, is there an errata? Arora-Barak exercise 12.4 | <p>There's an exercise in Arora-Barak on sensitivity and block sensitivity. The statement of the problem is:</p>

<blockquote>
 <p>Let <span class="math-container">$f$</span> be a function on <span class="math-container">$n = k^2$</span> variables that is an OR of <span class="math-container">$k$</span> ap... | complexity theory | 1 | Sensitivity and block sensitivity of specific problem, is there an errata? Arora-Barak exercise 12.4 -- (complexity theory)
<p>There's an exercise in Arora-Barak on sensitivity and block sensitivity. The statement of the problem is:</p>

<blockquote>
 <p>Let <span class="math-container">$f$</span> be a fun... | habedi/stack-exchange-dataset |
111,620 | Dubins TSP crossing trajectory theorem | <p>In the Dubins TSP (DTSP for short), one needs to visit a set of given points in the plane, and return to the starting point, minimizing the distance of such a trajectory. The difference with the Euclidean TSP (ETSP for short) however is that the visiting entity is curvature constrained by some <span class="math-cont... | traveling salesman | 1 | Dubins TSP crossing trajectory theorem -- (traveling salesman)
<p>In the Dubins TSP (DTSP for short), one needs to visit a set of given points in the plane, and return to the starting point, minimizing the distance of such a trajectory. The difference with the Euclidean TSP (ETSP for short) however is that the visiting... | habedi/stack-exchange-dataset |
111,631 | What untyped term inhabits induction on natural numbers in CoC? | <p>Induction on Church-encoded natural numbers (which I will call <code>indNat</code>) can not be defined within the Calculus of Constructions.</p>

<p>If we assumed <code>indNat</code> as an axiom, is there an untyped term that would have the semantics of the induction function? What if we had Scott-encoded na... | lambda calculus type theory dependent types calculus of constructions | 1 | What untyped term inhabits induction on natural numbers in CoC? -- (lambda calculus type theory dependent types calculus of constructions)
<p>Induction on Church-encoded natural numbers (which I will call <code>indNat</code>) can not be defined within the Calculus of Constructions.</p>

<p>If we assumed <code>i... | habedi/stack-exchange-dataset |
111,639 | How can we find a palindrome within a string? | <p>The problem requires us to find the substring within a string which happens to be a palindrome. Multiple palindromes are also allowed.
<br>For example, in "LODHIHDAK" "DHIHD" is a palindrome.</p>

<p>Comparing the reversed string with the original string to identify the common substring is one way but i... | algorithms time complexity dynamic programming | 1 | How can we find a palindrome within a string? -- (algorithms time complexity dynamic programming)
<p>The problem requires us to find the substring within a string which happens to be a palindrome. Multiple palindromes are also allowed.
<br>For example, in "LODHIHDAK" "DHIHD" is a palindrome.</p>

<p>Compar... | habedi/stack-exchange-dataset |
111,643 | Polynomial size Boolean circuit for counting number of bits | <p>Given a natural number <span class="math-container">$n \geq 1$</span>, I am looking for a Boolean circuit over <span class="math-container">$2n$</span> variables, <span class="math-container">$\varphi(x_1, y_1, \dots, x_n, y_n)$</span>, such that the output is true if and only if the assignment that makes it true ve... | complexity theory logic boolean algebra polynomials | 1 | Polynomial size Boolean circuit for counting number of bits -- (complexity theory logic boolean algebra polynomials)
<p>Given a natural number <span class="math-container">$n \geq 1$</span>, I am looking for a Boolean circuit over <span class="math-container">$2n$</span> variables, <span class="math-container">$\varphi... | habedi/stack-exchange-dataset |
111,661 | find derivation trees for CFG | <p>I need to draw the derivation tree for <span class="math-container">$1-2-(3-4)*5*6$</span> from the grammar below.
 I want to know how many possible derivation trees are there from this grammar.</p>

<p><span class="math-container">$$\begin{align}V_n&=\{expr,term,factor,number\}\\
V_t&= \{(,)... | automata context free regular expressions discrete mathematics | 1 | find derivation trees for CFG -- (automata context free regular expressions discrete mathematics)
<p>I need to draw the derivation tree for <span class="math-container">$1-2-(3-4)*5*6$</span> from the grammar below.
 I want to know how many possible derivation trees are there from this grammar.</p>

<p><spa... | habedi/stack-exchange-dataset |
111,667 | prove that there is a complete language in $L \cup \{A_{TM}\}$ | <p><span class="math-container">$A_{TM} = \{\langle M,w\rangle\mid w\in L(M)\}$</span></p>

<p><span class="math-container">$L$</span> = complexity class containing decision problems that can be solved by a deterministic Turing machine using logarithmic space</p>

<p>Given the language <span class="math... | complexity theory turing machines computability complexity classes | 1 | prove that there is a complete language in $L \cup \{A_{TM}\}$ -- (complexity theory turing machines computability complexity classes)
<p><span class="math-container">$A_{TM} = \{\langle M,w\rangle\mid w\in L(M)\}$</span></p>

<p><span class="math-container">$L$</span> = complexity class containing decision pro... | habedi/stack-exchange-dataset |
111,675 | How to characterize equivalence classes induced by Myhill-Nerode theorem? | <p>Given <span class="math-container">$L=\lbrace w\in \lbrace 0,1 \rbrace^\ast : N_0(w)=N_1(w) \rbrace$</span>, where <span class="math-container">$N_0(\cdot)$</span> and <span class="math-container">$N_1(\cdot)$</span> mean the number of zeroes and ones respectively, I need to characterize the classes induced by the ... | formal languages automata regular languages | 1 | How to characterize equivalence classes induced by Myhill-Nerode theorem? -- (formal languages automata regular languages)
<p>Given <span class="math-container">$L=\lbrace w\in \lbrace 0,1 \rbrace^\ast : N_0(w)=N_1(w) \rbrace$</span>, where <span class="math-container">$N_0(\cdot)$</span> and <span class="math-contain... | habedi/stack-exchange-dataset |
111,681 | Analysis of an approximation claim | <p>Consider the load balancing problem on two machines. Thus we want to distribute a set of <span class="math-container">$n$</span> jobs with processing times <span class="math-container">$t_1,...,t_n$</span> over two machines such that the makespan (maximum of the processing times of the two machines) is minimized. Pr... | approximation | 1 | Analysis of an approximation claim -- (approximation)
<p>Consider the load balancing problem on two machines. Thus we want to distribute a set of <span class="math-container">$n$</span> jobs with processing times <span class="math-container">$t_1,...,t_n$</span> over two machines such that the makespan (maximum of the ... | habedi/stack-exchange-dataset |
111,684 | is it always true that the depth of BFS is $\leq$ DFS? | <p>I have a simple theoretical question in very basic algorithms, as the title mentions, is it always true that the depth of BFS is <span class="math-container">$\leq$</span> DFS?</p>

<p>From what I understand, the tricky part here is the possible cycles in the graph. Even though that I believe that the depth ... | algorithms graphs graph traversal | 1 | is it always true that the depth of BFS is $\leq$ DFS? -- (algorithms graphs graph traversal)
<p>I have a simple theoretical question in very basic algorithms, as the title mentions, is it always true that the depth of BFS is <span class="math-container">$\leq$</span> DFS?</p>

<p>From what I understand, the tr... | habedi/stack-exchange-dataset |
111,686 | Generate triangular surface mesh of convex hull spanned by 8 points in 3D-Space | <p>I am looking for a numerically efficient algorithm to get a triangular surface mesh of the convex hull given by 8 points in three-dimensional space.</p>

<p>For context, the use case is the following:</p>

<p>I have a numerical Simulation calculating the time evolution of a field with three component... | algorithms | 1 | Generate triangular surface mesh of convex hull spanned by 8 points in 3D-Space -- (algorithms)
<p>I am looking for a numerically efficient algorithm to get a triangular surface mesh of the convex hull given by 8 points in three-dimensional space.</p>

<p>For context, the use case is the following:</p>

... | habedi/stack-exchange-dataset |
111,696 | Prove that there is no computability reduction HP $\le$ $\Sigma$* | <p>I tried to prove in negative way that there is computability reduction HP <span class="math-container">$\le$</span> <span class="math-container">$\Sigma$</span>* and accept contradiction because of HP <span class="math-container">$\in$</span> RE and <span class="math-container">$\Sigma$</span>* <span class="math-co... | computability reductions | 1 | Prove that there is no computability reduction HP $\le$ $\Sigma$* -- (computability reductions)
<p>I tried to prove in negative way that there is computability reduction HP <span class="math-container">$\le$</span> <span class="math-container">$\Sigma$</span>* and accept contradiction because of HP <span class="math-c... | habedi/stack-exchange-dataset |
111,709 | weighted-clique to vertex cover reduction | <blockquote>
 <p><strong>WEIGHTED-CLIQUE</strong></p>
 
 <ul>
 <li><p><strong>input:</strong> a undirected graph G that has weighted edges and 2 natural numbers a, b</p></li>
 <li><p><strong>question:</strong> does G have a clique of size a with total weight of b?</p></li>
 </ul>
</blo... | np hard polynomial time reductions | 1 | weighted-clique to vertex cover reduction -- (np hard polynomial time reductions)
<blockquote>
 <p><strong>WEIGHTED-CLIQUE</strong></p>
 
 <ul>
 <li><p><strong>input:</strong> a undirected graph G that has weighted edges and 2 natural numbers a, b</p></li>
 <li><p><strong>question:</strong> doe... | habedi/stack-exchange-dataset |
111,724 | Conjunctive normal form to simple elementary algebra | <p>I'm curious to know the computational complexity class of each step in this method of converting a CNF formula into simple elementary algebra.</p>

<p>An example:
<span class="math-container">$$\phi=\left(x_1 \vee x_2 \right) \wedge \left(\neg x_1 \vee x_3 \right) \wedge \left(\neg x_2 \vee \neg x_3 \rig... | complexity theory logic boolean algebra propositional logic | 1 | Conjunctive normal form to simple elementary algebra -- (complexity theory logic boolean algebra propositional logic)
<p>I'm curious to know the computational complexity class of each step in this method of converting a CNF formula into simple elementary algebra.</p>

<p>An example:
<span class="math-contai... | habedi/stack-exchange-dataset |
111,735 | Computing an Expression | <p>I am writing code to evaluate the following expression:
 <span class="math-container">$$ \frac{(a+b+c)!}{a! b! c!} $$</span>
where <span class="math-container">$a$</span>, <span class="math-container">$b$</span> and <span class="math-container">$c$</span> are on the range of <span class="math-container">$... | floating point numerical algorithms numerical analysis | 1 | Computing an Expression -- (floating point numerical algorithms numerical analysis)
<p>I am writing code to evaluate the following expression:
 <span class="math-container">$$ \frac{(a+b+c)!}{a! b! c!} $$</span>
where <span class="math-container">$a$</span>, <span class="math-container">$b$</span> and <span ... | habedi/stack-exchange-dataset |
111,747 | Number of Solutions for Brute Force Algorithm of Travelling Salesperson Problem | <p><br>
We are learning about the travelling salesperson problem in my high school class and we are discussing how computers could solve for the problem, even though the problem is intractable, using a brute force algorithm. <br>
I was wondering if the brute force algorithm calculates ALL possibilities for a nu... | algorithms traveling salesman | 1 | Number of Solutions for Brute Force Algorithm of Travelling Salesperson Problem -- (algorithms traveling salesman)
<p><br>
We are learning about the travelling salesperson problem in my high school class and we are discussing how computers could solve for the problem, even though the problem is intractable, using a... | habedi/stack-exchange-dataset |
111,752 | Doubt on Token in Compiler Design | <p>Say i have code snippet like --> </p>

<p>m -= n;</p>

<p>is <strong>minus</strong> and <strong>assignment</strong> considered as a single token or they will be considered as different token?</p>

<p>So the total token count will be 4 or 5?</p>
 | compilers | 1 | Doubt on Token in Compiler Design -- (compilers)
<p>Say i have code snippet like --> </p>

<p>m -= n;</p>

<p>is <strong>minus</strong> and <strong>assignment</strong> considered as a single token or they will be considered as different token?</p>

<p>So the total token count will be 4 or 5?</p>... | habedi/stack-exchange-dataset |
111,756 | Quadratic equations using 2 different approaches | <p>I am reading Mark Newman's Computational Physics and at chapter 4 page 133 in Exercise 4.2 he asks</p>

<p>a) Write a program that takes as input three numbers, a, b, and c, and prints out the two solutions to the quadratic equation <span class="math-container">$ax^2 + bx + c = 0$</span> using the standard f... | python | 1 | Quadratic equations using 2 different approaches -- (python)
<p>I am reading Mark Newman's Computational Physics and at chapter 4 page 133 in Exercise 4.2 he asks</p>

<p>a) Write a program that takes as input three numbers, a, b, and c, and prints out the two solutions to the quadratic equation <span class="ma... | habedi/stack-exchange-dataset |
111,759 | 3-CNF to "independent form" | <p>Is it possible to convert all logical formulae into a form such that each variable ends up in exactly 1 "factor" of the and operation? (<span class="math-container">$\wedge$</span>). Any combination of operations is allowed, though the fewer operations used the better.</p>

<p><span class="math-container">$$... | logic boolean algebra propositional logic 3 sat | 1 | 3-CNF to "independent form" -- (logic boolean algebra propositional logic 3 sat)
<p>Is it possible to convert all logical formulae into a form such that each variable ends up in exactly 1 "factor" of the and operation? (<span class="math-container">$\wedge$</span>). Any combination of operations is allowed, though the ... | habedi/stack-exchange-dataset |
111,770 | Kleene Star regex question, sed behavior? | <p>Kleene Star with 'sed' is behaving as expected for me, with exception of a case where the input pattern is "ab" and the regex is "b*". Does anyone know why this regex is not being matched against the pattern space?</p>

<p>This is the failure case:</p>

<pre><code>$ printf "ab\n" | sed -En 's/b*// p... | regular expressions kleene star | 1 | Kleene Star regex question, sed behavior? -- (regular expressions kleene star)
<p>Kleene Star with 'sed' is behaving as expected for me, with exception of a case where the input pattern is "ab" and the regex is "b*". Does anyone know why this regex is not being matched against the pattern space?</p>

<p>This i... | habedi/stack-exchange-dataset |
111,780 | Dubins TSP NP-hardness proof detail | <p>In Le Ny <em>et al.</em>'s paper <strong>On the Dubins Traveling Salesman Problem</strong> (<a href="https://tinyurl.com/y59f7d8x" rel="nofollow noreferrer">https://tinyurl.com/y59f7d8x</a>) the authors prove, among other works, that the Dubins Traveling Salesman Problem (DTSP) is NP-hard. I will give here the basic... | np hard correctness proof traveling salesman | 1 | Dubins TSP NP-hardness proof detail -- (np hard correctness proof traveling salesman)
<p>In Le Ny <em>et al.</em>'s paper <strong>On the Dubins Traveling Salesman Problem</strong> (<a href="https://tinyurl.com/y59f7d8x" rel="nofollow noreferrer">https://tinyurl.com/y59f7d8x</a>) the authors prove, among other works, th... | habedi/stack-exchange-dataset |
111,785 | Pumping Lemma for Regular Languages with 3 variables (a^nb^mc^m) | <p>I've been trying to understand the pumping lemma, and how to apply it to a language such as a^nb^mc^m where n >= 0 and m >= 0. The pumping lemma states that:</p>

<p>For any regular language L, there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exists u, v, w ∈ Σ∗, such that x = uvw, and<... | automata pumping lemma | 1 | Pumping Lemma for Regular Languages with 3 variables (a^nb^mc^m) -- (automata pumping lemma)
<p>I've been trying to understand the pumping lemma, and how to apply it to a language such as a^nb^mc^m where n >= 0 and m >= 0. The pumping lemma states that:</p>

<p>For any regular language L, there exists an intege... | habedi/stack-exchange-dataset |
111,788 | Randomly built binary search trees | <p>In Introduction to Algorithms (CLRS) 3rd Edition, page 299, the section attempts to prove:</p>

<blockquote>
 <p>The expected height of a randomly built binary search tree on <span class="math-container">$n$</span> distinct keys is <span class="math-container">$O(\lg n)$</span>.</p>
</blockquote>&#x... | algorithm analysis data structures proof techniques binary trees probability theory | 1 | Randomly built binary search trees -- (algorithm analysis data structures proof techniques binary trees probability theory)
<p>In Introduction to Algorithms (CLRS) 3rd Edition, page 299, the section attempts to prove:</p>

<blockquote>
 <p>The expected height of a randomly built binary search tree on <span... | habedi/stack-exchange-dataset |
111,804 | SImple NP-hard proof question | <blockquote>
<p><span class="math-container">$3SATplus$</span></p>
<ul>
<li><p>Input: 2 CNF formulas <span class="math-container">$F_1$</span>, <span class="math-container">$F_2$</span> where all clauses have exactly <span class="math-container">$3$</span> literals.</p>
</li>
<li><p>Question: Does e... | np hard | 1 | SImple NP-hard proof question -- (np hard)
<blockquote>
<p><span class="math-container">$3SATplus$</span></p>
<ul>
<li><p>Input: 2 CNF formulas <span class="math-container">$F_1$</span>, <span class="math-container">$F_2$</span> where all clauses have exactly <span class="math-container">$3$</span> literals... | habedi/stack-exchange-dataset |
111,809 | Can undecidability theorems be detected by a machine? | <p><strong>this question was originally written in mathoverflow, but a comment recommended me to rewrite it as a CS question.</strong></p>

<p>This is not a mathematically formalized question. I'm sorry for that but think it's more like mathematics than philosophy.</p>

<p>When we proved a theorem A whi... | turing machines logic first order logic | 1 | Can undecidability theorems be detected by a machine? -- (turing machines logic first order logic)
<p><strong>this question was originally written in mathoverflow, but a comment recommended me to rewrite it as a CS question.</strong></p>

<p>This is not a mathematically formalized question. I'm sorry for that b... | habedi/stack-exchange-dataset |
111,813 | Verifying Hamiltonian Cycle solution in O(n^2), n is the length of the encoding of G | <p>In the textbook of CLRS, 'ch. 34.2 Polynomial-time verification' it says the following:</p>

<blockquote>
 <p>Suppose that a friend tells you that a given
 graph G is hamiltonian, and then offers to prove it by giving you the vertices in order along the hamiltonian cycle. It would certainly be easy... | np complete np hard np decision problem hamiltonian circuit | 1 | Verifying Hamiltonian Cycle solution in O(n^2), n is the length of the encoding of G -- (np complete np hard np decision problem hamiltonian circuit)
<p>In the textbook of CLRS, 'ch. 34.2 Polynomial-time verification' it says the following:</p>

<blockquote>
 <p>Suppose that a friend tells you that a given... | habedi/stack-exchange-dataset |
111,827 | Algorithm to compute partitions of a graph in N cliques | <p>does anyone know of an efficient algorithm to compute the partition of a graph in N cliques?</p>

<p>Notice that N is the number of the cliques and not the size of them.</p>

<p>I have heard of the <a href="https://www.geeksforgeeks.org/two-clique-problem-check-graph-can-divided-two-cliques/" rel="no... | graphs reference request clique | 1 | Algorithm to compute partitions of a graph in N cliques -- (graphs reference request clique)
<p>does anyone know of an efficient algorithm to compute the partition of a graph in N cliques?</p>

<p>Notice that N is the number of the cliques and not the size of them.</p>

<p>I have heard of the <a href="h... | habedi/stack-exchange-dataset |
111,828 | Conjunctive Query Containment as SAT | <p>The problem of conjunctive query containment is known to be NP-Complete (originated at Chandra&Merlin 1977). Typically it's shown by reducing 3SAT or 3-colorability into this problem, and the other direction is typically proven by declaring it "trivial" (as it indeed looks trivial to see that the problem is in N... | database theory datalog | 1 | Conjunctive Query Containment as SAT -- (database theory datalog)
<p>The problem of conjunctive query containment is known to be NP-Complete (originated at Chandra&Merlin 1977). Typically it's shown by reducing 3SAT or 3-colorability into this problem, and the other direction is typically proven by declaring it "tr... | habedi/stack-exchange-dataset |
111,835 | What is the time complexity of LR parsers? | <p>Bottom up parsers in worst case take O(<span class="math-container">$n^3$</span>) time, and i believe that LR parser being a bottom up parser should also take O(<span class="math-container">$n^3$</span>) time, but i read on wiki that they are able to solve problems in linear time. How can this be possible? </p>
 | compilers parsers | 1 | What is the time complexity of LR parsers? -- (compilers parsers)
<p>Bottom up parsers in worst case take O(<span class="math-container">$n^3$</span>) time, and i believe that LR parser being a bottom up parser should also take O(<span class="math-container">$n^3$</span>) time, but i read on wiki that they are able to ... | habedi/stack-exchange-dataset |
111,838 | Selecting the right partition in NAUTY | <p>Graph isomorphism solver Nauty has two main procedures, individualization and refinement, to get to a discrete partition. During refinement procedure, we take <em>some</em> cell of the current partition and attempt to further split the partition on more cells. What I found is that depending on the order of which you... | graphs combinatorics graph isomorphism | 1 | Selecting the right partition in NAUTY -- (graphs combinatorics graph isomorphism)
<p>Graph isomorphism solver Nauty has two main procedures, individualization and refinement, to get to a discrete partition. During refinement procedure, we take <em>some</em> cell of the current partition and attempt to further split th... | habedi/stack-exchange-dataset |
111,850 | PCAs and Kleene's Recursion Theorem | <p>I might need some help with the following question.</p>

<p>Given a Partial Combinatory Algebra, we can define the fixed point combinator <span class="math-container">$Y := [\lambda^{*}xy.y(xxy)][\lambda^{*}xy.y(xxy)]$</span>. How does this relate to Kleenes recursion theorem, aka. fixed point theorem?</p>&#... | computability | 1 | PCAs and Kleene's Recursion Theorem -- (computability)
<p>I might need some help with the following question.</p>

<p>Given a Partial Combinatory Algebra, we can define the fixed point combinator <span class="math-container">$Y := [\lambda^{*}xy.y(xxy)][\lambda^{*}xy.y(xxy)]$</span>. How does this relate to Kle... | habedi/stack-exchange-dataset |
111,853 | Are $\mathsf{\#P}$ problems harder than $\mathsf{NP}$ problems | <p>I have a method to solve the <span class="math-container">$\mathsf{\#P}$</span> version of 3SAT in a way that seemingly reduces it to an <span class="math-container">$\mathsf{NP}$</span> problem. - I don't have a formal understanding of these terms so I will just show an example here.</p>

<blockquote>
 ... | complexity theory logic counting propositional logic | 1 | Are $\mathsf{\#P}$ problems harder than $\mathsf{NP}$ problems -- (complexity theory logic counting propositional logic)
<p>I have a method to solve the <span class="math-container">$\mathsf{\#P}$</span> version of 3SAT in a way that seemingly reduces it to an <span class="math-container">$\mathsf{NP}$</span> problem. ... | habedi/stack-exchange-dataset |
111,859 | Akra-Bazzi method integral diverges | <p>I want to solve this recursion:</p>

<p><span class="math-container">$$T(n) = 5T(\frac{n}{5}) + \frac{n}{lg(n)}$$</span></p>

<p>My attempt and issue:</p>

<p>None of the cases for master theorem apply here.
I tried using Akra-Bazzi method (<a href="https://en.wikipedia.org/wiki/Akra%E2%8... | time complexity asymptotics recurrence relation | 1 | Akra-Bazzi method integral diverges -- (time complexity asymptotics recurrence relation)
<p>I want to solve this recursion:</p>

<p><span class="math-container">$$T(n) = 5T(\frac{n}{5}) + \frac{n}{lg(n)}$$</span></p>

<p>My attempt and issue:</p>

<p>None of the cases for master theorem apply he... | habedi/stack-exchange-dataset |
111,865 | Context-free grammar for tautologies in one variable | <blockquote>
 <p>Construct a context-free grammar for the set of tautologies in <span class="math-container">$p$</span> - that is, the set of formulae in <span class="math-container">$\{p, \text{true}, \text{false}, \land, \lor, \lnot, (, )\}$</span> which evaluate to <span class="math-container">$\text{true}$</sp... | context free propositional logic | 1 | Context-free grammar for tautologies in one variable -- (context free propositional logic)
<blockquote>
 <p>Construct a context-free grammar for the set of tautologies in <span class="math-container">$p$</span> - that is, the set of formulae in <span class="math-container">$\{p, \text{true}, \text{false}, \land, \... | habedi/stack-exchange-dataset |
111,866 | Why can't DFA's have 0 exiting arrows for some input symbols? | <p>Suppose you are in a middle of computation on a non accepting state and at this point, an input of 0 is rejected by the DFA. But, according to Sipser's formal definition, you must still draw an exiting arrow for input 0 from this nonaccepting state, which is just redundant. Why not draw no arrows at all for 0?</p>&#... | finite automata | 1 | Why can't DFA's have 0 exiting arrows for some input symbols? -- (finite automata)
<p>Suppose you are in a middle of computation on a non accepting state and at this point, an input of 0 is rejected by the DFA. But, according to Sipser's formal definition, you must still draw an exiting arrow for input 0 from this nona... | habedi/stack-exchange-dataset |
111,873 | Diagonalization argument for MAJORITY | <p>For any language <span class="math-container">$A$</span>, define a language <span class="math-container">$L_{A}$</span> as:</p>

<p><span class="math-container">$L_{A} = \{0^{n}: \text{Number of strings in $A$ of length $n$ is more than $2^{n-1}$} \}$</span></p>

<p>I am trying to construct an <span ... | complexity theory | 1 | Diagonalization argument for MAJORITY -- (complexity theory)
<p>For any language <span class="math-container">$A$</span>, define a language <span class="math-container">$L_{A}$</span> as:</p>

<p><span class="math-container">$L_{A} = \{0^{n}: \text{Number of strings in $A$ of length $n$ is more than $2^{n-1}$} ... | habedi/stack-exchange-dataset |
111,877 | Designing solution to critical section problem with two semaphores vs single semaphore | <p>I came across following problem:</p>

<blockquote>
 <p>Let two processes P1 and P2 are there:</p>

<pre><code>+-----------------------+-----------------------+
| P1 | P2 |
| while(1) | while(1) |
| { ... | operating systems concurrency deadlocks semaphore | 1 | Designing solution to critical section problem with two semaphores vs single semaphore -- (operating systems concurrency deadlocks semaphore)
<p>I came across following problem:</p>

<blockquote>
 <p>Let two processes P1 and P2 are there:</p>

<pre><code>+-----------------------+-------------------... | habedi/stack-exchange-dataset |
111,879 | How do the bits of a certain emoji code for all the colors? | <p>I am watching an introductory course on computer science. At one part, it starts talking about unicode and how the bits 11111011000000010. He states that that codes for a laughing/crying face emoji.</p>

<p>However, he later on talks about how the pixels are each created through a number of bytes.He says the... | binary | 1 | How do the bits of a certain emoji code for all the colors? -- (binary)
<p>I am watching an introductory course on computer science. At one part, it starts talking about unicode and how the bits 11111011000000010. He states that that codes for a laughing/crying face emoji.</p>

<p>However, he later on talks abo... | habedi/stack-exchange-dataset |
111,887 | Steiner tree problem in graphs of diameter 3 | <p>I have an unweighted undirected graph <span class="math-container">$G(V, E)$</span> of diameter 3 and a subset <span class="math-container">$T\subseteq V$</span> of these vertices. I want to find the minimum tree <span class="math-container">$(V', E')$</span> that contains all vertices in <span class="math-container... | graphs computational geometry discrete mathematics | 1 | Steiner tree problem in graphs of diameter 3 -- (graphs computational geometry discrete mathematics)
<p>I have an unweighted undirected graph <span class="math-container">$G(V, E)$</span> of diameter 3 and a subset <span class="math-container">$T\subseteq V$</span> of these vertices. I want to find the minimum tree <sp... | habedi/stack-exchange-dataset |
111,895 | Which languages, decided by a turing machine are decidable? | <p>How do I decide if a language is decidable and/or semi-decidable?</p>

<p>I have theses languages:</p>

<p>a) { < M > | L(M) ⊆ 0*}</p>

<p>b) { < M > | L(M) contains at least one word of even length}</p>

<p>c) { < M > | L(M) is semi-decidable}</p>

<p>d... | turing machines undecidability decision problem semi decidability | 1 | Which languages, decided by a turing machine are decidable? -- (turing machines undecidability decision problem semi decidability)
<p>How do I decide if a language is decidable and/or semi-decidable?</p>

<p>I have theses languages:</p>

<p>a) { < M > | L(M) ⊆ 0*}</p>

<p>b) { < M ... | habedi/stack-exchange-dataset |
111,902 | how to solve simultaneous equation with O(n) | <p>Does someone know how to solve the below?</p>

<p>Assume that the array <span class="math-container">$A$</span> is already sorted. 
And show an <span class="math-container">$O(n)$</span>-time algorithm that determines whether or not there exist indices <span class="math-container">$i,j,k$</span> such tha... | algorithms complexity theory data structures | 1 | how to solve simultaneous equation with O(n) -- (algorithms complexity theory data structures)
<p>Does someone know how to solve the below?</p>

<p>Assume that the array <span class="math-container">$A$</span> is already sorted. 
And show an <span class="math-container">$O(n)$</span>-time algorithm that det... | habedi/stack-exchange-dataset |
111,910 | Given a certain context sensitive grammar, can one find out if a simpler context free grammar exists? | <p>Given a generating grammar, is it possible to reduce it to a context free form, if one exists. One method might seem to be if the context sensitive rules can be reached from higher generating points, in some sense. However, is this an interesting question worth worrying about? Are there practical situations, where t... | formal languages context free context sensitive | 1 | Given a certain context sensitive grammar, can one find out if a simpler context free grammar exists? -- (formal languages context free context sensitive)
<p>Given a generating grammar, is it possible to reduce it to a context free form, if one exists. One method might seem to be if the context sensitive rules can be r... | habedi/stack-exchange-dataset |
111,918 | Simple Hamiltonian cycle reduction | <blockquote>
 <p>HAMPATH</p>
 
 <ul>
 <li><p><strong>Input:</strong> An undirected graph <span class="math-container">$G$</span> and 2 nodes <span class="math-container">$s, t$</span></p></li>
 <li><p><strong>Question:</strong> Does G contain a Hamiltonian path from <span class="math-container"... | np complete polynomial time | 1 | Simple Hamiltonian cycle reduction -- (np complete polynomial time)
<blockquote>
 <p>HAMPATH</p>
 
 <ul>
 <li><p><strong>Input:</strong> An undirected graph <span class="math-container">$G$</span> and 2 nodes <span class="math-container">$s, t$</span></p></li>
 <li><p><strong>Question:</strong>... | habedi/stack-exchange-dataset |
111,929 | Finding path with specific length in weighted graph | <p>Given a weighted, cyclic, directed graph and two nodes I am looking for a connecting path which total weight comes as near as possible to a specific value which is greater than the shortest path.
Example in a real world scenario: Find a route from Washington D.C. to New York City which is 400 miles long, despite... | graphs routing | 1 | Finding path with specific length in weighted graph -- (graphs routing)
<p>Given a weighted, cyclic, directed graph and two nodes I am looking for a connecting path which total weight comes as near as possible to a specific value which is greater than the shortest path.
Example in a real world scenario: Find a rout... | habedi/stack-exchange-dataset |
111,932 | How can the VC-dimension of Turing machine be finite? | <p>The VC-dimension of a hypothesis class <span class="math-container">$\mathcal{H}$</span> is defined to be the size of the maximal set <span class="math-container">$C$</span> such that <span class="math-container">$\mathcal{H}$</span> <a href="https://en.wikipedia.org/wiki/Vapnik%E2%80%93Chervonenkis_dimension" rel=... | turing machines computability learning theory vc dimension | 1 | How can the VC-dimension of Turing machine be finite? -- (turing machines computability learning theory vc dimension)
<p>The VC-dimension of a hypothesis class <span class="math-container">$\mathcal{H}$</span> is defined to be the size of the maximal set <span class="math-container">$C$</span> such that <span class="ma... | habedi/stack-exchange-dataset |
111,949 | Proof involving asymptotic complexity | <p>The question in <a href="https://cs.stackexchange.com/questions/90702/proof-of-big-o-propositions">Proof of big-o propositions</a> asked to prove:</p>

<blockquote>
 <p><span class="math-container">$O(f(n))=O(g(n))\iff\Omega(f(n))=\Omega(g(n))\iff\Theta(f(n))=\Theta(g(n))$</span></p>
</blockquote>&#... | asymptotics | 1 | Proof involving asymptotic complexity -- (asymptotics)
<p>The question in <a href="https://cs.stackexchange.com/questions/90702/proof-of-big-o-propositions">Proof of big-o propositions</a> asked to prove:</p>

<blockquote>
 <p><span class="math-container">$O(f(n))=O(g(n))\iff\Omega(f(n))=\Omega(g(n))\iff\T... | habedi/stack-exchange-dataset |
111,961 | Is it theoretically possible to dynamically grow array size in stack memory? | <p>I was wondering, given the usual stack memory functioning, whether it is possible for an array like primitive type allowed to grow in size to exist.<br>
The functioning of such primitive type is as follows.</p>

<ul>
<li>Any one function is allowed to have only one such primitive variable.</li>
<... | stacks memory allocation | 1 | Is it theoretically possible to dynamically grow array size in stack memory? -- (stacks memory allocation)
<p>I was wondering, given the usual stack memory functioning, whether it is possible for an array like primitive type allowed to grow in size to exist.<br>
The functioning of such primitive type is as follows.... | habedi/stack-exchange-dataset |
111,962 | Why is $ZPP \geq BPP$ not true? | <p>This seems like a silly question, but I couldn't find a conclusive answer for it. </p>

<p>As far as I know, ZPP contains algorithms which run in polynomial time and either return a known-correct answer or abort (this definition is equal to the one where they either return a correct answer or run in exponent... | complexity theory reductions randomized algorithms | 1 | Why is $ZPP \geq BPP$ not true? -- (complexity theory reductions randomized algorithms)
<p>This seems like a silly question, but I couldn't find a conclusive answer for it. </p>

<p>As far as I know, ZPP contains algorithms which run in polynomial time and either return a known-correct answer or abort (this def... | habedi/stack-exchange-dataset |
111,963 | Worst Case Space Complexity of Merge Sort and Bubble Sort | <p>I understand that the worst space complexity of Bubble Sort is constant O(1), since all the space we need is the array where the elements were stored. But why is Merge Sort's worst space complexity O(n), linear? All space we need is the exact number of the elements, right? Please enlighten me.</p>
 | algorithm analysis space complexity space analysis mergesort | 1 | Worst Case Space Complexity of Merge Sort and Bubble Sort -- (algorithm analysis space complexity space analysis mergesort)
<p>I understand that the worst space complexity of Bubble Sort is constant O(1), since all the space we need is the array where the elements were stored. But why is Merge Sort's worst space comple... | habedi/stack-exchange-dataset |
111,968 | Create NOT gate from other gates | <p>If we are given only one NOT gate and any number of OR and AND gates, then, can we simulate more NOT gates?</p>
 | computer architecture logic | 1 | Create NOT gate from other gates -- (computer architecture logic)
<p>If we are given only one NOT gate and any number of OR and AND gates, then, can we simulate more NOT gates?</p>
 | habedi/stack-exchange-dataset |
111,988 | Number of ways painting graph in two colors, such that two nodes of same color are linked by edge | <p>We are given undirected graph of <span class="math-container">$N$</span> nodes and <span class="math-container">$M$</span> edges, we want to count the number of possible ways to paint this graph in <span class="math-container">$2$</span> colors such that for each two nodes having the same color, there must be an edg... | graphs counting | 1 | Number of ways painting graph in two colors, such that two nodes of same color are linked by edge -- (graphs counting)
<p>We are given undirected graph of <span class="math-container">$N$</span> nodes and <span class="math-container">$M$</span> edges, we want to count the number of possible ways to paint this graph in ... | habedi/stack-exchange-dataset |
112,015 | Is every Turing complete set for EXPSPACE autoreducible? | <p>I'm reading about autoreducibility, which is the following notion:</p>

<blockquote>
 <p>A set <span class="math-container">$L$</span> is autoreducible
 if there is a polynomial-time oracle Turing machine <span class="math-container">$M$</span>
 that accepts <span class="math-container">$L$</s... | complexity theory reductions | 1 | Is every Turing complete set for EXPSPACE autoreducible? -- (complexity theory reductions)
<p>I'm reading about autoreducibility, which is the following notion:</p>

<blockquote>
 <p>A set <span class="math-container">$L$</span> is autoreducible
 if there is a polynomial-time oracle Turing machine <sp... | habedi/stack-exchange-dataset |
112,017 | Weight functions in graph algorithms | <p>In text books, for instance in the 3rd edition of <em>Introduction to Algorithms</em>, Cormen, on page 625, the weights of the edge set <span class="math-container">$E$</span> is defined with a weight function <span class="math-container">$w:E\rightarrow \mathbb{R}$</span>.</p>

<p>Why is it defined in this ... | graphs weighted graphs notation | 1 | Weight functions in graph algorithms -- (graphs weighted graphs notation)
<p>In text books, for instance in the 3rd edition of <em>Introduction to Algorithms</em>, Cormen, on page 625, the weights of the edge set <span class="math-container">$E$</span> is defined with a weight function <span class="math-container">$w:E... | habedi/stack-exchange-dataset |
112,026 | Run time for a specific loop confusion | <p>I have a loop:
<code>for(int i = 1; i < N; i*=5) {...}</code></p>

<p>where <code>{...}</code> is some statement.</p>

<p>I'm trying to understand its run time. So, far I know that:</p>

<ul>
<li><p>We start with <span class="math-container">$i = 1$</span></p></li>
<li><p>We fi... | algorithms algorithm analysis | 1 | Run time for a specific loop confusion -- (algorithms algorithm analysis)
<p>I have a loop:
<code>for(int i = 1; i < N; i*=5) {...}</code></p>

<p>where <code>{...}</code> is some statement.</p>

<p>I'm trying to understand its run time. So, far I know that:</p>

<ul>
<li><p>We start ... | habedi/stack-exchange-dataset |
112,032 | Calculate minimum and maximum Ethernet (IEEE 802.3) frame size from frame format | <p><a href="https://i.stack.imgur.com/Od3Ou.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Od3Ou.png" alt="enter image description here"></a></p>

<p>According the frame format of Ethernet</p>

<p>Minimum Frame Size should be :</p>

<pre><code>7Bytes + 1Bytes + 6Bytes + 6Byte... | computer networks | 1 | Calculate minimum and maximum Ethernet (IEEE 802.3) frame size from frame format -- (computer networks)
<p><a href="https://i.stack.imgur.com/Od3Ou.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Od3Ou.png" alt="enter image description here"></a></p>

<p>According the frame format of Ethernet... | habedi/stack-exchange-dataset |
112,034 | Minimum Bounding Quadrilateral | <p>In an image processing project (using opencv with python), I am trying to detect as precisely as possible the location of a rectangular object in a photograph. My final goal is to output the 4 corners of the object.</p>

<p>For example, an image could look like this:
<a href="https://i.stack.imgur.com/b1... | algorithms computational geometry image processing | 1 | Minimum Bounding Quadrilateral -- (algorithms computational geometry image processing)
<p>In an image processing project (using opencv with python), I am trying to detect as precisely as possible the location of a rectangular object in a photograph. My final goal is to output the 4 corners of the object.</p>

<... | habedi/stack-exchange-dataset |
112,037 | What types are propositions? | <p>In the <a href="https://ncatlab.org/nlab/show/propositions+as+types" rel="nofollow noreferrer">propositions-as-types paradigm</a>, we are still faced with the question : what types are propositions ? I currently know 3 different answers :</p>

<ul>
<li>Coq's sort <code>Prop</code> and its typing rule tha... | coq homotopy type theory calculus of constructions | 1 | What types are propositions? -- (coq homotopy type theory calculus of constructions)
<p>In the <a href="https://ncatlab.org/nlab/show/propositions+as+types" rel="nofollow noreferrer">propositions-as-types paradigm</a>, we are still faced with the question : what types are propositions ? I currently know 3 different ans... | habedi/stack-exchange-dataset |
112,046 | Is the following a AVL tree? | <p>I have a tree as</p>

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

<p>Is it an AVL tree? it seems to balanced for me.</p>
 | data structures avl trees | 1 | Is the following a AVL tree? -- (data structures avl trees)
<p>I have a tree as</p>

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

<p>Is it an AVL tree? it seems to balanced for me.<... | habedi/stack-exchange-dataset |
112,048 | A push-down automaton with two stacks which is equivalent to a linear-bounded automaton | <p>It is known that a PDA with two stacks is equivalent to a TM.</p>

<p>On the other hand a PDA with one stack is capable to recognise only context-free languages.</p>

<p>Hence there is a kind of a gap between the class of PDA with one stack and the class of PDA with two stacks which should be capable... | turing machines context free pushdown automata context sensitive linear bounded automata | 1 | A push-down automaton with two stacks which is equivalent to a linear-bounded automaton -- (turing machines context free pushdown automata context sensitive linear bounded automata)
<p>It is known that a PDA with two stacks is equivalent to a TM.</p>

<p>On the other hand a PDA with one stack is capable to reco... | habedi/stack-exchange-dataset |
112,051 | Assuming an infinite amount of computing resources, would the minmax algorithm always win in chess? | <p>The minmax algorithm is a popular strategy used to design chess engines. Usually, since the state-space of chess is huge, we choose a fixed depth and evaluate the game tree down to that level, and pick the best sequence of moves so far.</p>

<p>Let's suppose we remove this limit, and we search for the whole ... | artificial intelligence game theory board games minmax algorithm | 1 | Assuming an infinite amount of computing resources, would the minmax algorithm always win in chess? -- (artificial intelligence game theory board games minmax algorithm)
<p>The minmax algorithm is a popular strategy used to design chess engines. Usually, since the state-space of chess is huge, we choose a fixed depth a... | habedi/stack-exchange-dataset |
112,054 | graph theory conventions, difference between a PATH and a GRAPH? | <p>Consider this example, I did my pseudocode in python</p>

<pre><code>findCycle(G):
 for each edge e in E(G):
 if isThereCycle(G-e):
 G = G - e
 return G 
</code></pre>

<p>assume isthereCycle returns whether the graph <span class="math-container">$G$</span>... | algorithms graphs | 1 | graph theory conventions, difference between a PATH and a GRAPH? -- (algorithms graphs)
<p>Consider this example, I did my pseudocode in python</p>

<pre><code>findCycle(G):
 for each edge e in E(G):
 if isThereCycle(G-e):
 G = G - e
 return G 
</code></pre>

... | habedi/stack-exchange-dataset |
112,059 | Computational complexity of calculating mean vs median? | <p>Suppose we have a list <span class="math-container">$L$</span> consisting of <span class="math-container">$N$</span> numbers (may include repetitions).</p>

<p>I am curious which is more computationally intensive to calculate, the mean or the median?</p>

<p>Naively, I would suppose calculating the m... | algorithms time complexity | 1 | Computational complexity of calculating mean vs median? -- (algorithms time complexity)
<p>Suppose we have a list <span class="math-container">$L$</span> consisting of <span class="math-container">$N$</span> numbers (may include repetitions).</p>

<p>I am curious which is more computationally intensive to calcu... | habedi/stack-exchange-dataset |
112,060 | If X (an NP-hard problem) is polynomial-time many-one reducible to problem Y, then Y is NP-hard. Why is it the case? | <p>According to <a href="https://gatecse.in/some_reduction_inferences/" rel="nofollow noreferrer">this</a> source, </p>

<blockquote>
 <p>If A is reduced to B and A ∈ class X, then B cannot be easier than X. This reduction is used to show if a problem belongs to NPH – just reduce some known NPH problem to... | complexity theory np hard np | 1 | If X (an NP-hard problem) is polynomial-time many-one reducible to problem Y, then Y is NP-hard. Why is it the case? -- (complexity theory np hard np)
<p>According to <a href="https://gatecse.in/some_reduction_inferences/" rel="nofollow noreferrer">this</a> source, </p>

<blockquote>
 <p>If A is reduced to... | habedi/stack-exchange-dataset |
112,065 | is FIND WORDS in P? | <p><strong>FIND WORDS</strong> is the following decision problem:</p>

<p>Given a list of words <em>L</em> and a Matrix <em>M</em>, are all words in <em>L</em> also in <em>M</em>? 
The words in <em>M</em> can be written up to down, down to up, left to right, right to left, diagonal-left-up, diagonal-left-do... | np decision problem | 1 | is FIND WORDS in P? -- (np decision problem)
<p><strong>FIND WORDS</strong> is the following decision problem:</p>

<p>Given a list of words <em>L</em> and a Matrix <em>M</em>, are all words in <em>L</em> also in <em>M</em>? 
The words in <em>M</em> can be written up to down, down to up, left to right, righ... | habedi/stack-exchange-dataset |
112,075 | Langton's Ant Periodic Behavior | <p>I was wondering if there's any initial configuration which generates a pure periodic behavior for Langton's Ant?</p>
 | cellular automata | 1 | Langton's Ant Periodic Behavior -- (cellular automata)
<p>I was wondering if there's any initial configuration which generates a pure periodic behavior for Langton's Ant?</p>
 | habedi/stack-exchange-dataset |
112,080 | Prove that the greedy algorithm to remove k digits from a n-digit positive integer is optimal | <p>Given a positive n-digit integer, such as 1214532 (n=7), remove k digits (for example k=4) such that the resulting integer is the smallest one.</p>

<p>A greedy algorithm for this would keep removing digits such that the resulting integer is the smallest. For the above example:</p>

<pre><code>Step 1... | algorithms correctness proof greedy algorithms | 1 | Prove that the greedy algorithm to remove k digits from a n-digit positive integer is optimal -- (algorithms correctness proof greedy algorithms)
<p>Given a positive n-digit integer, such as 1214532 (n=7), remove k digits (for example k=4) such that the resulting integer is the smallest one.</p>

<p>A greedy al... | habedi/stack-exchange-dataset |
112,095 | Probabilistic halting problem | <p>I'm a physics and math student working through Nielsen & Chuang's text on quantum computation and information. I don't have much experience in CS theory, so some of these exercises are confusing to me:</p>

<p>Suppose we number the probabilistic Turing machines and define the probabilistic halting functi... | undecidability halting problem probabilistic turing machines | 1 | Probabilistic halting problem -- (undecidability halting problem probabilistic turing machines)
<p>I'm a physics and math student working through Nielsen & Chuang's text on quantum computation and information. I don't have much experience in CS theory, so some of these exercises are confusing to me:</p>

<p... | habedi/stack-exchange-dataset |
112,098 | Basic complexity theory (in Oracle Separation of BQP and PH) | <p>I have some basic questions about complexity theory that came up when I tried to understand <a href="https://dl.acm.org/citation.cfm?id=3316315" rel="nofollow noreferrer">the result by Raz and Tal</a> that <strong>BQP</strong><span class="math-container">$^O\nsubseteq$</span> <strong>PH</strong><span class="math-con... | complexity theory quantum computing oracle machines | 1 | Basic complexity theory (in Oracle Separation of BQP and PH) -- (complexity theory quantum computing oracle machines)
<p>I have some basic questions about complexity theory that came up when I tried to understand <a href="https://dl.acm.org/citation.cfm?id=3316315" rel="nofollow noreferrer">the result by Raz and Tal</a... | habedi/stack-exchange-dataset |
112,101 | Algorithm Analysis of Insertion Sort | <p>Why is the recurrence formula for insertion sort is <code>T(n-1) + n</code>?</p>

<p>I understand the <code>T(n-1)</code> part but the why does the cost for merging results is n or linear. Do we have to merge in insertion sort?</p>
 | algorithms algorithm analysis sorting mathematical analysis | 1 | Algorithm Analysis of Insertion Sort -- (algorithms algorithm analysis sorting mathematical analysis)
<p>Why is the recurrence formula for insertion sort is <code>T(n-1) + n</code>?</p>

<p>I understand the <code>T(n-1)</code> part but the why does the cost for merging results is n or linear. Do we have to merg... | habedi/stack-exchange-dataset |
112,115 | Algorithm for detecting overlaps | <p><em>This is a real-world application, not a student assignment.</em></p>

<p>Suppose a list of events of that have <code>startTime</code> and <code>endTime</code>, and some overlap information. In pseudocode:</p>

<pre><code>class Event {
 Time startTime;
 Time endTime;
 bool ove... | algorithms efficiency intervals ordering | 1 | Algorithm for detecting overlaps -- (algorithms efficiency intervals ordering)
<p><em>This is a real-world application, not a student assignment.</em></p>

<p>Suppose a list of events of that have <code>startTime</code> and <code>endTime</code>, and some overlap information. In pseudocode:</p>

<pre><co... | habedi/stack-exchange-dataset |
112,124 | Is there a unit of measurement that can express code execution speed in absolute terms? | <p>I've always seen code execution speed measured either in units of time (e.g. <em>t</em> milliseconds), or using asymptotic analysis (e.g. O(<em>n</em> log <em>n</em>)). Execution speed will vary depending on hardware performance, and asymptotic analysis can tell us how code will perform relative to the size of the i... | complexity theory algorithm analysis time complexity asymptotics runtime analysis | 1 | Is there a unit of measurement that can express code execution speed in absolute terms? -- (complexity theory algorithm analysis time complexity asymptotics runtime analysis)
<p>I've always seen code execution speed measured either in units of time (e.g. <em>t</em> milliseconds), or using asymptotic analysis (e.g. O(<e... | habedi/stack-exchange-dataset |
112,145 | Linear codes : why has the parity check matrix dimensions $(n-k)*k$? | <p>I am studying Quantum error correction that is based on some aspects on classical error correction.</p>

<p>I am reading some very basics around linear error correcting codes.</p>

<p>I consider a linear code [n,k]: thus it encodes k bits of information into n bits.</p>

<p><strong>My questio... | error correcting codes | 1 | Linear codes : why has the parity check matrix dimensions $(n-k)*k$? -- (error correcting codes)
<p>I am studying Quantum error correction that is based on some aspects on classical error correction.</p>

<p>I am reading some very basics around linear error correcting codes.</p>

<p>I consider a linear ... | habedi/stack-exchange-dataset |
112,153 | How can the union of two 'context-free but not regular' languages be regular? | <p>I cannot understand how the union of two languages which are context-free but not regular, can result in a regular language:</p>

<blockquote>
 <p>If <span class="math-container">$L_1$</span> and <span class="math-container">$L_2$</span> are 'context-free but not regular' languages, defined over the sam... | formal languages regular languages context free closure properties | 1 | How can the union of two 'context-free but not regular' languages be regular? -- (formal languages regular languages context free closure properties)
<p>I cannot understand how the union of two languages which are context-free but not regular, can result in a regular language:</p>

<blockquote>
 <p>If <spa... | habedi/stack-exchange-dataset |
112,158 | Confusion about assignment axiom in Hoare logic | <p>I wanted to know if we are given the f.f.g. Hoare triple:</p>

<p>{x = 43}x := x + 1{x = 44}</p>

<p>How do we show that this is a valid Hoare triple?</p>

<p>My attempt was:</p>

<p>Using the assignment axiom:
{x + 1 = 43} x := x + 1 {x = 44}</p>

<p>But this doesn'the ma... | logic correctness proof hoare logic | 1 | Confusion about assignment axiom in Hoare logic -- (logic correctness proof hoare logic)
<p>I wanted to know if we are given the f.f.g. Hoare triple:</p>

<p>{x = 43}x := x + 1{x = 44}</p>

<p>How do we show that this is a valid Hoare triple?</p>

<p>My attempt was:</p>

<p>Using the ass... | habedi/stack-exchange-dataset |
112,160 | Representing partialled/curried functions in postfix notation? | <p>I'm working on a small query language in JSON. A query consists of a JSON array of JSON elements, such as strings, numbers, booleans, etc. Strings starting with a <code>'$'</code> or <code>'@'</code> represent postfix unary or binary operators, respectively.</p>

<p>I want to include some functional aspects ... | functional programming | 1 | Representing partialled/curried functions in postfix notation? -- (functional programming)
<p>I'm working on a small query language in JSON. A query consists of a JSON array of JSON elements, such as strings, numbers, booleans, etc. Strings starting with a <code>'$'</code> or <code>'@'</code> represent postfix unary or... | habedi/stack-exchange-dataset |
112,165 | Recover boolean vector from dot products | <p><strong>Question:</strong></p>

<p>I want to determine a boolean vector <span class="math-container">$b \in \{0,1\}^n$</span> consisting of zeros and ones, but cannot access it directly. I can only call a black-box computer code which will take the dot product of <span class="math-container">$b$</span> with ... | machine learning combinatorics linear algebra subset sum | 1 | Recover boolean vector from dot products -- (machine learning combinatorics linear algebra subset sum)
<p><strong>Question:</strong></p>

<p>I want to determine a boolean vector <span class="math-container">$b \in \{0,1\}^n$</span> consisting of zeros and ones, but cannot access it directly. I can only call a b... | habedi/stack-exchange-dataset |
112,168 | The Halting problem proof is wrong? | <p>First, let's see the pseudocode proof of halting problem:</p>

<pre><code>P(x) =
 run H(x, x)
 if H(x, x) answers "yes"
 loop forever
 else
 halt
</code></pre>

<p>Then we have a problem: </p>

<p>When param x is the encoding string of P itself, the code l... | complexity theory turing machines computability halting problem | 1 | The Halting problem proof is wrong? -- (complexity theory turing machines computability halting problem)
<p>First, let's see the pseudocode proof of halting problem:</p>

<pre><code>P(x) =
 run H(x, x)
 if H(x, x) answers "yes"
 loop forever
 else
 halt
</code></pre>
&#x... | habedi/stack-exchange-dataset |
112,179 | Basic classical linear error correcting code for bits exercice (from Nielsen & Chuang) | <p>I am learning about quantum error correction which is for a part based on classical linear error correcting code.</p>

<p>There is a very basic answer on an exercice I do not understand. Here is the problem (From Nielsen & Chuang, page 450, exercice 10.25)</p>

<blockquote>
 <p>Let <span cla... | error correcting codes | 1 | Basic classical linear error correcting code for bits exercice (from Nielsen & Chuang) -- (error correcting codes)
<p>I am learning about quantum error correction which is for a part based on classical linear error correcting code.</p>

<p>There is a very basic answer on an exercice I do not understand. Here is... | habedi/stack-exchange-dataset |
112,182 | Algorithm for placing circles of Diameter d around the edge of another circle with diameter D | <p>Hi i'm struggling with what i think may be simple maths. I need to place circles of a small size around the edge of larger circle.. is there an algorithm to calculate the angle for each small circle from the x-axis, counter clockwise? then using this angle i can find the Cartesian coordinates (x,y) of the enter of e... | algorithms graphs | 1 | Algorithm for placing circles of Diameter d around the edge of another circle with diameter D -- (algorithms graphs)
<p>Hi i'm struggling with what i think may be simple maths. I need to place circles of a small size around the edge of larger circle.. is there an algorithm to calculate the angle for each small circle f... | habedi/stack-exchange-dataset |
112,210 | PH=PSPACE implies collapse of PH? | <p>If PH=PSPACE, does this imply that the PH collapses to one of its levels?</p>

<p>(somehow I get an error message when posting "question doesn't meet quality standard" so I add this sentence in order to workaround it)</p>
 | complexity theory | 1 | PH=PSPACE implies collapse of PH? -- (complexity theory)
<p>If PH=PSPACE, does this imply that the PH collapses to one of its levels?</p>

<p>(somehow I get an error message when posting "question doesn't meet quality standard" so I add this sentence in order to workaround it)</p>
 | habedi/stack-exchange-dataset |
112,224 | How to get to the efficient solution of a problem on buying with exchange policy | <p>I was working through some coding challenges at hackerrank.com and got to <a href="https://www.hackerrank.com/challenges/chocolate-feast/problem" rel="nofollow noreferrer">this one</a>.</p>

<p>I understand the problem and how to solve it, but after solving it I searched for more solutions to improve mine. S... | algorithms algorithm analysis optimization | 1 | How to get to the efficient solution of a problem on buying with exchange policy -- (algorithms algorithm analysis optimization)
<p>I was working through some coding challenges at hackerrank.com and got to <a href="https://www.hackerrank.com/challenges/chocolate-feast/problem" rel="nofollow noreferrer">this one</a>.</p... | habedi/stack-exchange-dataset |
112,228 | What is the name of the operator that translates from $X\rightarrow(Y\rightarrow Z)$ to $Y\rightarrow(X\rightarrow Z)$? | <p>Is there a standard name for the operator that takes a function <span class="math-container">$f:X\rightarrow(Y\rightarrow Z)$</span> and returns the function <span class="math-container">$f':Y\rightarrow(X\rightarrow Z)$</span> that satisfies, for every <span class="math-container">$y \in Y$</span> and <span class="... | terminology lambda calculus combinatory logic | 1 | What is the name of the operator that translates from $X\rightarrow(Y\rightarrow Z)$ to $Y\rightarrow(X\rightarrow Z)$? -- (terminology lambda calculus combinatory logic)
<p>Is there a standard name for the operator that takes a function <span class="math-container">$f:X\rightarrow(Y\rightarrow Z)$</span> and returns t... | habedi/stack-exchange-dataset |
112,231 | Context Free Grammar $L=\{a^ib^{2i}c^{2i} | i>1\}$ | <p>In one of my exams I needed to find a CFG for <span class="math-container">$L=\{a^ib^{2i}c^{2i} | i>1\}$</span>.</p>

<p>however, it really seemed to me that it is not a CFG.
I tried to show it is not using the pumping lemma, and think I managed, but I don't really know if I did something wrong there.... | formal languages context free | 1 | Context Free Grammar $L=\{a^ib^{2i}c^{2i} | i>1\}$ -- (formal languages context free)
<p>In one of my exams I needed to find a CFG for <span class="math-container">$L=\{a^ib^{2i}c^{2i} | i>1\}$</span>.</p>

<p>however, it really seemed to me that it is not a CFG.
I tried to show it is not using the pumpi... | habedi/stack-exchange-dataset |
112,248 | Gas Station problem : Fixed path variation | <p>Given a set of cities where you need a certain amount of fuel to travel from one city to another, each city has a different fuel price and you can only load K amount of fuel to the vehicle. The path is fixed (ie) you have to go from C1 to Cn through C2, C3,.. and so on. The objective is to fill fuel in these cities ... | algorithms dynamic programming greedy algorithms | 1 | Gas Station problem : Fixed path variation -- (algorithms dynamic programming greedy algorithms)
<p>Given a set of cities where you need a certain amount of fuel to travel from one city to another, each city has a different fuel price and you can only load K amount of fuel to the vehicle. The path is fixed (ie) you hav... | habedi/stack-exchange-dataset |
112,251 | Number of nodes in Van-Emde-Boas tree of universe size u? | <p>The universe size <span class="math-container">$u$</span> in vEB trees is square rooted at each level until <span class="math-container">$u = 2$</span>. So, unlike search trees, the branching factor is different at each level.</p>
<p><a href="https://i.stack.imgur.com/2cyX4.jpg" rel="nofollow noreferrer"><img sr... | algorithms data structures van emde boas trees | 1 | Number of nodes in Van-Emde-Boas tree of universe size u? -- (algorithms data structures van emde boas trees)
<p>The universe size <span class="math-container">$u$</span> in vEB trees is square rooted at each level until <span class="math-container">$u = 2$</span>. So, unlike search trees, the branching factor is diffe... | habedi/stack-exchange-dataset |
112,252 | Is finite subset of a set which contains all non regular languages a regular set? | <p>Let A be a set which contains all non-regular languages. Then set B which is finite subset of A. Then will it be regular ?</p>

<p>I know that A is not recursive enumerable set (undecidable). So I wonder that if finite subset of undecidable set is a regular language or not.</p>
 | formal languages regular languages undecidability | 1 | Is finite subset of a set which contains all non regular languages a regular set? -- (formal languages regular languages undecidability)
<p>Let A be a set which contains all non-regular languages. Then set B which is finite subset of A. Then will it be regular ?</p>

<p>I know that A is not recursive enumerable... | habedi/stack-exchange-dataset |
112,253 | TQBF PSPACE-COMPLETE : Why this algorithm is exponential but Savitch's not? | <p>So this is a question pertaining to the proof for <span class="math-container">$PSPACE-COMPLETE$</span> (for TQBF for example). The idea is to first prove the <span class="math-container">$L$</span> <span class="math-container">$is$</span> <span class="math-container">$PSPACE$</span>(easy part) and next is to prove... | complexity theory space complexity nondeterminism | 1 | TQBF PSPACE-COMPLETE : Why this algorithm is exponential but Savitch's not? -- (complexity theory space complexity nondeterminism)
<p>So this is a question pertaining to the proof for <span class="math-container">$PSPACE-COMPLETE$</span> (for TQBF for example). The idea is to first prove the <span class="math-container... | habedi/stack-exchange-dataset |
112,261 | Is there an O(1) solution to find the kth-smallest element in an implicit min-heap? | <p>I know this would be an <em>O(k log n)</em> operation on a traditional heap, and I know there are ways to maintain Kth-smallest over a stream of inserts/deletes for constant-time access...</p>

<p>My question though is, when we have an implicit array representation of a min-heap, e.g.:</p>

<pre><cod... | algorithms asymptotics arrays heaps | 1 | Is there an O(1) solution to find the kth-smallest element in an implicit min-heap? -- (algorithms asymptotics arrays heaps)
<p>I know this would be an <em>O(k log n)</em> operation on a traditional heap, and I know there are ways to maintain Kth-smallest over a stream of inserts/deletes for constant-time access...</p>... | habedi/stack-exchange-dataset |
112,271 | Given n sets of points in the plane find the shortest path which passes from exactly one point from each set | <p>I am trying to find an algorithm for this. You can imagine each set <span class="math-container">$(S_1, S_2, \ldots, S_n)$</span> as points with different colour. Also it isn't necessarily <span class="math-container">$|S_1|=|S_2|=\cdots=|S_n|$</span>.</p>

<p>For <span class="math-container">$n=1$</span> we... | algorithms time complexity computational geometry traveling salesman | 1 | Given n sets of points in the plane find the shortest path which passes from exactly one point from each set -- (algorithms time complexity computational geometry traveling salesman)
<p>I am trying to find an algorithm for this. You can imagine each set <span class="math-container">$(S_1, S_2, \ldots, S_n)$</span> as p... | habedi/stack-exchange-dataset |
112,273 | efficiently calculate nearest common ancestor in a family tree (each person has two parents) | <p>I'm well aware of ways to efficiently calculate the lowest common ancestor in a tree of nodes which converge to a single root (ie, each node has only one parent). Just iterate back to root for each person, then walk back from root tossing off anything common.</p>

<p>In a matriarchal society, for example, t... | graphs | 1 | efficiently calculate nearest common ancestor in a family tree (each person has two parents) -- (graphs)
<p>I'm well aware of ways to efficiently calculate the lowest common ancestor in a tree of nodes which converge to a single root (ie, each node has only one parent). Just iterate back to root for each person, then ... | habedi/stack-exchange-dataset |
112,282 | Recurrence Equation upper limit problem | <p>I was looking at my teacher's notes and came about the following recurrence equation : </p>

<p><span class="math-container">$$
T(n) = 
 \begin{cases}
 1 &\quad\text{if } n\leq 1\\
 4T\left(\frac{n}{2}\right) + n^3 &\quad\text{if } n\gt1 \\
 \end{cases}
$... | recurrence relation | 1 | Recurrence Equation upper limit problem -- (recurrence relation)
<p>I was looking at my teacher's notes and came about the following recurrence equation : </p>

<p><span class="math-container">$$
T(n) = 
 \begin{cases}
 1 &\quad\text{if } n\leq 1\\
 4T\left(\frac{n}{2}\righ... | habedi/stack-exchange-dataset |
112,290 | When compiled into binary, what signifies the end of a string? How can this be differentiated from user input which compiles to the same binary? | <p>Apologies for the strange title, this is one of those questions I can't find through a Google search just because I don't even know what I'm supposed to be searching for.</p>

<p>As I understand it, programs are ultimately compiled into binary which is then run by a computer.</p>

<p>So say, for exam... | security | 1 | When compiled into binary, what signifies the end of a string? How can this be differentiated from user input which compiles to the same binary? -- (security)
<p>Apologies for the strange title, this is one of those questions I can't find through a Google search just because I don't even know what I'm supposed to be se... | habedi/stack-exchange-dataset |
112,299 | Complexity guess and induction proof | <p>I was trying to prove by induction that<br>
<span class="math-container">$$
T(n) = \begin{cases}
 1 &\quad\text{if } n\leq 1\\
 T\left(\lfloor\frac{n}{2}\rfloor\right) + n &\quad\text{if } n\gt1 \\
 \end{cases}
$$</span>
is <span class="math-container">$\Omega... | recurrence relation | 1 | Complexity guess and induction proof -- (recurrence relation)
<p>I was trying to prove by induction that<br>
<span class="math-container">$$
T(n) = \begin{cases}
 1 &\quad\text{if } n\leq 1\\
 T\left(\lfloor\frac{n}{2}\rfloor\right) + n &\quad\text{if } n\gt1 \\
 \end{ca... | habedi/stack-exchange-dataset |
112,302 | Minimize same placed elements in a list of permutations (Heap) | <p>I'm trying to optimize the permutations generated from a set of n elements.</p>

<p>Here is the pitch:
I have a set of 6 elements <span class="math-container">$\{1,2,3,4,5,6\}$</span> and I want to create 10 permutations. I could use Heap algorithm to keep 10 among 6! possible combinations.</p>

... | optimization permutations | 1 | Minimize same placed elements in a list of permutations (Heap) -- (optimization permutations)
<p>I'm trying to optimize the permutations generated from a set of n elements.</p>

<p>Here is the pitch:
I have a set of 6 elements <span class="math-container">$\{1,2,3,4,5,6\}$</span> and I want to create 10 per... | habedi/stack-exchange-dataset |
112,319 | Is a simple graph connected, if every node has at least one adjacent edge and $|E|\ge |V|-1$? | <p>Let <span class="math-container">$G=(V,E)$</span> be an undirected graph without self-loops or parallel edges.</p>

<p>Is the following statement true?<br>
If <span class="math-container">$|V|=n, |E|\ge n-1$</span> and every node has at least one adjacent edge, then <span class="math-container">$G$</span... | graphs connected components | 1 | Is a simple graph connected, if every node has at least one adjacent edge and $|E|\ge |V|-1$? -- (graphs connected components)
<p>Let <span class="math-container">$G=(V,E)$</span> be an undirected graph without self-loops or parallel edges.</p>

<p>Is the following statement true?<br>
If <span class="math-c... | habedi/stack-exchange-dataset |
112,342 | For signed integers, why don't representative the smallest number as all zeros in binary, and the largest as all ones? | <p>I'm reading up on bitwise operators, complements, and two's complements, and I'm wondering why the lower limit of a range (aka lowest negative number) isn't all zeroes in binary, and the upper limit isn't all ones.</p>

<p>For example, for 8 bit integers, why don't we represent <code>-128</code> as <code>000... | integers binary | 1 | For signed integers, why don't representative the smallest number as all zeros in binary, and the largest as all ones? -- (integers binary)
<p>I'm reading up on bitwise operators, complements, and two's complements, and I'm wondering why the lower limit of a range (aka lowest negative number) isn't all zeroes in binary... | habedi/stack-exchange-dataset |
112,344 | Expressing unsigned comparison through signed comparison of 2's complement | <p>Let <code>n > 0</code> be a natural number and for any two reminders <code>a, b</code> modulo <code>2^n</code> we have that <code>a < b</code> <strong><em>iff</em></strong> <code>a xor 0x800..00 <(signed) b xor 0x800...00</code>. </p>

<p>It is also true that <code>a <(signed) b</code> iff <code>... | boolean algebra modular arithmetic | 1 | Expressing unsigned comparison through signed comparison of 2's complement -- (boolean algebra modular arithmetic)
<p>Let <code>n > 0</code> be a natural number and for any two reminders <code>a, b</code> modulo <code>2^n</code> we have that <code>a < b</code> <strong><em>iff</em></strong> <code>a xor 0x800..00 &... | habedi/stack-exchange-dataset |
112,352 | Proof: There exists an irregular language L such that LLLL is regular | <p>As title.</p>

<p>I consider finding a specific L to fulfill the condition stated to prove the statement, however, I have no luck in finding one.</p>

<p>A senior gave me a hint that Lagrange's four square theorem might help, but I don't see how I can utilize it.</p>

<p>Thanks.</p>
 | formal languages regular languages finite automata | 1 | Proof: There exists an irregular language L such that LLLL is regular -- (formal languages regular languages finite automata)
<p>As title.</p>

<p>I consider finding a specific L to fulfill the condition stated to prove the statement, however, I have no luck in finding one.</p>

<p>A senior gave me a hi... | habedi/stack-exchange-dataset |
112,358 | Sum of unique integers to cnf constraint | <p>As a study project I try to solve the <a href="https://en.wikipedia.org/wiki/Kakuro" rel="nofollow noreferrer">kakuro</a> puzzle problem using SAT SOLVER.
I can't really find an efficient way to convert the sum of k unique integers (1...9) to a CNF constraint. 
What I had in mind:</p>

<p>for a group... | constraint satisfaction sat solvers java | 1 | Sum of unique integers to cnf constraint -- (constraint satisfaction sat solvers java)
<p>As a study project I try to solve the <a href="https://en.wikipedia.org/wiki/Kakuro" rel="nofollow noreferrer">kakuro</a> puzzle problem using SAT SOLVER.
I can't really find an efficient way to convert the sum of k unique int... | habedi/stack-exchange-dataset |
112,360 | Range of each building in array | <p>I have two arrays, X and H, where X is sorted. X[i] represents the coordinate of building i. Y[i] represents the height of building i. If building i collapses, all buildings in the interval [ X[i]+1, X[i]+H[i] ], both ends inclusive, will collapse, too. Those collapsed building may cause more buildings to collapse a... | algorithms data structures arrays | 1 | Range of each building in array -- (algorithms data structures arrays)
<p>I have two arrays, X and H, where X is sorted. X[i] represents the coordinate of building i. Y[i] represents the height of building i. If building i collapses, all buildings in the interval [ X[i]+1, X[i]+H[i] ], both ends inclusive, will collaps... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.