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 |
|---|---|---|---|---|---|---|
83,343 | What is this operator in "The Temporal Logic of Programs" Pnueli 1977? | <p>In <a href="http://fi.ort.edu.uy/innovaportal/file/20124/1/49-pnueli_temporal_logic_of_programs.pdf" rel="nofollow noreferrer">The Temporal Logic of Programs</a> there is an operator first appearing on page 3 (48) under "Partial Correctness" that looks like an elongated super set symbol. What is it?</p>
 | linear temporal logic program correctness | 1 | What is this operator in "The Temporal Logic of Programs" Pnueli 1977? -- (linear temporal logic program correctness)
<p>In <a href="http://fi.ort.edu.uy/innovaportal/file/20124/1/49-pnueli_temporal_logic_of_programs.pdf" rel="nofollow noreferrer">The Temporal Logic of Programs</a> there is an operator first appearing ... | habedi/stack-exchange-dataset |
83,346 | Find multiple duplicates in $n$ size data set in linear time | <p>Problem:</p>

<blockquote>
 <p>Given a vectors of size $n$ with integer data within $[1, n-1]$ range, find $if$ and $which$ numbers are multiple duplicates (numbers appearing more than once). The time complexity ought to be linear and space complexity constant (don't use any auxiliary data structure exc... | algorithms arrays searching | 1 | Find multiple duplicates in $n$ size data set in linear time -- (algorithms arrays searching)
<p>Problem:</p>

<blockquote>
 <p>Given a vectors of size $n$ with integer data within $[1, n-1]$ range, find $if$ and $which$ numbers are multiple duplicates (numbers appearing more than once). The time complexit... | habedi/stack-exchange-dataset |
83,352 | Confused about NP-Complete Proof Using Reduction | <p>Consider a job schedule decision problem with only one machine takes input $\{(r_1,p_1,d_1),(r_2,p_2,d_2),...,(r_n,p_n,d_n),K\}$; where $r_i$ is the start time for the ith triple, and $p_i$ is the process time of the triple; and $d_i$ is the deadline.Require for each $i$, schedule a job at time $t_i$ such that $r_i≤... | complexity theory np complete | 1 | Confused about NP-Complete Proof Using Reduction -- (complexity theory np complete)
<p>Consider a job schedule decision problem with only one machine takes input $\{(r_1,p_1,d_1),(r_2,p_2,d_2),...,(r_n,p_n,d_n),K\}$; where $r_i$ is the start time for the ith triple, and $p_i$ is the process time of the triple; and $d_i... | habedi/stack-exchange-dataset |
83,360 | What property of cons allows elimination of tail recursion modulo cons? | <p>I'm familiar with the idea of <em>basic</em> tail recursion elimination, where functions that return the direct result of a call to themselves can be rewritten as iterative loops.</p>

<pre><code>foo(...):
 # ...
 return foo(...)
</code></pre>

<p>I also understand that, as a specia... | compilers recursion program optimization tail recursion | 1 | What property of cons allows elimination of tail recursion modulo cons? -- (compilers recursion program optimization tail recursion)
<p>I'm familiar with the idea of <em>basic</em> tail recursion elimination, where functions that return the direct result of a call to themselves can be rewritten as iterative loops.</p>&... | habedi/stack-exchange-dataset |
83,368 | Meaning of $|w| ≡ 2 \mod 3$ | <p>I'm new to formal language and automata theory and I was left alone with this exercise. The task is to define a formal grammar for given language. </p>

<p>$Σ \in \{a,b\}$ </p>

<p>$L = \{ w \in Σ^*\, |\, |w| \equiv 2 \mod 3 \} $</p>

<p>I already solved tasks of that kind, but now i struggl... | formal languages formal grammars modular arithmetic | 1 | Meaning of $|w| ≡ 2 \mod 3$ -- (formal languages formal grammars modular arithmetic)
<p>I'm new to formal language and automata theory and I was left alone with this exercise. The task is to define a formal grammar for given language. </p>

<p>$Σ \in \{a,b\}$ </p>

<p>$L = \{ w \in Σ^*\, |\, |w| \equiv... | habedi/stack-exchange-dataset |
83,378 | What is the deterministic finitite automaton (DFA) for the regex ".*b." | <p>I'm looking for a finite state machine that can match inputs to the regular expression <code>.*b.</code> <em>deterministically</em> (i.e. it cannot change state w/o being fed input and the transition to a new state is solely determined by the current state and the input word).</p>

<p>Consider the following ... | finite automata regular expressions nondeterminism | 1 | What is the deterministic finitite automaton (DFA) for the regex ".*b." -- (finite automata regular expressions nondeterminism)
<p>I'm looking for a finite state machine that can match inputs to the regular expression <code>.*b.</code> <em>deterministically</em> (i.e. it cannot change state w/o being fed input and the ... | habedi/stack-exchange-dataset |
83,386 | Is it possible to obtain dynamic tree with two dimensions in big matrix | <p>Let's say we have given matrix of size $n \cdot m$, such that both $n, m$ are big numbers and we cannot keep the whole matrix in memory (up to 10 millions).</p>

<p>In some of the coordinates of the matrix there are positive numbers and all other fields are zeroes (at most 100000 elements are with value diff... | trees search algorithms search trees | 1 | Is it possible to obtain dynamic tree with two dimensions in big matrix -- (trees search algorithms search trees)
<p>Let's say we have given matrix of size $n \cdot m$, such that both $n, m$ are big numbers and we cannot keep the whole matrix in memory (up to 10 millions).</p>

<p>In some of the coordinates of ... | habedi/stack-exchange-dataset |
83,402 | Solving the recurrence $T(n)=T(n−1)/T(n−2)$ | <p>How can I solve this?
I saw <a href="https://cs.stackexchange.com/questions/52214/solving-the-recurrence-tn-tn-1tn-2">Solving the recurrence $T(n)=T(n-1)*T(n-2)$</a> but I don't know how I can apply it to $T(n)=T(n-1)/T(n-2)$?</p>
 | recurrence relation | 1 | Solving the recurrence $T(n)=T(n−1)/T(n−2)$ -- (recurrence relation)
<p>How can I solve this?
I saw <a href="https://cs.stackexchange.com/questions/52214/solving-the-recurrence-tn-tn-1tn-2">Solving the recurrence $T(n)=T(n-1)*T(n-2)$</a> but I don't know how I can apply it to $T(n)=T(n-1)/T(n-2)$?</p>
 | habedi/stack-exchange-dataset |
83,410 | Prove that Integer linear programming (ILP) is in NP | <p>Help is needed, I've tried to solve it by myself but I could find any reasonable solution which is solid enough. this is what I've wrote:</p>

<blockquote>
 <p>Consider a 0-1 ILP, where each variable x1,x2...,xn can assume values
 0 or 1. The number of constraints is m.</p>
 
 <p>We can c... | complexity theory np integer programming | 1 | Prove that Integer linear programming (ILP) is in NP -- (complexity theory np integer programming)
<p>Help is needed, I've tried to solve it by myself but I could find any reasonable solution which is solid enough. this is what I've wrote:</p>

<blockquote>
 <p>Consider a 0-1 ILP, where each variable x1,x2... | habedi/stack-exchange-dataset |
83,412 | Any way to find a 3-vertex cycle in a graph using an incidence matrix in O(nm) time? | <p>I have a graph with n edges and m vertices. This is an <strong>undirected</strong> graph.</p>

<p>I need to find a 3 vertex cycle. Only 3.</p>

<p>I'm confident I need to use an incidence matrix for this as this seems to be the best data structure. I'm familiar with cycle finding algorithms and they ... | graphs graph traversal | 1 | Any way to find a 3-vertex cycle in a graph using an incidence matrix in O(nm) time? -- (graphs graph traversal)
<p>I have a graph with n edges and m vertices. This is an <strong>undirected</strong> graph.</p>

<p>I need to find a 3 vertex cycle. Only 3.</p>

<p>I'm confident I need to use an incidence ... | habedi/stack-exchange-dataset |
83,413 | Show that function is not turing-computable? | <p>We have two functions:</p>

<p>$f_1: \mathbb{N}\rightarrow \mathbb{N} \quad $
$f_2: \mathbb{N}\rightarrow \mathbb{N}$</p>

<p>By definition $f_1$ is turing-computable while $f_2$ is not.</p>

<p>Then we define a third funtion $g(n) = f_1(n) + f_2(n)$.</p>

<p>I want to show that $... | computability check my answer | 1 | Show that function is not turing-computable? -- (computability check my answer)
<p>We have two functions:</p>

<p>$f_1: \mathbb{N}\rightarrow \mathbb{N} \quad $
$f_2: \mathbb{N}\rightarrow \mathbb{N}$</p>

<p>By definition $f_1$ is turing-computable while $f_2$ is not.</p>

<p>Then we define... | habedi/stack-exchange-dataset |
83,425 | How do you translate these 2 regular languages in words correctly? | <p>Given are 2 different languages and I'd like to know if I understand them correctly.</p>

<p>L ⊆ ∑* is a regular language.</p>

<ol>
<li><p>cycle(L) = {vu ∈ ∑* | uv ∈ L}</p></li>
<li><p>L/2 = {x ∈ ∑* | ∃y ∈ ∑* : xy ∈ L, |x| = |y|}</p></li>
</ol>

<p>I need to know that because the... | formal languages regular languages automata finite automata | 1 | How do you translate these 2 regular languages in words correctly? -- (formal languages regular languages automata finite automata)
<p>Given are 2 different languages and I'd like to know if I understand them correctly.</p>

<p>L ⊆ ∑* is a regular language.</p>

<ol>
<li><p>cycle(L) = {vu ∈ ∑* | uv ... | habedi/stack-exchange-dataset |
83,427 | Construct a computable function from non-computable funciton | <p>Let $f_1 $ and $f_2$ be two functions from $\mathbb{N} \rightarrow \mathbb{N}$.</p>

<p>$f_1$ is turing-computable while $f_2$ is not.</p>

<p>$h(i)$ is a function that returns $1$ when $f_1(i) = f_2(i)$ and $0$ else.</p>

<p>The challenge is to construct $f_1 $ and $f_2$ so that $h(i)$ is co... | computability | 1 | Construct a computable function from non-computable funciton -- (computability)
<p>Let $f_1 $ and $f_2$ be two functions from $\mathbb{N} \rightarrow \mathbb{N}$.</p>

<p>$f_1$ is turing-computable while $f_2$ is not.</p>

<p>$h(i)$ is a function that returns $1$ when $f_1(i) = f_2(i)$ and $0$ else.</p>... | habedi/stack-exchange-dataset |
83,430 | Computational complexity vs Computational cost | <p>Is there a difference between the computational complexity and computational cost of an algorithm?</p>
 | algorithms complexity theory algorithm analysis terminology | 1 | Computational complexity vs Computational cost -- (algorithms complexity theory algorithm analysis terminology)
<p>Is there a difference between the computational complexity and computational cost of an algorithm?</p>
 | habedi/stack-exchange-dataset |
83,440 | How to convert between bases partially? | <p>I have some large number $n$ in base $b_1$ and I want to convert it to base $b_2$. $n$ is about a million decimal digits long, therefore it's impractical to convert it as a whole. However I don't need the entire $n$, just <strong>some arbitrary slice</strong> of it when it's converted to $b_2$</p>

<p>For ex... | algorithms optimization base conversion | 1 | How to convert between bases partially? -- (algorithms optimization base conversion)
<p>I have some large number $n$ in base $b_1$ and I want to convert it to base $b_2$. $n$ is about a million decimal digits long, therefore it's impractical to convert it as a whole. However I don't need the entire $n$, just <strong>so... | habedi/stack-exchange-dataset |
83,457 | finding best n players in minimum number of comparisons | <p>I am trying to find out if there is any generic way to find out first to nth best player in a tournament if n is less than the square root of input size i.e. 5 best players in the sample size of 25 players?</p>
<p>I thought of using below approach to find out 2 best players.</p>
<p>So for finding out the 3rd... | algorithms comparison | 1 | finding best n players in minimum number of comparisons -- (algorithms comparison)
<p>I am trying to find out if there is any generic way to find out first to nth best player in a tournament if n is less than the square root of input size i.e. 5 best players in the sample size of 25 players?</p>
<p>I thought of usi... | habedi/stack-exchange-dataset |
83,459 | How to retrieve reset bit in constant time in a bit array | <p>In a game application there is a session id assigned to each player every time they start a new session. 
Session id's are always unique and there can be billion users of this game. Whenever a user logs-in, get() function is called which basically assigns a bit to the user by setting a bit from a bitarray and wh... | algorithms balanced search trees bit manipulation | 1 | How to retrieve reset bit in constant time in a bit array -- (algorithms balanced search trees bit manipulation)
<p>In a game application there is a session id assigned to each player every time they start a new session. 
Session id's are always unique and there can be billion users of this game. Whenever a user lo... | habedi/stack-exchange-dataset |
83,473 | Checking for intersection of $d$-dimensional spheres | <p>Is there a simple algorithm to check whether $n$ different balls (of the same radius) in $\mathbb{R}^d$ intersect? That is, coordinates of their centers $x_i$ are given, radius $R$ is given and we need to determine if there exists a point $p$ such that $$\| p - x_i \| \leq R \quad \forall i.$$
In other words, ch... | computational geometry | 1 | Checking for intersection of $d$-dimensional spheres -- (computational geometry)
<p>Is there a simple algorithm to check whether $n$ different balls (of the same radius) in $\mathbb{R}^d$ intersect? That is, coordinates of their centers $x_i$ are given, radius $R$ is given and we need to determine if there exists a poi... | habedi/stack-exchange-dataset |
83,484 | semaphore implementation with test and set | <p>I'm trying to understand the algorithm for implementing semaphores on SMP system using test and set instruction described here:
<a href="https://people.mpi-sws.org/~druschel/courses/os/lectures/proc4.pdf" rel="nofollow noreferrer">https://people.mpi-sws.org/~druschel/courses/os/lectures/proc4.pdf</a></p>
&#x... | concurrency synchronization | 1 | semaphore implementation with test and set -- (concurrency synchronization)
<p>I'm trying to understand the algorithm for implementing semaphores on SMP system using test and set instruction described here:
<a href="https://people.mpi-sws.org/~druschel/courses/os/lectures/proc4.pdf" rel="nofollow noreferrer">https:... | habedi/stack-exchange-dataset |
83,485 | How to find longest possible identical sequence in Array A and B? | <p>You have to arrays of single digit numbers. (0 - 9).</p>

<pre><code>A = [....1 billion elements....];
B = [3,5,8,1,2,5,8,3,4,9,1,0,2];
</code></pre>

<p>I want to find combo of as few as possible subsets that of array B in A. </p>

<p>So whole Array B could be in Array A by coinciden... | algorithms data structures | 1 | How to find longest possible identical sequence in Array A and B? -- (algorithms data structures)
<p>You have to arrays of single digit numbers. (0 - 9).</p>

<pre><code>A = [....1 billion elements....];
B = [3,5,8,1,2,5,8,3,4,9,1,0,2];
</code></pre>

<p>I want to find combo of as few as possibl... | habedi/stack-exchange-dataset |
83,497 | Is the Choice operator implementable on $\pi$-calculus? | <p>I was reading about $\pi$-calculus, and some authors include in the basic operations a Choice operator $P \oplus Q$ which means that either $P$ or $Q$ will be executed, but not both.</p>

<p>On page 8 of "Applied $\pi$ - an introduction" (available on <a href="http://www.cl.cam.ac.uk/~pes20/apppi.ps" rel="no... | pi calculus | 1 | Is the Choice operator implementable on $\pi$-calculus? -- (pi calculus)
<p>I was reading about $\pi$-calculus, and some authors include in the basic operations a Choice operator $P \oplus Q$ which means that either $P$ or $Q$ will be executed, but not both.</p>

<p>On page 8 of "Applied $\pi$ - an introduction... | habedi/stack-exchange-dataset |
83,502 | Is the balanced parentheses language inherently ambiguous? | <p>I have this grammar:</p>

<p>$S\rightarrow SS |S \rightarrow(S)|S\rightarrow\epsilon $</p>

<p>Now this grammar generates the set of balanced parentheses. But this grammar is ambiguous. I am trying to find an unambiguous grammar for this language but all in vain. This has led me to believe that the ... | formal grammars | 1 | Is the balanced parentheses language inherently ambiguous? -- (formal grammars)
<p>I have this grammar:</p>

<p>$S\rightarrow SS |S \rightarrow(S)|S\rightarrow\epsilon $</p>

<p>Now this grammar generates the set of balanced parentheses. But this grammar is ambiguous. I am trying to find an unambiguous... | habedi/stack-exchange-dataset |
83,505 | King of the North: Placing bannermen surrounding castle | <p>I was trying to solve the <a href="https://open.kattis.com/problems/thekingofthenorth" rel="nofollow noreferrer">King of the North</a> problem in <a href="https://open.kattis.com" rel="nofollow noreferrer">Kattis</a>. Basically, the problem is, the king has a castle to protect. To do this, he wants to place bannerme... | computational geometry | 1 | King of the North: Placing bannermen surrounding castle -- (computational geometry)
<p>I was trying to solve the <a href="https://open.kattis.com/problems/thekingofthenorth" rel="nofollow noreferrer">King of the North</a> problem in <a href="https://open.kattis.com" rel="nofollow noreferrer">Kattis</a>. Basically, the ... | habedi/stack-exchange-dataset |
83,507 | I have n boys and n girls. I need to pair as much of them as possible for a dance in O(nlogn). Reduce this to a standard problem? | <p>There are n girls and n boys. Each girl i has an objective attractiveness constant Pi (a natural number). The bigger the number, the more attractive. Each boy has a range in which he is comfortable asking the girl out [Ai, Bi] (inclusive). A boy will not ask someone out who is below Ai or above Bi.</p>

<p>I... | algorithms optimization bipartite matching constraint satisfaction | 1 | I have n boys and n girls. I need to pair as much of them as possible for a dance in O(nlogn). Reduce this to a standard problem? -- (algorithms optimization bipartite matching constraint satisfaction)
<p>There are n girls and n boys. Each girl i has an objective attractiveness constant Pi (a natural number). The bigge... | habedi/stack-exchange-dataset |
83,535 | Enumerate probabilistic and other kinds of Turing machines together | <p>When we talk about the enumeration of TM's, do we mean the "regular" deterministic ones? So if we want to enumerate nondeterministic or probabilistic TM's, do we need a separate enumeration?</p>

<p>I can see how we could describe probabilistic TM's as strings, just as we describe the deterministic TM's only... | complexity theory | 1 | Enumerate probabilistic and other kinds of Turing machines together -- (complexity theory)
<p>When we talk about the enumeration of TM's, do we mean the "regular" deterministic ones? So if we want to enumerate nondeterministic or probabilistic TM's, do we need a separate enumeration?</p>

<p>I can see how we co... | habedi/stack-exchange-dataset |
83,542 | Converting CFG to CNF | <p>need some help with the following question:</p>

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

<p>I've watched a few youtube tutorials but I'm struggling to convert this specific C... | formal languages natural language processing | 1 | Converting CFG to CNF -- (formal languages natural language processing)
<p>need some help with the following question:</p>

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

<p>I've watch... | habedi/stack-exchange-dataset |
83,553 | What is the transitive and reflective closure of the derivation relationship? | <p><em>This question is asked during a class of Computer Science.</em></p>

<blockquote>
 <p>What is the transitive and reflective closure of the derivation
 relationship?</p>
</blockquote>

<p>I know that if $R$ is a relationship on $A^2$, a transitivive and reflective relation on $R$ is ... | formal languages logic | 1 | What is the transitive and reflective closure of the derivation relationship? -- (formal languages logic)
<p><em>This question is asked during a class of Computer Science.</em></p>

<blockquote>
 <p>What is the transitive and reflective closure of the derivation
 relationship?</p>
</blockquote>&#x... | habedi/stack-exchange-dataset |
83,556 | Determining Ambiguity of grammar | <p>I read that no LL(1) grammar can be ambiguous.</p>

<p>Can we just make a LL(1) predictive parser table for a grammar to determine whether it's ambiguous? If the grammar is not LL(1), can we say that grammar is ambiguous?</p>
 | context free formal grammars | 1 | Determining Ambiguity of grammar -- (context free formal grammars)
<p>I read that no LL(1) grammar can be ambiguous.</p>

<p>Can we just make a LL(1) predictive parser table for a grammar to determine whether it's ambiguous? If the grammar is not LL(1), can we say that grammar is ambiguous?</p>
 | habedi/stack-exchange-dataset |
83,574 | Does space complexity analysis usually include output space? | <p>Since most examples of complexity analysis I've seen involve functions that return either nothing (e.g. in-place sort) or a single value (e.g. computation, lookup), I haven't been able to figure this out just by reading examples.</p>

<p>If a function returns a new list, should the space complexity analysis ... | complexity theory algorithm analysis space complexity space analysis | 1 | Does space complexity analysis usually include output space? -- (complexity theory algorithm analysis space complexity space analysis)
<p>Since most examples of complexity analysis I've seen involve functions that return either nothing (e.g. in-place sort) or a single value (e.g. computation, lookup), I haven't been ab... | habedi/stack-exchange-dataset |
83,593 | Number of words in $L$ of length $n$? | <p>Be $L$ a formal language over the alphabet $\Sigma$. $L$ can be defined by induction:<br>
$L^0 = \{\epsilon\}$ and for $i>0: L^i = \Sigma*L^{i-1}$.<br>
Means that $|L^n|$ is the number of words in $L$ of length $n \in \mathbb{N}$ letters from $\Sigma$.<br>
Find $|L^n|$.</p>

<p>For $\Sigma = \... | formal languages proof assistants | 1 | Number of words in $L$ of length $n$? -- (formal languages proof assistants)
<p>Be $L$ a formal language over the alphabet $\Sigma$. $L$ can be defined by induction:<br>
$L^0 = \{\epsilon\}$ and for $i>0: L^i = \Sigma*L^{i-1}$.<br>
Means that $|L^n|$ is the number of words in $L$ of length $n \in \mathbb{N}$... | habedi/stack-exchange-dataset |
83,598 | How does the number of clauses affect the difficulty of a 3-SAT problem? | <p>What is the relationship between the number of clauses and the difficulty of a 3-SAT problem?</p>
 | complexity theory satisfiability 3 sat | 1 | How does the number of clauses affect the difficulty of a 3-SAT problem? -- (complexity theory satisfiability 3 sat)
<p>What is the relationship between the number of clauses and the difficulty of a 3-SAT problem?</p>
 | habedi/stack-exchange-dataset |
83,602 | Show that kleene plus language is a regular language by describing how you build a DFA or NFA for it | <blockquote>
 <p>L ⊆ ∑* is a regular language. Show that L^+ (aka kleene plus) is a
 regular language by describing how you can build a DFA or NFA for the
 language.</p>
</blockquote>

<p>I would build a NFA. That NFA must have exactly one starting state and one end state, where the starting ... | formal languages automata finite automata | 1 | Show that kleene plus language is a regular language by describing how you build a DFA or NFA for it -- (formal languages automata finite automata)
<blockquote>
 <p>L ⊆ ∑* is a regular language. Show that L^+ (aka kleene plus) is a
 regular language by describing how you can build a DFA or NFA for the
 l... | habedi/stack-exchange-dataset |
83,608 | $U = \{ \langle M, x, \#^{t} \rangle \vert M $ is a NTM that accepts $x$ within $t$ steps on some branch$\}$ is NP complete | <p>I'm trying to prove $U = \{ \langle M, x, \#^{t} \rangle \vert M $ is a NTM that accepts $x$ within $t$ steps on some branch$\}$ is NP-complete. Showing it is NP is trivial. NP-hardness is the hard part. One way to do it would be to reduce a known NP-complete problem to $U$. Another way would be to find a general wa... | complexity theory np complete reductions nondeterminism | 1 | $U = \{ \langle M, x, \#^{t} \rangle \vert M $ is a NTM that accepts $x$ within $t$ steps on some branch$\}$ is NP complete -- (complexity theory np complete reductions nondeterminism)
<p>I'm trying to prove $U = \{ \langle M, x, \#^{t} \rangle \vert M $ is a NTM that accepts $x$ within $t$ steps on some branch$\}$ is ... | habedi/stack-exchange-dataset |
83,612 | "Natural" reductions vs "Polynomial-time many-one" reductions (Karp Reductions) | <p>For two problems $A$ and $B$ and a <strong>Karp</strong> Reduction $R$ from $A$ to $B$, we call the reduction $R$ <strong>natural</strong> if, for any instance $I$ of problem $A$, the size of $R(I)$ (as well as the possible numerical parameters of $R(I)$ depends only on the size of $I$ and the sizes of $I$ and $R(I)... | complexity theory reductions lower bounds | 1 | "Natural" reductions vs "Polynomial-time many-one" reductions (Karp Reductions) -- (complexity theory reductions lower bounds)
<p>For two problems $A$ and $B$ and a <strong>Karp</strong> Reduction $R$ from $A$ to $B$, we call the reduction $R$ <strong>natural</strong> if, for any instance $I$ of problem $A$, the size o... | habedi/stack-exchange-dataset |
83,617 | How huffman tree uses MinHeap? | <p>As far as I know, a minheap is data structure whose parent node's value is less than child node and maxheap is when parent node is greater than child node. <a href="http://www.geeksforgeeks.org/greedy-algorithms-set-3-huffman-coding/" rel="nofollow noreferrer">Here</a> they have used minheap. But as the node closer ... | data structures heaps | 1 | How huffman tree uses MinHeap? -- (data structures heaps)
<p>As far as I know, a minheap is data structure whose parent node's value is less than child node and maxheap is when parent node is greater than child node. <a href="http://www.geeksforgeeks.org/greedy-algorithms-set-3-huffman-coding/" rel="nofollow noreferrer... | habedi/stack-exchange-dataset |
83,634 | Are there unary languages that are in RE but not R? | <p>Suppose that we have an alphabet Σ = {a}. My question is, is it possible to create a language with this alphabet, which is recursively enumerable, but not recursive?</p>

<p>My assumption is a no, i think we can construct a deterministic finite machine, which accepts every language, constructed with a single... | computability | 1 | Are there unary languages that are in RE but not R? -- (computability)
<p>Suppose that we have an alphabet Σ = {a}. My question is, is it possible to create a language with this alphabet, which is recursively enumerable, but not recursive?</p>

<p>My assumption is a no, i think we can construct a deterministic ... | habedi/stack-exchange-dataset |
83,635 | Is closed form of summation less costly? | <p>I imagine finding the closed form of an algorithm should yield fewer steps than the original. But in the case of a summation from 1 to n, I'm not sure if it actually does.</p>

<p>Here's the original sum</p>

<pre><code>Sum(N)
 total = 0
 for x = 1 to N
 total = total + x
 ... | algorithms efficiency | 1 | Is closed form of summation less costly? -- (algorithms efficiency)
<p>I imagine finding the closed form of an algorithm should yield fewer steps than the original. But in the case of a summation from 1 to n, I'm not sure if it actually does.</p>

<p>Here's the original sum</p>

<pre><code>Sum(N)
 ... | habedi/stack-exchange-dataset |
83,638 | Sequential History in Herlihy and Wing's Linearizability paper | <p>I've been reading Herlihy and Wing's paper <em>Linearizability: A Correctness Condition for Concurrent Objects</em> (<em>ACM Transactions on Programming Languages and Systems</em>, 12(3):463–492, 1990; <a href="https://cs.brown.edu/~mph/HerlihyW90/p463-herlihy.pdf" rel="nofollow noreferrer">PDF</a>) and there'... | distributed systems | 1 | Sequential History in Herlihy and Wing's Linearizability paper -- (distributed systems)
<p>I've been reading Herlihy and Wing's paper <em>Linearizability: A Correctness Condition for Concurrent Objects</em> (<em>ACM Transactions on Programming Languages and Systems</em>, 12(3):463–492, 1990; <a href="https://cs.b... | habedi/stack-exchange-dataset |
83,651 | Is the complement of the Turing machine equality language not recursively enumerable as well? | <p>The language that determines if two Turing machines are equivalent is not recursively enumerable because you can reduce it to the emptiness problem (does a Turing machine take no input). </p>

<p>Then for the complement of this language (ie. if two Turing machines are not equivalent) would you be able to red... | computability turing machines undecidability | 1 | Is the complement of the Turing machine equality language not recursively enumerable as well? -- (computability turing machines undecidability)
<p>The language that determines if two Turing machines are equivalent is not recursively enumerable because you can reduce it to the emptiness problem (does a Turing machine ta... | habedi/stack-exchange-dataset |
83,663 | Algorithm for finding cycles in a hypergraph | <p>Define a hypergraph as a set $V$ of vertices and a set $E$ of hyperedges, where a hyperedge is a non-empty subset of $V$. (This is a generalisation of an undirected graph, in which edges are allowed to connect any number of nodes, rather than just two.)</p>

<p>Define a cycle in a hypergraph as a cyclic sequ... | algorithms graphs | 1 | Algorithm for finding cycles in a hypergraph -- (algorithms graphs)
<p>Define a hypergraph as a set $V$ of vertices and a set $E$ of hyperedges, where a hyperedge is a non-empty subset of $V$. (This is a generalisation of an undirected graph, in which edges are allowed to connect any number of nodes, rather than just t... | habedi/stack-exchange-dataset |
83,677 | Low for EXP and NEXP | <p>What are the largest classes which are low for EXP and NEXP?</p>

<p>For example: I am aware the class P, QP are low for EXP as well as NEXP. We also know that NP is not low for either of them. </p>

<p>Is class BPP low for EXP or NEXP? What is the largest oracle class we can provide to EXP (or NEXP)... | complexity theory time complexity complexity classes | 1 | Low for EXP and NEXP -- (complexity theory time complexity complexity classes)
<p>What are the largest classes which are low for EXP and NEXP?</p>

<p>For example: I am aware the class P, QP are low for EXP as well as NEXP. We also know that NP is not low for either of them. </p>

<p>Is class BPP low fo... | habedi/stack-exchange-dataset |
83,678 | Which type of control unit used in modern processor? | <p>Is it hard wired CU or microprogramed?</p>
 | computer architecture | 1 | Which type of control unit used in modern processor? -- (computer architecture)
<p>Is it hard wired CU or microprogramed?</p>
 | habedi/stack-exchange-dataset |
83,689 | How to calculate least common multiple (LCM) for two numbers with constants (shifts)? | <p>What's the most effective algorithm to calculate LCM for 2 numbers where each of them has their own "shift"?</p>

<p>Example:</p>

<p>We want to find LCM for 25 + 5 as c and 30 + 10 as c
Then for the first case, the sequence will look like this:</p>

<p>25*1+5, 25*2+5, 25*3+5, 25*4+5...</... | algorithms | 1 | How to calculate least common multiple (LCM) for two numbers with constants (shifts)? -- (algorithms)
<p>What's the most effective algorithm to calculate LCM for 2 numbers where each of them has their own "shift"?</p>

<p>Example:</p>

<p>We want to find LCM for 25 + 5 as c and 30 + 10 as c
Then for... | habedi/stack-exchange-dataset |
83,697 | Is $E_{LBA}$ turing-recognizable? | <p>I have seen <a href="http://www.cs.tut.fi/~elomaa/teach/iTCS-11-8.pdf" rel="nofollow noreferrer">a proof that $E_{LBA}$ is not decidable</a>. But is it at least turing recognizable? How to prove it?</p>

<p><em>NOTE:</em> $E_{LBA}$ is defined as the emptiness problem for <a href="https://en.wikipedia.org/wi... | turing machines automata undecidability | 1 | Is $E_{LBA}$ turing-recognizable? -- (turing machines automata undecidability)
<p>I have seen <a href="http://www.cs.tut.fi/~elomaa/teach/iTCS-11-8.pdf" rel="nofollow noreferrer">a proof that $E_{LBA}$ is not decidable</a>. But is it at least turing recognizable? How to prove it?</p>

<p><em>NOTE:</em> $E_{LBA... | habedi/stack-exchange-dataset |
83,700 | Theorem Prover for complexity theoretic reductions | <p>Can complexity theoretic reductions that lead to proofs of say NP completeness be formalized using an existing theorem prover such as Coq?</p>

<p>If so, can you provide an outline of how to formalize a simple reduction argument? I’d also appreciate pointers to the literature. </p>
 | complexity theory automated theorem proving | 1 | Theorem Prover for complexity theoretic reductions -- (complexity theory automated theorem proving)
<p>Can complexity theoretic reductions that lead to proofs of say NP completeness be formalized using an existing theorem prover such as Coq?</p>

<p>If so, can you provide an outline of how to formalize a simple... | habedi/stack-exchange-dataset |
83,711 | What is the fastest known algorithm for matrix multiplication as of (2017/11)? | <p>Recently I have learned about both the <a href="https://en.wikipedia.org/wiki/Strassen_algorithm" rel="nofollow noreferrer">Strassen algorithm</a> and the <a href="https://en.wikipedia.org/wiki/Coppersmith%E2%80%93Winograd_algorithm" rel="nofollow noreferrer">Coppersmith–Winograd algorithm</a> (independently), accor... | algorithms complexity theory time complexity matrices | 1 | What is the fastest known algorithm for matrix multiplication as of (2017/11)? -- (algorithms complexity theory time complexity matrices)
<p>Recently I have learned about both the <a href="https://en.wikipedia.org/wiki/Strassen_algorithm" rel="nofollow noreferrer">Strassen algorithm</a> and the <a href="https://en.wiki... | habedi/stack-exchange-dataset |
83,717 | Confusion about reduction of $L=\{w_i | M_i\text{ halts on }w_i\}$ to Halting Problem or Diagonalization language? | <p>I want to reduce $L$ (stated above) to the Halting Problem in order to say that L is recursively enumerable but not recursive just like the Halting Problem, but is it enough to say that if I can solve the Halting Problem then I can solve $L$, because then I can feed into the Halting Problem the input $w_i$ twice, as... | computability reductions halting problem | 1 | Confusion about reduction of $L=\{w_i | M_i\text{ halts on }w_i\}$ to Halting Problem or Diagonalization language? -- (computability reductions halting problem)
<p>I want to reduce $L$ (stated above) to the Halting Problem in order to say that L is recursively enumerable but not recursive just like the Halting Problem,... | habedi/stack-exchange-dataset |
83,719 | Proving Blank-halt to be recursively enumerable through reduction to Halting problem | <p>To prove the blank-halt problem is undecidable (does a given Turing machine halt on the empty input), it's a case of reducing the halting problem to the blank-halt problem and since the halting problem is undecidable, the blank-halt problem is undecidable.</p>

<p>However to prove the blank-halt problem is r... | computability turing machines reductions halting problem | 1 | Proving Blank-halt to be recursively enumerable through reduction to Halting problem -- (computability turing machines reductions halting problem)
<p>To prove the blank-halt problem is undecidable (does a given Turing machine halt on the empty input), it's a case of reducing the halting problem to the blank-halt proble... | habedi/stack-exchange-dataset |
83,722 | Does the empty word count as a 'word'? | <p>If I have DFA accepting</p>

<p>$\{w \in \{a,b\}^*$ s.t. on every odd position in $w$ there is a $b\}$</p>

<p>Would the empty word be accepted? Also, would the word $eb$ be accepted?</p>
 | finite automata | 1 | Does the empty word count as a 'word'? -- (finite automata)
<p>If I have DFA accepting</p>

<p>$\{w \in \{a,b\}^*$ s.t. on every odd position in $w$ there is a $b\}$</p>

<p>Would the empty word be accepted? Also, would the word $eb$ be accepted?</p>
 | habedi/stack-exchange-dataset |
83,724 | What is the minimal pumping length of this string $(01)^*$ | <p>In this <a href="https://math.stackexchange.com/a/1508488/171091">answer</a>, it is told that the minimal $p$ value is $1$. One of the conditions of the pumping lemma is that</p>

<p>$|xy| \leq p$</p>

<p>Now if we try to split a string $01^p$, we might do it like this:</p>

<p>$x=\epsilon$, ... | formal languages regular languages pumping lemma | 1 | What is the minimal pumping length of this string $(01)^*$ -- (formal languages regular languages pumping lemma)
<p>In this <a href="https://math.stackexchange.com/a/1508488/171091">answer</a>, it is told that the minimal $p$ value is $1$. One of the conditions of the pumping lemma is that</p>

<p>$|xy| \leq p$... | habedi/stack-exchange-dataset |
83,728 | How to prove non-existence of $O(2^n)$ approximation algorithm solving TSP? | <p>The following theorem (from "The Design of approximation algorithms" by Williamson & Shmoys, pg 43) states:</p>

<blockquote>
 <p>For any $\alpha > 1$, there does not exist an $\alpha$-approximation algorithm for the
 traveling salesman problem on $n$ cities, provided $P \neq NP$. In fact, ... | algorithms complexity theory approximation traveling salesman | 1 | How to prove non-existence of $O(2^n)$ approximation algorithm solving TSP? -- (algorithms complexity theory approximation traveling salesman)
<p>The following theorem (from "The Design of approximation algorithms" by Williamson & Shmoys, pg 43) states:</p>

<blockquote>
 <p>For any $\alpha > 1$, th... | habedi/stack-exchange-dataset |
83,749 | Finding non-trivial NFA that accepts all short strings | <p>It is well-known that every non-trivial NFA of $k$ states (an NFA that does not accept all strings) rejects a string of length at most $2^k$.</p>

<p>But is this upper bound asymptotically tight ? </p>

<p>I found a rough sub-exponential bound in this strategy.</p>

<p>Let $p_i$ be an $i$-th ... | finite automata nondeterminism | 1 | Finding non-trivial NFA that accepts all short strings -- (finite automata nondeterminism)
<p>It is well-known that every non-trivial NFA of $k$ states (an NFA that does not accept all strings) rejects a string of length at most $2^k$.</p>

<p>But is this upper bound asymptotically tight ? </p>

<p>I fo... | habedi/stack-exchange-dataset |
83,752 | "Any problem whose domain is finite is always Decidable", is true or false? | <p>Question no:$1$</p>

<blockquote>
 <p>"Any problem whose domain is finite is always Decidable" </p>
</blockquote>

<p>lets take a TM,$M$ and finite domain of problem i.e. finite set of strings for eg. {$a,abaa,bba$}, Now the problem "whether $M$ accepts these set of strings or not is decid... | turing machines undecidability | 1 | "Any problem whose domain is finite is always Decidable", is true or false? -- (turing machines undecidability)
<p>Question no:$1$</p>

<blockquote>
 <p>"Any problem whose domain is finite is always Decidable" </p>
</blockquote>

<p>lets take a TM,$M$ and finite domain of problem i.e. finite s... | habedi/stack-exchange-dataset |
83,754 | Number of DFA states required | <p>What is the minimal number of DFA states required to recognize binary numbers (encoded MSB to LSB) which are divisible by 6 and 8?</p>

<p>For divisibility by $6$ we required $6$ states.</p>

<p>For divisibility by $8$ we require $4$ states.</p>

<p>So in total, we need $6 \times 4$ states = ... | finite automata | 1 | Number of DFA states required -- (finite automata)
<p>What is the minimal number of DFA states required to recognize binary numbers (encoded MSB to LSB) which are divisible by 6 and 8?</p>

<p>For divisibility by $6$ we required $6$ states.</p>

<p>For divisibility by $8$ we require $4$ states.</p>
... | habedi/stack-exchange-dataset |
83,762 | Regularity of a language with odd and even positions containing an even number of 1's | <p>Given an alphabet $\Sigma = \{0, 1\}$ and
a formal language $$L = \{ w \in \Sigma^* |\ |\mathrm{odd}(w)|_1, |\mathrm{even}(w)|_1 \text{are even numbers} \}$$ </p>

<p>That means that the number of 1's in the odd and even positions of a given string are always an even number. I've tried using the Pump... | regular languages pumping lemma | 1 | Regularity of a language with odd and even positions containing an even number of 1's -- (regular languages pumping lemma)
<p>Given an alphabet $\Sigma = \{0, 1\}$ and
a formal language $$L = \{ w \in \Sigma^* |\ |\mathrm{odd}(w)|_1, |\mathrm{even}(w)|_1 \text{are even numbers} \}$$ </p>

<p>That means ... | habedi/stack-exchange-dataset |
83,766 | How to efficiently get frequency of subranges and update its values altogether? | <p>I'm trying to solve the following problem:</p>

<p>There are <code>N</code> notes in an array (2<=N<=10<sup>5</sup>) labeled 0..N-1, all of them initially set to <code>1</code>. Then there follows <code>Q</code> operations to perform in the array (1<=Q<=10<sup>5</sup>).</p>

<p>The task f... | data structures | 1 | How to efficiently get frequency of subranges and update its values altogether? -- (data structures)
<p>I'm trying to solve the following problem:</p>

<p>There are <code>N</code> notes in an array (2<=N<=10<sup>5</sup>) labeled 0..N-1, all of them initially set to <code>1</code>. Then there follows <code... | habedi/stack-exchange-dataset |
83,770 | Help understand the notation | <p>I'm reading a computer science paper, this one: <a href="https://arxiv.org/abs/1608.03960" rel="nofollow noreferrer">https://arxiv.org/abs/1608.03960</a>. It uses certain notation in one of the illustrations (Figure 9, page 8 in the PDF version) that I don't understand how to interpret.
Attaching here as well fo... | notation | 1 | Help understand the notation -- (notation)
<p>I'm reading a computer science paper, this one: <a href="https://arxiv.org/abs/1608.03960" rel="nofollow noreferrer">https://arxiv.org/abs/1608.03960</a>. It uses certain notation in one of the illustrations (Figure 9, page 8 in the PDF version) that I don't understand how ... | habedi/stack-exchange-dataset |
83,776 | Is the language in the description context free? | <p>I am stuck on a question. Lets say there is a string that can be created from three alphabets a,b,c the condition is number of a<= number of b<= number of c. I can solve if there are a and b (two alphabets) but I am not able to solve for 3. Any help will be appreciated.
Thanks</p>
 | formal languages | 1 | Is the language in the description context free? -- (formal languages)
<p>I am stuck on a question. Lets say there is a string that can be created from three alphabets a,b,c the condition is number of a<= number of b<= number of c. I can solve if there are a and b (two alphabets) but I am not able to solve for 3.... | habedi/stack-exchange-dataset |
83,781 | Finding one of 2/3 of all array elements in constant expected time | <p>How do I go about designing a constant time algorithm which satisfies the following I/O requirements:</p>
<blockquote>
<p><em>Input</em>: an array <span class="math-container">$A$</span> of length <span class="math-container">$3n$</span>, containing <span class="math-container">$2n$</span> values of the symb... | algorithms randomized algorithms searching algorithm design | 1 | Finding one of 2/3 of all array elements in constant expected time -- (algorithms randomized algorithms searching algorithm design)
<p>How do I go about designing a constant time algorithm which satisfies the following I/O requirements:</p>
<blockquote>
<p><em>Input</em>: an array <span class="math-container">$... | habedi/stack-exchange-dataset |
83,785 | What are the examples of trivial and non-trivial properties of language recognized by a Turing machine? | <p><strong>Rice's theorem:</strong> Any nontrivial property about the language recognized by a Turing machine is undecidable.</p>

<p>I know the proof but I am not able to understand the theorem. I think trivial properties are like :language recognised by Turing machine contain at substring "aab". where as nont... | turing machines | 1 | What are the examples of trivial and non-trivial properties of language recognized by a Turing machine? -- (turing machines)
<p><strong>Rice's theorem:</strong> Any nontrivial property about the language recognized by a Turing machine is undecidable.</p>

<p>I know the proof but I am not able to understand the ... | habedi/stack-exchange-dataset |
83,793 | Is it possible to simulate a CPU with software? | <p>I know it sounds a bit silly, but I got really curious. Is it possible to simulate a CPU in, let's say, Python? <a href="https://gaming.stackexchange.com/questions/20219/is-minecraft-turing-complete">Some have argued that Minecraft, for instance, allows one to build turing-complete machines</a>, but has some real re... | algorithms turing machines cpu | 1 | Is it possible to simulate a CPU with software? -- (algorithms turing machines cpu)
<p>I know it sounds a bit silly, but I got really curious. Is it possible to simulate a CPU in, let's say, Python? <a href="https://gaming.stackexchange.com/questions/20219/is-minecraft-turing-complete">Some have argued that Minecraft, ... | habedi/stack-exchange-dataset |
83,795 | Nontrivial examples of sparse languages | <p>A language $L$ is said to be sparse if there exist a polynomial $p$ such that $|L \cap \{0,1\}^n| \le p(n)$. </p>

<p>One trivial example is suppose language is over single alphabet $1$ then $$L = \{1^n | n \in Z^+\}$$</p>

<p><strong>Question :</strong> What are the other non-trivial examples of sp... | complexity theory computability | 1 | Nontrivial examples of sparse languages -- (complexity theory computability)
<p>A language $L$ is said to be sparse if there exist a polynomial $p$ such that $|L \cap \{0,1\}^n| \le p(n)$. </p>

<p>One trivial example is suppose language is over single alphabet $1$ then $$L = \{1^n | n \in Z^+\}$$</p>

... | habedi/stack-exchange-dataset |
83,815 | If a problem is "not semi-decidable" and "not decidable" can we say it is "undecidable"? | <p>I was under impression that when a Language (or problem) is not semi-decidable and not decidable then we can say it's undecidable and I think it makes sense also based on diagram. </p>

<p><a href="https://i.stack.imgur.com/Y1dVD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y1dVD.png" a... | undecidability semi decidability | 1 | If a problem is "not semi-decidable" and "not decidable" can we say it is "undecidable"? -- (undecidability semi decidability)
<p>I was under impression that when a Language (or problem) is not semi-decidable and not decidable then we can say it's undecidable and I think it makes sense also based on diagram. </p>
&... | habedi/stack-exchange-dataset |
83,820 | Will the machine ever reach on any other state other than start state? | <p>Given a TM M, will it ever reach any other state other than start state if it starts with blank tape ?
Is the above problem decidable ?</p>

<p>I think that if a TM really reaches any other state other than start state then we can check the transitions and find out. But if it doesn't at any point of time... | computability | 1 | Will the machine ever reach on any other state other than start state? -- (computability)
<p>Given a TM M, will it ever reach any other state other than start state if it starts with blank tape ?
Is the above problem decidable ?</p>

<p>I think that if a TM really reaches any other state other than start st... | habedi/stack-exchange-dataset |
83,824 | Different decompositions of the string in the pumping lemma proof | <p>Let $s = a^pb^{2p}$, now which one of those decomposition is correct:</p>

<p>$x=a^k$, $y=a^l$, $z=a^{p-k-l}b^{2p}$, where $k+l \leq p$</p>

<p>$x=a^{p-k}$, $y=a^k$, $z=b^{2p}$, where $1\leq k \leq p$</p>

<p>$x=\epsilon$, $y=a$, $z=a^{p-1}b^{2p}$</p>

<p>or are they the same? I've re... | regular languages pumping lemma | 1 | Different decompositions of the string in the pumping lemma proof -- (regular languages pumping lemma)
<p>Let $s = a^pb^{2p}$, now which one of those decomposition is correct:</p>

<p>$x=a^k$, $y=a^l$, $z=a^{p-k-l}b^{2p}$, where $k+l \leq p$</p>

<p>$x=a^{p-k}$, $y=a^k$, $z=b^{2p}$, where $1\leq k \leq ... | habedi/stack-exchange-dataset |
83,828 | Reduction from P to NP | <p>Conceptually, I know that reducing a problem $Y$ that's NP-complete to a problem $X$ implies that $X$ is at least as hard as $Y$, implying $X$ is also NP-complete. So if any NPC problem, say $Z$, can be solved in polynomial time, then that implies $P = NP$, since any other NP-complete problem can be reduced to $Z$ i... | complexity theory reductions np | 1 | Reduction from P to NP -- (complexity theory reductions np)
<p>Conceptually, I know that reducing a problem $Y$ that's NP-complete to a problem $X$ implies that $X$ is at least as hard as $Y$, implying $X$ is also NP-complete. So if any NPC problem, say $Z$, can be solved in polynomial time, then that implies $P = NP$,... | habedi/stack-exchange-dataset |
83,831 | NP-completeness of triangle removal problem | <p>Triangle removal problem states that, given an undirected graph G, can you pick a subset 
S of vertices such that removing S will remove all triangles from the old graph and |S| <= k. I was trying to use reduce from vertex cover problem, but every construction I attempted has failed. Here's what I've done:</p... | np complete decision problem | 1 | NP-completeness of triangle removal problem -- (np complete decision problem)
<p>Triangle removal problem states that, given an undirected graph G, can you pick a subset 
S of vertices such that removing S will remove all triangles from the old graph and |S| <= k. I was trying to use reduce from vertex cover pro... | habedi/stack-exchange-dataset |
83,837 | What is the time and space complexity of Rete algorithm | <p>I am working on pattern matching algorithm. Its working and using very less memory. For the comparison, I have to compare it with the Rete Algorithm. I have checked it in the thesis of the author, some of his paper and he has provided some complexities which are not based on then, nor does its efficiency is provided... | algorithms machine learning runtime analysis pattern recognition space analysis | 1 | What is the time and space complexity of Rete algorithm -- (algorithms machine learning runtime analysis pattern recognition space analysis)
<p>I am working on pattern matching algorithm. Its working and using very less memory. For the comparison, I have to compare it with the Rete Algorithm. I have checked it in the t... | habedi/stack-exchange-dataset |
83,842 | Completeness problem of TM | <p>$L = \{ \langle M \rangle \mid L(M) = \Sigma^∗ \}$</p>

<p>Is above problem R.E ?</p>

<p>I found an explanation in one of the websites and I have doubt in few lines of paragraph.</p>

<p>The explanation was</p>

<p>Now, given a halting problem $(\langle H \rangle, w)$, we proceed as ... | computability turing machines semi decidability | 1 | Completeness problem of TM -- (computability turing machines semi decidability)
<p>$L = \{ \langle M \rangle \mid L(M) = \Sigma^∗ \}$</p>

<p>Is above problem R.E ?</p>

<p>I found an explanation in one of the websites and I have doubt in few lines of paragraph.</p>

<p>The explanation was</p>&#... | habedi/stack-exchange-dataset |
83,851 | Undecidable predicate logic is decidable by people? | <p><a href="https://www.google.ee/search?q=%22there%20is%20no%20uniform%20mechanical%20procedure%22%20logic%20in%20computer%20science" rel="nofollow noreferrer">Logic in computer science</a> (By Michael Huth,Mark Ryan, second edition, page 132) says</p>

<blockquote>
 <p>Every φ can, in principle, be disco... | computability logic undecidability first order logic logical validity | 1 | Undecidable predicate logic is decidable by people? -- (computability logic undecidability first order logic logical validity)
<p><a href="https://www.google.ee/search?q=%22there%20is%20no%20uniform%20mechanical%20procedure%22%20logic%20in%20computer%20science" rel="nofollow noreferrer">Logic in computer science</a> (B... | habedi/stack-exchange-dataset |
83,854 | Are URI's a regular language? | <p>Do URI's, as defined in <a href="https://tools.ietf.org/html/rfc3986" rel="nofollow noreferrer">rfc3986</a>, form a regular language?</p>

<p>How can I tell?</p>

<p>There's a BNF grammar provided, but I don't know how to check that it has a unique representation of every URI, or that it describes a ... | formal languages regular languages | 1 | Are URI's a regular language? -- (formal languages regular languages)
<p>Do URI's, as defined in <a href="https://tools.ietf.org/html/rfc3986" rel="nofollow noreferrer">rfc3986</a>, form a regular language?</p>

<p>How can I tell?</p>

<p>There's a BNF grammar provided, but I don't know how to check tha... | habedi/stack-exchange-dataset |
83,856 | Expressing conditional in linear program | <p>I have two variables $A$ and $B$, with $A$ being binary and $B$ is a real number where $B \ge 0$. My conditions are:</p>

<pre><code>if B > 0
 A = 1
else
 A = 0
</code></pre>

<p>How to express this as a linear program? I have figured out one condition using the big... | linear programming integer programming | 1 | Expressing conditional in linear program -- (linear programming integer programming)
<p>I have two variables $A$ and $B$, with $A$ being binary and $B$ is a real number where $B \ge 0$. My conditions are:</p>

<pre><code>if B > 0
 A = 1
else
 A = 0
</code></pre>

<p>Ho... | habedi/stack-exchange-dataset |
83,859 | Continuing the example of why it's hard to compute with univalence? | <p>In <a href="http://eprints.nottingham.ac.uk/44008/1/types.pdf" rel="noreferrer">"Towards a cubical type theory without an interval"</a> Altenkirch and Kaposi motivate why it is hard to compute with univalence. They say:</p>

<blockquote>
 <p>For example, we can define the equivalence <code>(not ,...)</c... | homotopy type theory | 1 | Continuing the example of why it's hard to compute with univalence? -- (homotopy type theory)
<p>In <a href="http://eprints.nottingham.ac.uk/44008/1/types.pdf" rel="noreferrer">"Towards a cubical type theory without an interval"</a> Altenkirch and Kaposi motivate why it is hard to compute with univalence. They say:</p>... | habedi/stack-exchange-dataset |
83,863 | Randomly choose a line - algorithm | <p>We have a large file that can't fit into internal memory. How do we randomly pick one line so that each line has the same probability to be picked? </p>

<p>And how do we randomly pick such n lines so that they all have the same probability?</p>

<p>We don't know the number of lines beforehand.</p>&#... | algorithms randomness sampling | 1 | Randomly choose a line - algorithm -- (algorithms randomness sampling)
<p>We have a large file that can't fit into internal memory. How do we randomly pick one line so that each line has the same probability to be picked? </p>

<p>And how do we randomly pick such n lines so that they all have the same probabili... | habedi/stack-exchange-dataset |
83,867 | Constraint Satisfaction: maximizing total value with no overlaps | <p>Suppose we have a bunch of bars, which can represent anything (time slots, paths, physical items...) and each of them has a start point, an end point, and an associated value.</p>

<p><a href="https://i.stack.imgur.com/gsjmg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gsjmg.png" alt="e... | constraint satisfaction constraint programming | 1 | Constraint Satisfaction: maximizing total value with no overlaps -- (constraint satisfaction constraint programming)
<p>Suppose we have a bunch of bars, which can represent anything (time slots, paths, physical items...) and each of them has a start point, an end point, and an associated value.</p>

<p><a href=... | habedi/stack-exchange-dataset |
83,871 | Traveling Salesman -- number of qubits required? | <p>I'm trying (in vain) to get a beginner's grasp of quantum computing, so doing a lot of reading. I've started looking at IBM's QISkit Jupyter Notebooks, and came across <a href="https://github.com/QISKit/qiskit-tutorial/blob/master/4_applications/classical_optimization.ipynb" rel="noreferrer">the one on MaxCut proble... | algorithms complexity theory quantum computing traveling salesman | 1 | Traveling Salesman -- number of qubits required? -- (algorithms complexity theory quantum computing traveling salesman)
<p>I'm trying (in vain) to get a beginner's grasp of quantum computing, so doing a lot of reading. I've started looking at IBM's QISkit Jupyter Notebooks, and came across <a href="https://github.com/Q... | habedi/stack-exchange-dataset |
83,884 | Is there an example of an AVL tree that is taller than a binary heap? | <p>I am curious because I took a quiz and answered false to the question:</p>

<p>"The height of an AVL tree may be greater than the height of a binary heap with the same elements."</p>

<p>I have been trying to think of an example, but I just cannot figure it out. Does anyone know when this is the case... | binary trees heaps binary search trees | 1 | Is there an example of an AVL tree that is taller than a binary heap? -- (binary trees heaps binary search trees)
<p>I am curious because I took a quiz and answered false to the question:</p>

<p>"The height of an AVL tree may be greater than the height of a binary heap with the same elements."</p>

<p>... | habedi/stack-exchange-dataset |
83,889 | What algorithm paradigm is a recursive solver of Sudoku? | <p>I am interested in knowing what algorithmic paradigm are the usual recursive sudoku solvers. Can I consider it a local search? or are they Dynamic programming, greedy, divide and conquer, backtracking?</p>
 | programming paradigms sudoku | 1 | What algorithm paradigm is a recursive solver of Sudoku? -- (programming paradigms sudoku)
<p>I am interested in knowing what algorithmic paradigm are the usual recursive sudoku solvers. Can I consider it a local search? or are they Dynamic programming, greedy, divide and conquer, backtracking?</p>
 | habedi/stack-exchange-dataset |
83,891 | Is there any polynomial time algorithm for a restricted EXP-time problem? | <p>Let we fix $<T>$ and $w$, where $<T>$ is its binary representation of a Turing machine and $w$ is input.</p>

<p>We want to check if $T$ doesn't halt over $w$ before $2^{|w|}$ steps. A trivial solution is to use a universal Turing machine which simulates $T$ on $w$ and counts its steps, but this ... | complexity theory time complexity | 1 | Is there any polynomial time algorithm for a restricted EXP-time problem? -- (complexity theory time complexity)
<p>Let we fix $<T>$ and $w$, where $<T>$ is its binary representation of a Turing machine and $w$ is input.</p>

<p>We want to check if $T$ doesn't halt over $w$ before $2^{|w|}$ steps. A... | habedi/stack-exchange-dataset |
83,896 | Regular expression for even/odd string on alphabet | <p>Given the alphabet <span class="math-container">$\{ a,b \}$</span>, if I want to build the regular expression for even/odd lenght strings, I can think that an even lenght string is given by some combination of <span class="math-container">$a$</span>'s and <span class="math-container">$b$</span>'s, and the letters ca... | formal languages regular expressions | 1 | Regular expression for even/odd string on alphabet -- (formal languages regular expressions)
<p>Given the alphabet <span class="math-container">$\{ a,b \}$</span>, if I want to build the regular expression for even/odd lenght strings, I can think that an even lenght string is given by some combination of <span class="m... | habedi/stack-exchange-dataset |
83,903 | The 'directionality' of reductions? | <p>I've been finding myself a bit confused with the <em>direction</em> of reductions used to show that certain languages are not recursive. For example, let us say we want to determine if the Halting Problem ($HALT_{TM}$)is undecidable. I know we can assume that it is decidable and then try to build a decider for the a... | computability turing machines reductions halting problem | 1 | The 'directionality' of reductions? -- (computability turing machines reductions halting problem)
<p>I've been finding myself a bit confused with the <em>direction</em> of reductions used to show that certain languages are not recursive. For example, let us say we want to determine if the Halting Problem ($HALT_{TM}$)i... | habedi/stack-exchange-dataset |
83,907 | Question about IO automaton | <p>I'm currently reading Nancy Lynch book about distributed systems, chapter about IO automaton. And I have following questions related to book exercise 8.13(c).</p>

<p>We are given some automaton A with sig(A) is empty. Traces(P) is the set of sequences over {1,2} in wich every occurance of 1 is immediatly ... | automata distributed systems concurrency | 1 | Question about IO automaton -- (automata distributed systems concurrency)
<p>I'm currently reading Nancy Lynch book about distributed systems, chapter about IO automaton. And I have following questions related to book exercise 8.13(c).</p>

<p>We are given some automaton A with sig(A) is empty. Traces(P) is the... | habedi/stack-exchange-dataset |
83,929 | Algorithm for finding cliques | <p>Given an arbitrary undirected graph $G = (V,E)$, I am interested in a low-polynomial time algorithm which can find several moderately large (ideally $O(n^\epsilon)$ vertices per clique for $\epsilon > 0$) cliques in $G$, provided they exist.</p>

<p>I am aware that the problem of finding the maximal cliqu... | algorithms graphs probabilistic algorithms clique | 1 | Algorithm for finding cliques -- (algorithms graphs probabilistic algorithms clique)
<p>Given an arbitrary undirected graph $G = (V,E)$, I am interested in a low-polynomial time algorithm which can find several moderately large (ideally $O(n^\epsilon)$ vertices per clique for $\epsilon > 0$) cliques in $G$, provided... | habedi/stack-exchange-dataset |
83,932 | What is the complexity of determining Satisfiability of a CNF containing both Horn and Dual Horn clauses? | <p>If a CNF contains both horn and dual horn clauses and does not contain clauses of other types, then can its Satisfiability always be determined in polynomial time?</p>

<p>If the answer to the above problem is yes, then suppose we only add XOR clauses in addition to horn and dual horn clauses, can the Satisf... | complexity theory time complexity satisfiability sat solvers | 1 | What is the complexity of determining Satisfiability of a CNF containing both Horn and Dual Horn clauses? -- (complexity theory time complexity satisfiability sat solvers)
<p>If a CNF contains both horn and dual horn clauses and does not contain clauses of other types, then can its Satisfiability always be determined i... | habedi/stack-exchange-dataset |
83,935 | Size of the language accepted by a Turing Machine | <p>I want to figure out if the following language is Turing decidable, Turing acceptable but not turing decidable, or neither. The language is </p>

<pre><code>{ρ(M) : |L(M)| ≤ 10} 
</code></pre>

<p>My question for this problem is what does |L(M)| ≤ 10 mean? At first, I thought it meant that t... | computability turing machines | 1 | Size of the language accepted by a Turing Machine -- (computability turing machines)
<p>I want to figure out if the following language is Turing decidable, Turing acceptable but not turing decidable, or neither. The language is </p>

<pre><code>{ρ(M) : |L(M)| ≤ 10} 
</code></pre>

<p>My questio... | habedi/stack-exchange-dataset |
83,942 | Finite state automaton's reaction to simultaneous events | <p>What does happen if two events simultaneously occur at a particular state of a finite state automaton (FSA)?</p>

<p>For example, assume that an FSA's event table at its state $s$ is as follows:</p>

<p>$\delta(s,e_1)=s_1$ and $\delta(s,e_2)=s_2$. What will be the system's next state if both $e_1$ an... | automata finite automata concurrency | 1 | Finite state automaton's reaction to simultaneous events -- (automata finite automata concurrency)
<p>What does happen if two events simultaneously occur at a particular state of a finite state automaton (FSA)?</p>

<p>For example, assume that an FSA's event table at its state $s$ is as follows:</p>

<p... | habedi/stack-exchange-dataset |
83,953 | Combinatorics: how many ways can we mark nodes in a DAG as black or white, if every node downstream of a black node is also black? | <p>We are assigning the colours white/black to the vertices of a DAG, under the condition that if $V$ is black and there is a path $V \to W$ for some vertex $W$, then $W$ is black.</p>

<p>Examples:</p>

<ul>
<li>In the case of a linear chain of $N$ nodes, the answer is $N+1$ - either all the nodes ... | algorithms graphs combinatorics | 1 | Combinatorics: how many ways can we mark nodes in a DAG as black or white, if every node downstream of a black node is also black? -- (algorithms graphs combinatorics)
<p>We are assigning the colours white/black to the vertices of a DAG, under the condition that if $V$ is black and there is a path $V \to W$ for some ve... | habedi/stack-exchange-dataset |
83,958 | Is there a limit on transition function compositions in NFAs? | <p>I want to prove regularity of a language that contains a known regular language $L$ using an NFA.</p>

<p>Say the transition function of the automation that accepts $L$ is $f$.</p>

<p>In my new transition function, is there a limitation on composition of $f$?
For example, can I make the followin... | regular languages automata finite automata computation models | 1 | Is there a limit on transition function compositions in NFAs? -- (regular languages automata finite automata computation models)
<p>I want to prove regularity of a language that contains a known regular language $L$ using an NFA.</p>

<p>Say the transition function of the automation that accepts $L$ is $f$.</p>... | habedi/stack-exchange-dataset |
83,963 | Knapsack Problem with Vector Values | <p>I am searching for information on a variant of the 0-1 Knapsack Problem I will call the Vector Knapsack Problem (VKP), which is basically the same as the standard KP except that the values being summed are vectors (and them sum is the Euclidean norm of the sum of the vectors). Formally, given a set of $m$ vectors $v... | complexity theory knapsack problems | 1 | Knapsack Problem with Vector Values -- (complexity theory knapsack problems)
<p>I am searching for information on a variant of the 0-1 Knapsack Problem I will call the Vector Knapsack Problem (VKP), which is basically the same as the standard KP except that the values being summed are vectors (and them sum is the Eucli... | habedi/stack-exchange-dataset |
83,971 | Proving that it is undecidable if a Turing machine accepts a language that is its own reverse | <p>I have a Turing machine M. How can I prove that $L(M) = (L(M))^R$ is decidable by constructing a Turing machine that can do this? I know how to figure out if two DFA's accept the same language (using the symmetric difference) however I don't believe it works for Turing machines. Now I am able to design a Turing mach... | computability turing machines decision problem | 1 | Proving that it is undecidable if a Turing machine accepts a language that is its own reverse -- (computability turing machines decision problem)
<p>I have a Turing machine M. How can I prove that $L(M) = (L(M))^R$ is decidable by constructing a Turing machine that can do this? I know how to figure out if two DFA's acc... | habedi/stack-exchange-dataset |
83,972 | How to define function type in AGDA | <p>The "function" type $\rightarrow$ is predefined in Agda. But how would one define it if it was not predefined? Specifically I am talking about $\rightarrow$ in:</p>

<pre><code>data Nat : Set where
 zero : Nat
 Suc : Nat -> Nat
</code></pre>
 | type theory automated theorem proving | 1 | How to define function type in AGDA -- (type theory automated theorem proving)
<p>The "function" type $\rightarrow$ is predefined in Agda. But how would one define it if it was not predefined? Specifically I am talking about $\rightarrow$ in:</p>

<pre><code>data Nat : Set where
 zero : Nat
 Su... | habedi/stack-exchange-dataset |
83,979 | Paper-based algorithm to find longest formula which is common to at least two formulas | <p>Given a list of logical formulas:</p>

<ul>
<li>f1: A&B</li>
<li>f2: A&D&C</li>
<li>f3: B&D&E</li>
<li>f4: A&B&C</li>
<li>f5: 
<li>fn: ... 
</ul>

<p>In this case I want A&B as the longest formula which is common to at least two formulas.
Is there a simple algorith... | algorithms optimization | 1 | Paper-based algorithm to find longest formula which is common to at least two formulas -- (algorithms optimization)
<p>Given a list of logical formulas:</p>

<ul>
<li>f1: A&B</li>
<li>f2: A&D&C</li>
<li>f3: B&D&E</li>
<li>f4: A&B&C</li>
<li>f5: 
<li>fn: ... 
</ul>

<p>In this... | habedi/stack-exchange-dataset |
83,980 | Reconstruct graph of N edges from a matrix of shortest pair distances (N*N) (i.e. result from Floyd-Warshall algorithm) | <p>I want to reconstruct a graph when given the results of a Floyd-Warshall shortest pair distances matrix, similar to the problem being solved in this question:</p>

<p><a href="https://cs.stackexchange.com/questions/81027/is-it-possible-to-reconstruct-graph-if-we-have-given-matrix-of-shortest-pairs">Is it pos... | algorithms graphs graph traversal weighted graphs | 1 | Reconstruct graph of N edges from a matrix of shortest pair distances (N*N) (i.e. result from Floyd-Warshall algorithm) -- (algorithms graphs graph traversal weighted graphs)
<p>I want to reconstruct a graph when given the results of a Floyd-Warshall shortest pair distances matrix, similar to the problem being solved i... | habedi/stack-exchange-dataset |
83,990 | Is implication(function) more fundamental than lets say conjunction(product) in type theory? | <p>According to the answer at (<a href="https://cs.stackexchange.com/questions/83972/how-to-define-function-type-in-agda">How to define function type in AGDA</a>) the function type is kind of a fundamental thing in Agda and needed for bootstrapping, hence end user can not define it like what they do for conjunction(pro... | type theory dependent types curry howard | 1 | Is implication(function) more fundamental than lets say conjunction(product) in type theory? -- (type theory dependent types curry howard)
<p>According to the answer at (<a href="https://cs.stackexchange.com/questions/83972/how-to-define-function-type-in-agda">How to define function type in AGDA</a>) the function type ... | habedi/stack-exchange-dataset |
83,996 | Are neural networks inherently imperfect because they mimic an imperfect machine (human)? | <p>Neural networks are the base for all(most?) of the machine learning / deep learning algorithms/programs.</p>

<p>Humans don't have fixed algorithms to decide or do something. Initially, we don't know how a snake is supposed to look. <strong>We learn</strong> that <strong>from experience</strong>. But our lea... | artificial intelligence neural networks | 1 | Are neural networks inherently imperfect because they mimic an imperfect machine (human)? -- (artificial intelligence neural networks)
<p>Neural networks are the base for all(most?) of the machine learning / deep learning algorithms/programs.</p>

<p>Humans don't have fixed algorithms to decide or do something.... | habedi/stack-exchange-dataset |
83,997 | Complexity Classes UP and US | <p>According to complexity zoo:
Class <strong>UP</strong> (Unambiguous Polynomial-Time) is defined as:
The class of decision problems solvable by an NP machine such that</p>

<ol>
<li>If the answer is “yes,” exactly one computation path accepts. </li>
<li>If the answer is “no,” all computation ... | complexity theory time complexity complexity classes | 1 | Complexity Classes UP and US -- (complexity theory time complexity complexity classes)
<p>According to complexity zoo:
Class <strong>UP</strong> (Unambiguous Polynomial-Time) is defined as:
The class of decision problems solvable by an NP machine such that</p>

<ol>
<li>If the answer is “yes,” exact... | habedi/stack-exchange-dataset |
84,000 | Are $BPP^{BPP^{\oplus P}}$ and $BPP^{NP}$ contained in $BPP^{\oplus P}$? | <ol>
<li><p>Does $BPP^{NP}\subseteq\Sigma_k^P\cap P/poly^{NP}\subseteq BPP^{\oplus P}$ hold at some $3\leq k<\infty$?</p></li>
<li><p>Also is $BPP^{BPP^{\oplus P}}\subseteq BPP^{\oplus P}$ known?</p></li>
</ol>

<p>Note Sipser gives $BPP\subseteq \Sigma_2P$ and Adleman gives $BPP\subseteq P/poly$... | complexity theory | 1 | Are $BPP^{BPP^{\oplus P}}$ and $BPP^{NP}$ contained in $BPP^{\oplus P}$? -- (complexity theory)
<ol>
<li><p>Does $BPP^{NP}\subseteq\Sigma_k^P\cap P/poly^{NP}\subseteq BPP^{\oplus P}$ hold at some $3\leq k<\infty$?</p></li>
<li><p>Also is $BPP^{BPP^{\oplus P}}\subseteq BPP^{\oplus P}$ known?</p></li>
</ol... | habedi/stack-exchange-dataset |
84,004 | Find cut vertex in tree with constraint on the size of largest component | <p>I have a connected and undirected graph without cycles (i.e. a tree), and I am trying to find a single cut vertex that, when removed, disconnects the graph into a set of connected components. The largest of these components should not have size greater than some threshold. So if one such cut vertex exists, I need to... | algorithms graphs searching | 1 | Find cut vertex in tree with constraint on the size of largest component -- (algorithms graphs searching)
<p>I have a connected and undirected graph without cycles (i.e. a tree), and I am trying to find a single cut vertex that, when removed, disconnects the graph into a set of connected components. The largest of thes... | habedi/stack-exchange-dataset |
84,011 | Can we convert an NFA to a regular expression of polynomial length? | <p>Can we convert an NFA having $n$ states to a regular expression of length $\mathrm{poly}(n)$? </p>

<p>In contrast, it is well known that a regular expression of length $n$ can be easily converted to an $\mathcal{O}(n)$-state NFA.</p>
 | regular languages finite automata regular expressions | 1 | Can we convert an NFA to a regular expression of polynomial length? -- (regular languages finite automata regular expressions)
<p>Can we convert an NFA having $n$ states to a regular expression of length $\mathrm{poly}(n)$? </p>

<p>In contrast, it is well known that a regular expression of length $n$ can be ea... | habedi/stack-exchange-dataset |
84,014 | Find biggest K, such that any subset of size less than K is not affecting the array | <p>Let's say we have given array $A = \{a_1, a_2, a_3,\dots,a_n\}$ of size $n$, and integer $L$, we want to find biggest integer $K$, such that the array without any subset of size $x, x\leq K$ will have sum greater or equal to $L$.</p>

<p><strong>Example</strong></p>

<p>$A = \{1, 2,3\}, L = 2$, in th... | dynamic programming arrays subset sum | 1 | Find biggest K, such that any subset of size less than K is not affecting the array -- (dynamic programming arrays subset sum)
<p>Let's say we have given array $A = \{a_1, a_2, a_3,\dots,a_n\}$ of size $n$, and integer $L$, we want to find biggest integer $K$, such that the array without any subset of size $x, x\leq K$... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.