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 |
|---|---|---|---|---|---|---|
30,088 | Betweenness Centrality measurement in Undirected Graphs | <p>I'm working with graphs of a very large size (> 60k vertices), and want to speed up B.C. measurements. It is defined here: <a href="http://en.wikipedia.org/wiki/Betweenness_centrality" rel="nofollow">http://en.wikipedia.org/wiki/Betweenness_centrality</a> The algorithm that I am using to compute B.C. is Brandes' alg... | graphs | 1 | Betweenness Centrality measurement in Undirected Graphs -- (graphs)
<p>I'm working with graphs of a very large size (> 60k vertices), and want to speed up B.C. measurements. It is defined here: <a href="http://en.wikipedia.org/wiki/Betweenness_centrality" rel="nofollow">http://en.wikipedia.org/wiki/Betweenness_centrali... | habedi/stack-exchange-dataset |
30,101 | Data structure for counting bits set on a table | <p>I have a table that contains only bits. I would like to be able to do the following two queries:</p>

<ul>
<li>SET any bit to 0 or 1;</li>
<li>GET the number of bits that are set to 1 from the beginning of the table up to a specifique index i.</li>
</ul>

<p>Is there a data structure that... | algorithms data structures trees | 1 | Data structure for counting bits set on a table -- (algorithms data structures trees)
<p>I have a table that contains only bits. I would like to be able to do the following two queries:</p>

<ul>
<li>SET any bit to 0 or 1;</li>
<li>GET the number of bits that are set to 1 from the beginning of the table... | habedi/stack-exchange-dataset |
30,103 | Count points enclosed by several planes in 3D space | <p>I have for example 10 planes with their equation: Ax + By + Cz = D and a list of 3D points.
Those plane can make regions, some of them closed, and others not, the task is to count the number of points in each region.</p>

<p>I just need some ideas about how to solve, or if there is an algorithm for that.... | algorithms computational geometry | 1 | Count points enclosed by several planes in 3D space -- (algorithms computational geometry)
<p>I have for example 10 planes with their equation: Ax + By + Cz = D and a list of 3D points.
Those plane can make regions, some of them closed, and others not, the task is to count the number of points in each region.</p>&#... | habedi/stack-exchange-dataset |
30,106 | Finding an exactly weighted st-path in a digraph | <p>I have a weighted digraph graph $G = (V,E)$ where the weights are positive and negative integers. The graph $G$ is not necessarily acyclic.</p>

<p>The question is: given 2 nodes $v_1$ and $v_2$, is there a path from $v_1$ to $v_2$ with a weight $w$. </p>

<p>I would like to know if there are any kno... | complexity theory graphs decision problem | 1 | Finding an exactly weighted st-path in a digraph -- (complexity theory graphs decision problem)
<p>I have a weighted digraph graph $G = (V,E)$ where the weights are positive and negative integers. The graph $G$ is not necessarily acyclic.</p>

<p>The question is: given 2 nodes $v_1$ and $v_2$, is there a path f... | habedi/stack-exchange-dataset |
30,108 | Does register renaming remove all kinds of WAR hazard? | <p>For the following two instruction</p>

<pre><code>[Note: MOV Destination, Source ]

i1 : MOV R1, R2
i2 : ADD R2, R3
</code></pre>

<p>Since i1 is reading from R2 and i2 is writing to R2 there is a WAR data dependency and by register renaming like below we can remove this hazard</p>&#x... | computer architecture cpu pipelines | 1 | Does register renaming remove all kinds of WAR hazard? -- (computer architecture cpu pipelines)
<p>For the following two instruction</p>

<pre><code>[Note: MOV Destination, Source ]

i1 : MOV R1, R2
i2 : ADD R2, R3
</code></pre>

<p>Since i1 is reading from R2 and i2 is writing to R2 the... | habedi/stack-exchange-dataset |
30,112 | What does sublinear space mean for Turing machines? | <p>The problem of deciding whether an input is a palindrome or not has been proved to require $\Omega(\log n)$ space on a Turing machine. However, even storing the input takes space $n$ so doesn't that mean that all Turing machines require space $\Omega(n)$?</p>

<p>Of course, there's no contradiction here... | turing machines space complexity | 1 | What does sublinear space mean for Turing machines? -- (turing machines space complexity)
<p>The problem of deciding whether an input is a palindrome or not has been proved to require $\Omega(\log n)$ space on a Turing machine. However, even storing the input takes space $n$ so doesn't that mean that all Turing ma... | habedi/stack-exchange-dataset |
30,115 | Determining set of states that satisfy a CTL formulae | <p>I'm trying to understand CTL formulae, and until now I've understood everything (or at least I thought I did). I have the following Kripke strucure:</p>

<p><img src="https://i.stack.imgur.com/gfo56.png" alt="Kripke structure"></p>

<p>Now given the following CTL formulae <code>A(g U EG (b v y))</cod... | model checking software verification computation tree logic temporal logic | 1 | Determining set of states that satisfy a CTL formulae -- (model checking software verification computation tree logic temporal logic)
<p>I'm trying to understand CTL formulae, and until now I've understood everything (or at least I thought I did). I have the following Kripke strucure:</p>

<p><img src="https://... | habedi/stack-exchange-dataset |
30,120 | How can I simplify the following Product of Sums: ab+ac'+a'b'+a'c+b'c'+bc? | <p>I started with POS: (a+b+c)(a+b'+c)(a'+b+c)(a'+b+c')</p>

<p>and after a long while, I got: ab+ac'+a'b'+a'c+b'c'+bc</p>

<p>and then I'm not sure how to simplify this. I thought maybe I can cancel the ab with a'b', and b'c' with bc and end with ac'+a'c but it doesn't seem to be right if I look at the... | logic | 1 | How can I simplify the following Product of Sums: ab+ac'+a'b'+a'c+b'c'+bc? -- (logic)
<p>I started with POS: (a+b+c)(a+b'+c)(a'+b+c)(a'+b+c')</p>

<p>and after a long while, I got: ab+ac'+a'b'+a'c+b'c'+bc</p>

<p>and then I'm not sure how to simplify this. I thought maybe I can cancel the ab with a'b', ... | habedi/stack-exchange-dataset |
30,132 | Is finding if a graph has k isolated nodes a NP-Complete problem? | <p>I was wondering if finding if a graph has k or more isolated nodes is a NP-Complete problem. I found the following problem:</p>

<blockquote>
 <p>Prove that the following problem is NP-Complete. Given a set of T
 transactions: $T = \{t_1,t_2,\dots,t_m\}$ where each transaction $t_i$ is a
 pair... | complexity theory graphs np complete | 1 | Is finding if a graph has k isolated nodes a NP-Complete problem? -- (complexity theory graphs np complete)
<p>I was wondering if finding if a graph has k or more isolated nodes is a NP-Complete problem. I found the following problem:</p>

<blockquote>
 <p>Prove that the following problem is NP-Complete. G... | habedi/stack-exchange-dataset |
30,143 | Are regex crosswords NP-hard? | <p>I was fooling around the other day on this website: <a href="http://regexcrossword.com/">http://regexcrossword.com/</a> and it got me wondering what the best way to solve it was.</p>

<p>Can you solve the following problem in polynomial time or is it NP-hard?</p>

<blockquote>
 <p>Given an NxM g... | complexity theory np hard regular expressions | 1 | Are regex crosswords NP-hard? -- (complexity theory np hard regular expressions)
<p>I was fooling around the other day on this website: <a href="http://regexcrossword.com/">http://regexcrossword.com/</a> and it got me wondering what the best way to solve it was.</p>

<p>Can you solve the following problem in po... | habedi/stack-exchange-dataset |
30,155 | Mutual information intuition | <p>I was creating an example for a casual talk on mutual information. I considered a system of two coins, which with probability 1/2 are copies of each other, and with probability 1/2 are independent.</p>

<p>Then $P(A=B)=1/2+1/2\times 1/2=3/4$, so $P(HH)=P(TT)=3/8$ and $P(HT)=P(TH)=1/8$.</p>

<p>Total ... | probability theory information theory entropy | 1 | Mutual information intuition -- (probability theory information theory entropy)
<p>I was creating an example for a casual talk on mutual information. I considered a system of two coins, which with probability 1/2 are copies of each other, and with probability 1/2 are independent.</p>

<p>Then $P(A=B)=1/2+1/2\ti... | habedi/stack-exchange-dataset |
30,160 | Algorithms which are both deterministic and non-deterministic | <p>I'm just starting my second year in computer science and one of my classes briefly touched upon deterministic vs. non-deterministic algorithms. This got me thinking - is there any use for algorithms which return deterministic output for certain inputs, but non-deterministic output for other inputs? Say, something al... | algorithms terminology nondeterminism | 1 | Algorithms which are both deterministic and non-deterministic -- (algorithms terminology nondeterminism)
<p>I'm just starting my second year in computer science and one of my classes briefly touched upon deterministic vs. non-deterministic algorithms. This got me thinking - is there any use for algorithms which return ... | habedi/stack-exchange-dataset |
30,162 | Is an algorithm in pseudocode a reasonable way to establish complexity? | <p>We define the language</p>

<p>$$
L = \{a^nb^n : n\geq0 \}
$$</p>

<p>and we want to prove the following</p>

<p>$$
L = \mathrm{DSPACE}(\log n)\,.
$$</p>

<p>So we have to prove that by using $\log n$ space on the work tape of a Turing machine we can decide this langu... | complexity theory proof techniques | 1 | Is an algorithm in pseudocode a reasonable way to establish complexity? -- (complexity theory proof techniques)
<p>We define the language</p>

<p>$$
L = \{a^nb^n : n\geq0 \}
$$</p>

<p>and we want to prove the following</p>

<p>$$
L = \mathrm{DSPACE}(\log n)\,.
$$</p>

<... | habedi/stack-exchange-dataset |
30,165 | Converting truth table to algebraic normal form | <blockquote>
 <p>Is there any <em>efficient</em> algorithm to convert a given <a href="http://en.wikipedia.org/wiki/Truth_table" rel="nofollow noreferrer">truth table</a> of a Boolean function to its equivalent <a href="http://en.wikipedia.org/wiki/Algebraic_normal_form" rel="nofollow noreferrer">algebraic normal ... | algorithms boolean algebra | 1 | Converting truth table to algebraic normal form -- (algorithms boolean algebra)
<blockquote>
 <p>Is there any <em>efficient</em> algorithm to convert a given <a href="http://en.wikipedia.org/wiki/Truth_table" rel="nofollow noreferrer">truth table</a> of a Boolean function to its equivalent <a href="http://en.wikip... | habedi/stack-exchange-dataset |
30,166 | Is There a Complete Problem for the Class of Turing Decidable Problems? | <p>Languages such as $\text{HALT}_{TM}$ are $\textsf{RE-complete}$ under many-one reductions. It is trivial to see that $\text{co-RE}$ has complete problems, too. S. Schmitz <a href="http://arxiv.org/abs/1312.5686" rel="nofollow">[1]</a> considers some classes inbetween $\text{ELEM}$ and $\text{REC}$. They present com... | computability reductions turing completeness recursion theory | 1 | Is There a Complete Problem for the Class of Turing Decidable Problems? -- (computability reductions turing completeness recursion theory)
<p>Languages such as $\text{HALT}_{TM}$ are $\textsf{RE-complete}$ under many-one reductions. It is trivial to see that $\text{co-RE}$ has complete problems, too. S. Schmitz <a hre... | habedi/stack-exchange-dataset |
30,175 | Etymology of time and space "complexity" | <p>The word choice of "complexity" in analysis of algorithms to describe <a href="http://en.wikipedia.org/wiki/Time_complexity">temporal</a> and <a href="http://en.wikipedia.org/wiki/DSPACE">spatial</a> resource requirements has always struct me as an odd one. These are certainly useful and meaningful concepts. This qu... | terminology algorithm analysis history | 1 | Etymology of time and space "complexity" -- (terminology algorithm analysis history)
<p>The word choice of "complexity" in analysis of algorithms to describe <a href="http://en.wikipedia.org/wiki/Time_complexity">temporal</a> and <a href="http://en.wikipedia.org/wiki/DSPACE">spatial</a> resource requirements has always... | habedi/stack-exchange-dataset |
30,176 | Finding vertices for which there either exists a path to all other vertices or other vertices have a path to them | <p>Or in other words, find all $v \in V$ such that there exists a path $\forall w \in V$ $v \rightarrow w$ or $w \rightarrow v$. This is for a directed acyclic graph. I need to find an $O(|E| + |V|)$ algorithm for this.</p>

<p>I can see how to identify if a given vertex meets these traits (perform a BFS start... | algorithms graphs | 1 | Finding vertices for which there either exists a path to all other vertices or other vertices have a path to them -- (algorithms graphs)
<p>Or in other words, find all $v \in V$ such that there exists a path $\forall w \in V$ $v \rightarrow w$ or $w \rightarrow v$. This is for a directed acyclic graph. I need to find ... | habedi/stack-exchange-dataset |
30,185 | Maximum value a variable can hold without documentation | <p>Suppose we work with some particular programming language (like C++) on some particular computer. Furthermore, we want to know which values are minimum and maximum for some particular numeric data type of this language. We can't use any specific tools of our language (like <a href="http://en.cppreference.com/w/cpp/t... | algorithm analysis formal methods | 1 | Maximum value a variable can hold without documentation -- (algorithm analysis formal methods)
<p>Suppose we work with some particular programming language (like C++) on some particular computer. Furthermore, we want to know which values are minimum and maximum for some particular numeric data type of this language. We... | habedi/stack-exchange-dataset |
30,186 | Is the "data path cycle" the same thing of the "fetch-decode-execute cycle"? | <p>I am reading the book <code>Structured Computer Organization</code> (5th edition) by <em>Tanenbaum</em> and at a certain point, in the second chapter, he talks about <code>data path cycle</code> and <code>fetch-decode-execute cycle</code>, and I am not understanding if they are really the same thing.</p>

<p... | computer architecture | 1 | Is the "data path cycle" the same thing of the "fetch-decode-execute cycle"? -- (computer architecture)
<p>I am reading the book <code>Structured Computer Organization</code> (5th edition) by <em>Tanenbaum</em> and at a certain point, in the second chapter, he talks about <code>data path cycle</code> and <code>fetch-de... | habedi/stack-exchange-dataset |
30,190 | How to prove strict space lower bounds using crossing sequences in Turing machines? | <p>I understand the notion of crossing sequences when talking about time, however how are they used to actually prove strict lower bounds for some decision/search problems?</p>

<p>For example, suppose that you have an array of size N and you want to find the maximum number in it.</p>

<p>Speaking infor... | turing machines proof techniques space complexity | 1 | How to prove strict space lower bounds using crossing sequences in Turing machines? -- (turing machines proof techniques space complexity)
<p>I understand the notion of crossing sequences when talking about time, however how are they used to actually prove strict lower bounds for some decision/search problems?</p>
... | habedi/stack-exchange-dataset |
30,197 | How does the Vertex Cover algorithm by Chen et al find its tuples? | <p>I'm <a href="https://cs.stackexchange.com/questions/30060/implementing-general-vertex-folding-procedure-in-an-undirected-graph">still</a> fighting with the aforementioned paper "Improved upper bounds for vertex cover" by Chen, Kanj, Xia (<a href="http://www.cs.lafayette.edu/~gexia/research/mfcs06.pdf" rel="nofollow ... | algorithms graphs np complete parameterized complexity branch and bound | 1 | How does the Vertex Cover algorithm by Chen et al find its tuples? -- (algorithms graphs np complete parameterized complexity branch and bound)
<p>I'm <a href="https://cs.stackexchange.com/questions/30060/implementing-general-vertex-folding-procedure-in-an-undirected-graph">still</a> fighting with the aforementioned pa... | habedi/stack-exchange-dataset |
30,205 | Are there more partially recursive functions than and recursive functions? | <p>Is the cardinality of the set of partially recursive functions greater than the cardinality of the set of recursive functions ?</p>
 | computability combinatorics | 1 | Are there more partially recursive functions than and recursive functions? -- (computability combinatorics)
<p>Is the cardinality of the set of partially recursive functions greater than the cardinality of the set of recursive functions ?</p>
 | habedi/stack-exchange-dataset |
30,208 | What is a forwarding pointer? | <p>I recently came across the concept of "forwarding pointer" and have not been able to find sources of a precise definition. In my case this was mentioned and briefly (but poorly) explained during a discussion on distributed systems.</p>
<p>Could you elaborate on the concept, its usual context(s) and pos... | terminology programming languages | 1 | What is a forwarding pointer? -- (terminology programming languages)
<p>I recently came across the concept of "forwarding pointer" and have not been able to find sources of a precise definition. In my case this was mentioned and briefly (but poorly) explained during a discussion on distributed systems.</p>&#x... | habedi/stack-exchange-dataset |
30,215 | Computation is effectively computable in theory and in practice | <p>My big question is the following: What is the meaning of a computation being "effectively computable" (EC) in theory and in practice? </p>

<p>In trying to understand these concepts further, I have a couple of sub-questions as well:</p>

<ol>
<li><p>Is there a relationship between a computation b... | terminology computability | 1 | Computation is effectively computable in theory and in practice -- (terminology computability)
<p>My big question is the following: What is the meaning of a computation being "effectively computable" (EC) in theory and in practice? </p>

<p>In trying to understand these concepts further, I have a couple of sub-... | habedi/stack-exchange-dataset |
30,221 | How to show whether $n2^n = 2^{O(n)}$? | <p>show whether $n2^n = 2^{O(n)}$ is true or not.</p>

<p>In my opinion, it's false because O(n) can be n and thus the equality will be wrong, because $n2^n$ grows much faster than $2^n$</p>
 | asymptotics | 1 | How to show whether $n2^n = 2^{O(n)}$? -- (asymptotics)
<p>show whether $n2^n = 2^{O(n)}$ is true or not.</p>

<p>In my opinion, it's false because O(n) can be n and thus the equality will be wrong, because $n2^n$ grows much faster than $2^n$</p>
 | habedi/stack-exchange-dataset |
30,247 | Are there hardware lock implementations without test-and-set or swap? | <p>Locks are usually implemented thru test-and-set and swap machine-level instructions. Are there other implementations that do not use these?</p>

<p>Also, can we say that all hardware level solutions to the critical section problem can be categorized into just three, namely, interrupt disabling, test-and-set ... | concurrency synchronization mutual exclusion | 1 | Are there hardware lock implementations without test-and-set or swap? -- (concurrency synchronization mutual exclusion)
<p>Locks are usually implemented thru test-and-set and swap machine-level instructions. Are there other implementations that do not use these?</p>

<p>Also, can we say that all hardware level ... | habedi/stack-exchange-dataset |
30,257 | help understanding formal grammar for subtraction example | <p>I am going through the <a href="http://www.itu.dk/people/kfl/parsernotes.pdf" rel="nofollow">following document</a> trying to understand a simple grammar for a basic subtraction example (page 4).</p>

<p>The example states that</p>

<blockquote>
 <p>Simple arithmetic expressions of arbitrary len... | formal languages formal grammars | 1 | help understanding formal grammar for subtraction example -- (formal languages formal grammars)
<p>I am going through the <a href="http://www.itu.dk/people/kfl/parsernotes.pdf" rel="nofollow">following document</a> trying to understand a simple grammar for a basic subtraction example (page 4).</p>

<p>The examp... | habedi/stack-exchange-dataset |
30,271 | Intuition behind recurrences with growth O(n log n) vs O(n²) | <p>Been trying to get the intuition behind <em>why</em> two very similar recurrence relations don't follow a pattern I would expect. They are pretty well known relations:</p>

<p>Relation 1 - </p>

<p>$T(n) = 2T(\frac{n}{2}) + n$</p>

<p>Relation 2 - </p>

<p>$T(n) = 2T(\frac{n}{2}) + n^... | asymptotics recurrence relation | 1 | Intuition behind recurrences with growth O(n log n) vs O(n²) -- (asymptotics recurrence relation)
<p>Been trying to get the intuition behind <em>why</em> two very similar recurrence relations don't follow a pattern I would expect. They are pretty well known relations:</p>

<p>Relation 1 - </p>

<p>$T(n)... | habedi/stack-exchange-dataset |
30,274 | Given a permutation of 0..N-1, determine the index of that permutation in the lexicographic ordering of all permutations of 0..N-1, in linear time | <p>There are various $\mathcal O(n \log n)$ or worse solutions, but I'm looking for one that runs in $\mathcal O(n)$, or a proof that none exist.</p>
 | permutations | 1 | Given a permutation of 0..N-1, determine the index of that permutation in the lexicographic ordering of all permutations of 0..N-1, in linear time -- (permutations)
<p>There are various $\mathcal O(n \log n)$ or worse solutions, but I'm looking for one that runs in $\mathcal O(n)$, or a proof that none exist.</p>
 | habedi/stack-exchange-dataset |
30,285 | What is the name of the problem? (partitioning graph into three covers) | <p>I was wondering if this problem has a name:</p>

<p>Given a simple graph whose edges are colored red, blue and green, $G=(V,B\cup R\cup G)$, is there a vertex-coloring $c:V\to \{B,R,G\}$ such that every edge has an endpoint with the same color?</p>

<p>Also, is this known to be NP-complete?</p>
&... | algorithms complexity theory graphs satisfiability colorings | 1 | What is the name of the problem? (partitioning graph into three covers) -- (algorithms complexity theory graphs satisfiability colorings)
<p>I was wondering if this problem has a name:</p>

<p>Given a simple graph whose edges are colored red, blue and green, $G=(V,B\cup R\cup G)$, is there a vertex-coloring $c:... | habedi/stack-exchange-dataset |
30,289 | Could an alternating approach yield a fairer solution to the stable marriage problem? | <p>With the <a href="http://en.wikipedia.org/wiki/Stable_marriage_problem#Algorithm" rel="nofollow">G-S algorithm</a> solution to the <a href="http://en.wikipedia.org/wiki/Stable_marriage_problem" rel="nofollow">stable marriage problem</a>, the proposers get the best possible stable matches, while the reviewers get the... | algorithms matching | 1 | Could an alternating approach yield a fairer solution to the stable marriage problem? -- (algorithms matching)
<p>With the <a href="http://en.wikipedia.org/wiki/Stable_marriage_problem#Algorithm" rel="nofollow">G-S algorithm</a> solution to the <a href="http://en.wikipedia.org/wiki/Stable_marriage_problem" rel="nofollo... | habedi/stack-exchange-dataset |
30,303 | In ID3 algorithm, which attribute to choose if information gains are equal? | <p>In the ID3 algorithm for building a decision tree, you pick which attribute to branch off on by calculating the information gain. What happens if the calculated information gain is equal for two different attributes? Can you choose either attribute as the new branch?</p>
 | algorithms machine learning | 1 | In ID3 algorithm, which attribute to choose if information gains are equal? -- (algorithms machine learning)
<p>In the ID3 algorithm for building a decision tree, you pick which attribute to branch off on by calculating the information gain. What happens if the calculated information gain is equal for two different att... | habedi/stack-exchange-dataset |
30,315 | Can file snapshots aid in detecting malware? | <p>I noticed certain programs have a feature that can have a 'snapshot' of a file from a certaim time and compare it to a more recent snapshot of the file. If one's system has a snapshot of a program when 'first' downloaded and it can compare this to the program 'as it is now' and if there are any changes this might ... | security filesystems | 1 | Can file snapshots aid in detecting malware? -- (security filesystems)
<p>I noticed certain programs have a feature that can have a 'snapshot' of a file from a certaim time and compare it to a more recent snapshot of the file. If one's system has a snapshot of a program when 'first' downloaded and it can compare this... | habedi/stack-exchange-dataset |
30,330 | The Hindley-Milner type system plus polymorphic recursion is undecidable or semidecidable? | <p>I have often read that Hindley-Milner extended to allow polymorphic recursion is <em>undecidable</em>. However is the term used what is actually meant? Or do people actually mean <em>semidecidable</em> when they mention that?</p>

<p>I ask this before I've recently found <a href="http://link.springer.com/cha... | type inference semi decidability | 1 | The Hindley-Milner type system plus polymorphic recursion is undecidable or semidecidable? -- (type inference semi decidability)
<p>I have often read that Hindley-Milner extended to allow polymorphic recursion is <em>undecidable</em>. However is the term used what is actually meant? Or do people actually mean <em>semid... | habedi/stack-exchange-dataset |
30,331 | Grammar for ${a^n b^n c^{n+m}}$ | <p>Can we define a grammar for the following language?</p>

<p>$$L = \{a^n b^n c^{n+m} | n,m>=0\}\,.
$$</p>

<p>I can define one for this:<br>
$$L=\{a^nb^n|n,m>=0\}
$$</p>

<blockquote>
 <p>S --> aSb | λ </p>
</blockquote>

<p>or this one:
$$L=\{b^nc^{n+m}... | formal languages formal grammars | 1 | Grammar for ${a^n b^n c^{n+m}}$ -- (formal languages formal grammars)
<p>Can we define a grammar for the following language?</p>

<p>$$L = \{a^n b^n c^{n+m} | n,m>=0\}\,.
$$</p>

<p>I can define one for this:<br>
$$L=\{a^nb^n|n,m>=0\}
$$</p>

<blockquote>
 <p>S --> aSb | λ... | habedi/stack-exchange-dataset |
30,333 | Efficient representation of a given surjective function $\{1 \ldots N\} \rightarrow \{1 \ldots M\}$ when $N \gg M$ | <p>More precisely: The input is set of $M$ sets (most likely stored sequentially on disk) that contain partitions of the set $\{1..N\}$. I want to efficiently (as far as memory and time complexity goes) represent this structure. Let's call this hypothetical structure $S$. I need the structure to support just a single f... | data structures hash hash tables | 1 | Efficient representation of a given surjective function $\{1 \ldots N\} \rightarrow \{1 \ldots M\}$ when $N \gg M$ -- (data structures hash hash tables)
<p>More precisely: The input is set of $M$ sets (most likely stored sequentially on disk) that contain partitions of the set $\{1..N\}$. I want to efficiently (as far ... | habedi/stack-exchange-dataset |
30,334 | Compute square root using (bit) additions and shifts as primitives | <blockquote>
 <p><strong>Question:</strong> Given an $n$-bit natural number $N$, how to compute $\lceil \sqrt{N} \rceil$ using only $O(n)$ (bit) additions and shifts?</p>
</blockquote>

<p>The tip is to use binary search. However, I could not achieve the required complexity (I got $O(n^2)$).</p>
&#... | algorithms arithmetic binary search | 1 | Compute square root using (bit) additions and shifts as primitives -- (algorithms arithmetic binary search)
<blockquote>
 <p><strong>Question:</strong> Given an $n$-bit natural number $N$, how to compute $\lceil \sqrt{N} \rceil$ using only $O(n)$ (bit) additions and shifts?</p>
</blockquote>

<p>The ti... | habedi/stack-exchange-dataset |
30,346 | How can an algorithm have exponential space complexity but polynomial time complexity? | <p>For enumerating the <a href="http://en.wikipedia.org/wiki/Feedback_vertex_set" rel="noreferrer">minimal feedback vertex sets</a> of a graph Schwikowski and Speckenmeyer show an algorithm "GENERATE-MFVS" in their publication "<a href="http://www.sciencedirect.com/science/article/pii/S0166218X00003395" rel="noreferrer... | complexity theory time complexity space complexity polynomial time | 1 | How can an algorithm have exponential space complexity but polynomial time complexity? -- (complexity theory time complexity space complexity polynomial time)
<p>For enumerating the <a href="http://en.wikipedia.org/wiki/Feedback_vertex_set" rel="noreferrer">minimal feedback vertex sets</a> of a graph Schwikowski and Sp... | habedi/stack-exchange-dataset |
30,347 | When are binary trees better than hashtables in real world applications? | <p>I am currently bushing up on my data structures and basic algorithms, part of that is the Binary Tree.
I do understand the algorithms, and how to implement a binary search tree and such. I do so how smart it is that we can do lookups in O(log n) time.</p>

<p>I am however having a hard time finding an ex... | data structures trees binary trees applied theory | 1 | When are binary trees better than hashtables in real world applications? -- (data structures trees binary trees applied theory)
<p>I am currently bushing up on my data structures and basic algorithms, part of that is the Binary Tree.
I do understand the algorithms, and how to implement a binary search tree and such... | habedi/stack-exchange-dataset |
30,349 | Why does a DFA either contain all or no words $a^k$ if it loops for $a$ in all states? | <p>I am trying to solve this particular problem from Automata Theory by Ullman, Hopcroft, it is as shown below:</p>
<blockquote>
<p>Let <span class="math-container">$A$</span> be a <span class="math-container">$DFA$</span> and <span class="math-container">$a$</span> be a particular input symbol of <span class="... | automata finite automata | 1 | Why does a DFA either contain all or no words $a^k$ if it loops for $a$ in all states? -- (automata finite automata)
<p>I am trying to solve this particular problem from Automata Theory by Ullman, Hopcroft, it is as shown below:</p>
<blockquote>
<p>Let <span class="math-container">$A$</span> be a <span class="m... | habedi/stack-exchange-dataset |
30,351 | Rice's Theorem: implication of having an undecidable property | <p>I understand the assumptions that have to be true about a property or set of properties in a Turing machine description for Rice's Theorem to apply.</p>

<p>But then what? If a set of Turing machines have an undecidable property, is the language itself necessarily undecidable? Or only if you can find a redu... | computability undecidability rice theorem | 1 | Rice's Theorem: implication of having an undecidable property -- (computability undecidability rice theorem)
<p>I understand the assumptions that have to be true about a property or set of properties in a Turing machine description for Rice's Theorem to apply.</p>

<p>But then what? If a set of Turing machines... | habedi/stack-exchange-dataset |
30,357 | The buckets of water problem | <p>Let's consider the following problem (buckets/pails of water problem) (This problem may be known with different name. If does, please correct me).</p>

<p>Let $B=\{b_1,...,b_n\}$ be a set of $n$ buckets. Suppose each bucket has a maximum capacity $c_i \in \mathbb{Z}$. This also can be written as a maxium ca... | algorithms complexity theory combinatorics np hard | 1 | The buckets of water problem -- (algorithms complexity theory combinatorics np hard)
<p>Let's consider the following problem (buckets/pails of water problem) (This problem may be known with different name. If does, please correct me).</p>

<p>Let $B=\{b_1,...,b_n\}$ be a set of $n$ buckets. Suppose each bucket... | habedi/stack-exchange-dataset |
30,371 | How to vocalize hexadecimal numbers? | <p>When I want to vocalize a hexadecimal number like 0x41, so I say "forty one in hexadecimal", "four, one in hex" or what? Or do you always have to calculate and say "65 in hexadecimal notation"? I feel like that would complicate communication if I just want to tell someone what numbers I see on the paper in fornt of ... | terminology | 1 | How to vocalize hexadecimal numbers? -- (terminology)
<p>When I want to vocalize a hexadecimal number like 0x41, so I say "forty one in hexadecimal", "four, one in hex" or what? Or do you always have to calculate and say "65 in hexadecimal notation"? I feel like that would complicate communication if I just want to tel... | habedi/stack-exchange-dataset |
30,372 | Typical set in Shannon's source coding theorem | <p>I was following the textbook by David Mackay: <a href="http://www.cs.toronto.edu/~mackay/itprnn/book.pdf" rel="nofollow"><em>Information theory inference and learning algorithms</em></a>.</p>

<p>I have question on asymptotic equiparition' principle:</p>

<blockquote>
 <p>For an ensemble of $N$ ... | sets coding theory encoding scheme | 1 | Typical set in Shannon's source coding theorem -- (sets coding theory encoding scheme)
<p>I was following the textbook by David Mackay: <a href="http://www.cs.toronto.edu/~mackay/itprnn/book.pdf" rel="nofollow"><em>Information theory inference and learning algorithms</em></a>.</p>

<p>I have question on asympto... | habedi/stack-exchange-dataset |
30,373 | Whats the name of this search game? | <p>I am struggling in finding the name of this game (in order to find research papers related to it in the literature). </p>

<p>Given an initial word $X$ and a target word $Y$, what is the minimum number of (letter) flips needed for $X$ to reach $Y$ assuming $X$ and $Y$ having the same number of letters, we fl... | board games search problem computer games | 1 | Whats the name of this search game? -- (board games search problem computer games)
<p>I am struggling in finding the name of this game (in order to find research papers related to it in the literature). </p>

<p>Given an initial word $X$ and a target word $Y$, what is the minimum number of (letter) flips needed... | habedi/stack-exchange-dataset |
30,375 | Two's complement overflow | <p>I know that in the case of a 16 bit word, if we have x - 115 in decimal, the smallest x that would cause overflow would be (32767 + 115 + 1)= 32883 because it would represent a number that is larger than the largest positive integer we could represent in a 16 bit word.
However, I was wondering what would the lar... | arithmetic | 1 | Two's complement overflow -- (arithmetic)
<p>I know that in the case of a 16 bit word, if we have x - 115 in decimal, the smallest x that would cause overflow would be (32767 + 115 + 1)= 32883 because it would represent a number that is larger than the largest positive integer we could represent in a 16 bit word.
H... | habedi/stack-exchange-dataset |
30,384 | Does the complement of sigma Kleene star exist? | <p>If $\Sigma^*$ is the set of ALL strings including the empty string, then what can its complement possibly be? The empty set?</p>
 | formal languages | 1 | Does the complement of sigma Kleene star exist? -- (formal languages)
<p>If $\Sigma^*$ is the set of ALL strings including the empty string, then what can its complement possibly be? The empty set?</p>
 | habedi/stack-exchange-dataset |
30,391 | Prove that REG is closed against removing all but lexicographicaly largest words (per length) | <blockquote>
<p>Let <span class="math-container">$\Sigma_n = \{0, 1, ... , n-1\}$</span>. Suppose <span class="math-container">$L \subseteq$</span> <span class="math-container">$\Sigma^*_n$</span>, and let</p>
<p><span class="math-container">$\qquad\displaystyle\mathcal{B}(L) = \{ x \in L : x = \textrm{lex}\ma... | formal languages closure properties | 1 | Prove that REG is closed against removing all but lexicographicaly largest words (per length) -- (formal languages closure properties)
<blockquote>
<p>Let <span class="math-container">$\Sigma_n = \{0, 1, ... , n-1\}$</span>. Suppose <span class="math-container">$L \subseteq$</span> <span class="math-container">$\S... | habedi/stack-exchange-dataset |
30,401 | Is this variant of ATM decidable? | <p>Ok so I understand how $\mathrm{ATM} = \{\langle M,w \rangle \mid \text{$M$ is a TM and $M$ accepts $w$}\}$ is undecidable.</p>

<p>Is this because $w$ is a variable?</p>

<p>What if the parameter is fixed?</p>

<p>Consider $\mathrm{BTM} = \{\langle M,w \rangle \mid \text{$M$ is a TM and $M$ ... | computability undecidability | 1 | Is this variant of ATM decidable? -- (computability undecidability)
<p>Ok so I understand how $\mathrm{ATM} = \{\langle M,w \rangle \mid \text{$M$ is a TM and $M$ accepts $w$}\}$ is undecidable.</p>

<p>Is this because $w$ is a variable?</p>

<p>What if the parameter is fixed?</p>

<p>Consider $... | habedi/stack-exchange-dataset |
30,413 | Interpret bits as a signed integer in 2s complement | <p><img src="https://i.stack.imgur.com/9XYxI.png" alt="enter image description here"></p>

<p>Imagine you load this data as a <code>4-byte word</code> into a register R. What is the value in <code>R</code> on a <strong>big endian</strong> machine and what is it on a <strong>little endian</strong> machine if you... | computer architecture | 1 | Interpret bits as a signed integer in 2s complement -- (computer architecture)
<p><img src="https://i.stack.imgur.com/9XYxI.png" alt="enter image description here"></p>

<p>Imagine you load this data as a <code>4-byte word</code> into a register R. What is the value in <code>R</code> on a <strong>big endian</st... | habedi/stack-exchange-dataset |
30,414 | Decide whether there exists a walk of weight exactly k | <p>Consider the following problem:</p>

<p><em>Input:</em> a directed graph $G = (V,E,\omega)$ where $\omega : E \longrightarrow \mathbb{Z}$, two vertices $v_1, v_2 \in V$, and a weight $k \in \mathbb{Z}$</p>

<p><em>Question:</em> Does there exist a walk from $v_1$ to $v_2$ with weight exactly $k$?</p>... | algorithms complexity theory graphs undecidability | 1 | Decide whether there exists a walk of weight exactly k -- (algorithms complexity theory graphs undecidability)
<p>Consider the following problem:</p>

<p><em>Input:</em> a directed graph $G = (V,E,\omega)$ where $\omega : E \longrightarrow \mathbb{Z}$, two vertices $v_1, v_2 \in V$, and a weight $k \in \mathbb{... | habedi/stack-exchange-dataset |
30,425 | Tower Of Hanoi Time Calculation | <p>I have been trying this Towers of Hanoi question since last week but never able to come with the right approach towards the solution.</p>

<p>The setup is the standard Towers of Hanoi, except that moving the smallest disk costs one unit of time, moving the second-smallest disk takes two units of time and so ... | discrete mathematics towers of hanoi | 1 | Tower Of Hanoi Time Calculation -- (discrete mathematics towers of hanoi)
<p>I have been trying this Towers of Hanoi question since last week but never able to come with the right approach towards the solution.</p>

<p>The setup is the standard Towers of Hanoi, except that moving the smallest disk costs one uni... | habedi/stack-exchange-dataset |
30,437 | How can one search in O(log n) time in a red-black tree? | <p>How does the <em>search operation</em> for a red-black tree work and how does it take $O(\log n)$ time, where $n$ is the number of items? I know a red-black tree takes $O(\log n)$ recolorings and $O(1)$ rotations, but I was specifically interested in a good description of its search operation.</p>
 | algorithms data structures trees search trees | 1 | How can one search in O(log n) time in a red-black tree? -- (algorithms data structures trees search trees)
<p>How does the <em>search operation</em> for a red-black tree work and how does it take $O(\log n)$ time, where $n$ is the number of items? I know a red-black tree takes $O(\log n)$ recolorings and $O(1)$ rotati... | habedi/stack-exchange-dataset |
30,448 | Asymptotic Proofs - BigOh/BigTheta | <p>This is not homework, but from a past exam. I do not know how to solve this one at all. Can anyone please take the time and show me how to do these? Thank you.</p>

<blockquote>
 <p>Prove that $5^n \in O(6^n)$, but that $5^n \notin \Theta(6^n)$. (Doing this shows that $6^n$ bounds $5^n$ from above, but ... | asymptotics proof techniques | 1 | Asymptotic Proofs - BigOh/BigTheta -- (asymptotics proof techniques)
<p>This is not homework, but from a past exam. I do not know how to solve this one at all. Can anyone please take the time and show me how to do these? Thank you.</p>

<blockquote>
 <p>Prove that $5^n \in O(6^n)$, but that $5^n \notin \Th... | habedi/stack-exchange-dataset |
30,457 | Union of regular languages that is not regular | <p>I've come across that question :
<strong>"Give examples of two regular languages which their union doesn't output a regular language. "</strong></p>

<p>This is pretty shocking to me because I believe that regular languages are closed under union. Which means to me that if I take two regular languages an... | formal languages regular languages closure properties | 1 | Union of regular languages that is not regular -- (formal languages regular languages closure properties)
<p>I've come across that question :
<strong>"Give examples of two regular languages which their union doesn't output a regular language. "</strong></p>

<p>This is pretty shocking to me because I believ... | habedi/stack-exchange-dataset |
30,460 | Smallest(k) in red-black tree. How is it O(logn)? | <p>Is it the same as find minimum for a binary search tree?
I know recoloring runs in O(logn) and rotations are O(1).</p>

<p>Even if we are wanting it to find the 'k-th' smallest key in the red-black tree.</p>

<p>Could someone help me understand it in more detail? Thank you!</p>
 | algorithms data structures trees binary trees search trees | 1 | Smallest(k) in red-black tree. How is it O(logn)? -- (algorithms data structures trees binary trees search trees)
<p>Is it the same as find minimum for a binary search tree?
I know recoloring runs in O(logn) and rotations are O(1).</p>

<p>Even if we are wanting it to find the 'k-th' smallest key in the red... | habedi/stack-exchange-dataset |
30,462 | Find strings in L^4 | <pre><code>Let L = {ab,aa,baa}. 
</code></pre>

<p>I need to find L^4. From my understanding, I union the set.</p>

<p>So:</p>

<pre><code>L^1 = {ab,aa,baa}
L^2 = {abab,abaa,abbaa,aaab,aaaa,aabaa,baaab,baaaa,baabaa}
L^3 = {abababab,abababaa,abababba,....} ??
</code></pre>
&#x... | formal languages sets | 1 | Find strings in L^4 -- (formal languages sets)
<pre><code>Let L = {ab,aa,baa}. 
</code></pre>

<p>I need to find L^4. From my understanding, I union the set.</p>

<p>So:</p>

<pre><code>L^1 = {ab,aa,baa}
L^2 = {abab,abaa,abbaa,aaab,aaaa,aabaa,baaab,baaaa,baabaa}
L^3 = {abababab,ababa... | habedi/stack-exchange-dataset |
30,467 | Non-deterministic Turing machine and palindromes | <p>I have to design a Non-deterministic Turing machine that accepts only non-palindromes in $NTime(n\log n)$.</p>

<p>I think this would be easy on a 2-tape DTM. Simply copy the string onto the second tape – $O(n)$ time – and then check both tapes (one from beginning and the second from the end) – $O(n)$ time a... | turing machines decision problem | 1 | Non-deterministic Turing machine and palindromes -- (turing machines decision problem)
<p>I have to design a Non-deterministic Turing machine that accepts only non-palindromes in $NTime(n\log n)$.</p>

<p>I think this would be easy on a 2-tape DTM. Simply copy the string onto the second tape – $O(n)$ time – and... | habedi/stack-exchange-dataset |
30,481 | Which fixpoint is Haskell list type? | <p>Let's say that lists are defined as</p>

<pre><code>List a = Nil | Cons a (List a)
</code></pre>

<p>Then, in Haskell is <code>List x</code> the greatest or least fixpoint? I'm asking because the lfp should exclude infinite lists (but you can build them in Haskell), whereas the gfp should exclude... | programming languages type theory functional programming semantics category theory | 1 | Which fixpoint is Haskell list type? -- (programming languages type theory functional programming semantics category theory)
<p>Let's say that lists are defined as</p>

<pre><code>List a = Nil | Cons a (List a)
</code></pre>

<p>Then, in Haskell is <code>List x</code> the greatest or least fixpoint?... | habedi/stack-exchange-dataset |
30,488 | Maximum minimal set coverage | <p>Suppose we are given a universal set $U$ and a family of subsets of $U$, denoted by $F$ (elements in $F$ are subsets of $U$). We assume that all elements in $F$ can cover $U$, i.e., $U\subseteq \bigcup_{e\in F}e$. Consider the following max-cost set covering problem:</p>

<p>$\text{argmax}_{E\subseteq F} |E|... | reference request optimization set cover | 1 | Maximum minimal set coverage -- (reference request optimization set cover)
<p>Suppose we are given a universal set $U$ and a family of subsets of $U$, denoted by $F$ (elements in $F$ are subsets of $U$). We assume that all elements in $F$ can cover $U$, i.e., $U\subseteq \bigcup_{e\in F}e$. Consider the following max-c... | habedi/stack-exchange-dataset |
30,492 | Efficient algorithm for detecting overlaps in time intervals | <p>Let's say I am building a time clock app. The employee can log into the interface and then enter time for multiple projects so that we can generate reports for billing as well as payroll.</p>

<p>A table in the database will record the time-in and time-out for each project as a row. A user should be able to ... | algorithms search algorithms intervals | 1 | Efficient algorithm for detecting overlaps in time intervals -- (algorithms search algorithms intervals)
<p>Let's say I am building a time clock app. The employee can log into the interface and then enter time for multiple projects so that we can generate reports for billing as well as payroll.</p>

<p>A table ... | habedi/stack-exchange-dataset |
30,494 | How to determine the set of numbers read by a DFA from one state to another? | <p>Using the Deterministic Finite Automaton (Q, Σ, Δ, q_0, F):
<img src="https://i.stack.imgur.com/a20rR.jpg" alt="enter image description here"></p>

<p>Alphabet: Σ is {(0 0), (0 1), (1 0), (1 1)}</p>

<p>Definition of Δ to strings recursively:</p>

<p>Δ*(q, ε) = q for all q ∈ Q</p>
&#x... | automata finite automata | 1 | How to determine the set of numbers read by a DFA from one state to another? -- (automata finite automata)
<p>Using the Deterministic Finite Automaton (Q, Σ, Δ, q_0, F):
<img src="https://i.stack.imgur.com/a20rR.jpg" alt="enter image description here"></p>

<p>Alphabet: Σ is {(0 0), (0 1), (1 0), (1 1)}</p>... | habedi/stack-exchange-dataset |
30,502 | Finding a specific "balls-into-bins" partition given its index in the lexicographical ordering | <p>Given numbers $n,k\in \mathbb{N}$, we consider $\mathcal P$ to be the set of all possible partitions of $n$ balls into $k$ bins.</p>

<p>Alternatively, $\mathcal P$ is the set of all $k$-ary vectors in $\{0,1,\ldots,n\}^k$ such that the sum of the entries is exactly $n$.</p>

<p>For example, if $n=4$... | algorithms combinatorics balls and bins integer partitions | 1 | Finding a specific "balls-into-bins" partition given its index in the lexicographical ordering -- (algorithms combinatorics balls and bins integer partitions)
<p>Given numbers $n,k\in \mathbb{N}$, we consider $\mathcal P$ to be the set of all possible partitions of $n$ balls into $k$ bins.</p>

<p>Alternatively... | habedi/stack-exchange-dataset |
30,509 | Recursion: base case vs. small version | <p>I'm reviewing the definition of recursion and in my notes are two questions about a recursive problem. One question asks about the <strong>base case</strong>, the other one about the <strong>small version</strong> of the problem, I always get confused about which is which... can you help me to find a way to better u... | terminology data structures recursion arrays | 1 | Recursion: base case vs. small version -- (terminology data structures recursion arrays)
<p>I'm reviewing the definition of recursion and in my notes are two questions about a recursive problem. One question asks about the <strong>base case</strong>, the other one about the <strong>small version</strong> of the problem... | habedi/stack-exchange-dataset |
30,531 | For a graph to be connected, you need at least n-1 edges rigorous proof | <p>This fact seems obvious but I was unsure how to go about proving it very <strong>rigorous</strong>.</p>

<p>Let $|V| = n$ and $|E| = m$ for some connected graph $G$. Then consider the following proposition:</p>

<blockquote>
 <p>If a graph is connected then $|E| \geq n-1$, i.e. it needs at least... | graphs | 1 | For a graph to be connected, you need at least n-1 edges rigorous proof -- (graphs)
<p>This fact seems obvious but I was unsure how to go about proving it very <strong>rigorous</strong>.</p>

<p>Let $|V| = n$ and $|E| = m$ for some connected graph $G$. Then consider the following proposition:</p>

<bloc... | habedi/stack-exchange-dataset |
30,532 | Are all known algorithms for solving NP-complete problems constructive? | <p>Are there any known algorithms that correctly output "yes" to an NP-complete problem without implicitly generating a certificate?</p>

<p>I understand that it is straightforward to turn a satisfiability oracle into a satisfying-assignment finder: just iterate over the variables, each time asking the satisfia... | algorithms complexity theory np complete | 1 | Are all known algorithms for solving NP-complete problems constructive? -- (algorithms complexity theory np complete)
<p>Are there any known algorithms that correctly output "yes" to an NP-complete problem without implicitly generating a certificate?</p>

<p>I understand that it is straightforward to turn a sat... | habedi/stack-exchange-dataset |
30,539 | Meaning of empty clause | <p>Why does the empty clause is logically equivalent to a contraddiction:
$\square \cup \square \Longleftrightarrow \perp$</p>

<p>and why the empty cube is logically equivalent to a tautology:
$\square \cap \square \Longleftrightarrow \top$ ?</p>
 | logic propositional logic | 1 | Meaning of empty clause -- (logic propositional logic)
<p>Why does the empty clause is logically equivalent to a contraddiction:
$\square \cup \square \Longleftrightarrow \perp$</p>

<p>and why the empty cube is logically equivalent to a tautology:
$\square \cap \square \Longleftrightarrow \top$ ?</p>&#... | habedi/stack-exchange-dataset |
30,543 | What is the intuition behind the Potential Function in Amortized Analysis of some algorithm? | <p>I have come across many amortized analysis using a potential function. They all look magical to me. Everything works perfectly but I never got the intuition behind how they come up with such a "magical" potential function which makes everything work. My question is can someone share their experience in developing a ... | algorithms algorithm analysis runtime analysis amortized analysis | 1 | What is the intuition behind the Potential Function in Amortized Analysis of some algorithm? -- (algorithms algorithm analysis runtime analysis amortized analysis)
<p>I have come across many amortized analysis using a potential function. They all look magical to me. Everything works perfectly but I never got the intuit... | habedi/stack-exchange-dataset |
30,576 | Longest "bounded" subsequence | <p>Given a sequence of comparable objects $a_1, a_2, \ldots a_n,$ how quickly can we find the longest subsequence $s$ such that $s_i > s_1$ for $i > 1$? Or equivalently, how quickly can we find</p>

<p>$$
\underset{i}{\arg\max} \; \# \{j \mid a_j > a_i, i < j \le n \}
$$</p>

<p>Can... | algorithms subsequences | 1 | Longest "bounded" subsequence -- (algorithms subsequences)
<p>Given a sequence of comparable objects $a_1, a_2, \ldots a_n,$ how quickly can we find the longest subsequence $s$ such that $s_i > s_1$ for $i > 1$? Or equivalently, how quickly can we find</p>

<p>$$
\underset{i}{\arg\max} \; \# \{j \mid... | habedi/stack-exchange-dataset |
30,581 | What is the difference between consensus and mutual exclusion in Distributed Systems? | <p>If we can achieve consensus, does it imply we can achieve mutual exclusion? Is there a difference?</p>

<p>Example : Paxos solves the consensus problem, can it also be used to solve mutual exclusion?</p>
 | distributed systems mutual exclusion | 1 | What is the difference between consensus and mutual exclusion in Distributed Systems? -- (distributed systems mutual exclusion)
<p>If we can achieve consensus, does it imply we can achieve mutual exclusion? Is there a difference?</p>

<p>Example : Paxos solves the consensus problem, can it also be used to solve... | habedi/stack-exchange-dataset |
30,585 | Extracting maximum information from a set of exam answers and their scores | <p>Imagine we have a multiple-choice exam with N questions.
Suppose we have a set of K answer sheets to the exam and their total scores (1 for a correct answer on a question, 0 for incorrect).</p>

<p>How much information can we extract from this set about the true answers to the exam, and what is the shape... | complexity theory data mining constraint programming | 1 | Extracting maximum information from a set of exam answers and their scores -- (complexity theory data mining constraint programming)
<p>Imagine we have a multiple-choice exam with N questions.
Suppose we have a set of K answer sheets to the exam and their total scores (1 for a correct answer on a question, 0 for in... | habedi/stack-exchange-dataset |
30,588 | What do f(x) and g(x) represent in Big O notation? | <p><a href="https://cs.stackexchange.com/questions/57/how-does-one-know-which-notation-of-time-complexity-analysis-to-use">I have been reading about Big O notation</a>. People writing about Big O often use the terms $f(x)$ and $g(x)$. For instance, I often see people write things like $f(x) = O(g(x))$ or $f(x) \in O(g(... | terminology landau notation | 1 | What do f(x) and g(x) represent in Big O notation? -- (terminology landau notation)
<p><a href="https://cs.stackexchange.com/questions/57/how-does-one-know-which-notation-of-time-complexity-analysis-to-use">I have been reading about Big O notation</a>. People writing about Big O often use the terms $f(x)$ and $g(x)$. F... | habedi/stack-exchange-dataset |
30,595 | Computing the mode of XOR subsequences | <p>I was confronted with this problem in an online programming challenge and it has been bugging me since:</p>

<p>In the problem, you are given a list of 16-bit numbers, say
$a_0, a_1, ..., a_n$. An "XOR subsequence" is defined as the exclusive-or combination of every element in a consecutive subsequence o... | algorithms dynamic programming subsequences | 1 | Computing the mode of XOR subsequences -- (algorithms dynamic programming subsequences)
<p>I was confronted with this problem in an online programming challenge and it has been bugging me since:</p>

<p>In the problem, you are given a list of 16-bit numbers, say
$a_0, a_1, ..., a_n$. An "XOR subsequence" is... | habedi/stack-exchange-dataset |
30,600 | Stable marriage problem with only one side having preferences | <p>I was wondering about a variation on the Stable Marriage Problem. Initially, we have two sets of entities, usually males and females, and they have preference lists ranking the other group, and through a series of proposals, we end up with a stable matching. </p>

<p>Thinking of it like medical schools and a... | algorithms bipartite matching matching assignment problem | 1 | Stable marriage problem with only one side having preferences -- (algorithms bipartite matching matching assignment problem)
<p>I was wondering about a variation on the Stable Marriage Problem. Initially, we have two sets of entities, usually males and females, and they have preference lists ranking the other group, an... | habedi/stack-exchange-dataset |
30,604 | How much money do you need to pay for pilots and their assistants? | <p>I am new in writing recursive algorithm so I tried <a href="http://www.spoj.com/problems/MPILOT/" rel="nofollow noreferrer">this problem from SPOJ</a> but I could not formulate the recursive relation from where I can find the optimal solution. Can anyone help me to see the optimal solution of the problem below pleas... | algorithms recursion | 1 | How much money do you need to pay for pilots and their assistants? -- (algorithms recursion)
<p>I am new in writing recursive algorithm so I tried <a href="http://www.spoj.com/problems/MPILOT/" rel="nofollow noreferrer">this problem from SPOJ</a> but I could not formulate the recursive relation from where I can find th... | habedi/stack-exchange-dataset |
30,606 | Proving that $2^n$ does not divide $n!$ | <p>How can prove that $2^n \nmid n!$
using binary representation for $n!$ and $2^n$.</p>
 | discrete mathematics number theory | 1 | Proving that $2^n$ does not divide $n!$ -- (discrete mathematics number theory)
<p>How can prove that $2^n \nmid n!$
using binary representation for $n!$ and $2^n$.</p>
 | habedi/stack-exchange-dataset |
30,623 | Algorithm to determine whether a given graph is a caterpillar tree | <p>I am looking for an algorithm with time complexity in $\mathcal O(|V|)$ that determines whether a given graph $G=(V,E)$ is a caterpillar tree. </p>

<p>A caterpillar tree is a tree that has a path to which all nodes are connected by a maximum of one edge. So for every vertex v there is a vertex u on the path... | algorithms trees graph traversal | 1 | Algorithm to determine whether a given graph is a caterpillar tree -- (algorithms trees graph traversal)
<p>I am looking for an algorithm with time complexity in $\mathcal O(|V|)$ that determines whether a given graph $G=(V,E)$ is a caterpillar tree. </p>

<p>A caterpillar tree is a tree that has a path to whic... | habedi/stack-exchange-dataset |
30,631 | Prerequisites of computational complexity theory | <p>what's the prerequisite topics needed for understanding computational complexity theory and analysis of algorithm ...including big-O and Big-theta notations and these staff. I want a mathematical background and good book suggestions for each topic ... thanks</p>
 | complexity theory time complexity space complexity | 1 | Prerequisites of computational complexity theory -- (complexity theory time complexity space complexity)
<p>what's the prerequisite topics needed for understanding computational complexity theory and analysis of algorithm ...including big-O and Big-theta notations and these staff. I want a mathematical background and g... | habedi/stack-exchange-dataset |
30,634 | Keeping a String Secret in (Open) Source Code | <p>I have finished developing an app for Android and intend to publish it with GPL -- I want it to be open source.
However, the nature of the application (a game) is that it asks riddles and has the answers coded into the string resource. I can't publish the answers!
I was told to look into storing passwords se... | arrays security | 1 | Keeping a String Secret in (Open) Source Code -- (arrays security)
<p>I have finished developing an app for Android and intend to publish it with GPL -- I want it to be open source.
However, the nature of the application (a game) is that it asks riddles and has the answers coded into the string resource. I can't pu... | habedi/stack-exchange-dataset |
30,639 | What is the Relationship Between Programming Languages, Regular Expressions and Formal Languages | <p>I've looked around the net for an answer to this question and it seems as if everybody implicitly knows the answer except me. Presumably this is because the only people who care are those who have had tertiary education on the subject. I, on the other hand, have been thrown in the deep end for a high school assignme... | formal languages programming languages regular expressions | 1 | What is the Relationship Between Programming Languages, Regular Expressions and Formal Languages -- (formal languages programming languages regular expressions)
<p>I've looked around the net for an answer to this question and it seems as if everybody implicitly knows the answer except me. Presumably this is because the... | habedi/stack-exchange-dataset |
30,646 | Confusion in "mask bits" | <p>This is the question: </p>

<blockquote>
 <p>By definition of the IEEE754 standard, 32-bit floating point numbers
 are represented as follows: </p>
 
 <p>S (1 bit) E (8 bits) M (23 bits) S: Sign bit E: Exponent M:
 Mantissa </p>
 
 <p>Which of the following is the cor... | encoding scheme number formats | 1 | Confusion in "mask bits" -- (encoding scheme number formats)
<p>This is the question: </p>

<blockquote>
 <p>By definition of the IEEE754 standard, 32-bit floating point numbers
 are represented as follows: </p>
 
 <p>S (1 bit) E (8 bits) M (23 bits) S: Sign bit E: Exponent M:
 Ma... | habedi/stack-exchange-dataset |
30,652 | Data structure to insert, update and sort indexes by frequency and query an index for a particular cumulative frequency | <p>Here is the description of the data structure I am looking for:</p>

<p>Initial Original Data</p>

<pre>
Index | Frequency |
 1 3
 2 1
 3 7
 4 2
 5 6
</pre>

<p>Now it should be kept <strong>Sort</strong>-ed by their fre... | data structures dictionaries | 1 | Data structure to insert, update and sort indexes by frequency and query an index for a particular cumulative frequency -- (data structures dictionaries)
<p>Here is the description of the data structure I am looking for:</p>

<p>Initial Original Data</p>

<pre>
Index | Frequency |
 1 3&... | habedi/stack-exchange-dataset |
30,660 | Why does this pumping lemma application "prove" that 0*1* is not regular? | <p>Here is a proof that $0^*1^*$ is not regular, even though it is regular. I'm having a hard time figuring out what is wrong with the proof.</p>

<p>Assume $0^*1^*$ is regular. Let $p$ be the pumping length as defined by the pumping lemma. Let $s = 0^{p-1}11$, then $|s| \ge p$ and $s \in 0^*1^*$. According to ... | formal languages regular languages pumping lemma | 1 | Why does this pumping lemma application "prove" that 0*1* is not regular? -- (formal languages regular languages pumping lemma)
<p>Here is a proof that $0^*1^*$ is not regular, even though it is regular. I'm having a hard time figuring out what is wrong with the proof.</p>

<p>Assume $0^*1^*$ is regular. Let $p... | habedi/stack-exchange-dataset |
30,665 | Addressing mode | <p>I'm studying for an exam called Computer Fundamental, and started taking some previous exam but the given documents i had is way inadequate to solve all the question mentioned, like this one : </p>

<blockquote>
 <p>Which of the following is the correct combination of variousaddressing
 modes? He... | memory hardware | 1 | Addressing mode -- (memory hardware)
<p>I'm studying for an exam called Computer Fundamental, and started taking some previous exam but the given documents i had is way inadequate to solve all the question mentioned, like this one : </p>

<blockquote>
 <p>Which of the following is the correct combination o... | habedi/stack-exchange-dataset |
30,688 | are the activations of hidden nodes in an ANN binary or real valued? | <p>this may seem to be a pretty basic question, but it is something i have been puzzling over for some time.</p>

<p>when calculating the activations of nodes in a hidden layer in an ANN using sigmoid neurons for use with the backpropagation algorithm - should the output of the neuron be thresholded or not?</p>... | machine learning neural networks | 1 | are the activations of hidden nodes in an ANN binary or real valued? -- (machine learning neural networks)
<p>this may seem to be a pretty basic question, but it is something i have been puzzling over for some time.</p>

<p>when calculating the activations of nodes in a hidden layer in an ANN using sigmoid neur... | habedi/stack-exchange-dataset |
30,689 | Show that 6n^2 + 12n is O(n^2) | <p>I understand how I would do this if the problem were as such</p>

<p>$8n + 5$ is $O(n)$</p>

<p>$c>0$ and an integer constant $n(not 0) \geq 1$ such that $8n + 5 \leq cn$ for every integer $n \geq n(not 0)$</p>

<p>we could let $c= 13$ and $n(not 0) = 1$</p>

<p>or we could let $c ... | algorithms asymptotics landau notation | 1 | Show that 6n^2 + 12n is O(n^2) -- (algorithms asymptotics landau notation)
<p>I understand how I would do this if the problem were as such</p>

<p>$8n + 5$ is $O(n)$</p>

<p>$c>0$ and an integer constant $n(not 0) \geq 1$ such that $8n + 5 \leq cn$ for every integer $n \geq n(not 0)$</p>

<p>... | habedi/stack-exchange-dataset |
30,700 | Proving NP hardness of maximum sum of means of a partition into k sets | <p>I am trying to show the following problem is NP-hard and would like some help.</p>
<blockquote>
<p><em>Inputs:</em> Integer <span class="math-container">$k$</span>, and unordered set of <span class="math-container">$N$</span> numbers, <span class="math-container">$O$</span></p>
<p><em>Output:</em> the <s... | complexity theory np hard set cover | 1 | Proving NP hardness of maximum sum of means of a partition into k sets -- (complexity theory np hard set cover)
<p>I am trying to show the following problem is NP-hard and would like some help.</p>
<blockquote>
<p><em>Inputs:</em> Integer <span class="math-container">$k$</span>, and unordered set of <span class... | habedi/stack-exchange-dataset |
30,702 | Are DCFLs closed under reversal? | <p>According to <a href="http://planetmath.org/closurepropertiesonlanguages">this chart</a>, DCFLs are closed under reversal.</p>

<p>However, I am not convinced as the intuitive proof (reversing the arrows of the controlling finite state machine and switching the pushes and pops) for this seems to depend on no... | formal languages context free closure properties pushdown automata nondeterminism | 1 | Are DCFLs closed under reversal? -- (formal languages context free closure properties pushdown automata nondeterminism)
<p>According to <a href="http://planetmath.org/closurepropertiesonlanguages">this chart</a>, DCFLs are closed under reversal.</p>

<p>However, I am not convinced as the intuitive proof (revers... | habedi/stack-exchange-dataset |
30,712 | Teaching Recursion | <p>I'm a teacher assistant in my university and my next topic is recursion. what way is the best to teach recursion so that the student can grasp the concept easily and can think recursively?<br>
I was thinking about explaining the stack structure to teach recursion but I'm worried that they get stuck in tracing th... | recursion education didactics | 1 | Teaching Recursion -- (recursion education didactics)
<p>I'm a teacher assistant in my university and my next topic is recursion. what way is the best to teach recursion so that the student can grasp the concept easily and can think recursively?<br>
I was thinking about explaining the stack structure to teach recur... | habedi/stack-exchange-dataset |
30,714 | Is there a technique for statically checking that a function is only called at a particular rate? | <p>I was reading <a href="http://www.cl.cam.ac.uk/~srk31/blog/2014/10/07/" rel="noreferrer">this</a> article about types, and started wondering how static type checkers could enforce other properties in programs. For example, say I wanted to create a language which would allow checking at compile time that a particular... | algorithm analysis compilers type checking | 1 | Is there a technique for statically checking that a function is only called at a particular rate? -- (algorithm analysis compilers type checking)
<p>I was reading <a href="http://www.cl.cam.ac.uk/~srk31/blog/2014/10/07/" rel="noreferrer">this</a> article about types, and started wondering how static type checkers could... | habedi/stack-exchange-dataset |
30,732 | Calculating cache memory based on LRU algorithm | <p>Assuming i have 4 blocks of cache memory, Using the LRU (Least Recently Used) 
replacement algorithm on this following sequence of access to memory blocks: 1 2 3 4 5 2 5 4 1 5 2 3 : </p>

<pre><code>1 2 3 4 5 2 5 4 1 5 2 3

1 1 1 1 5 5 5 5 5 5 5 5
 ... | memory management cpu cache paging | 1 | Calculating cache memory based on LRU algorithm -- (memory management cpu cache paging)
<p>Assuming i have 4 blocks of cache memory, Using the LRU (Least Recently Used) 
replacement algorithm on this following sequence of access to memory blocks: 1 2 3 4 5 2 5 4 1 5 2 3 : </p>

<pre><code>1 2 3 4 5 ... | habedi/stack-exchange-dataset |
30,746 | Equivalence of data-flow analysis, abstract interpretation and type inference? | <p>@Babou's <a href="https://cs.stackexchange.com/a/30740/7459">answer to a recent question</a> reminds me that at one time I think I read a paper about the equivalence (in terms both of the facts that can be inferred or proved and the time complexity of running the inference algorithm) of <a href="http://en.wikipedia.... | reference request compilers type inference program optimization | 1 | Equivalence of data-flow analysis, abstract interpretation and type inference? -- (reference request compilers type inference program optimization)
<p>@Babou's <a href="https://cs.stackexchange.com/a/30740/7459">answer to a recent question</a> reminds me that at one time I think I read a paper about the equivalence (in... | habedi/stack-exchange-dataset |
30,757 | How is IO a monad? | <p>I am learning the Haskell programming language. From what I am reading, Input/Ouput (<a href="http://learnyouahaskell.com/input-and-output" rel="nofollow noreferrer">IO</a>) raises challenges for Haskell's purity, since by definition we are interacting with the outside world. From Wikipedia:</p>

<blockquo... | programming languages functional programming | 1 | How is IO a monad? -- (programming languages functional programming)
<p>I am learning the Haskell programming language. From what I am reading, Input/Ouput (<a href="http://learnyouahaskell.com/input-and-output" rel="nofollow noreferrer">IO</a>) raises challenges for Haskell's purity, since by definition we are intera... | habedi/stack-exchange-dataset |
30,764 | How do we analyze Algorithms with parallelism features | <p>As I am comparing between two algorithms, I was wondering which is the best approach to use to compare between the both. Big-O seems not the perfect metric for me, as the it's based on the worst-case, while most of cases in the area that I am working on is optimized. 
The second though is, I am using "Python-Map... | algorithms algorithm analysis parallel computing | 1 | How do we analyze Algorithms with parallelism features -- (algorithms algorithm analysis parallel computing)
<p>As I am comparing between two algorithms, I was wondering which is the best approach to use to compare between the both. Big-O seems not the perfect metric for me, as the it's based on the worst-case, while m... | habedi/stack-exchange-dataset |
30,771 | Terminologies of "Process calculus" and "Process algebra" | <p>In the literature, the terms of "process calculus" and "process algebra" are often interchangeable. Meanwhile, it confused me. </p>

<p><strong>My questions are:</strong></p>

<blockquote>
 <ol>
 <li>Are there formal, standard, and widely-accepted definitions of "calculus" and "algebra"?</l... | terminology process algebras mathematical foundations | 1 | Terminologies of "Process calculus" and "Process algebra" -- (terminology process algebras mathematical foundations)
<p>In the literature, the terms of "process calculus" and "process algebra" are often interchangeable. Meanwhile, it confused me. </p>

<p><strong>My questions are:</strong></p>

<blockqu... | habedi/stack-exchange-dataset |
30,778 | Why is the A* search heuristic optimal even if it underestimates costs? | <p>A* search finds optimal solution to problems as long as the heuristic is admissible which means it never overestimates the cost of the path to the from any given node (and consistent but let us focus on being admissible at the moment). </p>

<p>But why does it always find the optimal solution if the heuristi... | algorithms search algorithms heuristics | 1 | Why is the A* search heuristic optimal even if it underestimates costs? -- (algorithms search algorithms heuristics)
<p>A* search finds optimal solution to problems as long as the heuristic is admissible which means it never overestimates the cost of the path to the from any given node (and consistent but let us focus ... | habedi/stack-exchange-dataset |
30,785 | How exactly do you calculate the hidden layer gradients in the backpropagation algorithm? | <p>I have been going through the description of the backpropagation algorithm found <a href="http://neuralnetworksanddeeplearning.com/chap2.html" rel="nofollow">here</a>. and I am having a bit of trouble getting my head around some of the linear algebra.</p>

<p>Say I have a final output layer $L$ consisting of... | machine learning neural networks | 1 | How exactly do you calculate the hidden layer gradients in the backpropagation algorithm? -- (machine learning neural networks)
<p>I have been going through the description of the backpropagation algorithm found <a href="http://neuralnetworksanddeeplearning.com/chap2.html" rel="nofollow">here</a>. and I am having a bit... | habedi/stack-exchange-dataset |
30,790 | Recipe book for SAT encodings? | <p>SAT solvers are getting more and more efficient in solving large instances and are being used as back-ends in various contexts.
Every time one wants to use them to solve a problem in a specific domain, he/she has to come up with an ad-hoc encoding that not only has the right set of solutions but also puts the co... | reference request satisfiability sat solvers | 1 | Recipe book for SAT encodings? -- (reference request satisfiability sat solvers)
<p>SAT solvers are getting more and more efficient in solving large instances and are being used as back-ends in various contexts.
Every time one wants to use them to solve a problem in a specific domain, he/she has to come up with an ... | habedi/stack-exchange-dataset |
30,804 | Finding out if languages involving counting and modulo operations are regular | <p>I am having trouble with the regularity of the two following languages:</p>

<p>i) $\{0^{n}1^{m}|n,m>0,n-m=0\,mod\,3\}$</p>

<p>ii) $\{0^{n}1^{m}|n,m>0,n+m=0\,mod\,3\}$</p>

<p>To clarify this is stating that the (#(0's) - #(1's)) mod 3 = 0. </p>

<p>I know how to prove that the... | regular languages finite automata regular expressions | 1 | Finding out if languages involving counting and modulo operations are regular -- (regular languages finite automata regular expressions)
<p>I am having trouble with the regularity of the two following languages:</p>

<p>i) $\{0^{n}1^{m}|n,m>0,n-m=0\,mod\,3\}$</p>

<p>ii) $\{0^{n}1^{m}|n,m>0,n+m=0\... | habedi/stack-exchange-dataset |
30,805 | Count points in 2-d range | <p>You are given an array $A$ of size N $(N\leq 1\,000\,000)$ containing all integers $1..N$ exactly once. You are required to answer query in $O(\log^2 N )$ and to preprocess in $O(N\log^2N)$:</p>

<blockquote>
 <p>How many elements are there between indexes S and E, that are less than X? $( |L| : \forall... | algorithms data structures | 1 | Count points in 2-d range -- (algorithms data structures)
<p>You are given an array $A$ of size N $(N\leq 1\,000\,000)$ containing all integers $1..N$ exactly once. You are required to answer query in $O(\log^2 N )$ and to preprocess in $O(N\log^2N)$:</p>

<blockquote>
 <p>How many elements are there betwe... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.