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 |
|---|---|---|---|---|---|---|
75,950 | Is uniform cost search optimal? | <p>In my AI lecture notes (also many other AI lectures) it's written that uniform cost search is optimal (that is, uniform search always outputs the optimal path), but what if the cost is negative, won't the search algorithm possibly trapped in infinite loops? If solution is using a closed set to track explored nodes, ... | search algorithms | 1 | Is uniform cost search optimal? -- (search algorithms)
<p>In my AI lecture notes (also many other AI lectures) it's written that uniform cost search is optimal (that is, uniform search always outputs the optimal path), but what if the cost is negative, won't the search algorithm possibly trapped in infinite loops? If s... | habedi/stack-exchange-dataset |
75,952 | detecting a cycle in an undirected graph problem is in $RL$ complexity class | <p>I need come up with an algorithm for detecting a cycle in an undirected graph where the algorithm is in $RL$. That is, the algorithm detects a cycle with a probability greater-equal to $\frac{1}{2}$ but it doesn't return true for a graph with no cycle (no false-positive).</p>

<p>In class, we've learned that... | complexity theory graphs randomized algorithms | 1 | detecting a cycle in an undirected graph problem is in $RL$ complexity class -- (complexity theory graphs randomized algorithms)
<p>I need come up with an algorithm for detecting a cycle in an undirected graph where the algorithm is in $RL$. That is, the algorithm detects a cycle with a probability greater-equal to $\f... | habedi/stack-exchange-dataset |
75,969 | Prove that $NP^{NP\cap co-NP} = NP$ | <blockquote>
 <p>Let $A\in NP\cap co-NP$. Then, $NP^A = NP$.</p>
</blockquote>

<p>At first, I thought: Easy, let $L\in NP^A$ s.t. $A\in NP\cap co-NP$. Let $M_L$, an $NDTM$ to decide $L$ and $M_A$, an $NDTM$ to decide $A$. Then, we could create a new $NDTM$, $M$ which acts the same as $M_L$, but instea... | time complexity complexity classes | 1 | Prove that $NP^{NP\cap co-NP} = NP$ -- (time complexity complexity classes)
<blockquote>
 <p>Let $A\in NP\cap co-NP$. Then, $NP^A = NP$.</p>
</blockquote>

<p>At first, I thought: Easy, let $L\in NP^A$ s.t. $A\in NP\cap co-NP$. Let $M_L$, an $NDTM$ to decide $L$ and $M_A$, an $NDTM$ to decide $A$. Then... | habedi/stack-exchange-dataset |
75,970 | Is rejecting in polynomial time required for language to be in P? | <p>Language $L$ is in $\mathrm{P}$ if and only if there exists some Turing Machine $M$ such that for every word in $L$, $M$ either accepts or rejects it in polynomial time. Right? </p>

<p>But what if all we know about our language is that there exists TM $M'$ such that for every word in $L$, $M$ accepts it in ... | complexity theory polynomial time | 1 | Is rejecting in polynomial time required for language to be in P? -- (complexity theory polynomial time)
<p>Language $L$ is in $\mathrm{P}$ if and only if there exists some Turing Machine $M$ such that for every word in $L$, $M$ either accepts or rejects it in polynomial time. Right? </p>

<p>But what if all we... | habedi/stack-exchange-dataset |
75,979 | Check whether an interval is contained in a union of intervals | <p>Initial Problem:</p>

<blockquote>
 <p>Given an interval $[A, B]$ and a set of intervals $S = \{[S_{11},
S_{12}], [S_{21}, S_{22}], [S_{31}, S_{32}], \ldots, [S_{N1}, S_{N2}]\}$
 with $S_{11}\leq S_{21}\leq \cdots \leq S_{N1}$ output True if and only if
 $[A, B]$ is completely contained in... | algorithms time complexity intervals | 1 | Check whether an interval is contained in a union of intervals -- (algorithms time complexity intervals)
<p>Initial Problem:</p>

<blockquote>
 <p>Given an interval $[A, B]$ and a set of intervals $S = \{[S_{11},
S_{12}], [S_{21}, S_{22}], [S_{31}, S_{32}], \ldots, [S_{N1}, S_{N2}]\}$
 with $S_{11... | habedi/stack-exchange-dataset |
75,984 | Code to count number of leaves of a tree? | <p>I've just started learning C. Can anyone tell me whether my code is correct or not, if not what's the correct version? This is code for counting number of leaf nodes. Is this efficient one if this is correct?</p>

<pre><code>void Count_leaf( Tree* head)
 { static leaf = 0;
 if(hea... | data structures trees | 1 | Code to count number of leaves of a tree? -- (data structures trees)
<p>I've just started learning C. Can anyone tell me whether my code is correct or not, if not what's the correct version? This is code for counting number of leaf nodes. Is this efficient one if this is correct?</p>

<pre><code>void Count_leaf... | habedi/stack-exchange-dataset |
75,987 | Is the lambda calculus referentially transparent? | <p>In an answer of this <a href="https://www.reddit.com/r/haskell/comments/21y560/purity_and_referential_transparency_are_different/" rel="nofollow noreferrer">Reddit discussion</a> somebody defines referential transparency (RT) as "a context $K[ ]$ is RT if, for all $M$ and $N$ s.t. $M = N$, then $K[M] = K[N]$". Based... | lambda calculus | 1 | Is the lambda calculus referentially transparent? -- (lambda calculus)
<p>In an answer of this <a href="https://www.reddit.com/r/haskell/comments/21y560/purity_and_referential_transparency_are_different/" rel="nofollow noreferrer">Reddit discussion</a> somebody defines referential transparency (RT) as "a context $K[ ]$... | habedi/stack-exchange-dataset |
75,996 | Box representation in modern languages | <p>I'm studying value representation in modern languages. The idea is that since in many situations the size of objects can be unknown, one can introduce a box representation of it. This box representation is just a block stored at the heap with a tag to identify it. </p>

<p>My questions is as follows: who dea... | compilers | 1 | Box representation in modern languages -- (compilers)
<p>I'm studying value representation in modern languages. The idea is that since in many situations the size of objects can be unknown, one can introduce a box representation of it. This box representation is just a block stored at the heap with a tag to identify it... | habedi/stack-exchange-dataset |
76,018 | Is this "cycle" condition sufficient for unique minimum spanning tree? | <p>Given a connected, undirected, weighted graph $G$, the condition</p>

<blockquote>
 <p>The maximum-weight edge in any cycle of $G$ is unique.</p>
</blockquote>

<p>is <a href="https://cs.stackexchange.com/q/34015/4911"><em>not necessary</em></a> for $G$ to have a unique minimum spanning tree... | graphs minimum spanning tree | 1 | Is this "cycle" condition sufficient for unique minimum spanning tree? -- (graphs minimum spanning tree)
<p>Given a connected, undirected, weighted graph $G$, the condition</p>

<blockquote>
 <p>The maximum-weight edge in any cycle of $G$ is unique.</p>
</blockquote>

<p>is <a href="https://cs.... | habedi/stack-exchange-dataset |
76,026 | TF IDF Spark values are small after cosine similarity | <p>I am creating a software that computes the cosine similarity between 2 strings.</p>

<p>I am using Spark as I have to use Java. I created a Bag of words model and computed the cosine similarity successfully.</p>

<p>Feeding the same sentences to the software and substituting the bag of words model wi... | algorithms natural language processing | 1 | TF IDF Spark values are small after cosine similarity -- (algorithms natural language processing)
<p>I am creating a software that computes the cosine similarity between 2 strings.</p>

<p>I am using Spark as I have to use Java. I created a Bag of words model and computed the cosine similarity successfully.</p>... | habedi/stack-exchange-dataset |
76,029 | Why doesn't playing audio stop other tasks? | <p>If processors can only execute one thing at a time, how come I can play music continuously and still be able to run other tasks?</p>

<p>I understand the interrupt system, but isn't it needed that CPU continuously process audio for it to not sound jittery/laggy?</p>

<p>I am asking about the underlyi... | cpu multi tasking | 1 | Why doesn't playing audio stop other tasks? -- (cpu multi tasking)
<p>If processors can only execute one thing at a time, how come I can play music continuously and still be able to run other tasks?</p>

<p>I understand the interrupt system, but isn't it needed that CPU continuously process audio for it to not ... | habedi/stack-exchange-dataset |
76,044 | Hit/Miss in a 2-way set associative cache with offset | <p>"In a 2-way set associative cache of 4 blocks containing 4 words each, which one of these addresses will return a hit when being read? The blocks to be retained in the cache are decided by LRU."</p>

<p>4 word / block means that the offset = 2 bits.</p>

<p>2-way means 4 blocks / 2 = 2 sets. The inde... | cpu cache | 1 | Hit/Miss in a 2-way set associative cache with offset -- (cpu cache)
<p>"In a 2-way set associative cache of 4 blocks containing 4 words each, which one of these addresses will return a hit when being read? The blocks to be retained in the cache are decided by LRU."</p>

<p>4 word / block means that the offset ... | habedi/stack-exchange-dataset |
76,049 | Time complexity of $T(n) = nT(n-1) + n^2$ | <p>This time complexity comes from $N$-queen problem. There are many threads talking about the time complexity to be $O(n!)$ but I cannot figure out how we get it. Here is the progress I have so far:</p>

<p>$$
\begin{align}
T(n) & = n T(n-1) + n^2\\
& = n(n-1)T(n-2) + n(n-1)^2 + n^2\\
&... | recurrence relation | 1 | Time complexity of $T(n) = nT(n-1) + n^2$ -- (recurrence relation)
<p>This time complexity comes from $N$-queen problem. There are many threads talking about the time complexity to be $O(n!)$ but I cannot figure out how we get it. Here is the progress I have so far:</p>

<p>$$
\begin{align}
T(n) & =... | habedi/stack-exchange-dataset |
76,063 | Register Allocation and Definition of Interference | <p>In my textbook on compiler design <a href="http://www.diku.dk/~torbenm/Basics/basics_lulu2.pdf" rel="nofollow noreferrer">[1]</a>, it describes interference between two variables (the property that they cannot be in the same register at once) as follows:</p>

<blockquote>
 <p><strong><em>Definition 9.2<... | compilers | 1 | Register Allocation and Definition of Interference -- (compilers)
<p>In my textbook on compiler design <a href="http://www.diku.dk/~torbenm/Basics/basics_lulu2.pdf" rel="nofollow noreferrer">[1]</a>, it describes interference between two variables (the property that they cannot be in the same register at once) as follo... | habedi/stack-exchange-dataset |
76,065 | Can we recognize the difference of two strings of $2^n$ length using polynomial size strings? | <p>Is it possible to transform binary strings of length $2^n$ to $n^c$ binary strings of sized $n^d$ such that 
$$\forall s_1,s_2 \; \exists i \in \{1,\cdots,n^c\} \; f_i(s_1)\neq f_i(s_2),$$
Where two strings $s_1,s_2$ have length $2^n$ and $\forall i\in\{1,\cdots,n^c\}, \; f_i(s_j)\leq n^d, \; j\in \{1,2\}$?... | probability theory hash hashing | 1 | Can we recognize the difference of two strings of $2^n$ length using polynomial size strings? -- (probability theory hash hashing)
<p>Is it possible to transform binary strings of length $2^n$ to $n^c$ binary strings of sized $n^d$ such that 
$$\forall s_1,s_2 \; \exists i \in \{1,\cdots,n^c\} \; f_i(s_1)\neq f_i(s... | habedi/stack-exchange-dataset |
76,072 | Is this “cut condition" sufficient for unique minimum spanning tree? | <p>Given a connected, undirected, weighted graph $G$, the following "cut condition"</p>

<blockquote>
 <p>For any partition of the vertices of $G$ into two subsets, the minimum-weight edge with one endpoint in each subset is unique.</p>
</blockquote>

<p>is <a href="https://cs.stackexchange.com... | graphs minimum spanning tree | 1 | Is this “cut condition" sufficient for unique minimum spanning tree? -- (graphs minimum spanning tree)
<p>Given a connected, undirected, weighted graph $G$, the following "cut condition"</p>

<blockquote>
 <p>For any partition of the vertices of $G$ into two subsets, the minimum-weight edge with one endpoi... | habedi/stack-exchange-dataset |
76,080 | Does every r.e. set containing the set of total recursive functions contain all partial recursive functions? | <p>Any r.e. subset of $A\subseteq\mathbb{N}$ which contains the set $$\mathrm{Tot}=\{i\mid i\ \mbox{is an index of a total function } f\}$$ must, by a standard argument (of Post?) contain <em>some</em> partial recursive function indices.</p>

<p>Given a partial function index (and every total function), it's pr... | computability | 1 | Does every r.e. set containing the set of total recursive functions contain all partial recursive functions? -- (computability)
<p>Any r.e. subset of $A\subseteq\mathbb{N}$ which contains the set $$\mathrm{Tot}=\{i\mid i\ \mbox{is an index of a total function } f\}$$ must, by a standard argument (of Post?) contain <em>... | habedi/stack-exchange-dataset |
76,094 | DFA for $L=\{w: w\in \{a,b\}^*, |w|_a\ \equiv |w|_b \equiv 0$ $(mod$ $5) \}$ | <p>There is a language:
$L=\{w: w\in \{a,b\}^*, |w|_a\ \equiv |w|_b \equiv 0$ $(mod$ $5) \}$. My idea for DFA is - we count number of $a$$\pmod{5}$ and separately we count number of $b$$\pmod{5}$. So we end up with $5*5=25$ states, because each state have to keep track for both number of $a$ and $b$$\pmod{5}$. Is ... | automata regular languages finite automata | 1 | DFA for $L=\{w: w\in \{a,b\}^*, |w|_a\ \equiv |w|_b \equiv 0$ $(mod$ $5) \}$ -- (automata regular languages finite automata)
<p>There is a language:
$L=\{w: w\in \{a,b\}^*, |w|_a\ \equiv |w|_b \equiv 0$ $(mod$ $5) \}$. My idea for DFA is - we count number of $a$$\pmod{5}$ and separately we count number of $b$$\pmo... | habedi/stack-exchange-dataset |
76,098 | What is a batch compiler? | <p>I have the following quotation from my compiler's course (in the context of graph coloring):</p>

<blockquote>
 <p>Because it is slow, graph coloring tends to be used in batch
 compilers, while linear scan tends to be used in JIT compilers.</p>
</blockquote>

<p>I couldn't find a clear ... | compilers | 1 | What is a batch compiler? -- (compilers)
<p>I have the following quotation from my compiler's course (in the context of graph coloring):</p>

<blockquote>
 <p>Because it is slow, graph coloring tends to be used in batch
 compilers, while linear scan tends to be used in JIT compilers.</p>
</blockqu... | habedi/stack-exchange-dataset |
76,110 | Vertex Cover special cases | <p>This was from a test from my university:</p>

<p>Consider $T = t_1, t_2, \cdots, t_n$ a set of intervals of the form $(s, e)$, representing the start and end time, respectively. Now, select the minimum number of intervals such that their "union" intersects all other intervals. The question then asked for an ... | graphs np complete greedy algorithms | 1 | Vertex Cover special cases -- (graphs np complete greedy algorithms)
<p>This was from a test from my university:</p>

<p>Consider $T = t_1, t_2, \cdots, t_n$ a set of intervals of the form $(s, e)$, representing the start and end time, respectively. Now, select the minimum number of intervals such that their "u... | habedi/stack-exchange-dataset |
76,112 | What is the difference between $x:A$ and $x \Xi A$? | <p>Given a type hierarchy <span class="math-container">$(\tau,\sqsubseteq)$</span> and a signature <span class="math-container">$(VSym, FSym, PSym, \alpha)$</span>, one says that the typing function <span class="math-container">$\alpha$</span> assigns to each variable symbol <span class="math-container">$x \in VSym$</s... | type theory first order logic software verification | 1 | What is the difference between $x:A$ and $x \Xi A$? -- (type theory first order logic software verification)
<p>Given a type hierarchy <span class="math-container">$(\tau,\sqsubseteq)$</span> and a signature <span class="math-container">$(VSym, FSym, PSym, \alpha)$</span>, one says that the typing function <span class=... | habedi/stack-exchange-dataset |
76,123 | Why is $\log n = O(2^n)$? | <p>In my theoretical computer science book I have the following statement regarding the <strong>space complexity</strong> of $f(n)=2^n$:</p>

<p>$$\log(n) = O(f(n))$$</p>

<p>I can't understand how this is true, any help will be greatly appreciated.</p>
 | asymptotics landau notation | 1 | Why is $\log n = O(2^n)$? -- (asymptotics landau notation)
<p>In my theoretical computer science book I have the following statement regarding the <strong>space complexity</strong> of $f(n)=2^n$:</p>

<p>$$\log(n) = O(f(n))$$</p>

<p>I can't understand how this is true, any help will be greatly apprecia... | habedi/stack-exchange-dataset |
76,126 | What hash algorithm is it? | <p>I've found a simple multiply-with-add hash function in an old Usenet post.
Can someone identify what hash algorithm is it? An algorithm name or any attribution?</p>

<pre><code>size_t hash(const char* data, size_t length, size_t seed = 1)
{
 for (size_t i = 0; i < length; i++)
 {
... | algorithms algorithm analysis hash | 1 | What hash algorithm is it? -- (algorithms algorithm analysis hash)
<p>I've found a simple multiply-with-add hash function in an old Usenet post.
Can someone identify what hash algorithm is it? An algorithm name or any attribution?</p>

<pre><code>size_t hash(const char* data, size_t length, size_t seed = 1)... | habedi/stack-exchange-dataset |
76,127 | What am I missing in this application of Dijkstra? | <p>When running Dijkstra against the following graph:</p>

<pre><code> 1 3
A -- B -- C
 \ /
2 \ / 1
 \ /
 D
</code></pre>

<p>...I come up with the following:</p>

<pre><code> Current
 A B C D
 A ... | shortest path | 1 | What am I missing in this application of Dijkstra? -- (shortest path)
<p>When running Dijkstra against the following graph:</p>

<pre><code> 1 3
A -- B -- C
 \ /
2 \ / 1
 \ /
 D
</code></pre>

<p>...I come up with the following:</p>

<pre><code> Curren... | habedi/stack-exchange-dataset |
76,131 | Inline caching in not object oriented languages | <p>I've been recently studying <a href="https://en.wikipedia.org/wiki/Inline_caching" rel="nofollow noreferrer">inline caching</a> as a technique to optimize method dispatch in object oriented languages. Basically, the idea is that one can remember what was previously dispatched and predict that things will go on in th... | compilers functional programming caching | 1 | Inline caching in not object oriented languages -- (compilers functional programming caching)
<p>I've been recently studying <a href="https://en.wikipedia.org/wiki/Inline_caching" rel="nofollow noreferrer">inline caching</a> as a technique to optimize method dispatch in object oriented languages. Basically, the idea is... | habedi/stack-exchange-dataset |
76,143 | 4 Neurons to Decide 10 Digits | <p>I am trying to solve this algorithm exercises (<a href="http://neuralnetworksanddeeplearning.com/chap1.html#exercise_513527" rel="nofollow noreferrer">http://neuralnetworksanddeeplearning.com/chap1.html#exercise_513527</a>) in Michael Nielson's online book: Neural Networks and Deep Learning (<a href="http://neuralne... | algorithms neural networks algorithm design | 1 | 4 Neurons to Decide 10 Digits -- (algorithms neural networks algorithm design)
<p>I am trying to solve this algorithm exercises (<a href="http://neuralnetworksanddeeplearning.com/chap1.html#exercise_513527" rel="nofollow noreferrer">http://neuralnetworksanddeeplearning.com/chap1.html#exercise_513527</a>) in Michael Nie... | habedi/stack-exchange-dataset |
76,154 | Prove the time complexity of this algorithm of finding longest subarray with maximum value in the middle | <p>I'm trying to find time complexity $T(n)$ of the algorithm by a given pseudocode:</p>

<pre><code>1: for i:=1 to N do
2: begin
3: len := 1
4: while i - len >= 1 and i + len <= N do
5: begin
6: if a[i] > a[i - len] and a[i] > a[i + len] then
7: len := len + ... | algorithms complexity theory algorithm analysis time complexity | 1 | Prove the time complexity of this algorithm of finding longest subarray with maximum value in the middle -- (algorithms complexity theory algorithm analysis time complexity)
<p>I'm trying to find time complexity $T(n)$ of the algorithm by a given pseudocode:</p>

<pre><code>1: for i:=1 to N do
2: begin
... | habedi/stack-exchange-dataset |
76,159 | Which graph algorithm should I use? | <p>I need to find the shortest path in a Directed Unweighted Cyclic graph. And it has to be optimal (find a path if exists one) and also optimal in terms of space and time complexity, being time complexity the most important.
I think BFS is the solution. But am not sure.</p>

<p>What I am doing is mapping d... | graphs time complexity shortest path space complexity | 1 | Which graph algorithm should I use? -- (graphs time complexity shortest path space complexity)
<p>I need to find the shortest path in a Directed Unweighted Cyclic graph. And it has to be optimal (find a path if exists one) and also optimal in terms of space and time complexity, being time complexity the most important.... | habedi/stack-exchange-dataset |
76,163 | Creating a Grammar that is equivalent to "RegEx A, RegEx B, or BOTH" | <p>I have the following problem, create a Grammar on the Language {1,0} that accepts </p>

<blockquote>
 <p>"strings with a length divisible by 3, <strong>or</strong> strings with a number of 0s divisible
 by 3, <strong>or</strong> <em>BOTH</em>".</p>
</blockquote>

<p>I created grammars f... | formal grammars regular expressions | 1 | Creating a Grammar that is equivalent to "RegEx A, RegEx B, or BOTH" -- (formal grammars regular expressions)
<p>I have the following problem, create a Grammar on the Language {1,0} that accepts </p>

<blockquote>
 <p>"strings with a length divisible by 3, <strong>or</strong> strings with a number of 0s di... | habedi/stack-exchange-dataset |
76,168 | What is the difference between distributed representations and factors of variation in deep learning | <p>In the field of deep learning, people often talk about factors of variation which, in my understanding (in terms of dimensionality reduction), are the latent variable directions capturing variability in the data. I also often come across the term distributed representations which are basically the features of the in... | machine learning neural networks | 1 | What is the difference between distributed representations and factors of variation in deep learning -- (machine learning neural networks)
<p>In the field of deep learning, people often talk about factors of variation which, in my understanding (in terms of dimensionality reduction), are the latent variable directions ... | habedi/stack-exchange-dataset |
76,170 | Confirmation of Dijsktra application explanation | <p>Please can someone confirm that my description of the application of Dijkstra's algorithm is correct for this graph?</p>

<pre><code> 1 3
 A -- B -- C
 \ /
 2 \ / 1
 \ /
 D

Step Current Node

 B C D
1 A ... | shortest path | 1 | Confirmation of Dijsktra application explanation -- (shortest path)
<p>Please can someone confirm that my description of the application of Dijkstra's algorithm is correct for this graph?</p>

<pre><code> 1 3
 A -- B -- C
 \ /
 2 \ / 1
 \ /
 D

Step Current No... | habedi/stack-exchange-dataset |
76,171 | Mapping many transition functions into two transition functions | <p>Continuing from this answer: <a href="https://cs.stackexchange.com/a/56072/43035">https://cs.stackexchange.com/a/56072/43035</a></p>

<p>I don't understand how it's possible to map many transition functions $\delta_1,...,\delta_n$ of a NDTM into just two transition functions $\delta_0',\delta_1'$. How will c... | complexity theory turing machines nondeterminism | 1 | Mapping many transition functions into two transition functions -- (complexity theory turing machines nondeterminism)
<p>Continuing from this answer: <a href="https://cs.stackexchange.com/a/56072/43035">https://cs.stackexchange.com/a/56072/43035</a></p>

<p>I don't understand how it's possible to map many trans... | habedi/stack-exchange-dataset |
76,174 | How can, e.g., Dijkstra find all shortest paths in linear time? | <p>As I understand one can modify BFS for unweighted graph or Dijakstra for weighted graph to find all possible shortest paths from $s$ to $t$ in linear time. But how can this be, when there are $O(2^n)$ such paths?
What am I missing here?</p>
 | algorithms complexity theory graphs time complexity | 1 | How can, e.g., Dijkstra find all shortest paths in linear time? -- (algorithms complexity theory graphs time complexity)
<p>As I understand one can modify BFS for unweighted graph or Dijakstra for weighted graph to find all possible shortest paths from $s$ to $t$ in linear time. But how can this be, when there are... | habedi/stack-exchange-dataset |
76,176 | reduction from SET-COVER to VERTEX-COVER | <p>I've come with an idea for reduction from the set-cover problem to the vertex-cover problem, But I'm not sure if this reduction is correct. I saw in <a href="https://cs.stackexchange.com/questions/3354/reduction-from-set-cover-problem-to-vertex-cover-problem">this post's</a> comments that "There cannot be a nice re... | complexity theory np complete reductions | 1 | reduction from SET-COVER to VERTEX-COVER -- (complexity theory np complete reductions)
<p>I've come with an idea for reduction from the set-cover problem to the vertex-cover problem, But I'm not sure if this reduction is correct. I saw in <a href="https://cs.stackexchange.com/questions/3354/reduction-from-set-cover-pr... | habedi/stack-exchange-dataset |
76,177 | Vertical sticks challenge explanation | <p>This is a question based on <a href="https://cs.stackexchange.com/questions/1076/how-to-approach-vertical-sticks-challenge/1114#1114">this one</a></p>

<p>I've also tried this problem but I can't seem to understand Henry's solution to it. </p>

<p>Why is the average distance between the sticks $(n+1)... | algorithms probability theory | 1 | Vertical sticks challenge explanation -- (algorithms probability theory)
<p>This is a question based on <a href="https://cs.stackexchange.com/questions/1076/how-to-approach-vertical-sticks-challenge/1114#1114">this one</a></p>

<p>I've also tried this problem but I can't seem to understand Henry's solution to i... | habedi/stack-exchange-dataset |
76,184 | Why doesn't this quine-less language contradict Kleene's recursion theorem? | <p>Kleene's recursion theorem implies that every Turing complete programming language that satisfies certain properties have quines. <a href="http://wwwep.stewartsplace.org.uk/quines/quineless.html" rel="nofollow noreferrer">This website</a> claims that this is incorrect, and that there is a Turing complete without a q... | fixed point | 1 | Why doesn't this quine-less language contradict Kleene's recursion theorem? -- (fixed point)
<p>Kleene's recursion theorem implies that every Turing complete programming language that satisfies certain properties have quines. <a href="http://wwwep.stewartsplace.org.uk/quines/quineless.html" rel="nofollow noreferrer">Th... | habedi/stack-exchange-dataset |
76,186 | What would you get if you add parameters to context free grammars? | <p>I was thinking of grammars for indendation-sensitive languages and it looks like CF grammars would do the trick if combined with parameters. As an example, consider this fragment for simplified Python grammar in ANTLR-like format:</p>

<pre><code>// on top-level the statements have empty indent
program ... | formal languages context free formal grammars parsers | 1 | What would you get if you add parameters to context free grammars? -- (formal languages context free formal grammars parsers)
<p>I was thinking of grammars for indendation-sensitive languages and it looks like CF grammars would do the trick if combined with parameters. As an example, consider this fragment for simplifi... | habedi/stack-exchange-dataset |
76,192 | Why is Two-Phase Commit (2PC) blocking? | <p>Can anyone let me know, why 2PC is blocking when the coordinator fails? Is it because the cohorts don't employ timeout concept in 2PC?</p>

<p>Good reference: <a href="http://www.win.tue.nl/~atif/reports/paper4ICET.pdf" rel="nofollow noreferrer"><em>Analysis and Verification of Two-Phase Commit & Three-P... | distributed systems | 1 | Why is Two-Phase Commit (2PC) blocking? -- (distributed systems)
<p>Can anyone let me know, why 2PC is blocking when the coordinator fails? Is it because the cohorts don't employ timeout concept in 2PC?</p>

<p>Good reference: <a href="http://www.win.tue.nl/~atif/reports/paper4ICET.pdf" rel="nofollow noreferrer... | habedi/stack-exchange-dataset |
76,197 | Info about dataset from which a Huffman tree was generated | <p>I know that given the following huffman tree:</p>

<p><a href="https://i.stack.imgur.com/AVXpP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AVXpP.png" alt="A huffman tree"></a></p>

<p>you can say that C occurs most in the dataset from which it was generated and D and B occur th... | binary trees huffman coding | 1 | Info about dataset from which a Huffman tree was generated -- (binary trees huffman coding)
<p>I know that given the following huffman tree:</p>

<p><a href="https://i.stack.imgur.com/AVXpP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AVXpP.png" alt="A huffman tree"></a></p>

<p>yo... | habedi/stack-exchange-dataset |
76,205 | Impossibility for Byzantine Generals Problem where $n \leq 3m$ | <p>Wiki: <a href="https://en.wikipedia.org/wiki/Byzantine_fault_tolerance" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Byzantine_fault_tolerance</a></p>

<hr>

<p>In the paper "Reaching Agreement in the Presence of Faults", M. Pease et al. proved that there is no protocol (of some kind) to s... | distributed systems information theory fault tolerance | 1 | Impossibility for Byzantine Generals Problem where $n \leq 3m$ -- (distributed systems information theory fault tolerance)
<p>Wiki: <a href="https://en.wikipedia.org/wiki/Byzantine_fault_tolerance" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Byzantine_fault_tolerance</a></p>

<hr>

<p>In the... | habedi/stack-exchange-dataset |
76,212 | Is this a correct description of Dijkstra's algorithm | <p>I am on a journey understanding Dijkstra's algorithm.</p>

<p>My familiarity with mathematical terms is not great, so I have put the algorithm into my own English. I understand this is not ideal, but this is part of my learning process.</p>

<p>What are the major areas of misunderstanding in the desc... | shortest path | 1 | Is this a correct description of Dijkstra's algorithm -- (shortest path)
<p>I am on a journey understanding Dijkstra's algorithm.</p>

<p>My familiarity with mathematical terms is not great, so I have put the algorithm into my own English. I understand this is not ideal, but this is part of my learning process.... | habedi/stack-exchange-dataset |
76,213 | Solving 2-CNF TQBF with #SAT solver? | <p>We clearly know that 2-QCNF is in $\mathsf{P}$. Since that, if I understand it right, it is possible to solve it with #SAT solver (because $\mathsf{P} \subseteq \mathsf{\#P}$). But how can we only knowing amount of positive assignments for some non-quantified formulae solve 2-QCNF? And why this doesn't hold (at leas... | algorithms reductions | 1 | Solving 2-CNF TQBF with #SAT solver? -- (algorithms reductions)
<p>We clearly know that 2-QCNF is in $\mathsf{P}$. Since that, if I understand it right, it is possible to solve it with #SAT solver (because $\mathsf{P} \subseteq \mathsf{\#P}$). But how can we only knowing amount of positive assignments for some non-quan... | habedi/stack-exchange-dataset |
76,227 | How to convert two conflicting objective functions into a single objective function | <p>I have two objective functions say f1 where I have to minimize (X+Y) and another function f2 where I have to maximize (A-B). The two functions are conflicting. </p>

<p>I need to convert them into a minimization problem involving one single objective function using the weighed sum approach where the final fo... | optimization modelling convex hull | 1 | How to convert two conflicting objective functions into a single objective function -- (optimization modelling convex hull)
<p>I have two objective functions say f1 where I have to minimize (X+Y) and another function f2 where I have to maximize (A-B). The two functions are conflicting. </p>

<p>I need to conver... | habedi/stack-exchange-dataset |
76,230 | Disk scheduling algorithm - SCAN and C-SCAN | <p>I'm studying several disk scheduling algorithms; however, I'm kinda confused with SCAN. I understand the concept, but I don't understand the example given in the book. I think that the author made a mistake, but I want to be sure.</p>
<p>The example is the following:</p>
<blockquote>
<p>Description of SC... | computer architecture scheduling | 1 | Disk scheduling algorithm - SCAN and C-SCAN -- (computer architecture scheduling)
<p>I'm studying several disk scheduling algorithms; however, I'm kinda confused with SCAN. I understand the concept, but I don't understand the example given in the book. I think that the author made a mistake, but I want to be sure.</p>&... | habedi/stack-exchange-dataset |
76,233 | Choosing a shortest representative number from interval in arithmetic coding | <p>In <a href="https://en.wikipedia.org/wiki/Arithmetic_coding" rel="nofollow noreferrer">arithmetic coding</a> a word is coded as the binary encoding of a number in a certain interval. The interval is determined from a sequence of nested intervals according to the probability distribution on the letters of the word. <... | algorithms information theory data compression coding theory | 1 | Choosing a shortest representative number from interval in arithmetic coding -- (algorithms information theory data compression coding theory)
<p>In <a href="https://en.wikipedia.org/wiki/Arithmetic_coding" rel="nofollow noreferrer">arithmetic coding</a> a word is coded as the binary encoding of a number in a certain i... | habedi/stack-exchange-dataset |
76,239 | Is the language in class P | <p>So class P is the class of languages that are decidable in polynomial time on
a deterministic single-tape TM.</p>

<p>I can show that the decider for a language L* runs in polynomial time.</p>

<p>So is it true that this language in class P?
STARCLOSED DFA = { | A is a DFA, and L(A) = L(A)*}<... | turing machines | 1 | Is the language in class P -- (turing machines)
<p>So class P is the class of languages that are decidable in polynomial time on
a deterministic single-tape TM.</p>

<p>I can show that the decider for a language L* runs in polynomial time.</p>

<p>So is it true that this language in class P?
STA... | habedi/stack-exchange-dataset |
76,243 | Applying a 1-qubit gate to entangled qubits | <p>Given two entangled qubits in the state ${|00⟩+|11⟩\over \root \of 2}$, I have trouble getting the way of applying a <strong>1</strong>-qubit gate (let's say a Hadamard) to <strong>1</strong> of the entangled qubits (let's say the first one). Actually I have several questions:</p>

<ul>
<li><p>Following ... | quantum computing | 1 | Applying a 1-qubit gate to entangled qubits -- (quantum computing)
<p>Given two entangled qubits in the state ${|00⟩+|11⟩\over \root \of 2}$, I have trouble getting the way of applying a <strong>1</strong>-qubit gate (let's say a Hadamard) to <strong>1</strong> of the entangled qubits (let's say the first one). Actuall... | habedi/stack-exchange-dataset |
76,248 | Intuition behind straight-line programs | <p>Wikipedia defines straight-line programs in the following manner:</p>

<blockquote>
 <p>In mathematics, more specifically in computational algebra[disambiguation needed], a straight-line program (SLP) for a finite group G = 〈S〉 is a finite sequence L of elements of G such that every element of L that be... | complexity theory intuition computation tree logic | 1 | Intuition behind straight-line programs -- (complexity theory intuition computation tree logic)
<p>Wikipedia defines straight-line programs in the following manner:</p>

<blockquote>
 <p>In mathematics, more specifically in computational algebra[disambiguation needed], a straight-line program (SLP) for a f... | habedi/stack-exchange-dataset |
76,257 | Why not use Right Recursion to avoid Left Recursion? | <p>I am reading about Representative Grammars from book, where I encountered the following grammar:</p>

<p>$$ E \rightarrow E + T \ | \ T $$
$$ T \rightarrow T * F \ | \ F $$
$$ F \rightarrow (E) \ | \ id$$</p>

<p>The above grammar is left-recursive, which is bad. So in order to eliminate left... | compilers left recursion | 1 | Why not use Right Recursion to avoid Left Recursion? -- (compilers left recursion)
<p>I am reading about Representative Grammars from book, where I encountered the following grammar:</p>

<p>$$ E \rightarrow E + T \ | \ T $$
$$ T \rightarrow T * F \ | \ F $$
$$ F \rightarrow (E) \ | \ id$$</p>

... | habedi/stack-exchange-dataset |
76,261 | Prove that $L = \{ a^ib^jc^k | i < j \ and \ i+2j +3 < k \}$ is not CFG | <p>Can someone help me prove that $L = \{ a^ib^jc^k | i < j \ and \ i+2j+3 < k \}$ is not a context free language? </p>

<p>I've tried applying the pumping lemma for CFGs and proving case by case (taking x=uvw, at first v is int $a^+$, then v is in $a^+b^+$ etc.but I'm failing to find a contradiction). An... | context free formal grammars pumping lemma | 1 | Prove that $L = \{ a^ib^jc^k | i < j \ and \ i+2j +3 < k \}$ is not CFG -- (context free formal grammars pumping lemma)
<p>Can someone help me prove that $L = \{ a^ib^jc^k | i < j \ and \ i+2j+3 < k \}$ is not a context free language? </p>

<p>I've tried applying the pumping lemma for CFGs and proving cas... | habedi/stack-exchange-dataset |
76,287 | Why using finite automata in implementing lexical analyzers | <p>I studied the subject of building a lexical analyzer using finite automata, through the classical way: Regular Expression -> NDA -> DFA. And I found it elegant, and a more solid approach for building a lexer.<br>
Now my question is, what are other benifits from building a lexer this way, rather than the "<em>ad ... | finite automata compilers lexical analysis | 1 | Why using finite automata in implementing lexical analyzers -- (finite automata compilers lexical analysis)
<p>I studied the subject of building a lexical analyzer using finite automata, through the classical way: Regular Expression -> NDA -> DFA. And I found it elegant, and a more solid approach for building a lexer.<... | habedi/stack-exchange-dataset |
76,289 | Shortest paths among two subsets of nodes | <p>Given a directed graph $G = (V, E)$ with all edge weights being non-negative and two disjoint subsets of nodes $S, T \subseteq V$, design an algorithm to find the shortest paths among $S$ and $T$, (formally, $\min\{d(s,t): s \in S, t \in T\}$) in $O(m \log n)$ time, where $|V| = n$ and $|E| = m$.</p>
 | graphs shortest path | 1 | Shortest paths among two subsets of nodes -- (graphs shortest path)
<p>Given a directed graph $G = (V, E)$ with all edge weights being non-negative and two disjoint subsets of nodes $S, T \subseteq V$, design an algorithm to find the shortest paths among $S$ and $T$, (formally, $\min\{d(s,t): s \in S, t \in T\}$) in $O... | habedi/stack-exchange-dataset |
76,294 | Does there exist a Turing-machine that runs in time $o(n\log n)$, but not $O(n)$? | <p>It is known that any (deterministic, single-taped) Turing-machine that runs in time $o(n\log n)$, decides a regular language (e.g., <a href="https://math.stackexchange.com/questions/84040/does-dtimeon-regular">see this link</a>). Thus, there exists an equivalent Turing-machine that runs in time $O(n)$. In other word... | complexity theory turing machines time complexity | 1 | Does there exist a Turing-machine that runs in time $o(n\log n)$, but not $O(n)$? -- (complexity theory turing machines time complexity)
<p>It is known that any (deterministic, single-taped) Turing-machine that runs in time $o(n\log n)$, decides a regular language (e.g., <a href="https://math.stackexchange.com/question... | habedi/stack-exchange-dataset |
76,297 | How to count the bits with a 1 bit error correction Hamming code? | <p>I've seen both ways of counting the bits when determining where to place the parity bits in a 1 bit error correction Hamming code. Some people count the bits starting from the left, others do it by starting from the right.</p>

<p>When to use one or the other? Does this depends on the Endian ordering?</p>&#x... | hamming code | 1 | How to count the bits with a 1 bit error correction Hamming code? -- (hamming code)
<p>I've seen both ways of counting the bits when determining where to place the parity bits in a 1 bit error correction Hamming code. Some people count the bits starting from the left, others do it by starting from the right.</p>
&#... | habedi/stack-exchange-dataset |
76,305 | Given a Noisy Curve, Write a Function to Output Likely Slopes | <p>I am training a Variational Autoencoder (type of convolutional neural network), and have been plotting cost over time. The result is a noisy curve, shown here:<a href="https://i.stack.imgur.com/L5ZN9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L5ZN9.png" alt="Cost over Time"></a></p>

... | optimization neural networks approximation randomness | 1 | Given a Noisy Curve, Write a Function to Output Likely Slopes -- (optimization neural networks approximation randomness)
<p>I am training a Variational Autoencoder (type of convolutional neural network), and have been plotting cost over time. The result is a noisy curve, shown here:<a href="https://i.stack.imgur.com/L5... | habedi/stack-exchange-dataset |
76,308 | Turing machine that increments a binary number by 1 | <p>I was asked to construct a Turning Machine that computes the increment of a binary string by 1- The Turing Machine receives a binary string and accept a string which is an increment by 1 of the input, written to the left of the head . I was given the fact that the head first reads the <strong>MSB</strong>.</p>
&... | computability turing machines | 1 | Turing machine that increments a binary number by 1 -- (computability turing machines)
<p>I was asked to construct a Turning Machine that computes the increment of a binary string by 1- The Turing Machine receives a binary string and accept a string which is an increment by 1 of the input, written to the left of the he... | habedi/stack-exchange-dataset |
76,310 | Context sensitive grammar for $\{a^{2^n}\mid n\geq 0\}$ | <p>I want to build a context sensitive grammar for the language $\{a^{2^n}\mid n\geq 0\}$. I think it should be something like this
\begin{align*} 
S &\to aA \mid a\\
aA&\to aaaA \mid aa
\end{align*}</p>
 | formal grammars context sensitive | 1 | Context sensitive grammar for $\{a^{2^n}\mid n\geq 0\}$ -- (formal grammars context sensitive)
<p>I want to build a context sensitive grammar for the language $\{a^{2^n}\mid n\geq 0\}$. I think it should be something like this
\begin{align*} 
S &\to aA \mid a\\
aA&\to aaaA \mid aa
\end{align*}<... | habedi/stack-exchange-dataset |
76,317 | What is the name the class of functions described by O(n log n)? | <p>In "Big O", common notations have common names (instead of saying, "Oh of some constant factor"):</p>

<p><strong>O(1)</strong> is "Constant"</p>

<p><strong>O(log n)</strong> is "Logarithmic"</p>

<p><strong>O(n)</strong> is "Linear"</p>

<p><strong>O(n^2)</strong> is "Quadratic"</p>... | terminology asymptotics | 1 | What is the name the class of functions described by O(n log n)? -- (terminology asymptotics)
<p>In "Big O", common notations have common names (instead of saying, "Oh of some constant factor"):</p>

<p><strong>O(1)</strong> is "Constant"</p>

<p><strong>O(log n)</strong> is "Logarithmic"</p>

<... | habedi/stack-exchange-dataset |
76,333 | Randomized algorithm for 2kCNF satisfiability problem | <blockquote>
 <p>The problem: Let a formula in $\varphi\in 2kCNF$ where there's an assignment $\alpha$ such that for every clause, $l$ in $\varphi$, $\alpha$ satisfies at least $k$ literals of $l$. Suggest a randomized algorithm for finding a satisfying assignment for such $\varphi$.</p>
</blockquote>

... | algorithms satisfiability randomized algorithms random walks | 1 | Randomized algorithm for 2kCNF satisfiability problem -- (algorithms satisfiability randomized algorithms random walks)
<blockquote>
 <p>The problem: Let a formula in $\varphi\in 2kCNF$ where there's an assignment $\alpha$ such that for every clause, $l$ in $\varphi$, $\alpha$ satisfies at least $k$ literals of $l... | habedi/stack-exchange-dataset |
76,334 | Relativized world where $LogCFL^A=PSPACE^A$ | <p>I wonder whether there is a known relativization barrier against proving $LogCFL\neq PSPACE$. Hence I'm looking for a language $A$ for which $LogCFL^A=PSPACE^A$.</p>

<p>One could try $A:=TQBF$, where $TQBF$ is the $PSPACE$-complete problem to decide <a href="http://en.wikipedia.org/wiki/True_quantified_Bool... | complexity theory relativization | 1 | Relativized world where $LogCFL^A=PSPACE^A$ -- (complexity theory relativization)
<p>I wonder whether there is a known relativization barrier against proving $LogCFL\neq PSPACE$. Hence I'm looking for a language $A$ for which $LogCFL^A=PSPACE^A$.</p>

<p>One could try $A:=TQBF$, where $TQBF$ is the $PSPACE$-com... | habedi/stack-exchange-dataset |
76,339 | Does KMP Algorithm handle finding multiple matches in overlapping cases? | <p>I am wondering if KMP algorithm can find multiple matches in a given string when there is an overlap.</p>

<p>Here is an example.</p>

<blockquote>
 <p>Word to Search from (S): <code>abcabcabc</code> <br />
 Search word (W): <code>abcabc</code></p>
</blockquote>

<p>If you look... | algorithms | 1 | Does KMP Algorithm handle finding multiple matches in overlapping cases? -- (algorithms)
<p>I am wondering if KMP algorithm can find multiple matches in a given string when there is an overlap.</p>

<p>Here is an example.</p>

<blockquote>
 <p>Word to Search from (S): <code>abcabcabc</code> <br />&... | habedi/stack-exchange-dataset |
76,352 | Human ranked/sorted items | <p>I'm trying to derive an algorithm or procedure I would use to have a human interactively rank a series of items based on importance by comparing a random-pairing of items at a time.</p>

<p>So, given an array of let's say 10 "things", I want to present two of the things, and have the user specify which is th... | algorithms sorting | 1 | Human ranked/sorted items -- (algorithms sorting)
<p>I'm trying to derive an algorithm or procedure I would use to have a human interactively rank a series of items based on importance by comparing a random-pairing of items at a time.</p>

<p>So, given an array of let's say 10 "things", I want to present two of... | habedi/stack-exchange-dataset |
76,355 | Construct a Turing Machine to increment any binary number | <p>Construct a Turing Machine 
to increment any binary number
. </p>

<p>(for 
example, if
the 
input
is
10010 then the output will be 10011 
and if the input 111 then the output will 
be 1000</p>
 | turing machines | 1 | Construct a Turing Machine to increment any binary number -- (turing machines)
<p>Construct a Turing Machine 
to increment any binary number
. </p>

<p>(for 
example, if
the 
input
is
10010 then the output will be 10011 
and if the input 111 then the output will 
be 1... | habedi/stack-exchange-dataset |
76,361 | Asymptotic relationship of logarithms in different bases | <p>I'm reading through the Khan Academy course on algorithms. I'm taking a quiz and finally got the right answer (all 3 of the options are true).</p>

<blockquote>
 <p>For the functions $\lg n$ and $\log_8 n$, what is the asymptotic relationship between these functions. Select all that apply.</p>
 &#... | asymptotics landau notation | 1 | Asymptotic relationship of logarithms in different bases -- (asymptotics landau notation)
<p>I'm reading through the Khan Academy course on algorithms. I'm taking a quiz and finally got the right answer (all 3 of the options are true).</p>

<blockquote>
 <p>For the functions $\lg n$ and $\log_8 n$, what is... | habedi/stack-exchange-dataset |
76,376 | Construct DFA’s Accept all strings containing “ 011 ” or “ 001 ” as a substring and should not contain “ 010 ” as substring | <p>My question is </p>

<p>Accept all strings containing “ 011 ” or “ 001 ” as a substring and should not contain “ 010 ” as substring</p>

<p>for the following languages over the alphabet {0,1}</p>

<p>i have solve it but , i have doubt if i can make the string contain 010 as substring goes... | finite automata | 1 | Construct DFA’s Accept all strings containing “ 011 ” or “ 001 ” as a substring and should not contain “ 010 ” as substring -- (finite automata)
<p>My question is </p>

<p>Accept all strings containing “ 011 ” or “ 001 ” as a substring and should not contain “ 010 ” as substring</p>

<p>for the follo... | habedi/stack-exchange-dataset |
76,382 | Computing exam averages in less than linear time | <p>This is the question:</p>

<p>A spreadsheet keeps track of student scores on all the exams in a course. Each row of the spreadsheet corresponds to one student, and each column in a row corresponds to his/her score on one of the exams. There are r students and c exams, so the spreadsheet has r rows and c co... | algorithms time complexity arithmetic | 1 | Computing exam averages in less than linear time -- (algorithms time complexity arithmetic)
<p>This is the question:</p>

<p>A spreadsheet keeps track of student scores on all the exams in a course. Each row of the spreadsheet corresponds to one student, and each column in a row corresponds to his/her score on... | habedi/stack-exchange-dataset |
76,385 | Designing CFG that accepts a^n b^m (n<m<2n) | <p>Designing CFG for the following language $\{a^nb^m \hspace{0.2cm} | \hspace{0.2cm} n\ge0, m\ge0, n\le m \le 2n \}$ is easy.</p>

<blockquote>
 <p>$S \to aSb \mid aSbb \mid \lambda$</p>
</blockquote>

<p>Then how about this? Language $\{a^nb^m \hspace{0.2cm} | \hspace{0.2cm} n\ge0, m\ge0, n&l... | formal languages automata | 1 | Designing CFG that accepts a^n b^m (n<m<2n) -- (formal languages automata)
<p>Designing CFG for the following language $\{a^nb^m \hspace{0.2cm} | \hspace{0.2cm} n\ge0, m\ge0, n\le m \le 2n \}$ is easy.</p>

<blockquote>
 <p>$S \to aSb \mid aSbb \mid \lambda$</p>
</blockquote>

<p>Then how about... | habedi/stack-exchange-dataset |
76,386 | Regular Language $a^n b^m c^k$ to Context free grammar | <p>I am trying to convert a regular language to a context free grammar. The language is $L=\{a^n b^m c^k |n=m\ or\ m\le k\}$, my solution is: assume $m,n,k\ge0$</p>

<p>$S\to AS|BS|\lambda$</p>

<p>$A\to aAb|Ac|ab$</p>

<p>$B\to Bc|Bbc|aB$</p>

<p>Is this correct? Can somebody explain w... | formal languages context free formal grammars | 1 | Regular Language $a^n b^m c^k$ to Context free grammar -- (formal languages context free formal grammars)
<p>I am trying to convert a regular language to a context free grammar. The language is $L=\{a^n b^m c^k |n=m\ or\ m\le k\}$, my solution is: assume $m,n,k\ge0$</p>

<p>$S\to AS|BS|\lambda$</p>

<p>... | habedi/stack-exchange-dataset |
76,387 | Understanding the binary and hexadecimal representations of UTF-8 | <p>Here is a code point: <code>U+091D</code>. The symbol it represents in UTF-8 is झ. In hex the symbol requires three bytes: <code>e0 a4 9d</code>. But it looks like the number <code>091D</code> requires two bytes. So why do we need three bytes to encode the symbol? Probably due to</p>

<blockquote>
 <p>t... | encoding scheme | 1 | Understanding the binary and hexadecimal representations of UTF-8 -- (encoding scheme)
<p>Here is a code point: <code>U+091D</code>. The symbol it represents in UTF-8 is झ. In hex the symbol requires three bytes: <code>e0 a4 9d</code>. But it looks like the number <code>091D</code> requires two bytes. So why do we need... | habedi/stack-exchange-dataset |
76,393 | TCP Connection Termination - FIN, FIN ACK, ACK | <p>I've been reading that to terminate a TCP connection 3 handshakes are required: FIN, FIN ACK, and ACK. However, when closing a connection, Wireshark displays FIN ACK, FIN ACK, ACK; it never displays FIN by itself.</p>

<p>However, when establishing a connection Wireshark clearly displays the three handshakes... | computer networks communication protocols | 1 | TCP Connection Termination - FIN, FIN ACK, ACK -- (computer networks communication protocols)
<p>I've been reading that to terminate a TCP connection 3 handshakes are required: FIN, FIN ACK, and ACK. However, when closing a connection, Wireshark displays FIN ACK, FIN ACK, ACK; it never displays FIN by itself.</p>
&... | habedi/stack-exchange-dataset |
76,402 | Cubical type theory for dummies? | <p>I read <a href="https://arxiv.org/abs/1611.02108" rel="noreferrer">one of those popular papers</a> on cubical type theory, but no wonder I could only see formulas and diagrams without being able to recognize them at all.</p>

<p>So here's what I want. I want a deep enough explanation of what composition, Kan... | type theory homotopy type theory | 1 | Cubical type theory for dummies? -- (type theory homotopy type theory)
<p>I read <a href="https://arxiv.org/abs/1611.02108" rel="noreferrer">one of those popular papers</a> on cubical type theory, but no wonder I could only see formulas and diagrams without being able to recognize them at all.</p>

<p>So here's... | habedi/stack-exchange-dataset |
76,407 | Product of the entries of the product of two matrices | <p>Let $A=(a_{ij})$ and $B=(b_{ij})$ be $n \times n$ integer matrices. Then $AB=(\Sigma_{k=1}^n a_{ik}b_{kj})_{ij}$. I am interested in finding the most efficient algorithm for computing the product of the entries of $AB$, </p>

<p>$\Pi_{i,j=1}^n (\Sigma_{k=1 }^n a_{ik}b_{kj}$).</p>

<p>Certainly, the m... | algorithms complexity theory time complexity | 1 | Product of the entries of the product of two matrices -- (algorithms complexity theory time complexity)
<p>Let $A=(a_{ij})$ and $B=(b_{ij})$ be $n \times n$ integer matrices. Then $AB=(\Sigma_{k=1}^n a_{ik}b_{kj})_{ij}$. I am interested in finding the most efficient algorithm for computing the product of the entries of... | habedi/stack-exchange-dataset |
76,409 | I don't know how to prove a simple theorem used with fixpoint in Coq | <p>I am a beginner in coq and want to prove the following theorem t1. First I used <code>induction i</code> and <code>destruct j</code>, but it got bogged down in the middle.
I would like some hints for this problem. </p>

<p>Function f takes two arguments of nat and returns Prop (e.g., f 2 4 = x 2 ∧ x 3 ∧ ... | coq | 1 | I don't know how to prove a simple theorem used with fixpoint in Coq -- (coq)
<p>I am a beginner in coq and want to prove the following theorem t1. First I used <code>induction i</code> and <code>destruct j</code>, but it got bogged down in the middle.
I would like some hints for this problem. </p>

<p>Func... | habedi/stack-exchange-dataset |
76,418 | Prove that the language { uw : |u| =2 |w| } is regular | <p>I have a problem with this following question:</p>

<blockquote>
 <p>Prove that the language $\{uw : |u|=2|w|\}$ is regular. </p>
</blockquote>

<p>I tried to give this regular expression $(uw²)^*$ to resolve it.</p>
 | formal languages regular languages regular expressions | 1 | Prove that the language { uw : |u| =2 |w| } is regular -- (formal languages regular languages regular expressions)
<p>I have a problem with this following question:</p>

<blockquote>
 <p>Prove that the language $\{uw : |u|=2|w|\}$ is regular. </p>
</blockquote>

<p>I tried to give this regular ... | habedi/stack-exchange-dataset |
76,427 | Algorithm to find the median with a complexity of nlog(n) | <p>Does it exist an algorithm to find a median of table with a complexity nlog(n) 
Thank</p>
 | algorithms | 1 | Algorithm to find the median with a complexity of nlog(n) -- (algorithms)
<p>Does it exist an algorithm to find a median of table with a complexity nlog(n) 
Thank</p>
 | habedi/stack-exchange-dataset |
76,430 | What is "strobe"? | <p>For advancing the</p>

<p>address input of the RAM, we provide the</p>

<p>signal “strobe”.</p>

<p>Can anyone explain this in a bit more detail?
Thanks.</p>
 | cpu | 1 | What is "strobe"? -- (cpu)
<p>For advancing the</p>

<p>address input of the RAM, we provide the</p>

<p>signal “strobe”.</p>

<p>Can anyone explain this in a bit more detail?
Thanks.</p>
 | habedi/stack-exchange-dataset |
76,445 | Maximize pairings subject to distance constraint | <p>I have a list of people's locations on a world map and want to pair nearby people up such that the number of pairs is maximized. </p>

<p>For example, subject to the constraint that paired people are within d=10 miles of each other, I might find 742 pairs from a list of n=3000 people's locations. </p>
&#... | algorithms graphs optimization approximation linear programming | 1 | Maximize pairings subject to distance constraint -- (algorithms graphs optimization approximation linear programming)
<p>I have a list of people's locations on a world map and want to pair nearby people up such that the number of pairs is maximized. </p>

<p>For example, subject to the constraint that paired pe... | habedi/stack-exchange-dataset |
76,451 | Is it true that PAC is a subset of agnostic PAC? | <p>I would like to see the proof or a refernce to it. I feel it is obvious but my tutor insists the other way (agnostic PAC is a subset of PAC, and there are problems in PAC that are not angostic PAC).</p>
 | machine learning learning theory | 1 | Is it true that PAC is a subset of agnostic PAC? -- (machine learning learning theory)
<p>I would like to see the proof or a refernce to it. I feel it is obvious but my tutor insists the other way (agnostic PAC is a subset of PAC, and there are problems in PAC that are not angostic PAC).</p>
 | habedi/stack-exchange-dataset |
76,453 | Who was the first to define the RAM model? | <p>I am working on a project where I refer to the RAM model, I explain what it is, but I am not sure who defined it first.</p>

<p><a href="https://en.wikipedia.org/wiki/Random-access_machine" rel="nofollow noreferrer">The wikipedia article</a> is not very explicit about it, and the first citation is from 1946.... | computation models | 1 | Who was the first to define the RAM model? -- (computation models)
<p>I am working on a project where I refer to the RAM model, I explain what it is, but I am not sure who defined it first.</p>

<p><a href="https://en.wikipedia.org/wiki/Random-access_machine" rel="nofollow noreferrer">The wikipedia article</a> ... | habedi/stack-exchange-dataset |
76,455 | Prove that $L=\{x\mid K(x) \leq |x|-c\}$ is recognizable, where $x \in \{0,1\}^*$ | <p>Basically I want to prove that the set of all c-compressible binary strings is recognizable.</p>

<p>My goal is to construct a turing machine $N$ such that, given an input string $x$, $N$ accepts $x$ if there exist a turing machine $M$ and a string $s$ such that $M(s) = x$, and $|\langle M \rangle|+|s| \leq ... | complexity theory computability | 1 | Prove that $L=\{x\mid K(x) \leq |x|-c\}$ is recognizable, where $x \in \{0,1\}^*$ -- (complexity theory computability)
<p>Basically I want to prove that the set of all c-compressible binary strings is recognizable.</p>

<p>My goal is to construct a turing machine $N$ such that, given an input string $x$, $N$ ac... | habedi/stack-exchange-dataset |
76,460 | hamming distance of bloom filters | <p>In the introduction of <a href="https://www.eecs.harvard.edu/~michaelm/postscripts/alenex2006.pdf" rel="nofollow noreferrer">Distance-Sensitive Bloom Filters</a> the authors state:</p>

<blockquote>
 <p>The relative Hamming distance between two Bloom filters (of the same size, and created with the same ... | edit distance bloom filters | 1 | hamming distance of bloom filters -- (edit distance bloom filters)
<p>In the introduction of <a href="https://www.eecs.harvard.edu/~michaelm/postscripts/alenex2006.pdf" rel="nofollow noreferrer">Distance-Sensitive Bloom Filters</a> the authors state:</p>

<blockquote>
 <p>The relative Hamming distance betw... | habedi/stack-exchange-dataset |
76,466 | Eliminating cycles from a grammar | <p>I have the following grammar:</p>

<pre><code>S -> Xb | Y

Y -> X | a

X -> S | c
</code></pre>

<p>Here the lowercase letters are terminals.</p>

<p>I have an algorithm to find the cycle in this grammar. It is <code>S->Y->X->S</code> and in fact there is... | formal grammars compilers parsers | 1 | Eliminating cycles from a grammar -- (formal grammars compilers parsers)
<p>I have the following grammar:</p>

<pre><code>S -> Xb | Y

Y -> X | a

X -> S | c
</code></pre>

<p>Here the lowercase letters are terminals.</p>

<p>I have an algorithm to find the cycle in ... | habedi/stack-exchange-dataset |
76,467 | Can I prove that $\sqrt n\log{\sqrt n}=\Theta(n)$? | <p>I'd like to prove that $\sqrt n\log{\sqrt n}=\Theta(n)$ but I'm not sure how to do it.</p>

<p>This is my attempt:
$$
\lim_{n \to \infty}\frac{\log{\sqrt n}}{\sqrt n}=0 \Rightarrow \log{\sqrt n}=o(\sqrt n) \text{(Little o)}
$$</p>

<p>Therefore:
$$
\sqrt n\log{\sqrt n}=o(\sqrt n\... | asymptotics | 1 | Can I prove that $\sqrt n\log{\sqrt n}=\Theta(n)$? -- (asymptotics)
<p>I'd like to prove that $\sqrt n\log{\sqrt n}=\Theta(n)$ but I'm not sure how to do it.</p>

<p>This is my attempt:
$$
\lim_{n \to \infty}\frac{\log{\sqrt n}}{\sqrt n}=0 \Rightarrow \log{\sqrt n}=o(\sqrt n) \text{(Little o)}
$$</... | habedi/stack-exchange-dataset |
76,474 | How to check if two strings are permutations of each other using O(1) additional space? | <p>Given two strings how can you check if they are a permutation of each other using O(1) space? Modifying the strings is not allowed in any way.<br>
Note: O(1) space in relation to both the string length AND the size of the alphabet.</p>
 | algorithms strings space complexity | 1 | How to check if two strings are permutations of each other using O(1) additional space? -- (algorithms strings space complexity)
<p>Given two strings how can you check if they are a permutation of each other using O(1) space? Modifying the strings is not allowed in any way.<br>
Note: O(1) space in relation to both ... | habedi/stack-exchange-dataset |
76,505 | What should be the way to design code for such a situation? | <p>I have a graph as given below:
<a href="https://i.stack.imgur.com/ZHRTY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZHRTY.jpg" alt="enter image description here"></a></p>

<p>Let us assume one node as transmitter and another as receiver. </p>

<ol>
<li>We need to transf... | discrete mathematics information theory coding theory encoding scheme | 1 | What should be the way to design code for such a situation? -- (discrete mathematics information theory coding theory encoding scheme)
<p>I have a graph as given below:
<a href="https://i.stack.imgur.com/ZHRTY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZHRTY.jpg" alt="enter image description... | habedi/stack-exchange-dataset |
76,509 | Finding N most distinct values in set given distance metric | <p>Let's say you are given a set with $V$ vectors and you are given a simple Euclidean distance metric $d(a,b)$ for $a, b \in V$. Then what would be the most efficient algorithm to build a subset $S$ of a desired size $k$ such that the sum of the distances between the elements of the subset is maximized?</p>

<... | graphs | 1 | Finding N most distinct values in set given distance metric -- (graphs)
<p>Let's say you are given a set with $V$ vectors and you are given a simple Euclidean distance metric $d(a,b)$ for $a, b \in V$. Then what would be the most efficient algorithm to build a subset $S$ of a desired size $k$ such that the sum of the d... | habedi/stack-exchange-dataset |
76,510 | Dynamic programming, coming up with an algorithm | <p>I've been banging my head against the wall for the past two days and can't seem to come up with anything useful. The problem that needs to be solved is the following: I get an array of integers and I must return an array containing the elements that would give the maximum sum with the following condition: If I selec... | algorithms optimization dynamic programming | 1 | Dynamic programming, coming up with an algorithm -- (algorithms optimization dynamic programming)
<p>I've been banging my head against the wall for the past two days and can't seem to come up with anything useful. The problem that needs to be solved is the following: I get an array of integers and I must return an arra... | habedi/stack-exchange-dataset |
76,522 | Retrieve shortest path between two nodes using Bellman-Ford-Moore algorithm sequentially | <p>This is my first question here and I hope you can help mt clarifying a doubt.<br>
Basically, I'm studying shortest path algorithms, for instance Dijkstra, Bellman-Ford-Moore, and I came up with a doubt.<br>
From what I understood, given a node of a graph, these algorithms calculate all the shortest paths to ... | algorithms graphs shortest path | 1 | Retrieve shortest path between two nodes using Bellman-Ford-Moore algorithm sequentially -- (algorithms graphs shortest path)
<p>This is my first question here and I hope you can help mt clarifying a doubt.<br>
Basically, I'm studying shortest path algorithms, for instance Dijkstra, Bellman-Ford-Moore, and I came u... | habedi/stack-exchange-dataset |
76,527 | Find sum of values of points in 2D plane | <p>Given $N$ points in 2D plane, and each point has some value. Have to answer $Q$ queries of the form:</p>

<p>Given $x_1, x_2, y_1, y_2$, find sum of values of all points $(x,y)$ such that $x_1 \le x \le x_2$ and $y_1 \le y \le y_2$. $N$ and $Q$ are $\le 10^6$. Also it will be helpful if someone can provide i... | data structures | 1 | Find sum of values of points in 2D plane -- (data structures)
<p>Given $N$ points in 2D plane, and each point has some value. Have to answer $Q$ queries of the form:</p>

<p>Given $x_1, x_2, y_1, y_2$, find sum of values of all points $(x,y)$ such that $x_1 \le x \le x_2$ and $y_1 \le y \le y_2$. $N$ and $Q$ ar... | habedi/stack-exchange-dataset |
76,544 | Is following SAT case in $\mathsf{P}$? | <pre><code>f[1](2, 3, 20) : 10011010
f[2](4, 20, 21) : 10101001
f[3](4, 20, 22) : 10010110
f[4](2, 4, 23) : 10011010
f[5](5, 23, 24) : 10101001
f[6](5, 21, 23) : 01101001
f[7](2, 5, 26) : 10011010
f[8](2, 3, 33) : 10101001
f[9](3, 22, 33) : 10000110
f[10](3, 21, 40) : 10100110
f[... | complexity theory satisfiability 3 sat | 1 | Is following SAT case in $\mathsf{P}$? -- (complexity theory satisfiability 3 sat)
<pre><code>f[1](2, 3, 20) : 10011010
f[2](4, 20, 21) : 10101001
f[3](4, 20, 22) : 10010110
f[4](2, 4, 23) : 10011010
f[5](5, 23, 24) : 10101001
f[6](5, 21, 23) : 01101001
f[7](2, 5, 26) : 10011010
f[8](2, 3, 3... | habedi/stack-exchange-dataset |
76,549 | Converting if-then-else condition to integer linear programming with equality constraints | <p>I have an if-then-else condition with three binary variables $A$, $B$ and $C$:</p>

<pre><code>if A = 1
 then B = 1
else 
 B = C
</code></pre>

<p>How do I express this as an integer linear program with equality constraints?</p>
 | linear programming integer programming | 1 | Converting if-then-else condition to integer linear programming with equality constraints -- (linear programming integer programming)
<p>I have an if-then-else condition with three binary variables $A$, $B$ and $C$:</p>

<pre><code>if A = 1
 then B = 1
else 
 B = C
</code></pre... | habedi/stack-exchange-dataset |
76,578 | Finding shortest paths in undirected graphs with possibly negative edge weights | <p>The book <a href="https://books.google.com/books?id=idUdqdDXqnAC&pg=PA684&lpg=PA684&dq=edge+weights+negative+efficient+available+bellman+ford+sedgewick&source=bl&ots=ZZC4X7eemO&sig=8coCNFAZMRB6f2su6vyp_6ia2Ms&hl=en&sa=X&ved=0ahUKEwiR77Ox8LDUAhVB6WMKHUQFBJEQ6AEIQjAF#v=onepage&q... | algorithms graphs reference request shortest path weighted graphs | 1 | Finding shortest paths in undirected graphs with possibly negative edge weights -- (algorithms graphs reference request shortest path weighted graphs)
<p>The book <a href="https://books.google.com/books?id=idUdqdDXqnAC&pg=PA684&lpg=PA684&dq=edge+weights+negative+efficient+available+bellman+ford+sedgewick&am... | habedi/stack-exchange-dataset |
76,579 | Proof that TAUT is coNP-complete (or that a problem is coNP-complete if its complement is NP-complete) | <p>I need to prove that TAUT is coNP-complete. I showed that $\text{TAUT} \in \text{coNP}$ by reducing $\text{SAT}$ to $\overline{\text{TAUT}}$. However, I cannot figure out how to prove that every problem in coNP can be reduced to $\text{TAUT}$ in polynomial time. To do that, I would need one of two things:</p>
&#... | complexity theory np complete proof techniques co np | 1 | Proof that TAUT is coNP-complete (or that a problem is coNP-complete if its complement is NP-complete) -- (complexity theory np complete proof techniques co np)
<p>I need to prove that TAUT is coNP-complete. I showed that $\text{TAUT} \in \text{coNP}$ by reducing $\text{SAT}$ to $\overline{\text{TAUT}}$. However, I can... | habedi/stack-exchange-dataset |
76,580 | Highest possible value of combinations of 5 | <p>According to <a href="https://www.heroescounters.com/teampicker" rel="nofollow noreferrer">https://www.heroescounters.com/teampicker</a> a Hero has a synergy value with another hero, Heroes of the Storm have 60+ heroes each one with a synergy value for example:</p>

<pre><code>HeroID Synergy.With.HeroID ... | algorithms | 1 | Highest possible value of combinations of 5 -- (algorithms)
<p>According to <a href="https://www.heroescounters.com/teampicker" rel="nofollow noreferrer">https://www.heroescounters.com/teampicker</a> a Hero has a synergy value with another hero, Heroes of the Storm have 60+ heroes each one with a synergy value for exam... | habedi/stack-exchange-dataset |
76,605 | Meaning of Merge[A[1,..n], m] | <p>I was reading JeffE's (Prof. Jeffrey Erickson) notes on solving recurrences, and he used Merge[A[1,...n], m] where A is an array(I think) and m is an integer. What does this mean? I thought Merge sort took two arrays as input. He includes psuedo code, but I can't decipher what is means. What is it doing?</p>
&#x... | algorithms | 1 | Meaning of Merge[A[1,..n], m] -- (algorithms)
<p>I was reading JeffE's (Prof. Jeffrey Erickson) notes on solving recurrences, and he used Merge[A[1,...n], m] where A is an array(I think) and m is an integer. What does this mean? I thought Merge sort took two arrays as input. He includes psuedo code, but I can't deciphe... | habedi/stack-exchange-dataset |
76,613 | Prove "almost clique" is NP complete | <p>Given $G=(V,E)$, undirected graph, a group of vertices $S$ is called <strong>almost clique</strong> if by adding a single edge, $S$ becomes a clique.</p>

<p>Consider the language:
$L=\{\langle G,t\rangle \mid \text{the graph \(G\) contains a \(t\)-sized almost-clique}\}$.
Prove that $L$ is NP-comple... | np complete reductions np 3 sat clique | 1 | Prove "almost clique" is NP complete -- (np complete reductions np 3 sat clique)
<p>Given $G=(V,E)$, undirected graph, a group of vertices $S$ is called <strong>almost clique</strong> if by adding a single edge, $S$ becomes a clique.</p>

<p>Consider the language:
$L=\{\langle G,t\rangle \mid \text{the grap... | habedi/stack-exchange-dataset |
76,616 | Algorithm for deciding alpha-equivalence of terms in languages with bindings | <p>I am interested in the alpha equivalence relation in languages with variable bindings, such as:</p>

<pre><code>t := x:y 'x belong to y'
 | bot 'False'
 | t -> t 'implication'
 | Ax.t 'forall x, t'
</code></pre>

<p>Or the pure lambda calculus:</p>

<pre><code... | logic lambda calculus first order logic | 1 | Algorithm for deciding alpha-equivalence of terms in languages with bindings -- (logic lambda calculus first order logic)
<p>I am interested in the alpha equivalence relation in languages with variable bindings, such as:</p>

<pre><code>t := x:y 'x belong to y'
 | bot 'False'
 | t -> t 'imp... | habedi/stack-exchange-dataset |
76,623 | Fastest way to solve a system of linear equations | <p>I have to solve a system of up to 10000 equations with 10000 unknowns as fast as possible (preferably within a few seconds). I know that Gaussian elimination is too slow for that, so what algorithm is suitable for this task?</p>

<p>All coefficients and constants are non-negative integers modulo p (where p i... | algorithms linear algebra matrices numerical algorithms | 1 | Fastest way to solve a system of linear equations -- (algorithms linear algebra matrices numerical algorithms)
<p>I have to solve a system of up to 10000 equations with 10000 unknowns as fast as possible (preferably within a few seconds). I know that Gaussian elimination is too slow for that, so what algorithm is suita... | habedi/stack-exchange-dataset |
76,628 | How to write an algorithm which doubles stack in order to accommodate for new members where push is in constant time in the worst case? | <blockquote>
<p>We're given the algorithm which uses stack in order to store data (stack is implemented via an array). When the stack is full the algorithm does the following:</p>
<ol>
<li>Creates a new array double the size of the original one.</li>
<li>Copies all elements of the old array to the new a... | algorithms time complexity stacks | 1 | How to write an algorithm which doubles stack in order to accommodate for new members where push is in constant time in the worst case? -- (algorithms time complexity stacks)
<blockquote>
<p>We're given the algorithm which uses stack in order to store data (stack is implemented via an array). When the stack is full... | habedi/stack-exchange-dataset |
76,647 | What is meant by the term "prior" in machine learning | <p>I am new to machine learning. I have read several papers where they have employed deep learning for various applications and have used the term "prior" in most of the model design cases, say prior in human body pose estimation. Can someone explain what does it actually means. I could only find the mathematical formu... | terminology machine learning pattern recognition bayesian statistics | 1 | What is meant by the term "prior" in machine learning -- (terminology machine learning pattern recognition bayesian statistics)
<p>I am new to machine learning. I have read several papers where they have employed deep learning for various applications and have used the term "prior" in most of the model design cases, sa... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.