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 |
|---|---|---|---|---|---|---|
118,321 | NP-completeness for integer linear program | <p>This is a homework problem, so I don't want the solution. I need a hint which problem to reduce to the following and/or how to start on it. We were thinking of TSP or independent set but couldn't come up with a solution.</p>

<p>We have <span class="math-container">$i\ldots j$</span> stores and <span class="... | np complete reductions decision problem | 1 | NP-completeness for integer linear program -- (np complete reductions decision problem)
<p>This is a homework problem, so I don't want the solution. I need a hint which problem to reduce to the following and/or how to start on it. We were thinking of TSP or independent set but couldn't come up with a solution.</p>
... | habedi/stack-exchange-dataset |
118,322 | Why is the assignment rule the way it is in Hoare Logic? | <p>Why is the assignment rule the way it is in Hoare Logic/Axiomatic Semantics?
I can't wrap my head around why the assignment rule is backwards from what I expected.</p>

<p>I understand Hoare logic is use to prove formal propositions of the state of a program as commands are executed. Thus, if we execute ... | programming languages logic semantics software verification hoare logic | 1 | Why is the assignment rule the way it is in Hoare Logic? -- (programming languages logic semantics software verification hoare logic)
<p>Why is the assignment rule the way it is in Hoare Logic/Axiomatic Semantics?
I can't wrap my head around why the assignment rule is backwards from what I expected.</p>

<p... | habedi/stack-exchange-dataset |
118,336 | Dijkstra with max instead of sum | <p>Is it true that if we replace in the Dijkstra algorithm <code>+</code> with <code>max</code>, then the resulting algorithm correctly solves the problem of finding the shortest paths where the length of the path is measured as the maximum of its edge weights?</p>
 | algorithms graphs shortest path weighted graphs | 1 | Dijkstra with max instead of sum -- (algorithms graphs shortest path weighted graphs)
<p>Is it true that if we replace in the Dijkstra algorithm <code>+</code> with <code>max</code>, then the resulting algorithm correctly solves the problem of finding the shortest paths where the length of the path is measured as the m... | habedi/stack-exchange-dataset |
118,346 | Complexity of minimizing the maximum inter-cluster distance? | <p>Given <span class="math-container">$n$</span> non overlapping points <span class="math-container">$x_i \in \mathbb{Q}$</span>, and an integer <span class="math-container">$k\geq 2$</span>, <strong>what is known about the complexity</strong> of finding <span class="math-container">$k$</span> means (<span class="math-... | algorithms complexity theory | 1 | Complexity of minimizing the maximum inter-cluster distance? -- (algorithms complexity theory)
<p>Given <span class="math-container">$n$</span> non overlapping points <span class="math-container">$x_i \in \mathbb{Q}$</span>, and an integer <span class="math-container">$k\geq 2$</span>, <strong>what is known about the c... | habedi/stack-exchange-dataset |
118,366 | Question for "Only if" part for the theorem "A language is Turing-recognizable iff some enumerator enumerates it." | <p>I am trying to prove the theorem</p>

<blockquote>
 <p>A language is Turing-recognizable iff some enumerator enumerates it.</p>
</blockquote>

<p>I proved the "if" part, but I have no idea of proving the "only if" part, so I searched a proof for the "only if" part of this theorem. In the pro... | turing machines | 1 | Question for "Only if" part for the theorem "A language is Turing-recognizable iff some enumerator enumerates it." -- (turing machines)
<p>I am trying to prove the theorem</p>

<blockquote>
 <p>A language is Turing-recognizable iff some enumerator enumerates it.</p>
</blockquote>

<p>I proved t... | habedi/stack-exchange-dataset |
118,383 | Validity of self refering state with linear temporal logic 'X' connective | <p><a href="https://i.stack.imgur.com/QGqSm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QGqSm.png" alt="enter image description here"></a></p>

<p>Lets say we have model like the one above or a similar one where a node refers back to itself. </p>

<p>Now let's say if I want to kno... | linear temporal logic | 1 | Validity of self refering state with linear temporal logic 'X' connective -- (linear temporal logic)
<p><a href="https://i.stack.imgur.com/QGqSm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QGqSm.png" alt="enter image description here"></a></p>

<p>Lets say we have model like the one above... | habedi/stack-exchange-dataset |
118,399 | Probability of detecting errors in codewords | <p>I have been struggling with the below question for quite some time, and I don't have a pointer to move forward.</p>

<blockquote>
 <p>A certain Error Control Coding scheme using block codes takes an input block (dataword) of 500 bits
 and appends a 50 bit code to produce a 550 bit codeword which is... | probability theory computer networks error correcting codes | 1 | Probability of detecting errors in codewords -- (probability theory computer networks error correcting codes)
<p>I have been struggling with the below question for quite some time, and I don't have a pointer to move forward.</p>

<blockquote>
 <p>A certain Error Control Coding scheme using block codes take... | habedi/stack-exchange-dataset |
118,409 | Weighted Average of Multi-Output Neural Networks | <p>[1] discusses how to construct an ensemble of neural networks by giving each network a certain weight <span class="math-container">$\alpha_i$</span>:
<span class="math-container">\begin{equation}
f_\mathrm{GEM}(\boldsymbol{x}) = \sum_{i=1}^N \alpha_i f_i(\boldsymbol{x})
\end{equation}</span>
where ea... | neural networks | 1 | Weighted Average of Multi-Output Neural Networks -- (neural networks)
<p>[1] discusses how to construct an ensemble of neural networks by giving each network a certain weight <span class="math-container">$\alpha_i$</span>:
<span class="math-container">\begin{equation}
f_\mathrm{GEM}(\boldsymbol{x}) = \sum_{i=1}... | habedi/stack-exchange-dataset |
118,414 | How to convert a centralized algorithm to a distributed algorithm? | <p>Is there any algorithm or procedure to convert a centralized algorithm to a distributed algorithm? Is there any theoretical result or relevant complexity analysis? </p>
 | distributed systems | 1 | How to convert a centralized algorithm to a distributed algorithm? -- (distributed systems)
<p>Is there any algorithm or procedure to convert a centralized algorithm to a distributed algorithm? Is there any theoretical result or relevant complexity analysis? </p>
 | habedi/stack-exchange-dataset |
118,415 | Can polynomial many-to-one reduction be done to a specific problem instance? | <p>Let's say I reduce the problem <span class="math-container">$A \in L$</span> to <span class="math-container">$B \in K$</span> , with a function <span class="math-container">$f: \Sigma^{*} \rightarrow \Gamma^{*}$</span> such that <span class="math-container">$w \in L \Leftrightarrow f(w) \in K$</span> . I know if I w... | complexity theory reductions | 1 | Can polynomial many-to-one reduction be done to a specific problem instance? -- (complexity theory reductions)
<p>Let's say I reduce the problem <span class="math-container">$A \in L$</span> to <span class="math-container">$B \in K$</span> , with a function <span class="math-container">$f: \Sigma^{*} \rightarrow \Gamma... | habedi/stack-exchange-dataset |
118,420 | Find a Context-Free Grammar for $L:=\{a^nb^mc^{n+m}\mid n,m\in\mathbb{N}\}$ | <blockquote>
 <p>I want to find a Context-Free Grammar for <span class="math-container">$L:=\{a^nb^mc^{n+m}\mid n,m\in\mathbb{N}\}$</span></p>
</blockquote>

<p>I've tried the following:</p>

<p><span class="math-container">$G=(V,\Sigma,R,S)$</span> with <span class="math-container">$\Sigma=\{a... | context free formal grammars | 1 | Find a Context-Free Grammar for $L:=\{a^nb^mc^{n+m}\mid n,m\in\mathbb{N}\}$ -- (context free formal grammars)
<blockquote>
 <p>I want to find a Context-Free Grammar for <span class="math-container">$L:=\{a^nb^mc^{n+m}\mid n,m\in\mathbb{N}\}$</span></p>
</blockquote>

<p>I've tried the following:</p>&#x... | habedi/stack-exchange-dataset |
118,427 | Why does $L = \{ 0^n 1^n \space | \space n \in \mathbb{N} \}$ belong to $\mathrm{P}$? | <p>My professor said that the <em>non-regular</em> language <span class="math-container">$L_{1} = \{ 0^n 1^n \space | \space n \in \mathbb{N} \}$</span> belongs to <span class="math-container">$\mathrm{P}$</span>. I do understand that all regular languages belong to <span class="math-container">$\mathrm{P}$</span> as i... | complexity theory time complexity regular languages finite automata | 1 | Why does $L = \{ 0^n 1^n \space | \space n \in \mathbb{N} \}$ belong to $\mathrm{P}$? -- (complexity theory time complexity regular languages finite automata)
<p>My professor said that the <em>non-regular</em> language <span class="math-container">$L_{1} = \{ 0^n 1^n \space | \space n \in \mathbb{N} \}$</span> belongs ... | habedi/stack-exchange-dataset |
118,449 | WebHook versus API | <p>I've read many blogs about this but I still get somehow confused, specially why a webhook is a thing vs an API and not just a subset of API. </p>

<p>The way I interpret from most places (and interpret is the key work here) is that a webhook is just a passive "webmethod" that expects a POST (from what I read... | terminology api design | 1 | WebHook versus API -- (terminology api design)
<p>I've read many blogs about this but I still get somehow confused, specially why a webhook is a thing vs an API and not just a subset of API. </p>

<p>The way I interpret from most places (and interpret is the key work here) is that a webhook is just a passive "w... | habedi/stack-exchange-dataset |
118,451 | Why this greedy algorithm fails in rod cutting problem? | <p>Recall the rod cutting problem.</p>

<blockquote>
 <p>Given a rod of length <span class="math-container">$n$</span> inches and a table of prices <span class="math-container">$p_{i}$</span> for <span class="math-container">$i=1,2,3,4,\,.\,.\,.$</span> determine the maximum revenue <span class="math-conta... | algorithms dynamic programming greedy algorithms | 1 | Why this greedy algorithm fails in rod cutting problem? -- (algorithms dynamic programming greedy algorithms)
<p>Recall the rod cutting problem.</p>

<blockquote>
 <p>Given a rod of length <span class="math-container">$n$</span> inches and a table of prices <span class="math-container">$p_{i}$</span> for <... | habedi/stack-exchange-dataset |
118,452 | Grammar with fewest variables | <p>I am looking over a past exam for a theory of computation class I am taking, and unfortunately no solutions are provided. I am stuck on this question, and would greatly appreciate any help or hints. </p>

<ol>
<li><p>The Myhill-Nerode Theorem provides the minimum number of states of a DFA to recognize a ... | formal languages computability formal grammars | 1 | Grammar with fewest variables -- (formal languages computability formal grammars)
<p>I am looking over a past exam for a theory of computation class I am taking, and unfortunately no solutions are provided. I am stuck on this question, and would greatly appreciate any help or hints. </p>

<ol>
<li><p>The My... | habedi/stack-exchange-dataset |
118,458 | How does $LL(n)$ languages compare with $LR(0)$, for $n>0$? | <p>In the context of languages (not grammars), I know following:</p>

<blockquote>
 <ol>
 <li><span class="math-container">$LL(0) \subset LL(1) \subset LL(2) \subset \cdots \subset LL(k)$</span></li>
 <li><span class="math-container">$LR(0) \subset SLR(1) = LALR(1) = LR(1) = SLR(k) = LALR(k) = LR... | formal languages formal grammars parsers | 1 | How does $LL(n)$ languages compare with $LR(0)$, for $n>0$? -- (formal languages formal grammars parsers)
<p>In the context of languages (not grammars), I know following:</p>

<blockquote>
 <ol>
 <li><span class="math-container">$LL(0) \subset LL(1) \subset LL(2) \subset \cdots \subset LL(k)$</span></... | habedi/stack-exchange-dataset |
118,469 | How to write grammar production rules to describe recursive structures? | <p>I'm trying to describe a data structure by production rules. The structure is recursive; say a list of type <span class="math-container">$A$</span> made of elements of type <span class="math-container">$A$</span> or <span class="math-container">$B$</span>.</p>

<p>Writing the grammar, I build this:</p>
&... | data structures formal grammars | 1 | How to write grammar production rules to describe recursive structures? -- (data structures formal grammars)
<p>I'm trying to describe a data structure by production rules. The structure is recursive; say a list of type <span class="math-container">$A$</span> made of elements of type <span class="math-container">$A$</s... | habedi/stack-exchange-dataset |
118,478 | Deriving recursive definition from function specification | <p>Given this function specification, where name <code>xs</code> is bound to a list, <code>#</code> denotes its cardinality and <code>.</code> is the <code>list index</code> operator...</p>

<p><span class="math-container">$$\left( \sum i: 0 \leq i < \#xs: xs.i * (i + 1) \right)$$</span></p>

<p>I ne... | proof techniques recursion induction calculus of constructions | 1 | Deriving recursive definition from function specification -- (proof techniques recursion induction calculus of constructions)
<p>Given this function specification, where name <code>xs</code> is bound to a list, <code>#</code> denotes its cardinality and <code>.</code> is the <code>list index</code> operator...</p>
... | habedi/stack-exchange-dataset |
118,490 | Normalization in IBM hexadecimal floating point | <p>According to the Wikipedia <a href="https://en.wikipedia.org/wiki/IBM_hexadecimal_floating_point" rel="nofollow noreferrer">link</a> of IBM hexadecimal floating point:</p>

<blockquote>
 <p>Consider encoding the value −118.625 as an IBM single-precision
 floating-point value.</p>
 
 <p>Th... | floating point numeral representations | 1 | Normalization in IBM hexadecimal floating point -- (floating point numeral representations)
<p>According to the Wikipedia <a href="https://en.wikipedia.org/wiki/IBM_hexadecimal_floating_point" rel="nofollow noreferrer">link</a> of IBM hexadecimal floating point:</p>

<blockquote>
 <p>Consider encoding the ... | habedi/stack-exchange-dataset |
118,507 | Why does the category of language types have morphisms, not functors? | <p>I am probably not phrasing this question well, so please bear with me as I try to explain what I mean.</p>

<p>I am working on learning category theory, as applied to programming. So far, I understand that:</p>

<ul>
<li>Objects in a category are "unbroken"; you're not supposed to peer inside th... | programming languages category theory | 1 | Why does the category of language types have morphisms, not functors? -- (programming languages category theory)
<p>I am probably not phrasing this question well, so please bear with me as I try to explain what I mean.</p>

<p>I am working on learning category theory, as applied to programming. So far, I under... | habedi/stack-exchange-dataset |
118,508 | Winning strategy for a given game on graphs | <p>The game goes as follows. Two players are playing a game, player 1 and player 2, in which the first player starts by naming a hero <span class="math-container">$h_1$</span>, then player 2 responds with a villain <span class="math-container">$v_1$</span> who has played in a movie with <span class="math-container">$h_... | algorithms graphs bipartite matching game theory | 1 | Winning strategy for a given game on graphs -- (algorithms graphs bipartite matching game theory)
<p>The game goes as follows. Two players are playing a game, player 1 and player 2, in which the first player starts by naming a hero <span class="math-container">$h_1$</span>, then player 2 responds with a villain <span c... | habedi/stack-exchange-dataset |
118,514 | Is it decidable whether a given Turing machine moves its head more than 481 cells away from the left-end marker, on input ε? | <p>So, while reading some problems on decidability, I came across the following resource:
<a href="https://www.isical.ac.in/~ansuman/flat2018/tm-more-undecidable.pdf" rel="nofollow noreferrer">https://www.isical.ac.in/~ansuman/flat2018/tm-more-undecidable.pdf</a></p>

<p>Here, on page no 12, it is written t... | turing machines automata undecidability | 1 | Is it decidable whether a given Turing machine moves its head more than 481 cells away from the left-end marker, on input ε? -- (turing machines automata undecidability)
<p>So, while reading some problems on decidability, I came across the following resource:
<a href="https://www.isical.ac.in/~ansuman/flat2018/tm-m... | habedi/stack-exchange-dataset |
118,518 | Ambiguous Grammar demostration exercise | <p>Hi im stuck on an exercise of ambiguous grammar. I need an example that shows that this grammar is ambiguous. The grammar is defined as follows:</p>

<p><span class="math-container">$$S \rightarrow aT | bR$$</span>
<span class="math-container">$$R \rightarrow a | aS | bRR$$</span>
<span class="math-c... | formal grammars ambiguity tree grammars | 1 | Ambiguous Grammar demostration exercise -- (formal grammars ambiguity tree grammars)
<p>Hi im stuck on an exercise of ambiguous grammar. I need an example that shows that this grammar is ambiguous. The grammar is defined as follows:</p>

<p><span class="math-container">$$S \rightarrow aT | bR$$</span>
<span... | habedi/stack-exchange-dataset |
118,523 | Deterministic pushdown automaton for a given language | <p>I am trying to make a deterministic pushdown automaton from this language but without success.
Here is the language definition:</p>

<p><span class="math-container">$\ L=\{0^n 1^m a^i b^j \ /\ m,n,i,j > 0 \ and \ m+n=i+j \} $</span></p>

<p>Thanks!</p>
 | formal languages automata context free finite automata pushdown automata | 1 | Deterministic pushdown automaton for a given language -- (formal languages automata context free finite automata pushdown automata)
<p>I am trying to make a deterministic pushdown automaton from this language but without success.
Here is the language definition:</p>

<p><span class="math-container">$\ L=\{0... | habedi/stack-exchange-dataset |
118,531 | Given an unsorted list of $n$ items, how many random comparisons are needed on average to be able to sort the list? | <p>There is an unsorted list of <span class="math-container">$n$</span> items <span class="math-container">$x_1, \ldots, x_n$</span>. Until you can sort the list, you are given one of the <span class="math-container">${n \choose 2}$</span> possible binary comparisons uniformly at random (with replacement).</p>

... | sorting probability theory randomized algorithms dag | 1 | Given an unsorted list of $n$ items, how many random comparisons are needed on average to be able to sort the list? -- (sorting probability theory randomized algorithms dag)
<p>There is an unsorted list of <span class="math-container">$n$</span> items <span class="math-container">$x_1, \ldots, x_n$</span>. Until you ca... | habedi/stack-exchange-dataset |
118,533 | How to prove properties about a specific modular arithmetic equivalence | <p>Ever since I was introduced to modular arithmetic, I've had some trouble with it. I think it uses a part of my brain that I haven't used often. Anyways, I've been thinking about this specific equivalence: 
<span class="math-container">$$a^3 \equiv 5 \, (\text{mod } 7)$$</span>
And I have a hunch that no <spa... | proof techniques modular arithmetic | 1 | How to prove properties about a specific modular arithmetic equivalence -- (proof techniques modular arithmetic)
<p>Ever since I was introduced to modular arithmetic, I've had some trouble with it. I think it uses a part of my brain that I haven't used often. Anyways, I've been thinking about this specific equivalence:... | habedi/stack-exchange-dataset |
118,537 | What is f(x,y) in Digital Image Processing? | <p>I am a novice in Digital Image Processing, and while reading the book of DIP by Gonzalez and Woods, I find that they have represented digital image as <span class="math-container">$f(x,y)$</span> but nowhere it is mentioned what is <span class="math-container">$x$</span> and <span class="math-container">$y$</span> a... | image processing | 1 | What is f(x,y) in Digital Image Processing? -- (image processing)
<p>I am a novice in Digital Image Processing, and while reading the book of DIP by Gonzalez and Woods, I find that they have represented digital image as <span class="math-container">$f(x,y)$</span> but nowhere it is mentioned what is <span class="math-c... | habedi/stack-exchange-dataset |
118,540 | Matrix chain multiplication: Greedy approach | <p>some suggested a thread in which the algorithm multiplies the 2 matrices with lowest values first. Mine is different: it divides by parenthesis the 2 matrices. And continues to the next section.</p>

<p>The problem is: finding the most efficient way to multiply a series of matrices together, using an algorit... | multiplication matrix | 1 | Matrix chain multiplication: Greedy approach -- (multiplication matrix)
<p>some suggested a thread in which the algorithm multiplies the 2 matrices with lowest values first. Mine is different: it divides by parenthesis the 2 matrices. And continues to the next section.</p>

<p>The problem is: finding the most e... | habedi/stack-exchange-dataset |
118,556 | Is it possible for a syscall to pack together different places in memory? | <p>While programming with buffers like <code>uint8_t*</code> in C++ I often arrive at situations on where I'm forced to do copies. For example, if I receive packets in chuncks from the world and I want to parse something big that is formed of these packets, I'd have to create a bigger buffer and store them, in this buf... | memory management os kernel | 1 | Is it possible for a syscall to pack together different places in memory? -- (memory management os kernel)
<p>While programming with buffers like <code>uint8_t*</code> in C++ I often arrive at situations on where I'm forced to do copies. For example, if I receive packets in chuncks from the world and I want to parse so... | habedi/stack-exchange-dataset |
118,560 | one-to-many matching in bipartite graphs? | <p>Consider having two sets <span class="math-container">$L$</span> (left) and <span class="math-container">$R$</span> (right).
<span class="math-container">$R$</span> nodes have a capacity limit.
Each edge <span class="math-container">$e$</span> has a cost <span class="math-container">$w(e)$</span>.</p>
&#... | algorithms graphs matching string matching | 1 | one-to-many matching in bipartite graphs? -- (algorithms graphs matching string matching)
<p>Consider having two sets <span class="math-container">$L$</span> (left) and <span class="math-container">$R$</span> (right).
<span class="math-container">$R$</span> nodes have a capacity limit.
Each edge <span class="ma... | habedi/stack-exchange-dataset |
118,582 | Does pre-emption of a process occur when that process is busy waiting? | <p>I was reading about Peterson's Solution for Synchronisation. Let's assume the two shared variables to be <code>int bool flag[2]</code> and <code>turn</code>. Lets also consider the two processes as P0 and P1.</p>

<p>Initially, P0 executes causing - <code>flag[0] = true</code> and <code>turn = 1</code>. Now ... | operating systems process scheduling synchronization | 1 | Does pre-emption of a process occur when that process is busy waiting? -- (operating systems process scheduling synchronization)
<p>I was reading about Peterson's Solution for Synchronisation. Let's assume the two shared variables to be <code>int bool flag[2]</code> and <code>turn</code>. Lets also consider the two pro... | habedi/stack-exchange-dataset |
118,590 | Does $P/O(1)$ equal to $P$ if solver needs to consider smaller inputs? | <p>Suppose that <span class="math-container">$F$</span> is a problem such that for every <span class="math-container">$n$</span>, there is a program of length <span class="math-container">$O(1)$</span>, running in polynomial time to <span class="math-container">$n$</span>, that solves <span class="math-container">$F$</... | complexity theory time complexity complexity classes | 1 | Does $P/O(1)$ equal to $P$ if solver needs to consider smaller inputs? -- (complexity theory time complexity complexity classes)
<p>Suppose that <span class="math-container">$F$</span> is a problem such that for every <span class="math-container">$n$</span>, there is a program of length <span class="math-container">$O(... | habedi/stack-exchange-dataset |
118,594 | Derivation of product type eliminator in type theory | <p>In HoTT book, section 1.5 (Product Types) in order to define the eliminators for the product type it assumes a function of type <span class="math-container">$g:A \rightarrow B \rightarrow C$</span> and then goes on to define the eliminator rule ,saying that we can define a function <span class="math-container">$f:A ... | type theory homotopy type theory | 1 | Derivation of product type eliminator in type theory -- (type theory homotopy type theory)
<p>In HoTT book, section 1.5 (Product Types) in order to define the eliminators for the product type it assumes a function of type <span class="math-container">$g:A \rightarrow B \rightarrow C$</span> and then goes on to define t... | habedi/stack-exchange-dataset |
118,604 | How to delete a node from BST tree with 2 chidren? | <p>I googled, read several tutorials and watched several BST node deletion algorithm explanations before posting this question. For some reason, I cannot find a complete explanation of BST node deletion algorithms.</p>

<p>I've found 4 algorithms to remove the node with 2 children from Binary Search Tree:<br>&#... | trees binary trees search trees | 1 | How to delete a node from BST tree with 2 chidren? -- (trees binary trees search trees)
<p>I googled, read several tutorials and watched several BST node deletion algorithm explanations before posting this question. For some reason, I cannot find a complete explanation of BST node deletion algorithms.</p>

<p>I... | habedi/stack-exchange-dataset |
118,609 | A special case of subset sum | <p>I came across the following problem in my complexity-theory course:</p>

<p>Given a set of numbers <span class="math-container">$A := \{a_1, \dots, a_n\} \subset_{\mathrm{finite}} \mathbb{N}$</span> and a number <span class="math-container">$b$</span> also in <span class="math-container">$\mathbb{N}$</span> ... | algorithms complexity theory undecidability decision problem | 1 | A special case of subset sum -- (algorithms complexity theory undecidability decision problem)
<p>I came across the following problem in my complexity-theory course:</p>

<p>Given a set of numbers <span class="math-container">$A := \{a_1, \dots, a_n\} \subset_{\mathrm{finite}} \mathbb{N}$</span> and a number <s... | habedi/stack-exchange-dataset |
118,619 | Inorder tree tranversal on binary search tree doesn't give the elements in order? | <p>I have been told that inorder tree tranversal of binary search trees returns the tree elements in order. I came up with this binary search tree:</p>

<pre><code> 20
 /
 10
 \
 26
</code></pre>

<p>However the inorder tree tranversal of this seems to be 10, 26, 20?! ... | binary trees binary search trees | 1 | Inorder tree tranversal on binary search tree doesn't give the elements in order? -- (binary trees binary search trees)
<p>I have been told that inorder tree tranversal of binary search trees returns the tree elements in order. I came up with this binary search tree:</p>

<pre><code> 20
 /
 10&#... | habedi/stack-exchange-dataset |
118,630 | Difference between task and process | <p>I'd like to know which is the difference between a task and a process in computer science. I'm studying a course on real-time systems and there are some definitions that I don't know.</p>

<p>Thank you in advance.</p>
 | terminology definitions | 1 | Difference between task and process -- (terminology definitions)
<p>I'd like to know which is the difference between a task and a process in computer science. I'm studying a course on real-time systems and there are some definitions that I don't know.</p>

<p>Thank you in advance.</p>
 | habedi/stack-exchange-dataset |
118,646 | Gaussian noise: Image Processing | <p>As we all know, Gaussian Noise follows Gaussian or Normal distribution, and that distribution follows a <span class="math-container">$BELL$</span> <span class="math-container">$CURVE$</span>. </p>

<p><a href="https://i.stack.imgur.com/cGdxq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/... | image processing gaussian noise | 1 | Gaussian noise: Image Processing -- (image processing gaussian noise)
<p>As we all know, Gaussian Noise follows Gaussian or Normal distribution, and that distribution follows a <span class="math-container">$BELL$</span> <span class="math-container">$CURVE$</span>. </p>

<p><a href="https://i.stack.imgur.com/cGd... | habedi/stack-exchange-dataset |
118,664 | Find all nodes on simple paths between two nodes in cyclic directed graph | <p>Given two nodes <code>U</code> and <code>V</code> in a cyclic directed graph, how can I find the set of nodes that are part of a simple path from <code>U</code> to <code>V</code>?</p>

<p><strong>Attempt 1</strong></p>

<p>I've tried using a DFS from <code>U</code> that stores the set of visited node... | graphs graph traversal | 1 | Find all nodes on simple paths between two nodes in cyclic directed graph -- (graphs graph traversal)
<p>Given two nodes <code>U</code> and <code>V</code> in a cyclic directed graph, how can I find the set of nodes that are part of a simple path from <code>U</code> to <code>V</code>?</p>

<p><strong>Attempt 1</... | habedi/stack-exchange-dataset |
118,667 | Is it feasible to solve this subset cover problem with SAT solver? | <p>The problem is to find <span class="math-container">$\mathcal{S}$</span>, a minimal collect of subsets of <span class="math-container">$\{1,\dots, 17\}$</span> such that the two conditions are satisfied:</p>

<ol>
<li>if <span class="math-container">$S \subseteq \mathcal{S}$</span> then <span class="math... | combinatorics satisfiability sat solvers | 1 | Is it feasible to solve this subset cover problem with SAT solver? -- (combinatorics satisfiability sat solvers)
<p>The problem is to find <span class="math-container">$\mathcal{S}$</span>, a minimal collect of subsets of <span class="math-container">$\{1,\dots, 17\}$</span> such that the two conditions are satisfied:<... | habedi/stack-exchange-dataset |
118,671 | Understanding of big-O massively improved when I began thinking of orders as sets. How to apply the same approach to big-Theta? | <p>Today I revisited the topic of runtime complexity orders – big-O and big-<span class="math-container">$\Theta$</span>. I finally fully understood what the formal definition of big-O meant but more importantly I realised that big-O orders can be considered sets. </p>

<p>For example, <span class="math-contain... | time complexity asymptotics big o notation | 1 | Understanding of big-O massively improved when I began thinking of orders as sets. How to apply the same approach to big-Theta? -- (time complexity asymptotics big o notation)
<p>Today I revisited the topic of runtime complexity orders – big-O and big-<span class="math-container">$\Theta$</span>. I finally fully unders... | habedi/stack-exchange-dataset |
118,679 | Zero-knowledge proof of $\beta\eta$ equality | <p>Is there some way to give a zero-knowledge proof that two <span class="math-container">$\lambda$</span>-terms are convertible, i.e. equal modulo <span class="math-container">$\beta\eta$</span>?</p>

<p>A usual (and not zero-knowledge) proof that two terms are convertible is a path of terms between the two su... | lambda calculus | 1 | Zero-knowledge proof of $\beta\eta$ equality -- (lambda calculus)
<p>Is there some way to give a zero-knowledge proof that two <span class="math-container">$\lambda$</span>-terms are convertible, i.e. equal modulo <span class="math-container">$\beta\eta$</span>?</p>

<p>A usual (and not zero-knowledge) proof th... | habedi/stack-exchange-dataset |
118,687 | Is there a meta text processing concept in CS? | <p>I understand that text processing could be done in various ways on top of operating systems:</p>

<ul>
<li><p><strong>Shell utilities for processing a file (and/or a file name):</strong> <code>tr</code>, <code>sed</code>, <code>awk</code>, <code>perl</code>, <code>mv</code> and others</p></li>
<li><p... | regular languages regular expressions natural language processing | 1 | Is there a meta text processing concept in CS? -- (regular languages regular expressions natural language processing)
<p>I understand that text processing could be done in various ways on top of operating systems:</p>

<ul>
<li><p><strong>Shell utilities for processing a file (and/or a file name):</strong> ... | habedi/stack-exchange-dataset |
118,695 | Why don't prefix-free Turing machines suffer from complexity dips? | <p>It's claimed in several texts on algorithmic complexity that prefix-free Turing machines are better for understanding randomness, at least in infinite sequences. In Nies' <em>Computability and Randomness</em>, the reason is given by theorems 2.2.1 and 2.2.2 on p. 83. I'll focus on the former, which states that for... | turing machines kolmogorov complexity | 1 | Why don't prefix-free Turing machines suffer from complexity dips? -- (turing machines kolmogorov complexity)
<p>It's claimed in several texts on algorithmic complexity that prefix-free Turing machines are better for understanding randomness, at least in infinite sequences. In Nies' <em>Computability and Randomness</e... | habedi/stack-exchange-dataset |
118,699 | if a graph G(V,E) is connected $|E|\geq|V|-1$ | <p>If a graph G(V,E) is connected the number of edges is at least the number of Vertices-1.
It is pretty evident if you think about it but how do i prove it formally? </p>
 | graphs proof techniques connected | 1 | if a graph G(V,E) is connected $|E|\geq|V|-1$ -- (graphs proof techniques connected)
<p>If a graph G(V,E) is connected the number of edges is at least the number of Vertices-1.
It is pretty evident if you think about it but how do i prove it formally? </p>
 | habedi/stack-exchange-dataset |
118,703 | How does Bifunctor in Haskell work? | <p>I was reading 'Category Theory for Programmers' by Bartosz Milewski and got really confused by the implementation of bimap in <code>Bifunctor</code> typeclass.</p>

<pre><code>class Bifunctor f where
 bimap :: (a -> c) -> (b -> d) -> f a b -> f c d 
 bimap g h = first g . second ... | haskell | 1 | How does Bifunctor in Haskell work? -- (haskell)
<p>I was reading 'Category Theory for Programmers' by Bartosz Milewski and got really confused by the implementation of bimap in <code>Bifunctor</code> typeclass.</p>

<pre><code>class Bifunctor f where
 bimap :: (a -> c) -> (b -> d) -> f a b -... | habedi/stack-exchange-dataset |
118,714 | Simplifying a logic function using Boolean algebra | <p>Consider this Logic function : D = A B C + A B’ C + A’ B’ C + A B C’ + A’ B C’ + A B’ C’ I am trying to simplify it using Boolean algebra , I am stuck in this step : D= AB +B'C+ A’ B C’ + A B’ C’ So how do I continue simplifying it ?</p>
 | logic | 1 | Simplifying a logic function using Boolean algebra -- (logic)
<p>Consider this Logic function : D = A B C + A B’ C + A’ B’ C + A B C’ + A’ B C’ + A B’ C’ I am trying to simplify it using Boolean algebra , I am stuck in this step : D= AB +B'C+ A’ B C’ + A B’ C’ So how do I continue simplifying it ?</p>
 | habedi/stack-exchange-dataset |
118,725 | Performance speedup with Amdahl's law | <p>Consider this question: A program has 1M instructions and 30% of them are SQRT with CPI=8. The CPI of the rest of the instructions are 3. If we reduce the CPI of SQRT to 2, how much speedup is obtained?</p>

<p>I have two solutions for that:</p>

<p>1- Using Amdahl's law, We have </p>

<pre><... | performance | 1 | Performance speedup with Amdahl's law -- (performance)
<p>Consider this question: A program has 1M instructions and 30% of them are SQRT with CPI=8. The CPI of the rest of the instructions are 3. If we reduce the CPI of SQRT to 2, how much speedup is obtained?</p>

<p>I have two solutions for that:</p>

... | habedi/stack-exchange-dataset |
118,733 | Does a generator really stops the execution at the machine code level, and does it not use the stack? | <p>Never have I heard of a partially executed function before. But it seems the idea of it has been out for some time. Does a generator really stop execution at the machine code level, and that next time when the iterator is invoked, then there is a jump back to that machine code location to continue the execution?</p... | programming languages | 1 | Does a generator really stops the execution at the machine code level, and does it not use the stack? -- (programming languages)
<p>Never have I heard of a partially executed function before. But it seems the idea of it has been out for some time. Does a generator really stop execution at the machine code level, and t... | habedi/stack-exchange-dataset |
118,742 | Prove that the 2-approximation of a modified local search algorithm for max-cut is tight | <p>Consider the following local search approximation algorithm for the unweighted max cut problem:
start with an arbitrary partition of the vertices of the given graph <span class="math-container">$G = (V,E) $</span>, and as long as you can move 1 or 2 vertices from one side of the partition to the other, or switch... | algorithms algorithm analysis np complete approximation max cut | 1 | Prove that the 2-approximation of a modified local search algorithm for max-cut is tight -- (algorithms algorithm analysis np complete approximation max cut)
<p>Consider the following local search approximation algorithm for the unweighted max cut problem:
start with an arbitrary partition of the vertices of the gi... | habedi/stack-exchange-dataset |
118,755 | Text detection in computer vision | <p>I'm curious about the way text recognition works in machine learning(or more generally, the question of object vs not object) in computer vision.</p>

<p>How are systems trained when the not-object data set is so much greater in quantity and apparently lacks structure? </p>

<p>One approach is having... | machine learning neural networks computer vision | 1 | Text detection in computer vision -- (machine learning neural networks computer vision)
<p>I'm curious about the way text recognition works in machine learning(or more generally, the question of object vs not object) in computer vision.</p>

<p>How are systems trained when the not-object data set is so much gre... | habedi/stack-exchange-dataset |
118,760 | Coloring an interval graph with weights | <p>I have an interval graph <span class="math-container">$G=(V,E)$</span> and a set of colors <span class="math-container">$C=\{c_1,c_2,...,c_m\}$</span>, when a color <span class="math-container">$c_i$</span> is assigned to a vertex <span class="math-container">$v_j$</span>, we have a score <span class="math-container... | algorithms complexity theory graphs np complete colorings | 1 | Coloring an interval graph with weights -- (algorithms complexity theory graphs np complete colorings)
<p>I have an interval graph <span class="math-container">$G=(V,E)$</span> and a set of colors <span class="math-container">$C=\{c_1,c_2,...,c_m\}$</span>, when a color <span class="math-container">$c_i$</span> is assi... | habedi/stack-exchange-dataset |
118,763 | Sorting a large list of test scores | <p>You have a large list (say N > 10000) of test scores which you would like to sort. The test scores are between 1 and 100. What is quickest way to sort the list?</p>

<p>First thought. We have a O(N log N) bound, but we also have additional information about the quantities in the array, so I think we could do... | algorithms algorithm analysis sorting arrays lists | 1 | Sorting a large list of test scores -- (algorithms algorithm analysis sorting arrays lists)
<p>You have a large list (say N > 10000) of test scores which you would like to sort. The test scores are between 1 and 100. What is quickest way to sort the list?</p>

<p>First thought. We have a O(N log N) bound, but w... | habedi/stack-exchange-dataset |
118,770 | Find the minimal subset of rows of some matrix such that the sum of each column over this rows exceeds some threshold | <p>Let <span class="math-container">$A$</span> be a an <span class="math-container">$n\times m$</span> real valued matrix. The problem is to find the minimal subset <span class="math-container">$I$</span> of rows (if there is any) such that the sum of each column <span class="math-container">$j$</span> over the corresp... | optimization | 1 | Find the minimal subset of rows of some matrix such that the sum of each column over this rows exceeds some threshold -- (optimization)
<p>Let <span class="math-container">$A$</span> be a an <span class="math-container">$n\times m$</span> real valued matrix. The problem is to find the minimal subset <span class="math-c... | habedi/stack-exchange-dataset |
118,771 | find the union of all min cuts of a flow network | <p>I'm trying to solve the following question : </p>

<blockquote>
 <p>Given a flow network <span class="math-container">$N = (G=(V,E),c,s,t)$</span>. Let <span class="math-container">$\mathcal F$</span> be the set of all minimum cuts. Prove that <span class="math-container">$\mathcal F$</span> is closed u... | algorithms graphs network flow minimum cuts | 1 | find the union of all min cuts of a flow network -- (algorithms graphs network flow minimum cuts)
<p>I'm trying to solve the following question : </p>

<blockquote>
 <p>Given a flow network <span class="math-container">$N = (G=(V,E),c,s,t)$</span>. Let <span class="math-container">$\mathcal F$</span> be th... | habedi/stack-exchange-dataset |
118,778 | How to find time complexity of this pseudocode | <p>Recently, I came across a question about finding sum of all values in range <span class="math-container">$[low, high]$</span> in BST <span class="math-container">$T$</span>.</p>

<p>Then I formulated following algorithm to carry out that task:</p>

<blockquote>
 <ol>
 <li>We do inorder trav... | time complexity binary search trees | 1 | How to find time complexity of this pseudocode -- (time complexity binary search trees)
<p>Recently, I came across a question about finding sum of all values in range <span class="math-container">$[low, high]$</span> in BST <span class="math-container">$T$</span>.</p>

<p>Then I formulated following algorithm t... | habedi/stack-exchange-dataset |
118,781 | Arbitrary Turing machine run time analysis on the empty word | <p>Consider <span class="math-container">$L = \{ \langle M,n \rangle : M $</span> accpets <span class="math-container">$\epsilon $</span> in less than <span class="math-container">$T(n)$</span> steps<span class="math-container">$\}$</span></p>

<p>This language is decidable because a decider can simulate <span ... | turing machines time complexity | 1 | Arbitrary Turing machine run time analysis on the empty word -- (turing machines time complexity)
<p>Consider <span class="math-container">$L = \{ \langle M,n \rangle : M $</span> accpets <span class="math-container">$\epsilon $</span> in less than <span class="math-container">$T(n)$</span> steps<span class="math-conta... | habedi/stack-exchange-dataset |
118,782 | Complexity of cyclic sort | <p>I have this algorithm ("cyclic sort") to sort an array which contains unique numbers from 1 to <span class="math-container">$n$</span>:</p>

<pre><code>Input: A[1], ..., A[n]
i ← 1
while i ⩽ n:
 j ← A[i]
 if A[i] ≠ A[j]:
 swap A[i] and A[j]
 else:
 i ← i + 1
 end if&... | time complexity runtime analysis sorting | 1 | Complexity of cyclic sort -- (time complexity runtime analysis sorting)
<p>I have this algorithm ("cyclic sort") to sort an array which contains unique numbers from 1 to <span class="math-container">$n$</span>:</p>

<pre><code>Input: A[1], ..., A[n]
i ← 1
while i ⩽ n:
 j ← A[i]
 if A[i] ≠ A[j]... | habedi/stack-exchange-dataset |
118,788 | Confluence to show equivalent terms have one common reduct | <p>In lemma 30.3.9, Pierce states a confluence property for <span class="math-container">$F_{\omega}$</span>:</p>

<blockquote>
 <p><span class="math-container">$S \to_* T \land S \to_* U \implies \exists V. T \to_* V \land U \to_* V$</span></p>
</blockquote>

<p>He then states the following pr... | programming languages type theory term rewriting | 1 | Confluence to show equivalent terms have one common reduct -- (programming languages type theory term rewriting)
<p>In lemma 30.3.9, Pierce states a confluence property for <span class="math-container">$F_{\omega}$</span>:</p>

<blockquote>
 <p><span class="math-container">$S \to_* T \land S \to_* U \impli... | habedi/stack-exchange-dataset |
118,799 | Counting number of paths between two vertices in a DAG | <p>I need an algorithm that computes the number of paths between two nodes in a DAG (Directed acyclic graph) I need a dynamic porgramming solution if possible.</p>
 | algorithms graphs dynamic programming dag | 1 | Counting number of paths between two vertices in a DAG -- (algorithms graphs dynamic programming dag)
<p>I need an algorithm that computes the number of paths between two nodes in a DAG (Directed acyclic graph) I need a dynamic porgramming solution if possible.</p>
 | habedi/stack-exchange-dataset |
118,803 | Shortest paths between given red vertices and arbitrary blue vertices | <p>Given an undirected weighted graph, where each vertex has one of two colors - red or blue. I have to answer queries to find the shortest path between a given red vertex and <strong>any</strong> blue vertex in the graph. I have tried using Dijkstra algorithm with source the given red vertex, then finding the shortest... | algorithms graphs shortest path | 1 | Shortest paths between given red vertices and arbitrary blue vertices -- (algorithms graphs shortest path)
<p>Given an undirected weighted graph, where each vertex has one of two colors - red or blue. I have to answer queries to find the shortest path between a given red vertex and <strong>any</strong> blue vertex in t... | habedi/stack-exchange-dataset |
118,809 | (Leetcode) Combinatorial Sum - How to generate solution set from number of solution sets? | <p>The following question is taken from <a href="https://leetcode.com/problems/combination-sum/" rel="nofollow noreferrer">Leetcode entitled 'Combination Sum'</a></p>

<blockquote>
 <p>Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinati... | algorithms dynamic programming combinatorics python | 1 | (Leetcode) Combinatorial Sum - How to generate solution set from number of solution sets? -- (algorithms dynamic programming combinatorics python)
<p>The following question is taken from <a href="https://leetcode.com/problems/combination-sum/" rel="nofollow noreferrer">Leetcode entitled 'Combination Sum'</a></p>
&#... | habedi/stack-exchange-dataset |
118,813 | Length of strings accepted by DFA | <p>Problem: Given a DFA <span class="math-container">$D$</span>, find all possible lengths of strings accepted by the <span class="math-container">$D$</span>.</p>

<p>It makes sense that these lengths can be represented as <span class="math-container">$a_i+kb_i$</span>. What might be the algorithm to find all s... | graphs finite automata | 1 | Length of strings accepted by DFA -- (graphs finite automata)
<p>Problem: Given a DFA <span class="math-container">$D$</span>, find all possible lengths of strings accepted by the <span class="math-container">$D$</span>.</p>

<p>It makes sense that these lengths can be represented as <span class="math-container... | habedi/stack-exchange-dataset |
118,817 | 2D interval scheduling problem | <p>Suppose I give you <span class="math-container">$n$</span> axis-aligned rectangles with a specified width, height, and x-position (of the left edge) <span class="math-container">$\{(w_i, h_i, x_i) \mid i \in \{0, \ldots, n - 1\}\}$</span>, as well as a bound <span class="math-container">$(y_\mathrm{min}, y_\mathrm{m... | algorithms optimization approximation scheduling intervals | 1 | 2D interval scheduling problem -- (algorithms optimization approximation scheduling intervals)
<p>Suppose I give you <span class="math-container">$n$</span> axis-aligned rectangles with a specified width, height, and x-position (of the left edge) <span class="math-container">$\{(w_i, h_i, x_i) \mid i \in \{0, \ldots, n... | habedi/stack-exchange-dataset |
118,818 | Non-deterministic Turing machine for $L_1 = \{w\#0^n|w \text{ is a suffix of some $x$ in $L$ with } |x|=n\}$ | <p>Show if L is in NP, then also L1 is in NP</p>

<blockquote>
 <p><span class="math-container">$$L_1 = \{w\#0^n|w \text{ is a suffix of some $x$ in $L$ with } |x|=n\}$$</span></p>
</blockquote>

<p>I know that if L is in NP, then there exists a NTM <span class="math-container">$M_L$</span>... | formal languages turing machines time complexity nondeterminism | 1 | Non-deterministic Turing machine for $L_1 = \{w\#0^n|w \text{ is a suffix of some $x$ in $L$ with } |x|=n\}$ -- (formal languages turing machines time complexity nondeterminism)
<p>Show if L is in NP, then also L1 is in NP</p>

<blockquote>
 <p><span class="math-container">$$L_1 = \{w\#0^n|w \text{ is a su... | habedi/stack-exchange-dataset |
118,819 | Why guess $\Theta(n^2)$ for the substitution method of worst-case partitioning | <p>In the book</p>

<blockquote>
 <p>Introduction to Algorithms (3th edition) chapter 7</p>
</blockquote>

<p>the recurrence of the running time of quicksorts partitioning is given by <span class="math-container">$$T(n) = T(n-1) + \Theta(n)$$</span>
as the worst-case happens when the partit... | complexity theory quicksort | 1 | Why guess $\Theta(n^2)$ for the substitution method of worst-case partitioning -- (complexity theory quicksort)
<p>In the book</p>

<blockquote>
 <p>Introduction to Algorithms (3th edition) chapter 7</p>
</blockquote>

<p>the recurrence of the running time of quicksorts partitioning is given by... | habedi/stack-exchange-dataset |
118,821 | Is SAT a single language or a union of languages? | <p>I know that a language is in NP if a Turing machine can decide the language of its checking relation <span class="math-container">$\{\text{boolean formula }\#\text{ truth assignment | truth assignment is correct}\}$</span> in polynomial time.</p>

<p>Here is my confusion. All Turing machine have a finite inp... | complexity theory formal languages turing machines time complexity np complete | 1 | Is SAT a single language or a union of languages? -- (complexity theory formal languages turing machines time complexity np complete)
<p>I know that a language is in NP if a Turing machine can decide the language of its checking relation <span class="math-container">$\{\text{boolean formula }\#\text{ truth assignment |... | habedi/stack-exchange-dataset |
118,834 | Which combinatorial problem is similar to this problem? | <p>I have <span class="math-container">$n$</span> clients and for each client I have different options to choose from, for example, <span class="math-container">$C= \{C_1,C_2 \}$</span>. For each combination of <span class="math-container">$n$</span> options, there is a cost. I want to choose the best combination that ... | complexity theory | 1 | Which combinatorial problem is similar to this problem? -- (complexity theory)
<p>I have <span class="math-container">$n$</span> clients and for each client I have different options to choose from, for example, <span class="math-container">$C= \{C_1,C_2 \}$</span>. For each combination of <span class="math-container">$... | habedi/stack-exchange-dataset |
118,835 | What goes into proving two complicated programs are equivalent? | <p>Say I wanted to prove that two programs were equivalent (either <em>rigorously</em> if possible, or <em>informally</em> if not). More specifically, say I have something relatively complex such as an HTTP server implemented in C, and one implemented in Node.js/JavaScript. What can I do in terms of saying "these two a... | reference request proof techniques model checking research | 1 | What goes into proving two complicated programs are equivalent? -- (reference request proof techniques model checking research)
<p>Say I wanted to prove that two programs were equivalent (either <em>rigorously</em> if possible, or <em>informally</em> if not). More specifically, say I have something relatively complex s... | habedi/stack-exchange-dataset |
118,842 | Given n sorted arrays with size k select one element from every array such that the sum of the elements is minimum and the sum of their indices is k+1 | <p>So if <span class="math-container">$k = 3$</span> and <span class="math-container">$n = 2$</span> and we select the element <span class="math-container">$a_1[3]$</span> of the first array then we have to select <span class="math-container">$a_2[1]$</span> from the second array. If we select the element <span class="... | sorting dynamic programming | 1 | Given n sorted arrays with size k select one element from every array such that the sum of the elements is minimum and the sum of their indices is k+1 -- (sorting dynamic programming)
<p>So if <span class="math-container">$k = 3$</span> and <span class="math-container">$n = 2$</span> and we select the element <span cla... | habedi/stack-exchange-dataset |
118,846 | Adding constraints in grammar for Grammatical Evolution | <p>I'm trying to use Grammatical Evolution for creating trading strategies. Each sentence in the grammar when evaluated gives a weight matrix of size n x p . (n is the length of backtesting period and p is the total number of stocks in portfolio)</p>

<p>BNF form of Grammar</p>

<pre><code><expr> ... | formal grammars genetic algorithms tree grammars | 1 | Adding constraints in grammar for Grammatical Evolution -- (formal grammars genetic algorithms tree grammars)
<p>I'm trying to use Grammatical Evolution for creating trading strategies. Each sentence in the grammar when evaluated gives a weight matrix of size n x p . (n is the length of backtesting period and p is the ... | habedi/stack-exchange-dataset |
118,847 | If declarative programming is possible at the instruction/action level? | <p>I am considering what the possibilities are with declarative programming. I have a firm understanding of how to use declarative programming in practice, but, short of having examples, I don't know if it's possible to 100% use declarative programming all the way down to the machine code (theoretically).</p>

... | programming languages functional programming | 1 | If declarative programming is possible at the instruction/action level? -- (programming languages functional programming)
<p>I am considering what the possibilities are with declarative programming. I have a firm understanding of how to use declarative programming in practice, but, short of having examples, I don't kno... | habedi/stack-exchange-dataset |
118,856 | please tell Time complexity of following program | <p><a href="https://i.stack.imgur.com/o0oKF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o0oKF.png" alt=""></a>
please tell the time complexitiy of the following code</p>
 | time complexity | 1 | please tell Time complexity of following program -- (time complexity)
<p><a href="https://i.stack.imgur.com/o0oKF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o0oKF.png" alt=""></a>
please tell the time complexitiy of the following code</p>
 | habedi/stack-exchange-dataset |
118,858 | How can Lagrange Multipliers and Penalty Method be applied to optimize algorithms? | <p>I have a programming assignment which I was told that is solvable with some DP algorithm. The question is a variant of LIS problem where at most <span class="math-container">$k$</span> exceptions (restarts) are allowed.</p>
<p>But I know that there is a better solution. My professor mentioned Lagrange Multiplier... | algorithms optimization terminology dynamic programming | 1 | How can Lagrange Multipliers and Penalty Method be applied to optimize algorithms? -- (algorithms optimization terminology dynamic programming)
<p>I have a programming assignment which I was told that is solvable with some DP algorithm. The question is a variant of LIS problem where at most <span class="math-container"... | habedi/stack-exchange-dataset |
118,863 | Picross solving: matching checked cells to their clues | <p>I am writing a picross solver, and I am going with the "human logic" solving, which attempts to reproduce the reasoning a human might have when confronted to such a puzzle, in an iterative manner.<br>
Having solved a lot of those by hand, I found the human logic to be very algorithmic-ish given how the same kind... | algorithms | 1 | Picross solving: matching checked cells to their clues -- (algorithms)
<p>I am writing a picross solver, and I am going with the "human logic" solving, which attempts to reproduce the reasoning a human might have when confronted to such a puzzle, in an iterative manner.<br>
Having solved a lot of those by hand, I f... | habedi/stack-exchange-dataset |
118,868 | A single heap nim game | <p>Consider a game where two players remove sticks from a heap. The players move alternately, and the player who removes the last stick wins the game.</p>

<p>A set P = {p1,p2,…,pk} determines the allowed moves. For example, if P = {1,3,4}, a player may remove 1, 3 or 4 sticks.</p>

<p>Your task is find... | algorithms game theory | 1 | A single heap nim game -- (algorithms game theory)
<p>Consider a game where two players remove sticks from a heap. The players move alternately, and the player who removes the last stick wins the game.</p>

<p>A set P = {p1,p2,…,pk} determines the allowed moves. For example, if P = {1,3,4}, a player may remove ... | habedi/stack-exchange-dataset |
118,880 | What is the LTL expression for "there is a value of y whose next value is 8"? | <p>Basically i have a program which increases a variable by 1 in each iteration and resets it to 0 as soon as y becomes 8 (i.e. mod 8).</p>

<p>It is a quite simple example but it still bugs me out because i cannot clarify if my LTL-formula is correct for the property "there is a value of y whose next value is ... | linear temporal logic | 1 | What is the LTL expression for "there is a value of y whose next value is 8"? -- (linear temporal logic)
<p>Basically i have a program which increases a variable by 1 in each iteration and resets it to 0 as soon as y becomes 8 (i.e. mod 8).</p>

<p>It is a quite simple example but it still bugs me out because i... | habedi/stack-exchange-dataset |
118,881 | Why LL(1) grammar generate all regular languages? | <p>I came across following:</p>

<blockquote>
 <p>Every regular language has right linear grammar and this is LL(1). Thus, LL(1) grammar generates all regular languages.</p>
</blockquote>

<p>I tried to get that. </p>

<p><strong>Definition: Right linear grammar (RLG)</strong><br>
I... | formal languages regular languages formal grammars | 1 | Why LL(1) grammar generate all regular languages? -- (formal languages regular languages formal grammars)
<p>I came across following:</p>

<blockquote>
 <p>Every regular language has right linear grammar and this is LL(1). Thus, LL(1) grammar generates all regular languages.</p>
</blockquote>

... | habedi/stack-exchange-dataset |
118,887 | Finding a winner in a "long list" | <p>This is from betting domain which has something that is called a long list: a list of a "home team win/draw/away team win" markets for 13 games.
A punter can select any combination of the possible outcomes which are encoded in a following way:</p>

<pre><code>1 - home team wins
2 - draw
4 - away... | algorithms number theory | 1 | Finding a winner in a "long list" -- (algorithms number theory)
<p>This is from betting domain which has something that is called a long list: a list of a "home team win/draw/away team win" markets for 13 games.
A punter can select any combination of the possible outcomes which are encoded in a following way:</p>&... | habedi/stack-exchange-dataset |
118,891 | Prove that the class of CFG languages that are closed under reversal is undecidable | <h2>Note</h2>

<p>The wording of the title may be a bit vague, but I'm not asking if CFLs are closed under reversal. Please see below.</p>

<h2>Problem Description</h2>

<p>Given a word <span class="math-container">$w$</span>, define <span class="math-container">$w^{r}$</span> to be its reversal... | formal languages automata context free undecidability | 1 | Prove that the class of CFG languages that are closed under reversal is undecidable -- (formal languages automata context free undecidability)
<h2>Note</h2>

<p>The wording of the title may be a bit vague, but I'm not asking if CFLs are closed under reversal. Please see below.</p>

<h2>Problem Descripti... | habedi/stack-exchange-dataset |
118,914 | is the empty language L = ∅ a subset of every languages? | <p>I need to show false the following claim</p>

<blockquote>
 <p>Every language L which is a subset of <span class="math-container">$A_{TM}$</span> (<span class="math-container">$L \subseteq A_{TM}$</span>) is undecidable.</p>
</blockquote>

<p>For this, I wish to use the empty language L = ∅ ... | undecidability halting problem | 1 | is the empty language L = ∅ a subset of every languages? -- (undecidability halting problem)
<p>I need to show false the following claim</p>

<blockquote>
 <p>Every language L which is a subset of <span class="math-container">$A_{TM}$</span> (<span class="math-container">$L \subseteq A_{TM}$</span>) is und... | habedi/stack-exchange-dataset |
118,924 | Find a threshold such that one function is always bigger than the other | <p>Given the recursively defined function <span class="math-container">$c$</span>:
<span class="math-container">$$c(m,n)=\begin{cases}0&\text{for }m=0\\
n^2+n+1&\text{for }m = 1\text{ and }n\ge 0\\
c(m-1, 1)&\text{for }m>1\text{ and }n=0\\
c(m-1,c(m,n-1))&\text{for }m>1\text{ and ... | recursion proof assistants | 1 | Find a threshold such that one function is always bigger than the other -- (recursion proof assistants)
<p>Given the recursively defined function <span class="math-container">$c$</span>:
<span class="math-container">$$c(m,n)=\begin{cases}0&\text{for }m=0\\
n^2+n+1&\text{for }m = 1\text{ and }n\ge 0\\&#... | habedi/stack-exchange-dataset |
118,927 | Can a 2-way set associative mapping have just one set? | <p>Though unintuitive, can a 2-way set associative mapping have only one set. For e.g., Cache size 8 bytes, block size 4 bytes and main memory size as 16 bytes. Here the number of cache lines are 2 and given 2 way set associative the set count is only 1. Can I map the 4 blocks (0,1,2 and 3) in the main memory to a 2-wa... | cache | 1 | Can a 2-way set associative mapping have just one set? -- (cache)
<p>Though unintuitive, can a 2-way set associative mapping have only one set. For e.g., Cache size 8 bytes, block size 4 bytes and main memory size as 16 bytes. Here the number of cache lines are 2 and given 2 way set associative the set count is only 1.... | habedi/stack-exchange-dataset |
118,932 | Would models of computation in other conceivable universes be Turing complete? | <p>I'm interested in gathering some references that discuss the topic of the relationship between computation and physics.</p>

<p>Specifically, I'm interested in investigating two points of view:</p>

<ul>
<li>our current model of computation -- assuming it describes reality accurately -- impose a ... | computability computation models physics | 1 | Would models of computation in other conceivable universes be Turing complete? -- (computability computation models physics)
<p>I'm interested in gathering some references that discuss the topic of the relationship between computation and physics.</p>

<p>Specifically, I'm interested in investigating two points... | habedi/stack-exchange-dataset |
118,934 | Is a^mb^n where m=n^2 a CFL? | <p>Is <span class="math-container">$a^mb^n$</span> where <span class="math-container">$m=n^2$</span> a CFL?</p>

<hr>

<p>I have a doubt regrading this problem. Say if we pop <span class="math-container">$n$</span> number of <span class="math-container">$a's$</span> from the stack for each <span class="... | automata context free | 1 | Is a^mb^n where m=n^2 a CFL? -- (automata context free)
<p>Is <span class="math-container">$a^mb^n$</span> where <span class="math-container">$m=n^2$</span> a CFL?</p>

<hr>

<p>I have a doubt regrading this problem. Say if we pop <span class="math-container">$n$</span> number of <span class="math-conta... | habedi/stack-exchange-dataset |
118,939 | Why multiple rotations might be needed after deletion in an AVL tree if after insertion there can be at most one needed? | <p>I understand that after deletion you have to retrace to update ancestors and after insertion you do the similar however at most one rotation will be performed.</p>

<p>The question is why is there the difference in number of potential rotations for these two operations.</p>

<p>To me it seems like th... | trees avl trees | 1 | Why multiple rotations might be needed after deletion in an AVL tree if after insertion there can be at most one needed? -- (trees avl trees)
<p>I understand that after deletion you have to retrace to update ancestors and after insertion you do the similar however at most one rotation will be performed.</p>

<p... | habedi/stack-exchange-dataset |
118,956 | Subset sum problem for permutations | <p>Given permutations <span class="math-container">$g_1,\,\ldots, g_m \in S_n$</span> of size <span class="math-container">$n$</span> and target permutation <span class="math-container">$g \in S_n$</span>, decide if there exists a subset of <span class="math-container">$\{g_1,\, \ldots, g_m\}$</span>, which composition... | algorithms complexity theory permutations subset sum group theory | 1 | Subset sum problem for permutations -- (algorithms complexity theory permutations subset sum group theory)
<p>Given permutations <span class="math-container">$g_1,\,\ldots, g_m \in S_n$</span> of size <span class="math-container">$n$</span> and target permutation <span class="math-container">$g \in S_n$</span>, decide ... | habedi/stack-exchange-dataset |
118,970 | Dynamic testing of down casts as explained in TAPL | <p>On page 195 of Pierce's TAPL book, he states that one can replace a down-cast operator by some sort of dynamic type test. Then he gives the following rules:</p>

<p>T-Typetest:</p>

<p><span class="math-container">$\dfrac{\Gamma \vdash t_1:S \;\; \Gamma,x:T \vdash t_2:U \;\; \Gamma \vdash t_3:U}{\Gam... | programming languages type theory type checking | 1 | Dynamic testing of down casts as explained in TAPL -- (programming languages type theory type checking)
<p>On page 195 of Pierce's TAPL book, he states that one can replace a down-cast operator by some sort of dynamic type test. Then he gives the following rules:</p>

<p>T-Typetest:</p>

<p><span class=... | habedi/stack-exchange-dataset |
118,972 | Find shortest path of R,G,B Graph | <p>Let <span class="math-container">$G=(V,E)$</span> be a directed graph, <span class="math-container">$ω:E→\mathbb{R}$</span> a weight function, and <span class="math-container">$s,t\in V$</span> a pair of different nodes. It's given that <span class="math-container">$G$</span> doesn't have a negative cycle. Each edge... | algorithms graphs | 1 | Find shortest path of R,G,B Graph -- (algorithms graphs)
<p>Let <span class="math-container">$G=(V,E)$</span> be a directed graph, <span class="math-container">$ω:E→\mathbb{R}$</span> a weight function, and <span class="math-container">$s,t\in V$</span> a pair of different nodes. It's given that <span class="math-conta... | habedi/stack-exchange-dataset |
118,977 | How hard is finding the shortest path in a graph matching a given regular language? | <p>Suppose we are given a directed graph <span class="math-container">$G = (V, E)$</span> with edge weights <span class="math-container">$w : E \rightarrow \mathbb{R}$</span> (we can assume there are no negative cycles) and edge labels <span class="math-container">$\ell : E \rightarrow \Sigma$</span> from some alphabet... | graphs regular languages regular expressions shortest path | 1 | How hard is finding the shortest path in a graph matching a given regular language? -- (graphs regular languages regular expressions shortest path)
<p>Suppose we are given a directed graph <span class="math-container">$G = (V, E)$</span> with edge weights <span class="math-container">$w : E \rightarrow \mathbb{R}$</spa... | habedi/stack-exchange-dataset |
118,981 | Linear programming: reduce a contstraint that includes minimun | <p>I have an <em>almost</em> linear programme. However one of the constraints has a form <span class="math-container">$z = min(x,y)$</span> (all the other things are linear in the model). Is there a way to substitute this with something (or introduce additional variables) to turn this into a linear programme?</p>
&... | optimization linear programming | 1 | Linear programming: reduce a contstraint that includes minimun -- (optimization linear programming)
<p>I have an <em>almost</em> linear programme. However one of the constraints has a form <span class="math-container">$z = min(x,y)$</span> (all the other things are linear in the model). Is there a way to substitute thi... | habedi/stack-exchange-dataset |
118,982 | A microkernel fully hardcoded in hardware? | <p>Does there exist a (micro-)kernel of an operating system that is fully implemented in hardware? That is, a kernel that is not stored in RAM, and loaded into CPU registers after an interrupt or system call, but is instead a fully hardcoded part of the CPU itself, so that a system call/interrupt never leads to a conte... | cpu os kernel | 1 | A microkernel fully hardcoded in hardware? -- (cpu os kernel)
<p>Does there exist a (micro-)kernel of an operating system that is fully implemented in hardware? That is, a kernel that is not stored in RAM, and loaded into CPU registers after an interrupt or system call, but is instead a fully hardcoded part of the CPU ... | habedi/stack-exchange-dataset |
118,984 | Complexity of list coloring $K_n$ with $n$ colors | <p>The <a href="https://en.wikipedia.org/wiki/List_coloring" rel="nofollow noreferrer">list coloring problem</a> is, given a set <span class="math-container">$L(v)$</span> colors for each vertex <span class="math-container">$v \in G$</span>, is there a proper vertex coloring, <span class="math-container">$c$</span>, of... | complexity theory graphs colorings | 1 | Complexity of list coloring $K_n$ with $n$ colors -- (complexity theory graphs colorings)
<p>The <a href="https://en.wikipedia.org/wiki/List_coloring" rel="nofollow noreferrer">list coloring problem</a> is, given a set <span class="math-container">$L(v)$</span> colors for each vertex <span class="math-container">$v \in... | habedi/stack-exchange-dataset |
119,009 | maximum coverage version of dominating set | <p>The dominating set problem is :</p>

<blockquote>
 <p>Given an <span class="math-container">$n$</span> vertex graph <span class="math-container">$G=(V,E)$</span>, find a set <span class="math-container">$S(\subseteq V)$</span> such that <span class="math-container">$|N[S]|$</span> is exactly <span class... | graphs np complete terminology np hard set cover | 1 | maximum coverage version of dominating set -- (graphs np complete terminology np hard set cover)
<p>The dominating set problem is :</p>

<blockquote>
 <p>Given an <span class="math-container">$n$</span> vertex graph <span class="math-container">$G=(V,E)$</span>, find a set <span class="math-container">$S(\... | habedi/stack-exchange-dataset |
119,026 | Struggling to understand the thought process required to come up with some recurrences for Dynamic Programming problems | <p>I was doing a few dynamic programming problems and I am struggling to understand the thought process required to come up with recurrences.</p>

<p>The first problem I solved was <a href="https://leetcode.com/problems/longest-palindromic-substring/" rel="nofollow noreferrer">longest palindromic substring</a> ... | algorithms dynamic programming recurrence relation recursion | 1 | Struggling to understand the thought process required to come up with some recurrences for Dynamic Programming problems -- (algorithms dynamic programming recurrence relation recursion)
<p>I was doing a few dynamic programming problems and I am struggling to understand the thought process required to come up with recur... | habedi/stack-exchange-dataset |
119,028 | Error lower-bound for an algorithm for vertex cover | <p>I have the following randomized-algorithm for the vertex cover problem. Let <span class="math-container">$B_0$</span> be the output set:</p>

<ul>
<li>Fix some order <span class="math-container">$e_1, e_2, . . . , e_m$</span> over all edges in the edge set E of G, and set <span class="math-container">$B_... | algorithms graphs randomized algorithms vertex cover | 1 | Error lower-bound for an algorithm for vertex cover -- (algorithms graphs randomized algorithms vertex cover)
<p>I have the following randomized-algorithm for the vertex cover problem. Let <span class="math-container">$B_0$</span> be the output set:</p>

<ul>
<li>Fix some order <span class="math-container">... | habedi/stack-exchange-dataset |
119,036 | How to know if a problem belongs to NP Class? | <p><strong>What I know (NOT strictly speaking):</strong> I know that there is an open question about the equality of P and NP Classes and as long as there is no known algorithm that solves NP problems in P time then we make a distinction about the space-time solvability of such problems. Also, I know that you can make ... | np complete np p vs np constraint programming | 1 | How to know if a problem belongs to NP Class? -- (np complete np p vs np constraint programming)
<p><strong>What I know (NOT strictly speaking):</strong> I know that there is an open question about the equality of P and NP Classes and as long as there is no known algorithm that solves NP problems in P time then we make... | habedi/stack-exchange-dataset |
119,040 | Counting big enough elements | <p>Let <span class="math-container">$v$</span> be a vector of positive integers of length <span class="math-container">$n$</span>. I want to find the highest <span class="math-container">$k$</span> such as there are at least <span class="math-container">$k$</span> elements of <span class="math-container">$v$</span> tha... | counting | 1 | Counting big enough elements -- (counting)
<p>Let <span class="math-container">$v$</span> be a vector of positive integers of length <span class="math-container">$n$</span>. I want to find the highest <span class="math-container">$k$</span> such as there are at least <span class="math-container">$k$</span> elements of ... | habedi/stack-exchange-dataset |
119,048 | Clarifying what it means to be Strongly NP-Complete | <p>Wikipedia defines strongly NP-Complete as:</p>

<blockquote>
 <p>A problem is said to be strongly NP-complete, if it remains so even when all of its numerical parameters are bounded by a polynomial in the length of the input.</p>
</blockquote>

<p>What I interpret this to mean is this:</p>&#... | complexity theory np complete reference request | 1 | Clarifying what it means to be Strongly NP-Complete -- (complexity theory np complete reference request)
<p>Wikipedia defines strongly NP-Complete as:</p>

<blockquote>
 <p>A problem is said to be strongly NP-complete, if it remains so even when all of its numerical parameters are bounded by a polynomial i... | habedi/stack-exchange-dataset |
119,050 | What strategy should I use to sovle this interview problem? May I apply DP on this? | <p>The problem description is as below and it feels like a DP problem but I am not sure, thank you for helping!</p>

<p>You have a certain dose of a drug, say, 200 milliliters, and now some patients need this drug. The doses for each patient may vary from person to person, for example, 2.5 milliliters for A, B,... | algorithms optimization | 1 | What strategy should I use to sovle this interview problem? May I apply DP on this? -- (algorithms optimization)
<p>The problem description is as below and it feels like a DP problem but I am not sure, thank you for helping!</p>

<p>You have a certain dose of a drug, say, 200 milliliters, and now some patients ... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.