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 |
|---|---|---|---|---|---|---|
60,101 | Hoare logic - invariant of loop | <p>I am trying to prove partial corectness of following program:</p>

<pre><code>{s = 0 and j = 0}
while j <= n do begin
 { s + j = (j - 1)j/2 and j <= n + 1}
 s := s + j;
 { s = (j-1)j/2 and j <= n + 1}
 { s = j(j+1)/2 and j + 1 <= n + 1} 
 j := j + 1;
 { s = (... | hoare logic | 1 | Hoare logic - invariant of loop -- (hoare logic)
<p>I am trying to prove partial corectness of following program:</p>

<pre><code>{s = 0 and j = 0}
while j <= n do begin
 { s + j = (j - 1)j/2 and j <= n + 1}
 s := s + j;
 { s = (j-1)j/2 and j <= n + 1}
 { s = j(j+1)/2 and j + ... | habedi/stack-exchange-dataset |
60,109 | Finding Language of a CFG | <p>Say you are given the following CFG $G$:
$$
S \to S_1 \mid S_2 \\
S_1 \to AbAS_1c \mid \epsilon \\
S_2 \to BaBS_2c \mid \epsilon \\
A \to Aa \mid \epsilon \\
B \to Bb \mid \epsilon
$$</p>

<p>What is $L(G)$?</p>

<p>So far I've derived the following regular expressions:</p... | formal languages context free formal grammars | 1 | Finding Language of a CFG -- (formal languages context free formal grammars)
<p>Say you are given the following CFG $G$:
$$
S \to S_1 \mid S_2 \\
S_1 \to AbAS_1c \mid \epsilon \\
S_2 \to BaBS_2c \mid \epsilon \\
A \to Aa \mid \epsilon \\
B \to Bb \mid \epsilon
$$</p>

<p>What is $L(G... | habedi/stack-exchange-dataset |
60,112 | Why do you need to fill the first element of array when implementing heap? | <p>I'm looking at Heap data structure implementation from different sources. What I found is that sometimes it's implemented with the first element of array set to magic (default, unused?) value.</p>

<p>For example <a href="https://github.com/ngenerics/ngenerics/blob/master/Source/NGenerics/DataStructures/Gene... | data structures heaps | 1 | Why do you need to fill the first element of array when implementing heap? -- (data structures heaps)
<p>I'm looking at Heap data structure implementation from different sources. What I found is that sometimes it's implemented with the first element of array set to magic (default, unused?) value.</p>

<p>For ex... | habedi/stack-exchange-dataset |
60,130 | How to model "name similarity"? | <p>I am new to machine learning. But have basic understanding of the concepts.</p>

<p>Problem statement : We humans won't perceive much difference between "Tim Cook" and "Tim C0ok". ( 0 is been replaced with zero ). I am trying to model this. </p>

<p>Task is to come-up with a model which can predict i... | machine learning approximation strings | 1 | How to model "name similarity"? -- (machine learning approximation strings)
<p>I am new to machine learning. But have basic understanding of the concepts.</p>

<p>Problem statement : We humans won't perceive much difference between "Tim Cook" and "Tim C0ok". ( 0 is been replaced with zero ). I am trying to mode... | habedi/stack-exchange-dataset |
60,136 | Sort an array based on dependencies | <p>I have an array of objects, each of them has a numeric id and another array attached to them.</p>

<p>The array in the object contains the dependencies of that object. Each dependency is an id from the other objects. There are no circular dependencies.</p>

<p>Let's take this diagram:</p>

<p... | sorting arrays | 1 | Sort an array based on dependencies -- (sorting arrays)
<p>I have an array of objects, each of them has a numeric id and another array attached to them.</p>

<p>The array in the object contains the dependencies of that object. Each dependency is an id from the other objects. There are no circular dependencies.<... | habedi/stack-exchange-dataset |
60,140 | What decompression algorithms have the shortest implementations? | <p>I am writing an executable compressor for small (roughly 1 kilobyte) executable files.</p>

<p>I am exploring compression algorithms that are well suited for this task. The amount of time required to compress and decompress is not important for my purposes, nor is the complexity of the compressor. I am limit... | algorithms data compression | 1 | What decompression algorithms have the shortest implementations? -- (algorithms data compression)
<p>I am writing an executable compressor for small (roughly 1 kilobyte) executable files.</p>

<p>I am exploring compression algorithms that are well suited for this task. The amount of time required to compress an... | habedi/stack-exchange-dataset |
60,144 | Shifting deletion algorithm for linear-probing hash table | <p>I'm looking for the algorithm for deleting an element from a linear-probing hash table that does a delete-and-shift instead of just using tombstone elements.</p>

<p>The basic idea is quite simple - but I keep getting caught up in corner cases (notably, w.r.t. "wraparound", where an element hashes to a high ... | algorithms data structures hash tables | 1 | Shifting deletion algorithm for linear-probing hash table -- (algorithms data structures hash tables)
<p>I'm looking for the algorithm for deleting an element from a linear-probing hash table that does a delete-and-shift instead of just using tombstone elements.</p>

<p>The basic idea is quite simple - but I ke... | habedi/stack-exchange-dataset |
60,149 | What to call a script that runs other scripts? | <p>I have a number of small scripts that are being called, in order, by one larger script. So I can run them all with just one command. I was wondering if there was a technical name for this main program (that runs the smaller ones). Currently I am calling it the 'master', but am not sure if that is correct.</p>
 | terminology | 1 | What to call a script that runs other scripts? -- (terminology)
<p>I have a number of small scripts that are being called, in order, by one larger script. So I can run them all with just one command. I was wondering if there was a technical name for this main program (that runs the smaller ones). Currently I am calling... | habedi/stack-exchange-dataset |
60,151 | Probability distribution of runs given k bits set in an n-bit circular buffer | <p>Imagine you have a circular buffer holding <code>n</code> bits. You (uniformly) randomly set <code>k</code> of those <code>n</code> bits. (This is without replacement, so you are left with a buffer of <code>n</code> bits of which <code>k</code>bits are set.)</p>

<p>Now you randomly select a location in the ... | combinatorics | 1 | Probability distribution of runs given k bits set in an n-bit circular buffer -- (combinatorics)
<p>Imagine you have a circular buffer holding <code>n</code> bits. You (uniformly) randomly set <code>k</code> of those <code>n</code> bits. (This is without replacement, so you are left with a buffer of <code>n</code> bits... | habedi/stack-exchange-dataset |
60,153 | In TensorFlow tutorials, why do they use only the first term of cross-entropy as the cost function? | <p>The cross-entropy cost function is usually <a href="http://neuralnetworksanddeeplearning.com/chap3.html#the_cross-entropy_cost_function" rel="nofollow">defined</a> as</p>

<p>$$C = -\frac{1}{n} \sum_x \left[y \ln \hat{y} + (1-y ) \ln (1-\hat{y}) \right]$$</p>

<p>where $y$ is the expected output and ... | machine learning | 1 | In TensorFlow tutorials, why do they use only the first term of cross-entropy as the cost function? -- (machine learning)
<p>The cross-entropy cost function is usually <a href="http://neuralnetworksanddeeplearning.com/chap3.html#the_cross-entropy_cost_function" rel="nofollow">defined</a> as</p>

<p>$$C = -\frac... | habedi/stack-exchange-dataset |
60,157 | How to memorize Master Theorem? | <p>I know the maths behind, I know if I do the algebra I can get the result of the 3 cases. I also have an intuition of the 3 cases: <a href="https://www.quora.com/What-is-an-intuitive-explanation-of-the-Master-Theorem" rel="noreferrer">Quora</a></p>

<p>However, I just cannot memorize this "simple" 3 cases whe... | education didactics | 1 | How to memorize Master Theorem? -- (education didactics)
<p>I know the maths behind, I know if I do the algebra I can get the result of the 3 cases. I also have an intuition of the 3 cases: <a href="https://www.quora.com/What-is-an-intuitive-explanation-of-the-Master-Theorem" rel="noreferrer">Quora</a></p>

<p>... | habedi/stack-exchange-dataset |
60,161 | Problem complete for the class of ALL languages | <p>$\text{ALL}$ is literally the class of ALL languages.</p>

<p>Are there $\text{ALL}$—complete problems? That is, are there problems for which a solution would allow one to solve any problem whatsoever? Such problems could reasonably be considered"the hardest problems, bar none".</p>

<p>One such pr... | undecidability | 1 | Problem complete for the class of ALL languages -- (undecidability)
<p>$\text{ALL}$ is literally the class of ALL languages.</p>

<p>Are there $\text{ALL}$—complete problems? That is, are there problems for which a solution would allow one to solve any problem whatsoever? Such problems could reasonably be con... | habedi/stack-exchange-dataset |
60,165 | Problems that are easy on bipartite but hard on general graphs | <p>Are there any problems that are easy for bipartite graphs, but hard for general graphs?</p>

<p>I am asking because some classical problems are formulated in reference to people looking for a spouse, such as the marriage problem (for straight people) and the stable marriage problem (for straight people). Bot... | complexity theory graphs bipartite matching | 1 | Problems that are easy on bipartite but hard on general graphs -- (complexity theory graphs bipartite matching)
<p>Are there any problems that are easy for bipartite graphs, but hard for general graphs?</p>

<p>I am asking because some classical problems are formulated in reference to people looking for a spous... | habedi/stack-exchange-dataset |
60,168 | Can the human brain be considered Turing complete? | <p>I'm not a student in computer science, but from what I understand from the Wikipedia article on the topic, a programming language is Turing complete if it can emulate another Turing complete language's algorithm.</p>

<p>Now if we consider that languages like Java, C, C++ and so on are considered Turing comp... | turing completeness computer vs human human computing | 1 | Can the human brain be considered Turing complete? -- (turing completeness computer vs human human computing)
<p>I'm not a student in computer science, but from what I understand from the Wikipedia article on the topic, a programming language is Turing complete if it can emulate another Turing complete language's algor... | habedi/stack-exchange-dataset |
60,173 | How can I model overlapping service times in queueing model? | <p>Say there are two queues (1 and 2) in series.</p>

<p>The latency will be $t_1 + t_2$ without overlapping of their service times ($t_1$ and $t_2$ respectively).</p>

<p>If there is a overlapping, the latency will be $t_1 + t_2 - T_o$ where $T_o$ is the overlapped time. (Specifically $T_o = \min(t_1,t... | queueing theory | 1 | How can I model overlapping service times in queueing model? -- (queueing theory)
<p>Say there are two queues (1 and 2) in series.</p>

<p>The latency will be $t_1 + t_2$ without overlapping of their service times ($t_1$ and $t_2$ respectively).</p>

<p>If there is a overlapping, the latency will be $t_... | habedi/stack-exchange-dataset |
60,176 | Classification training data, but regression prediction | <p>Suppose I'm performing machine learning on a simple dataset, and have a bunch of training data of the form:</p>

<pre><code>x (feature) y (label)
-----------------------
1 0
2 1
3 1
4 0
5 1
6 1
...
<... | machine learning probability theory neural networks classification features | 1 | Classification training data, but regression prediction -- (machine learning probability theory neural networks classification features)
<p>Suppose I'm performing machine learning on a simple dataset, and have a bunch of training data of the form:</p>

<pre><code>x (feature) y (label)
--------------------... | habedi/stack-exchange-dataset |
60,180 | How many times do we access memory with a TLB? | <p>As I understand it, when we are on a virtual memory based system, we have to access memory 2 times (one for the Page Table and one for the physical address in RAM). But, how many times would we have to access if we had a TLB?</p>
 | operating systems virtual memory | 1 | How many times do we access memory with a TLB? -- (operating systems virtual memory)
<p>As I understand it, when we are on a virtual memory based system, we have to access memory 2 times (one for the Page Table and one for the physical address in RAM). But, how many times would we have to access if we had a TLB?</p>&#x... | habedi/stack-exchange-dataset |
60,185 | What factors influence machine epsilon? | <p>I was wondering what factors effect a machine's epsilon value. I was thinking about how modern computers can calculate expressions to higher accuracy then their predecessors, but what hardware and software factors allow for improved accuracy? Is it the implementation of better algorithms for computing various functi... | computer architecture floating point numerical algorithms | 1 | What factors influence machine epsilon? -- (computer architecture floating point numerical algorithms)
<p>I was wondering what factors effect a machine's epsilon value. I was thinking about how modern computers can calculate expressions to higher accuracy then their predecessors, but what hardware and software factors ... | habedi/stack-exchange-dataset |
60,219 | Is it possible to create a chatbot that doesn't fall into an infinite loop under some restrictions? | <p>Consider a chatbot that runs on a turing machine. It has some restrictions:</p>

<ol>
<li>It must talk to itself 1 sentence at a time.</li>
<li>It is forced to use English words to reply. (so only around say 80 k different words to pick from)</li>
<li>A sentence cannot be longer than N words (say... | turing machines | 1 | Is it possible to create a chatbot that doesn't fall into an infinite loop under some restrictions? -- (turing machines)
<p>Consider a chatbot that runs on a turing machine. It has some restrictions:</p>

<ol>
<li>It must talk to itself 1 sentence at a time.</li>
<li>It is forced to use English words to... | habedi/stack-exchange-dataset |
60,222 | Dijkstra's algorithm runtime for dense graphs | <p>The runtime for Dijkstra's algorithm implemented with a priority queue on a sparse graph is $O((E+V)\log V)$. For a dense graph such as a complete graph, there can be $V(V-1)/2$ edges. </p>

<p>Since $E \sim V^2$, is the runtime $O((V+V^2)\log V)$? </p>
 | graphs algorithm analysis asymptotics landau notation | 1 | Dijkstra's algorithm runtime for dense graphs -- (graphs algorithm analysis asymptotics landau notation)
<p>The runtime for Dijkstra's algorithm implemented with a priority queue on a sparse graph is $O((E+V)\log V)$. For a dense graph such as a complete graph, there can be $V(V-1)/2$ edges. </p>

<p>Since $E \... | habedi/stack-exchange-dataset |
60,229 | Find a CFG for palindromes with at most three c's | <p>I'm trying to figure this one out, as I've found the CFG for the palindrome language.
I can't work on a solution that also covers #c(w) <= 3.</p>

<p>Find a CFG for the language 
 {w∈{a,b,c} | Reverse(w)=w, #c(w)<=3}?</p>

<p>Would appreciate your help</p>
 | formal languages context free formal grammars | 1 | Find a CFG for palindromes with at most three c's -- (formal languages context free formal grammars)
<p>I'm trying to figure this one out, as I've found the CFG for the palindrome language.
I can't work on a solution that also covers #c(w) <= 3.</p>

<p>Find a CFG for the language 
 {w∈{a,b,c} |... | habedi/stack-exchange-dataset |
60,240 | Why is the zero-th power of the empty set {ε}? | <p>It has been <a href="https://cs.stackexchange.com/questions/51096/how-is-emptyset-epsilon">asked before why $\emptyset^\star=\{\epsilon\}$</a>.
The answer boils down to $\emptyset^\star$ being defined as
$$ L^\star = \bigcup_{i=0}^\infty L^i, $$
where a word in $L^i$ is the concatenation of $i$ words fro... | formal languages mathematical foundations | 1 | Why is the zero-th power of the empty set {ε}? -- (formal languages mathematical foundations)
<p>It has been <a href="https://cs.stackexchange.com/questions/51096/how-is-emptyset-epsilon">asked before why $\emptyset^\star=\{\epsilon\}$</a>.
The answer boils down to $\emptyset^\star$ being defined as
$$ L^\star ... | habedi/stack-exchange-dataset |
60,242 | Is Green's the best 16-input sorting network so far? | <p>Every paper says that Green's construction is the best 16-input sorting 
network as for now. </p>

<p>But why does Wikipedia says: "Size, lower bound: 53"?</p>

<p>I thought "lower bound" meant:"If there exists at least an algorithm that can...". Am I wrong?</p>
 | complexity theory terminology sorting lower bounds circuits | 1 | Is Green's the best 16-input sorting network so far? -- (complexity theory terminology sorting lower bounds circuits)
<p>Every paper says that Green's construction is the best 16-input sorting 
network as for now. </p>

<p>But why does Wikipedia says: "Size, lower bound: 53"?</p>

<p>I thought "lowe... | habedi/stack-exchange-dataset |
60,246 | Is converting an ambiguous grammar to an unambiguous grammar computable? | <p>Is the problem of converting ambiguous grammar into unambiguous grammar computable? (Consider Domain as all context free languages). </p>
 | computability context free formal grammars undecidability | 1 | Is converting an ambiguous grammar to an unambiguous grammar computable? -- (computability context free formal grammars undecidability)
<p>Is the problem of converting ambiguous grammar into unambiguous grammar computable? (Consider Domain as all context free languages). </p>
 | habedi/stack-exchange-dataset |
60,262 | Find member of CFL that is Levenshtein-closest to non-member string | <p>Is there an (efficient?) algorithm which given a context-free language $L$ (given as a grammar) and a string $x$ with $x \not \in L$ computes a $y$ with $y \in L$ and $\forall y': y' \in L \implies d(x, y) \le d(x, y')$, where $d$ is the Levenshtein distance? (Secondarily, can one enumerate all such $y$?)</p>
&#... | formal languages context free string metrics edit distance | 1 | Find member of CFL that is Levenshtein-closest to non-member string -- (formal languages context free string metrics edit distance)
<p>Is there an (efficient?) algorithm which given a context-free language $L$ (given as a grammar) and a string $x$ with $x \not \in L$ computes a $y$ with $y \in L$ and $\forall y': y' \i... | habedi/stack-exchange-dataset |
60,276 | Solving inhomogeneous recursion using quadratic particular solution | <p>I am interested in solving recursions and while I was trying to solve this one:
$a_n=a_{n-1}+4n-3$</p>

<p>I ran onto a problem, I don't see how to find an explicit solution using standard inhomogeneous method(finding homogeneous and particular solution). Specifically I have a problem with finding partic... | recurrence relation mathematical foundations | 1 | Solving inhomogeneous recursion using quadratic particular solution -- (recurrence relation mathematical foundations)
<p>I am interested in solving recursions and while I was trying to solve this one:
$a_n=a_{n-1}+4n-3$</p>

<p>I ran onto a problem, I don't see how to find an explicit solution using standar... | habedi/stack-exchange-dataset |
60,277 | Is this argument wrong "since DOM is special kind of RDOM, then RDOM is NP-hard"? | <p>The domination problem $DOM$ is defined as
$$
DOM = \{ \langle G,k \rangle\ | \ G \text{ has a domination of size } k, K \in \mathbb{N} \},
$$
and the rainbow domination problem $RDOM$ is defined as
$$
RDOM = \{ \langle G,r,k \rangle \ | \ G \text{ has a r-dominating set of size } k; r,k \in ... | complexity theory np complete reductions proof techniques np hard | 1 | Is this argument wrong "since DOM is special kind of RDOM, then RDOM is NP-hard"? -- (complexity theory np complete reductions proof techniques np hard)
<p>The domination problem $DOM$ is defined as
$$
DOM = \{ \langle G,k \rangle\ | \ G \text{ has a domination of size } k, K \in \mathbb{N} \},
$$
and t... | habedi/stack-exchange-dataset |
60,294 | Which is the most efficient out of Bubble Sort, Selection Sort, Insertion Sort for a identical set of elements? | <p>Which of the sorting algorithm is (classical implementation with no enhancements) the fastest for a data set with all identical elements? And why?</p>

<p>How would one justify the answer to the above question logically?
Logically as in without implementing the algorithms and finding the average time con... | algorithms algorithm analysis runtime analysis sorting | 1 | Which is the most efficient out of Bubble Sort, Selection Sort, Insertion Sort for a identical set of elements? -- (algorithms algorithm analysis runtime analysis sorting)
<p>Which of the sorting algorithm is (classical implementation with no enhancements) the fastest for a data set with all identical elements? And why... | habedi/stack-exchange-dataset |
60,330 | How to find greatest set intersection of at least a given cardinality? | <p>While dealing with a problem, I uncovered this subproblem:</p>

<p>Input: A set of sets $S = \{S_1,...,S_r\}$ where $\mid$ $S_1$ $\cup$ ... $\cup$ $S_r$$\mid = n$, as well as a number $k<n$.</p>

<p>Output: A subset of $S$, $T = \{S_{t_{1}},...,S_{t_{p}}\}$ so that $\mid$ $S_{t_{1}}$ $\cap$ ... $\... | algorithms optimization combinatorics | 1 | How to find greatest set intersection of at least a given cardinality? -- (algorithms optimization combinatorics)
<p>While dealing with a problem, I uncovered this subproblem:</p>

<p>Input: A set of sets $S = \{S_1,...,S_r\}$ where $\mid$ $S_1$ $\cup$ ... $\cup$ $S_r$$\mid = n$, as well as a number $k<n$.</... | habedi/stack-exchange-dataset |
60,336 | Proving a grammar/language as not regular | <p>$D → T ∨ D | T$</p>

<p>$T → C ∧ T | C$</p>

<p>$C → ¬C | name | ( D )$</p>

<p>$name → a | b | c | d$</p>

<p>I am not looking for the complete answer, but more the methodology of working this out. How would I go about proving that this language is not regular? </p>
 | formal languages regular languages | 1 | Proving a grammar/language as not regular -- (formal languages regular languages)
<p>$D → T ∨ D | T$</p>

<p>$T → C ∧ T | C$</p>

<p>$C → ¬C | name | ( D )$</p>

<p>$name → a | b | c | d$</p>

<p>I am not looking for the complete answer, but more the methodology of working this out. How ... | habedi/stack-exchange-dataset |
60,339 | Algorithm to enclose a 2D-gridbased-room efficient | <p>I have the problem that I have a grid-based room which has 1 or more exits and I want to "secure" the room with minimal effort.</p>

<p>Here a little Example:</p>

<p><a href="https://i.stack.imgur.com/fIAG9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fIAG9.png" alt="Room Example"></a><... | algorithms optimization computational geometry | 1 | Algorithm to enclose a 2D-gridbased-room efficient -- (algorithms optimization computational geometry)
<p>I have the problem that I have a grid-based room which has 1 or more exits and I want to "secure" the room with minimal effort.</p>

<p>Here a little Example:</p>

<p><a href="https://i.stack.imgur.... | habedi/stack-exchange-dataset |
60,347 | Optimizing neural network on small training set | <p>I'm in the process of optimizing my neural network. I'd like to optimize on a small training set (1000 rows) as opposed to my full training set (100K rows) for speed reasons.</p>

<p>Will the optimal hyper-parameters (i.e. my learning rate, dropout prob, regularization parameter, # of hidden units, etc...) ... | machine learning neural networks | 1 | Optimizing neural network on small training set -- (machine learning neural networks)
<p>I'm in the process of optimizing my neural network. I'd like to optimize on a small training set (1000 rows) as opposed to my full training set (100K rows) for speed reasons.</p>

<p>Will the optimal hyper-parameters (i.e.... | habedi/stack-exchange-dataset |
60,355 | Linear time algorithm for finding $k$ shortest paths from $s$ to $t$ | <blockquote>
 <p><strong>Definition.</strong> Given a graph $G=(V,E)$ and two vertices $s$ and $t$, 
 the $k$-shortest-paths problem is finding the $k$ shortest simple paths 
 between $s$ and $t$ in $G$.</p>
</blockquote>

<p>Note that the length of these paths is not necessarily equal, and v... | algorithms graphs optimization shortest path enumeration | 1 | Linear time algorithm for finding $k$ shortest paths from $s$ to $t$ -- (algorithms graphs optimization shortest path enumeration)
<blockquote>
 <p><strong>Definition.</strong> Given a graph $G=(V,E)$ and two vertices $s$ and $t$, 
 the $k$-shortest-paths problem is finding the $k$ shortest simple paths 
... | habedi/stack-exchange-dataset |
60,359 | Is the prime factorization problem not an instance of the change making problem? | <p>When using as the set of coins all logarithms of the prime numbers or numbers in general, and when using the logarithm of the number to be factored. The problem is just finding the logarithms that can be used to make the total. But then the change making problem is listed as non NP problem, but the prime factorizati... | complexity theory optimization factoring primes | 1 | Is the prime factorization problem not an instance of the change making problem? -- (complexity theory optimization factoring primes)
<p>When using as the set of coins all logarithms of the prime numbers or numbers in general, and when using the logarithm of the number to be factored. The problem is just finding the lo... | habedi/stack-exchange-dataset |
60,361 | Finding a fixed-size set whose members are contained by the largest number of other sets | <p>I've been thinking about a problem, inspired by meeting a beginner-level foreign language professor at the Goethe-Institut who learned the five most common languages spoken by students in order to communicate with as many students as possible.</p>

<p>Consider some finite population of people, each of whom s... | terminology reference request optimization combinatorics sets | 1 | Finding a fixed-size set whose members are contained by the largest number of other sets -- (terminology reference request optimization combinatorics sets)
<p>I've been thinking about a problem, inspired by meeting a beginner-level foreign language professor at the Goethe-Institut who learned the five most common langu... | habedi/stack-exchange-dataset |
60,374 | What is the fastest way to check if an integer is divisible by another? | <p>What would the Big O be?
Can something like this be done in O(log(n)) where n is the number of bits?</p>
 | algorithms decision problem efficiency number theory | 1 | What is the fastest way to check if an integer is divisible by another? -- (algorithms decision problem efficiency number theory)
<p>What would the Big O be?
Can something like this be done in O(log(n)) where n is the number of bits?</p>
 | habedi/stack-exchange-dataset |
60,389 | Long multiplication school method: number of primitive operations to calculate first partial product? | <p>Having got some basics down in regard to addition and explaining it in terms of primitive operations (addition and multiplication), I am now again stuck on understanding the more complicated long multiplication.</p>

<p>I have read in my introductory book (Mehlhörn's 'Algorithms and Data Structures') that ea... | algorithm analysis runtime analysis arithmetic multiplication | 1 | Long multiplication school method: number of primitive operations to calculate first partial product? -- (algorithm analysis runtime analysis arithmetic multiplication)
<p>Having got some basics down in regard to addition and explaining it in terms of primitive operations (addition and multiplication), I am now again s... | habedi/stack-exchange-dataset |
60,391 | Best practices for normalizing up training, validation, and test sets | <p>I was reading up on how to normalize my training, validation, and test sets for a neural network, when I read this snippet:</p>

<blockquote>
 <p>An important point to make about the preprocessing is that any
 preprocessing statistics (e.g. the data mean) must only be computed on
 the training... | machine learning neural networks statistics | 1 | Best practices for normalizing up training, validation, and test sets -- (machine learning neural networks statistics)
<p>I was reading up on how to normalize my training, validation, and test sets for a neural network, when I read this snippet:</p>

<blockquote>
 <p>An important point to make about the pr... | habedi/stack-exchange-dataset |
60,399 | Example of a simple recognizable language, whose complement is not recognizable | <p>Can any one provide me with a simple language that is recognizable, but that it's complement is not?</p>

<p>I have read that recognizable languages may have this property but I am yet to find an example to think about. If you could provide the recognizable proof for both language and complement I would be v... | turing machines undecidability | 1 | Example of a simple recognizable language, whose complement is not recognizable -- (turing machines undecidability)
<p>Can any one provide me with a simple language that is recognizable, but that it's complement is not?</p>

<p>I have read that recognizable languages may have this property but I am yet to find ... | habedi/stack-exchange-dataset |
60,402 | Showing that all vertex degrees in MSTs of Euclidian graphs are in O(1) | <p>There is a finite set of points $S$ in the plane with $ |S| = n$. MST is the minimal spanning tree of S. "Minimal" here refers to the Euclidean distance between the points of $S$, so the MST is the minimum spanning tree with the lowest overall distance.</p>

<p>I want to prove that the degree of every node i... | graphs computational geometry minimum spanning tree | 1 | Showing that all vertex degrees in MSTs of Euclidian graphs are in O(1) -- (graphs computational geometry minimum spanning tree)
<p>There is a finite set of points $S$ in the plane with $ |S| = n$. MST is the minimal spanning tree of S. "Minimal" here refers to the Euclidean distance between the points of $S$, so the M... | habedi/stack-exchange-dataset |
60,413 | k-Closest pairs in Delaunay triangulation | <p>Assume there is a set of points $S$ in $\mathbb{R^2}$.
In this set of points there is a pair of points which are the nearest neighbors, the second-nearest neighbors and the third-nearest neighbors.</p>

<p>I want to show that the pair of points which represent:</p>

<ol>
<li>the nearest neigh... | computational geometry | 1 | k-Closest pairs in Delaunay triangulation -- (computational geometry)
<p>Assume there is a set of points $S$ in $\mathbb{R^2}$.
In this set of points there is a pair of points which are the nearest neighbors, the second-nearest neighbors and the third-nearest neighbors.</p>

<p>I want to show that the pair ... | habedi/stack-exchange-dataset |
60,416 | Sorting algorithm which sorts half the possible inputs in linear time | <blockquote>
 <p>Prove that there isn't any comparison sort algorithm which for an input of size $n$ can sort at least half of the permutations of the input in linear time.
 (For the other half the algorithm can return anything, even a completely unsorted array.)</p>
</blockquote>

<p>I know that ... | sorting lower bounds comparison | 1 | Sorting algorithm which sorts half the possible inputs in linear time -- (sorting lower bounds comparison)
<blockquote>
 <p>Prove that there isn't any comparison sort algorithm which for an input of size $n$ can sort at least half of the permutations of the input in linear time.
 (For the other half the algor... | habedi/stack-exchange-dataset |
60,417 | Can't understand this division algorithm in Computer Architecture | <p>So, I'm preparing for an exam where I have solve divisions using this division algorithm:</p>

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

<p>While I understand the theory (image... | computer architecture | 1 | Can't understand this division algorithm in Computer Architecture -- (computer architecture)
<p>So, I'm preparing for an exam where I have solve divisions using this division algorithm:</p>

<p><a href="https://i.stack.imgur.com/eODH5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eODH5.png"... | habedi/stack-exchange-dataset |
60,432 | modify Dijkstra's algorithm to compute shortest path only for the vertex which is no more than three edges away from the start vertex | <p>i want to modify Dijkstra algorithm to compute shortest path only for the vertex which is no more than three edges away from the start vertex</p>

<p>I tried it with BFS(breadth first search). Initially calculates the number of edges away from source to each vertex v. Then run Dijkstra's algorithm with a con... | algorithms shortest path | 1 | modify Dijkstra's algorithm to compute shortest path only for the vertex which is no more than three edges away from the start vertex -- (algorithms shortest path)
<p>i want to modify Dijkstra algorithm to compute shortest path only for the vertex which is no more than three edges away from the start vertex</p>
&#x... | habedi/stack-exchange-dataset |
60,433 | Which neural network topology is the most efficient to generate randomly shaped letters? | <p>I have created some unique shapes, so-called "letters" for a custom alphabet, all of which can fit into 9x9 pixels. Instead of drawing countless more, I try to combine <a href="https://www.reddit.com/r/proceduralgeneration/comments/4a69pe/i_suck_at_drawing_so_i_asked_a_deep_neural_net_to/" rel="nofollow noreferrer">... | graphs neural networks randomness network topology | 1 | Which neural network topology is the most efficient to generate randomly shaped letters? -- (graphs neural networks randomness network topology)
<p>I have created some unique shapes, so-called "letters" for a custom alphabet, all of which can fit into 9x9 pixels. Instead of drawing countless more, I try to combine <a h... | habedi/stack-exchange-dataset |
60,434 | Sorting a stack of cards with help of a computer | <p>I have a physical stack of cards, with numbers on them (or, in reality, I have a stack of exams, with students names on them ;)). I want to sort the cards in ascending order.</p>

<p>This is an extremely boring task. I usually use mergesort myself (quick question: what do you use?). But say each card has a Q... | sorting | 1 | Sorting a stack of cards with help of a computer -- (sorting)
<p>I have a physical stack of cards, with numbers on them (or, in reality, I have a stack of exams, with students names on them ;)). I want to sort the cards in ascending order.</p>

<p>This is an extremely boring task. I usually use mergesort myself... | habedi/stack-exchange-dataset |
60,435 | How would the Internet work between planets? | <p>Say that in the future there are people on other planets, e.g., Mars. The one-way communication delay to Mars is <a href="http://www.spaceacademy.net.au/spacelink/commdly.htm" rel="nofollow">between 3 and 21 minutes</a>.</p>

<p>Say we want to connect the people on Mars to the Internet. How would we deal w... | computer networks | 1 | How would the Internet work between planets? -- (computer networks)
<p>Say that in the future there are people on other planets, e.g., Mars. The one-way communication delay to Mars is <a href="http://www.spaceacademy.net.au/spacelink/commdly.htm" rel="nofollow">between 3 and 21 minutes</a>.</p>

<p>Say we want... | habedi/stack-exchange-dataset |
60,437 | Stable matching with constraints | <p>I'm reading through Algorithm Design by Kleinberg and Tardos and was working on Ch1 Q1. The question is about stable matching and their 'proof' is presented by contradiction. I have an alternative argument and want to know if its right. The question paraphrased is:</p>

<blockquote>
 <p>Consider a town ... | algorithms matching | 1 | Stable matching with constraints -- (algorithms matching)
<p>I'm reading through Algorithm Design by Kleinberg and Tardos and was working on Ch1 Q1. The question is about stable matching and their 'proof' is presented by contradiction. I have an alternative argument and want to know if its right. The question paraphras... | habedi/stack-exchange-dataset |
60,442 | Why the number of equivalence classes for the intersection of an irregular language L2 and a regular languge L3 (with 3 EC) can't be determined? | <p>I'm trying to understand why can't we determine the number of equivalence classes of the intersection of L2 which is irregular and L3 which is regular and known to have 3 equivalence classes (L3 can't be empty). Can't we say it has minimum of 1?</p>

<p>Can we determine the number of equivalence classes for ... | formal languages regular languages | 1 | Why the number of equivalence classes for the intersection of an irregular language L2 and a regular languge L3 (with 3 EC) can't be determined? -- (formal languages regular languages)
<p>I'm trying to understand why can't we determine the number of equivalence classes of the intersection of L2 which is irregular and L... | habedi/stack-exchange-dataset |
60,449 | Batch regularization & L2 regularization | <p>Is performing batch regularization in addition to L2 regularization redundant?</p>

<p>Batch regularization: <a href="http://arxiv.org/abs/1502.03167" rel="nofollow">http://arxiv.org/abs/1502.03167</a></p>

<p>Notice how when performing batch regularization, you forgo using a bias term (and instead n... | machine learning neural networks | 1 | Batch regularization & L2 regularization -- (machine learning neural networks)
<p>Is performing batch regularization in addition to L2 regularization redundant?</p>

<p>Batch regularization: <a href="http://arxiv.org/abs/1502.03167" rel="nofollow">http://arxiv.org/abs/1502.03167</a></p>

<p>Notice how w... | habedi/stack-exchange-dataset |
60,452 | Running time of naive recursive implementation of unbounded knapsack problem | <p>How does one go about analyzing the running time of a naive recursive solution to the unbounded knapsack problem? Lots of sources say the naive implementation is "exponential" without giving more detail.</p>

<p>For reference, here's a bit of Python code that implements the brute-force solution. Note that th... | algorithm analysis runtime analysis knapsack problems | 1 | Running time of naive recursive implementation of unbounded knapsack problem -- (algorithm analysis runtime analysis knapsack problems)
<p>How does one go about analyzing the running time of a naive recursive solution to the unbounded knapsack problem? Lots of sources say the naive implementation is "exponential" witho... | habedi/stack-exchange-dataset |
60,460 | Generating all directed acyclic graphs with constraints | <p>I am interested in listing all the unlabeled<sup>1</sup> acyclic digraphs with <em>n</em> vertices which satisfy some additional constraints, such as (a) the resulting graph is connected and (b) except for <code>R</code> identified root vertices, all vertices have two incoming edges and zero or one outgoing edges.</... | algorithms graphs graph isomorphism graph algorithms | 1 | Generating all directed acyclic graphs with constraints -- (algorithms graphs graph isomorphism graph algorithms)
<p>I am interested in listing all the unlabeled<sup>1</sup> acyclic digraphs with <em>n</em> vertices which satisfy some additional constraints, such as (a) the resulting graph is connected and (b) except f... | habedi/stack-exchange-dataset |
60,464 | When is the minimum spanning tree for a graph not unique | <p>Given a weighted, undirected graph G: Which <strong>conditions</strong> must hold true so that there are <strong>multiple</strong> minimum spanning trees for G?</p>

<p>I know that the MST is unique when all of the weights are distinct, but you can't reverse this statement. If there are muliple edges with th... | graphs weighted graphs spanning trees minimum spanning tree | 1 | When is the minimum spanning tree for a graph not unique -- (graphs weighted graphs spanning trees minimum spanning tree)
<p>Given a weighted, undirected graph G: Which <strong>conditions</strong> must hold true so that there are <strong>multiple</strong> minimum spanning trees for G?</p>

<p>I know that the MS... | habedi/stack-exchange-dataset |
60,465 | How do I find running time for the following divide and conquer problem? | <p>Question is to find the runtime $T(n)$ of following problem by solving the recurrence.</p>

<p>$T(n)=16\cdot T(\frac{n}{4}) + n!$.</p>

<p>I went through the following theory.</p>

<p><em>If the recurrence relation is of the form $T(n)=aT(\frac{n}{b}) + \Theta(n^k(\log n)^p)$,where $a \geq 1$... | complexity theory asymptotics discrete mathematics divide and conquer | 1 | How do I find running time for the following divide and conquer problem? -- (complexity theory asymptotics discrete mathematics divide and conquer)
<p>Question is to find the runtime $T(n)$ of following problem by solving the recurrence.</p>

<p>$T(n)=16\cdot T(\frac{n}{4}) + n!$.</p>

<p>I went through... | habedi/stack-exchange-dataset |
60,471 | Is It possible to change the side of 0 and 1 in Huffman tree? | <p>When we are constructing the Huffman tree to get the Huffman codes, Is it possible to give "1" to left side and "0" to right side rather than giving "0" to left side and "1" to right side of the tree?</p>
 | algorithms huffman coding | 1 | Is It possible to change the side of 0 and 1 in Huffman tree? -- (algorithms huffman coding)
<p>When we are constructing the Huffman tree to get the Huffman codes, Is it possible to give "1" to left side and "0" to right side rather than giving "0" to left side and "1" to right side of the tree?</p>
 | habedi/stack-exchange-dataset |
60,474 | How to minimize the following DFA? | <p>Consider the DFA, M=({1, 2, 3, 4, 5, 6}, {a, b}, 1, {2, 5}, δ), whose δ is specified below.</p>

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

<p>I calculated the following and got... | finite automata nondeterminism | 1 | How to minimize the following DFA? -- (finite automata nondeterminism)
<p>Consider the DFA, M=({1, 2, 3, 4, 5, 6}, {a, b}, 1, {2, 5}, δ), whose δ is specified below.</p>

<p><a href="https://i.stack.imgur.com/vn3LX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vn3LX.png" alt="enter image de... | habedi/stack-exchange-dataset |
60,476 | Asymptotic equivalent of the recurrence T(n)=3⋅T(n/2)+n | <p>The questions is to find the running time $T(n)$ of the following function:</p>

<p>$$T(n)=3\cdot T(n/2) + n \tag{1}$$</p>

<p>I know how to solve it using Master theorem for Divide and Conquer but I am trying to solve it by expanding:
$$\textstyle
T(n) = n+\frac{3}{2}n +(\frac{3}{2})^2n + (... | complexity theory asymptotics master theorem divide and conquer | 1 | Asymptotic equivalent of the recurrence T(n)=3⋅T(n/2)+n -- (complexity theory asymptotics master theorem divide and conquer)
<p>The questions is to find the running time $T(n)$ of the following function:</p>

<p>$$T(n)=3\cdot T(n/2) + n \tag{1}$$</p>

<p>I know how to solve it using Master theorem for D... | habedi/stack-exchange-dataset |
60,484 | Maximizing the rank of a binary matrix by zeroing matrix entries | <p>Given a Square Binary Matrix. </p>

<p>The entries of the Matrix are the integers modulo 2 (i.e., GF(2)). The Rank of the Given Matrix is an Integer value R0. </p>

<p>What is the fastest known Algorithm to maximize the Rank of the matrix if the following operations are permitted:</p>

<ol>&#... | algorithms | 1 | Maximizing the rank of a binary matrix by zeroing matrix entries -- (algorithms)
<p>Given a Square Binary Matrix. </p>

<p>The entries of the Matrix are the integers modulo 2 (i.e., GF(2)). The Rank of the Given Matrix is an Integer value R0. </p>

<p>What is the fastest known Algorithm to maximize the ... | habedi/stack-exchange-dataset |
60,486 | Unsure about parse tree of PCFG | <p>I'm new to build parse trees and I'm really unsure if I'm doing this right. So I have this example Grammar (S->Sa, S->aSa, S->a) and the word I'm parsing is simply aaaa.</p>

<p>My solution would look like</p>

<p><a href="https://i.stack.imgur.com/Sf4Ob.png" rel="nofollow noreferrer"><img src="https... | trees parsers tree grammars | 1 | Unsure about parse tree of PCFG -- (trees parsers tree grammars)
<p>I'm new to build parse trees and I'm really unsure if I'm doing this right. So I have this example Grammar (S->Sa, S->aSa, S->a) and the word I'm parsing is simply aaaa.</p>

<p>My solution would look like</p>

<p><a href="https://i.sta... | habedi/stack-exchange-dataset |
60,492 | Spanning tree display conventions | <p>On <a href="http://courses.ics.hawaii.edu/ReviewICS241/morea/trees/SpanningTrees-QA.pdf" rel="nofollow">page two of this discussion of spanning trees</a> there are two different tree structures shown, one labeled <em>DFS tree starting from a as the root</em> and the other labeled <em>Spanning tree created by DFS</em... | algorithms discrete mathematics spanning trees | 1 | Spanning tree display conventions -- (algorithms discrete mathematics spanning trees)
<p>On <a href="http://courses.ics.hawaii.edu/ReviewICS241/morea/trees/SpanningTrees-QA.pdf" rel="nofollow">page two of this discussion of spanning trees</a> there are two different tree structures shown, one labeled <em>DFS tree start... | habedi/stack-exchange-dataset |
60,503 | Reversing topo-order of the original graph instead of the topo-order of the transposed graph? | <p>(Note that my question is different from <a href="https://cs.stackexchange.com/questions/19652/kosaraju-s-algorithm-why-transpose">this one</a>, I understand why we have to do a dfs on a reversed graph, I want to understand why we can't reverse the topological order instead of transposing the graph.)</p>

<p... | graphs | 1 | Reversing topo-order of the original graph instead of the topo-order of the transposed graph? -- (graphs)
<p>(Note that my question is different from <a href="https://cs.stackexchange.com/questions/19652/kosaraju-s-algorithm-why-transpose">this one</a>, I understand why we have to do a dfs on a reversed graph, I want t... | habedi/stack-exchange-dataset |
60,509 | Vertex cover of a graph by removing leaf-vertices from a DFS tree | <p>Question taken from "The Algorithm Design Manual" by Steven S. Skiena, 1997.</p>

<p>A vertex cover of a graph $G=(V,E)$ is a subset of vertices $V'\subseteq V$ such that every edge $e\in E$ contains at least one vertex from $V′$. </p>

<p>Delete all the leaves from any depth-first search tree of $G$... | algorithms algorithm analysis graph traversal | 1 | Vertex cover of a graph by removing leaf-vertices from a DFS tree -- (algorithms algorithm analysis graph traversal)
<p>Question taken from "The Algorithm Design Manual" by Steven S. Skiena, 1997.</p>

<p>A vertex cover of a graph $G=(V,E)$ is a subset of vertices $V'\subseteq V$ such that every edge $e\in E$ c... | habedi/stack-exchange-dataset |
60,510 | Is it possible to produce different shortest path trees using bellman ford and Dijkstra algorithm? | <p>Given a graph G=(V,E) with positive edges weights, Is it possible to produce different shortest path trees for the Bellman-Ford algorithm and Dijkstra's algorithm? </p>
 | algorithms shortest path | 1 | Is it possible to produce different shortest path trees using bellman ford and Dijkstra algorithm? -- (algorithms shortest path)
<p>Given a graph G=(V,E) with positive edges weights, Is it possible to produce different shortest path trees for the Bellman-Ford algorithm and Dijkstra's algorithm? </p>
 | habedi/stack-exchange-dataset |
60,513 | Solving recurrence relation $T(n)=\sqrt{n} \cdot T(\sqrt{n}) + n$ using method of guessing and confirm? | <p>The book I am following explains the solution as,</p>

<blockquote>
 <p>As we can see,the size of sub problems at the first level of recursion
 is $n$.So, let us guess that $T(n)=O(n\log n)$ and try to prove that our guess is correct.</p>
</blockquote>

<p><strong>Doubt-</strong> Does i... | asymptotics recurrence relation | 1 | Solving recurrence relation $T(n)=\sqrt{n} \cdot T(\sqrt{n}) + n$ using method of guessing and confirm? -- (asymptotics recurrence relation)
<p>The book I am following explains the solution as,</p>

<blockquote>
 <p>As we can see,the size of sub problems at the first level of recursion
 is $n$.So, let... | habedi/stack-exchange-dataset |
60,529 | Generators in category theory | <blockquote>
 <p>An object K in a category C is called a generator if, for all pairs of
 morphisms f, g : A → B between arbitrary objects A and B, f = g iff ∀e
 : K → A. f ◦ e = g ◦ e.</p>
</blockquote>

<p>Source: <a href="http://events.cs.bham.ac.uk/mgs2012/lectures/ReddyNotes.pdf" rel="nof... | category theory | 1 | Generators in category theory -- (category theory)
<blockquote>
 <p>An object K in a category C is called a generator if, for all pairs of
 morphisms f, g : A → B between arbitrary objects A and B, f = g iff ∀e
 : K → A. f ◦ e = g ◦ e.</p>
</blockquote>

<p>Source: <a href="http://events.cs.b... | habedi/stack-exchange-dataset |
60,530 | Terminology - What does alphanumeric order mean in relation to decimals? | <p>It is also called <a href="https://en.wikipedia.org/wiki/Natural_sort_order" rel="nofollow">Natural sort order.</a></p>

<blockquote>
 <p><a href="https://blog.codinghorror.com/sorting-for-humans-natural-sort-order/" rel="nofollow">"It's hard to find information on natural sorting"-Jeff Atwood on Coding... | terminology sorting | 1 | Terminology - What does alphanumeric order mean in relation to decimals? -- (terminology sorting)
<p>It is also called <a href="https://en.wikipedia.org/wiki/Natural_sort_order" rel="nofollow">Natural sort order.</a></p>

<blockquote>
 <p><a href="https://blog.codinghorror.com/sorting-for-humans-natural-so... | habedi/stack-exchange-dataset |
60,542 | How to determine if prolog query will give an answer or not? | <p>Explain what will happen if we try to evaluate the query “path(a,e).”. When the query was actually run, it kept looping.I used the following method. Is it correct? </p>

<p>When evaluating $path(Z,e)$, if $path(Z,e):-edge(Z,e)$ was chosen, it would have returned true since there is $edge(b,e)$. But why did t... | prolog | 1 | How to determine if prolog query will give an answer or not? -- (prolog)
<p>Explain what will happen if we try to evaluate the query “path(a,e).”. When the query was actually run, it kept looping.I used the following method. Is it correct? </p>

<p>When evaluating $path(Z,e)$, if $path(Z,e):-edge(Z,e)$ was chos... | habedi/stack-exchange-dataset |
60,559 | What are the differences between parse and decision trees? | <p>I have created a parse tree for the formula: a∧¬(b∨c)∨¬d∧(¬b) successfully.
I am now asked to create a decision tree for the same formula. What are the main differences between a parse tree and a decision tree?</p>
 | logic trees propositional logic bdd | 1 | What are the differences between parse and decision trees? -- (logic trees propositional logic bdd)
<p>I have created a parse tree for the formula: a∧¬(b∨c)∨¬d∧(¬b) successfully.
I am now asked to create a decision tree for the same formula. What are the main differences between a parse tree and a decision tree?</p... | habedi/stack-exchange-dataset |
60,565 | Showing strong connectivity is in DSPACE((logn)^2) | <p>$ST-CONN = \text{{(G,s,t) | G is directed graph, there's path from s to t}}$<br/>
I've learned the following deterministic algorithm to solve the problem in $log^2n$ space:<br/>
$\psi(G,s,t,k) :$ <br/>
$\hspace{1cm}\text{if k == 1: return 1 if there's edge from s to t, else return 0;}$<br/>
$\hspace{... | algorithm analysis turing machines space analysis | 1 | Showing strong connectivity is in DSPACE((logn)^2) -- (algorithm analysis turing machines space analysis)
<p>$ST-CONN = \text{{(G,s,t) | G is directed graph, there's path from s to t}}$<br/>
I've learned the following deterministic algorithm to solve the problem in $log^2n$ space:<br/>
$\psi(G,s,t,k) :$ <br/>&#... | habedi/stack-exchange-dataset |
60,579 | Is this solution to the dining philosopher's problem entirely valid? | <p>In a question <a href="https://stackoverflow.com/a/38361905/2271269">on Stack Overflow</a>, the answer by Patrick Trentin lists the following solution to the <a href="https://en.wikipedia.org/wiki/Dining_philosophers_problem" rel="nofollow noreferrer">dining philosopher's problem</a>:</p>

<blockquote>
 ... | algorithms concurrency deadlocks | 1 | Is this solution to the dining philosopher's problem entirely valid? -- (algorithms concurrency deadlocks)
<p>In a question <a href="https://stackoverflow.com/a/38361905/2271269">on Stack Overflow</a>, the answer by Patrick Trentin lists the following solution to the <a href="https://en.wikipedia.org/wiki/Dining_philos... | habedi/stack-exchange-dataset |
60,584 | Algorithm for length of longest common subsequence | <p>The case of multiple strings. A slight modification of the dynamic programming algorithm for two strings is used as a subroutine. Here is the pseudo code:</p>

<pre><code># The modified dynamic programming algorithm for longest common subsequence.
# Inputs: x, y - the strings
 xL, yL - their... | algorithms optimization strings correctness proof | 1 | Algorithm for length of longest common subsequence -- (algorithms optimization strings correctness proof)
<p>The case of multiple strings. A slight modification of the dynamic programming algorithm for two strings is used as a subroutine. Here is the pseudo code:</p>

<pre><code># The modified dynamic programmi... | habedi/stack-exchange-dataset |
60,585 | Generate random point inside a polyhedron | <p>I would like to know if there are <em>known</em> algorithms for generating a random point(say following a probability distribution <em>P</em>) inside an arbitrary polyhedron(possibly non-convex and may contain holes)?</p>

<p>I find approaches for 2D case like the one described <a href="https://stackoverflow... | algorithms computational geometry | 1 | Generate random point inside a polyhedron -- (algorithms computational geometry)
<p>I would like to know if there are <em>known</em> algorithms for generating a random point(say following a probability distribution <em>P</em>) inside an arbitrary polyhedron(possibly non-convex and may contain holes)?</p>

<p>I ... | habedi/stack-exchange-dataset |
60,588 | Why are these (lossless) compression methods of many similar png images ineffective? | <p>I just came across the following thing: I put multiple identical copies of a png image into a folder and then tried to compress that folder with the following methods:</p>

<ul>
<li><code>tar czf folder.tar.gz folder/</code></li>
<li><code>tar cf folder.tar folder/ && xz --stdout folder.tar &... | data compression | 1 | Why are these (lossless) compression methods of many similar png images ineffective? -- (data compression)
<p>I just came across the following thing: I put multiple identical copies of a png image into a folder and then tried to compress that folder with the following methods:</p>

<ul>
<li><code>tar czf fo... | habedi/stack-exchange-dataset |
60,593 | NP-hardness of maximum set cover with even/odd coverage requirement | <p>Given universal set $U=X \cup Y = \{x_1, \ldots, x_{n_1} \} \cup \{y_1, \ldots, y_{n_2}\}$ where $X \cap Y = \emptyset$
and sets $\mathcal{S}=\{s_1, \ldots, s_m\}$ such that $s_i \subseteq U$ for all $i=1,\ldots,m$ and integer $k \in \mathbb{Z}^{+}$.</p>

<p>Find $\mathcal{C} \subseteq \mathcal{S}$ (deno... | optimization np hard np discrete mathematics set cover | 1 | NP-hardness of maximum set cover with even/odd coverage requirement -- (optimization np hard np discrete mathematics set cover)
<p>Given universal set $U=X \cup Y = \{x_1, \ldots, x_{n_1} \} \cup \{y_1, \ldots, y_{n_2}\}$ where $X \cap Y = \emptyset$
and sets $\mathcal{S}=\{s_1, \ldots, s_m\}$ such that $s_i \subse... | habedi/stack-exchange-dataset |
60,600 | Number of cycles that arithmetic instruction takes for 25% improvement in performance? | <p>The program has the following proportion of instructions:
Arithmetic: 70%
Load/Store: 10%
Branch: 20%</p>

<p>The question is to <code>find the number of cycles on average that an arithmetic instruction take for a 25% improvement in performance if load/store and branch instructions are not improv... | computer architecture | 1 | Number of cycles that arithmetic instruction takes for 25% improvement in performance? -- (computer architecture)
<p>The program has the following proportion of instructions:
Arithmetic: 70%
Load/Store: 10%
Branch: 20%</p>

<p>The question is to <code>find the number of cycles on average that an ari... | habedi/stack-exchange-dataset |
60,607 | Is the inverse of MST cycle property always true? Why? | <p>I am trying to find an algorithm which would check for each edge in a given weighted undirected graph whether it belongs to any of the graph's Minimum Spanning Trees.</p>

<p>I have found many potential solutions to this problem, which use the cycle property of MSTs, that is (quoting Wikipedia):
<em>For ... | algorithms graphs correctness proof minimum spanning tree | 1 | Is the inverse of MST cycle property always true? Why? -- (algorithms graphs correctness proof minimum spanning tree)
<p>I am trying to find an algorithm which would check for each edge in a given weighted undirected graph whether it belongs to any of the graph's Minimum Spanning Trees.</p>

<p>I have found man... | habedi/stack-exchange-dataset |
60,623 | Hardness amplification of PRFs by increasing key length | <p>I was reading the GGM construction for PRFs and wondering the relation between key length and hardness. GGM construction does not seem to yield any significant improvements. Are there any PRF constructions which take into account key length for increasing hardness? Alternatively, are there any constructions which tr... | complexity theory pseudo random generators | 1 | Hardness amplification of PRFs by increasing key length -- (complexity theory pseudo random generators)
<p>I was reading the GGM construction for PRFs and wondering the relation between key length and hardness. GGM construction does not seem to yield any significant improvements. Are there any PRF constructions which t... | habedi/stack-exchange-dataset |
60,626 | Sifting algorithm for group generated by a set | <p>On page 38 of "Lecture Notes in Computer Science" by Christoph M. Hoffmann, there is an algorithm (ALGORITHM 2).</p>

<p>I have some confusions.</p>

<p><a href="https://i.stack.imgur.com/uTTrg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uTTrg.jpg" alt="enter image description... | algorithms group theory | 1 | Sifting algorithm for group generated by a set -- (algorithms group theory)
<p>On page 38 of "Lecture Notes in Computer Science" by Christoph M. Hoffmann, there is an algorithm (ALGORITHM 2).</p>

<p>I have some confusions.</p>

<p><a href="https://i.stack.imgur.com/uTTrg.jpg" rel="nofollow noreferrer"... | habedi/stack-exchange-dataset |
60,630 | DFS for all possible walks from a source to a destination with exactly k edges | <p>Problem Statement: Given a directed graph and two vertices ‘u’ and ‘v’ in it, count all possible walks from ‘u’ to ‘v’ with exactly k edges on the walk.</p>

<p>My question is that, say we have a DAG (directed acyclic graph), can DFS be a solution to the problem? I understand that native DFS would fail for t... | algorithms graphs counting | 1 | DFS for all possible walks from a source to a destination with exactly k edges -- (algorithms graphs counting)
<p>Problem Statement: Given a directed graph and two vertices ‘u’ and ‘v’ in it, count all possible walks from ‘u’ to ‘v’ with exactly k edges on the walk.</p>

<p>My question is that, say we have a DA... | habedi/stack-exchange-dataset |
60,634 | Find Divisible Sum Pairs in an array in O(n) time | <p>You are given an array of n integers <code>a0, a1, .. an</code> and a positive integer <code>k</code>. Find and print the number of pairs <code>(i,j)</code> where <code>i<j</code> and <code>i+j</code> is evenly divisible by k (Which is <code>i+j % k == 0</code>). This problem has been taken from <a href="https://... | algorithms arrays modular arithmetic | 1 | Find Divisible Sum Pairs in an array in O(n) time -- (algorithms arrays modular arithmetic)
<p>You are given an array of n integers <code>a0, a1, .. an</code> and a positive integer <code>k</code>. Find and print the number of pairs <code>(i,j)</code> where <code>i<j</code> and <code>i+j</code> is evenly divisible b... | habedi/stack-exchange-dataset |
60,635 | I can't understand this example of PDA Automata | <p>looking for old tests of Language Theory, I see this exercise:</p>

<p>Give a PDA automata that recognize the language $L = \{w \in \{a,b\}^*,\ 2|w|_a=3|w|_b\}$</p>

<p>They propose this solution:
<a href="https://i.stack.imgur.com/fLKS4.png" rel="nofollow noreferrer"><img src="https://i.stack.im... | automata pushdown automata | 1 | I can't understand this example of PDA Automata -- (automata pushdown automata)
<p>looking for old tests of Language Theory, I see this exercise:</p>

<p>Give a PDA automata that recognize the language $L = \{w \in \{a,b\}^*,\ 2|w|_a=3|w|_b\}$</p>

<p>They propose this solution:
<a href="https://i.s... | habedi/stack-exchange-dataset |
60,640 | Time complexity of Depth First Search | <p>Please forgive me for asking a novice question, but I'm a beginner at algorithms and complexities, and it's sometimes hard to understand how the complexity for a specific algorithm has come about.</p>

<p>I was reading the DFS algorithm from <em>Introduction to Algorithms by Cormen</em>, and this was the alg... | graphs algorithm analysis runtime analysis trees graph traversal | 1 | Time complexity of Depth First Search -- (graphs algorithm analysis runtime analysis trees graph traversal)
<p>Please forgive me for asking a novice question, but I'm a beginner at algorithms and complexities, and it's sometimes hard to understand how the complexity for a specific algorithm has come about.</p>

... | habedi/stack-exchange-dataset |
60,642 | Using oracle machine to speed up tree solution search | <p>Let $P$ be a boolean problem of size $n$, thus the complete solution search space tree is of size $2^n$. Applying simple tree search for the solution will have take $O(2^n)$ operations, (for simplicity let's assume we do not apply any cuts).</p>

<p>Let $M$ be an <em>oracle machine</em> able to solve a probl... | complexity theory decision problem oracle machines | 1 | Using oracle machine to speed up tree solution search -- (complexity theory decision problem oracle machines)
<p>Let $P$ be a boolean problem of size $n$, thus the complete solution search space tree is of size $2^n$. Applying simple tree search for the solution will have take $O(2^n)$ operations, (for simplicity let's... | habedi/stack-exchange-dataset |
60,647 | Modify DFA/NFA that accepts Language Subset with only Palindromes (with Size Limit)? | <p>Given a DFA (D1) with P1 states, that accepts a language L1. </p>

<p>Modify (D1) to create another DFA (D2), such that it will accept the language L2 that is defined as: All strings in L1 that are also a palindrome (of maximum length P1).</p>

<p>How many states would the minimized D2 have (worst ca... | regular languages automata | 1 | Modify DFA/NFA that accepts Language Subset with only Palindromes (with Size Limit)? -- (regular languages automata)
<p>Given a DFA (D1) with P1 states, that accepts a language L1. </p>

<p>Modify (D1) to create another DFA (D2), such that it will accept the language L2 that is defined as: All strings in L1 tha... | habedi/stack-exchange-dataset |
60,654 | Finding a minimal width strip which encloses a set of points in the plane | <p><em>Problem</em>: Consider a set of $n$ points in the plane, how could we find a strip of minimal vertical distance that contains all points?</p>

<p><em>Definitions</em>: A strip is defined by two parallel lines and the vertical distance is defined as the distance between their intersection points with the ... | computational geometry linear programming duality | 1 | Finding a minimal width strip which encloses a set of points in the plane -- (computational geometry linear programming duality)
<p><em>Problem</em>: Consider a set of $n$ points in the plane, how could we find a strip of minimal vertical distance that contains all points?</p>

<p><em>Definitions</em>: A strip ... | habedi/stack-exchange-dataset |
60,657 | What do you call a "non-probabilistic Bloom Filter"? | <p>One of my coworkers came up with a nice technique to solve a problem and I feel like it must already have a name. I just don't don't know how to figure out what it is.</p>

<p>It is a technique for caching easy answers for a subset of an input domain before falling back to an expensive computation. In that r... | data structures bloom filters | 1 | What do you call a "non-probabilistic Bloom Filter"? -- (data structures bloom filters)
<p>One of my coworkers came up with a nice technique to solve a problem and I feel like it must already have a name. I just don't don't know how to figure out what it is.</p>

<p>It is a technique for caching easy answers fo... | habedi/stack-exchange-dataset |
60,661 | How are the number of bytes less than the number of pixels in an image? | <p>Lets take, for example this jpeg image here</p>

<p><a href="https://i.stack.imgur.com/f94hv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f94hv.jpg" alt="example"></a></p>

<p>The image there is 400 x 300, or 120000 pixels and The file size of the image (on my computer) is shown... | image processing data compression storage | 1 | How are the number of bytes less than the number of pixels in an image? -- (image processing data compression storage)
<p>Lets take, for example this jpeg image here</p>

<p><a href="https://i.stack.imgur.com/f94hv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f94hv.jpg" alt="example"></a><... | habedi/stack-exchange-dataset |
60,673 | Is unrestricted grammar equivalent to deterministic Turing machine? | <p>Suppose we have unrestricted grammar but with restrictions on how rules are applied: we take first rule, search in string left to right and apply it as we go. If no match found, we proceed with second rule and so on. Else, if match(es) is found, we return to first rule and start of the string and start loop again.<b... | turing machines formal grammars | 1 | Is unrestricted grammar equivalent to deterministic Turing machine? -- (turing machines formal grammars)
<p>Suppose we have unrestricted grammar but with restrictions on how rules are applied: we take first rule, search in string left to right and apply it as we go. If no match found, we proceed with second rule and so... | habedi/stack-exchange-dataset |
60,677 | set with maximum sum consisting of mutually co-prime numbers | <p><strong>Definitions.</strong> Let $n$ be a natural number and $S$ be a subset of distinct natural numbers all less than $n$, and <em>mutually co-prime</em>. Then find the maximum sum the set $S$ can have.<br><br>
<strong>Example.</strong> Let $n=10$, then the maximum sum $S$ can have is $30$ corresponding to $S=... | greedy algorithms number theory | 1 | set with maximum sum consisting of mutually co-prime numbers -- (greedy algorithms number theory)
<p><strong>Definitions.</strong> Let $n$ be a natural number and $S$ be a subset of distinct natural numbers all less than $n$, and <em>mutually co-prime</em>. Then find the maximum sum the set $S$ can have.<br><br>
<s... | habedi/stack-exchange-dataset |
60,683 | Does a NFA/DFA need a failure state? | <p>I'm learning for my exam in theoretical computer science and I'm not sure about it, because I got different sources with different answers. So I wanted to ask here: </p>

<p>If I draw a NFA/DFA and I maybe don't need the transition from a state $z_k \rightarrow z_{k+1}$ with a $0$ above the alphabet $\Sigm... | automata finite automata | 1 | Does a NFA/DFA need a failure state? -- (automata finite automata)
<p>I'm learning for my exam in theoretical computer science and I'm not sure about it, because I got different sources with different answers. So I wanted to ask here: </p>

<p>If I draw a NFA/DFA and I maybe don't need the transition from a sta... | habedi/stack-exchange-dataset |
60,685 | Algorithm to find the first person in front of $A$ that is shorter than $A$ | <p>We have an array of $n$ positive integers $a_0,a_1\dots a_{n-1}$ and let $a_n=0$.</p>

<p>I need to build an array $b_0,b_1\dots b_{n-1}$ such that $b_i$ is the first integer larger than $i$ with $a_{b_i}\leq a_i$. (Note that there is no requirement that the $b_i$ be distinct.)</p>

<p>Does anybody... | algorithms arrays | 1 | Algorithm to find the first person in front of $A$ that is shorter than $A$ -- (algorithms arrays)
<p>We have an array of $n$ positive integers $a_0,a_1\dots a_{n-1}$ and let $a_n=0$.</p>

<p>I need to build an array $b_0,b_1\dots b_{n-1}$ such that $b_i$ is the first integer larger than $i$ with $a_{b_i}\leq ... | habedi/stack-exchange-dataset |
60,701 | Does Damas-Milner still have principal types if existential type schemata are added? | <p>In the Damas-Milner type system, type schemata can be formed in two ways:</p>

<ul>
<li>$T$</li>
<li>$\forall X. S$</li>
</ul>

<p>Where $T$ ranges over monotypes and $S$ ranges over type schemata. The type-checking algorithm for this system is well known, and explanations of it can be fo... | type theory type checking type inference | 1 | Does Damas-Milner still have principal types if existential type schemata are added? -- (type theory type checking type inference)
<p>In the Damas-Milner type system, type schemata can be formed in two ways:</p>

<ul>
<li>$T$</li>
<li>$\forall X. S$</li>
</ul>

<p>Where $T$ ranges over monot... | habedi/stack-exchange-dataset |
60,715 | Hash for verifying both compressed and uncompressed data? | <p>Is it possible to have a single hash function output simultaneously verify a compressed block of data as well as its uncompressed counterpart?</p>

<p>Trivially one could just use a hash function twice (once on the uncompressed version and again on the compressed version) and concatenate the outputs, or use ... | hash data compression | 1 | Hash for verifying both compressed and uncompressed data? -- (hash data compression)
<p>Is it possible to have a single hash function output simultaneously verify a compressed block of data as well as its uncompressed counterpart?</p>

<p>Trivially one could just use a hash function twice (once on the uncompres... | habedi/stack-exchange-dataset |
60,720 | What does the exact $\mu$-recursive program for minimization look like? | <p>The minimization of a given primitive recursive function $f$ is computed by the following expression:</p>

<p>$
\newcommand{\pr}[2]{\text{pr}^{#1}_{#2}}
\newcommand{\gpr}{\text{Pr}}
\newcommand{\sig}{\text{sgn}}
\text{Mn}[f] = \gpr[g, h] \circ (\pr{1}{1}, \pr{1}{1})
$</p>

<p>$g =... | computability primitive recursion mu recursion | 1 | What does the exact $\mu$-recursive program for minimization look like? -- (computability primitive recursion mu recursion)
<p>The minimization of a given primitive recursive function $f$ is computed by the following expression:</p>

<p>$
\newcommand{\pr}[2]{\text{pr}^{#1}_{#2}}
\newcommand{\gpr}{\text{... | habedi/stack-exchange-dataset |
60,721 | Can there be a context-sensitive pumping lemma? | <p>A "pumping" property (words of a certain length imply the existence of loops in the language-defining mechanism) are known to exist for regular and context-free languages and a few more (usually used to disprove a language's membership to a certain class).</p>

<p>Within the discussion <a href="https://stack... | formal languages pumping lemma context sensitive | 1 | Can there be a context-sensitive pumping lemma? -- (formal languages pumping lemma context sensitive)
<p>A "pumping" property (words of a certain length imply the existence of loops in the language-defining mechanism) are known to exist for regular and context-free languages and a few more (usually used to disprove a l... | habedi/stack-exchange-dataset |
60,734 | Count elements in the real world in constant time by weighing them | <p>I suppose that counting n elements should be linear time, right? It takes double time to count double number of elements. But in the real world, it is faster and O(1) to weigh elements and find out the total weight so in the real world you can count n elements O(1) just by putting all the elements on a scale and div... | time complexity computation models counting | 1 | Count elements in the real world in constant time by weighing them -- (time complexity computation models counting)
<p>I suppose that counting n elements should be linear time, right? It takes double time to count double number of elements. But in the real world, it is faster and O(1) to weigh elements and find out the... | habedi/stack-exchange-dataset |
60,735 | Why does using unary in subset sum problem result polynomial time complexity? | <p>From my understanding, the complexity of the algorithm is <code>O(number of inputs * number of bits for input)</code>.
The number of bits in binary notation is obviously less than the number of bits in unary notation. Then why is it that for binary, complexity is exponential but for unary, it is polynomial?</p>&... | algorithms complexity theory algorithm analysis runtime analysis | 1 | Why does using unary in subset sum problem result polynomial time complexity? -- (algorithms complexity theory algorithm analysis runtime analysis)
<p>From my understanding, the complexity of the algorithm is <code>O(number of inputs * number of bits for input)</code>.
The number of bits in binary notation is obvio... | habedi/stack-exchange-dataset |
60,736 | Understanding the Broyden–Fletcher–Goldfarb–Shanno Algorithm to Select Weights for Neural Nets | <p>I am trying to train and implement a Neural Network. I was reading a few articles, learning about their principles and the math that goes behind them. However, while I was trying to understand the math, specifically the optimization part (for selecting weights), I ran into a problem: I couldn’t understand the Broyde... | algorithms optimization artificial intelligence neural networks numerical algorithms | 1 | Understanding the Broyden–Fletcher–Goldfarb–Shanno Algorithm to Select Weights for Neural Nets -- (algorithms optimization artificial intelligence neural networks numerical algorithms)
<p>I am trying to train and implement a Neural Network. I was reading a few articles, learning about their principles and the math that... | habedi/stack-exchange-dataset |
60,737 | FInding number of ancestors at given depth | <p>I have a rooted tree with $n$ vertices.</p>

<p>I want to be able to answer the given queries in logarithmic time after setting up some sort of data structure (preferably in time $n\log n$.</p>

<p>The query is given by $v$ and $k$.</p>

<p>I want to find the number of ancestors of $v$ of deg... | algorithms trees | 1 | FInding number of ancestors at given depth -- (algorithms trees)
<p>I have a rooted tree with $n$ vertices.</p>

<p>I want to be able to answer the given queries in logarithmic time after setting up some sort of data structure (preferably in time $n\log n$.</p>

<p>The query is given by $v$ and $k$.</p>... | habedi/stack-exchange-dataset |
60,738 | MTBF calculation with 2 units connected in series | <p>Me and a friend have a opinion difference regarding a question that got asked in a previous IT test. </p>

<p>The short version:</p>

<p>2 units, <code>n</code> and <code>m</code> are connected in series but operate as one system. <code>n</code> has a MTBF of 200, <code>m</code> of 300. What is the M... | logic | 1 | MTBF calculation with 2 units connected in series -- (logic)
<p>Me and a friend have a opinion difference regarding a question that got asked in a previous IT test. </p>

<p>The short version:</p>

<p>2 units, <code>n</code> and <code>m</code> are connected in series but operate as one system. <code>n</... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.