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 |
|---|---|---|---|---|---|---|
72,384 | Functorial type constructors in System F | <p>I have come across the claim that all basic data types in System F, such as Bool, Nat, and List(U), can be expressed in the form $\forall \alpha (((T\alpha \rightarrow \alpha) \rightarrow \alpha)$, where $T(\alpha)$ is a definable functorial type constructor. </p>

<p>Can someone explain why this is true or ... | lambda calculus type theory | 1 | Functorial type constructors in System F -- (lambda calculus type theory)
<p>I have come across the claim that all basic data types in System F, such as Bool, Nat, and List(U), can be expressed in the form $\forall \alpha (((T\alpha \rightarrow \alpha) \rightarrow \alpha)$, where $T(\alpha)$ is a definable functorial t... | habedi/stack-exchange-dataset |
72,385 | A closed form expression for # of inputs of a binary tree and its number of nodes | <p>Is there any closed from expression that can express the number of input pins of a binary tree based on height of the tree and its number of nodes?</p>

<p>In case that the binary tree is a full tree, it is easy to find the number of input pins. In this case we will have $2^{H-1}$ nodes at the last level of ... | trees dynamic programming binary trees | 1 | A closed form expression for # of inputs of a binary tree and its number of nodes -- (trees dynamic programming binary trees)
<p>Is there any closed from expression that can express the number of input pins of a binary tree based on height of the tree and its number of nodes?</p>

<p>In case that the binary tre... | habedi/stack-exchange-dataset |
72,387 | Complexity of solving multiple problems of the same complexity? | <p>If I am given two languages $A$ and $B$ which are in NP, then we know that there exists a NDTM that can decide $A$ in polynomial time, and there exists another NDTM that can decide $B$ in polynomial time. Can I decide $A$ and $B$ in polynomial time using a NDTM by simply using a NDTM to check for belonging in $A$ th... | complexity theory | 1 | Complexity of solving multiple problems of the same complexity? -- (complexity theory)
<p>If I am given two languages $A$ and $B$ which are in NP, then we know that there exists a NDTM that can decide $A$ in polynomial time, and there exists another NDTM that can decide $B$ in polynomial time. Can I decide $A$ and $B$ ... | habedi/stack-exchange-dataset |
72,396 | Why is the lower bound of element uniqueness in $\Omega(n\log n)$? | <p>I wish to discuss the element uniqueness problem. First let's define the problem:</p>

<p>Definition from wikipedia:</p>

<blockquote>
 <p>In computational complexity theory, the element distinctness problem
 or element uniqueness problem is the problem of determining whether
 all the ... | complexity theory lower bounds | 1 | Why is the lower bound of element uniqueness in $\Omega(n\log n)$? -- (complexity theory lower bounds)
<p>I wish to discuss the element uniqueness problem. First let's define the problem:</p>

<p>Definition from wikipedia:</p>

<blockquote>
 <p>In computational complexity theory, the element distin... | habedi/stack-exchange-dataset |
72,411 | Proof that bin packing is strongly NP-complete? | <p>Wikipedia claims that bin packing is strongly NP-complete. Unfortunately I haven't been able to find a proof. Does anyone know where to find it?</p>
 | complexity theory np complete | 1 | Proof that bin packing is strongly NP-complete? -- (complexity theory np complete)
<p>Wikipedia claims that bin packing is strongly NP-complete. Unfortunately I haven't been able to find a proof. Does anyone know where to find it?</p>
 | habedi/stack-exchange-dataset |
72,421 | Proving laws of take and drop functions using structural induction on lists | <p>I'm trying to prove the following laws using structural induction on (finite) lists:</p>

<pre><code>take m (drop n xs) = drop n (take (m + n) xs)
drop m (drop n xs) = drop (m + n) xs
</code></pre>

<p>for all <code>m</code>, <code>n</code> and every finite list <code>xs</code> (code snippets... | proof techniques induction | 1 | Proving laws of take and drop functions using structural induction on lists -- (proof techniques induction)
<p>I'm trying to prove the following laws using structural induction on (finite) lists:</p>

<pre><code>take m (drop n xs) = drop n (take (m + n) xs)
drop m (drop n xs) = drop (m + n) xs
</code></... | habedi/stack-exchange-dataset |
72,424 | How does 0 have two values in one's complement? | <p>It is said that in 2's complement 0 has only one value, while in 1's complement both +0 and -0 have separate values. What are they? </p>
 | arithmetic | 1 | How does 0 have two values in one's complement? -- (arithmetic)
<p>It is said that in 2's complement 0 has only one value, while in 1's complement both +0 and -0 have separate values. What are they? </p>
 | habedi/stack-exchange-dataset |
72,428 | Hidden Markov Model initial probability reestimate: Why $\pi^*_i = \gamma_i(1)$ instead of $\pi^*_i = \frac{\gamma_i(1)}{\sum_{j = 1}^N \gamma_j(1)}$ | <p>In the sources I consulted it states that in the Baum Welch algorithm the reestimate of the initial probability of state $i$ of the HMM is $\pi^*_i = \gamma_i(1)$. But $\gamma_i(t)$ is the probability of being in state ${\displaystyle i}$ at time ${\displaystyle t}$ given the observed sequence ${\displaystyle Y}$ an... | machine learning probability theory probabilistic algorithms hidden markov models | 1 | Hidden Markov Model initial probability reestimate: Why $\pi^*_i = \gamma_i(1)$ instead of $\pi^*_i = \frac{\gamma_i(1)}{\sum_{j = 1}^N \gamma_j(1)}$ -- (machine learning probability theory probabilistic algorithms hidden markov models)
<p>In the sources I consulted it states that in the Baum Welch algorithm the reesti... | habedi/stack-exchange-dataset |
72,429 | Approximate time to execute algorithm | <p>Suppose a comparison between elements takes 1ms to execute. If an algorithm is O(logN), for example, deletion in an AVL Tree, and the AVL Tree contains 100 elements. Does that mean that the time to execute the algorithm would be log100 * 1ms? Do I need more information to calculate this or is this enough?</p>
 | algorithms time complexity | 1 | Approximate time to execute algorithm -- (algorithms time complexity)
<p>Suppose a comparison between elements takes 1ms to execute. If an algorithm is O(logN), for example, deletion in an AVL Tree, and the AVL Tree contains 100 elements. Does that mean that the time to execute the algorithm would be log100 * 1ms? Do I... | habedi/stack-exchange-dataset |
72,431 | How many edges before a random graph is connected? | <p>Let $G$ be a undirected graph with $n$ vertices and no edges, and let $f(k)$ be the probability that if we add $k$ edges randomly to $G$ that $G$ will be connected. How would one determine $f(k)$ for a given $n\in\mathbb N$?</p>

<h2>Specifics:</h2>

<p>When we add an edge to the graph $G$, any edge ... | random graphs | 1 | How many edges before a random graph is connected? -- (random graphs)
<p>Let $G$ be a undirected graph with $n$ vertices and no edges, and let $f(k)$ be the probability that if we add $k$ edges randomly to $G$ that $G$ will be connected. How would one determine $f(k)$ for a given $n\in\mathbb N$?</p>

<h2>Speci... | habedi/stack-exchange-dataset |
72,439 | Matrix for modular exponentiation in Shor's algorithm | <p>I'm trying to simulate Shor's algorithm with a model using vectors for quantum registers and matrices for quantum gates, however I'm stuck at the modular exponentiation bit of Shor's algorithm, having no idea how to build the corresponding matrix (unlike Hadamard and QFT). How can I build said matrix?</p>
 | quantum computing | 1 | Matrix for modular exponentiation in Shor's algorithm -- (quantum computing)
<p>I'm trying to simulate Shor's algorithm with a model using vectors for quantum registers and matrices for quantum gates, however I'm stuck at the modular exponentiation bit of Shor's algorithm, having no idea how to build the corresponding ... | habedi/stack-exchange-dataset |
72,441 | Time complexity of matrix multiplication in Big-Align | <p>I am reading the following paper:</p>

<p><a href="http://team-net-work.org/pdfs/KoutraTL_ICDM13.pdf" rel="nofollow noreferrer">Big-Align: Fast Bipartite Graph Alignment</a>. Danai Koutra, Hanghang Tong, David Lubensky. International Conference on Data Mining (ICDM 2013).</p>

<p>I'd like to unders... | time complexity runtime analysis linear algebra | 1 | Time complexity of matrix multiplication in Big-Align -- (time complexity runtime analysis linear algebra)
<p>I am reading the following paper:</p>

<p><a href="http://team-net-work.org/pdfs/KoutraTL_ICDM13.pdf" rel="nofollow noreferrer">Big-Align: Fast Bipartite Graph Alignment</a>. Danai Koutra, Hanghang Ton... | habedi/stack-exchange-dataset |
72,442 | Finding the language accepted by a DFA | <p>I've got this DFA and I need to figure out and describe the language that it accepts. I figured that $M= \{\{1,2,3,4,5,6\}, \{a,b\},1, \{1,5\}, \delta\}$<br>
Now I don't know how to move forward.
<a href="https://i.stack.imgur.com/Gif4K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gif4K... | regular languages finite automata | 1 | Finding the language accepted by a DFA -- (regular languages finite automata)
<p>I've got this DFA and I need to figure out and describe the language that it accepts. I figured that $M= \{\{1,2,3,4,5,6\}, \{a,b\},1, \{1,5\}, \delta\}$<br>
Now I don't know how to move forward.
<a href="https://i.stack.imgur.com/... | habedi/stack-exchange-dataset |
72,446 | How can primitive recursion in two variables be made to be of only one variable? | <p>Problem 7.16 in The Nature of Computation reads as follows:</p>

<blockquote>
 <p>[...] show that when defining primitive recursive functions, we really only need to think about functions of a single variable. In particular, show that a function $f(x)$ is primitive recursive if and only if it can be gen... | primitive recursion | 1 | How can primitive recursion in two variables be made to be of only one variable? -- (primitive recursion)
<p>Problem 7.16 in The Nature of Computation reads as follows:</p>

<blockquote>
 <p>[...] show that when defining primitive recursive functions, we really only need to think about functions of a singl... | habedi/stack-exchange-dataset |
72,449 | counteracting numerical instability in HMM training | <p>I am training a HMM with Baum Welch for part of speech tagging. I am training the model with 79 hidden variables (part of speech tags) and 80,000 observed variables (words). I am working with log probabilities. To give you an idea, I defined the necessary arithmetic operations like so:</p>

<pre><code>struct... | machine learning hidden markov models | 1 | counteracting numerical instability in HMM training -- (machine learning hidden markov models)
<p>I am training a HMM with Baum Welch for part of speech tagging. I am training the model with 79 hidden variables (part of speech tags) and 80,000 observed variables (words). I am working with log probabilities. To give you... | habedi/stack-exchange-dataset |
72,451 | How many gates until Turing Complete | <p>A computer can be pretty much made using just nand gates and a clock. Suppose you randomly place down nand gates on a board and connect them randomly to other nand gates. How many gates does someone have to put before it can be expected that the "computer" is Turing Complete?</p>
 | turing machines turing completeness | 1 | How many gates until Turing Complete -- (turing machines turing completeness)
<p>A computer can be pretty much made using just nand gates and a clock. Suppose you randomly place down nand gates on a board and connect them randomly to other nand gates. How many gates does someone have to put before it can be expected th... | habedi/stack-exchange-dataset |
72,475 | Formal languages - exercise | <p>I'm trying to solve this exercise: given $L=\left\{a^kb^k|k>0\right\}$
determine $L^2$ and $L^3$.</p>

<p>So I'm able to solve this kind of exercise if k is given into a defined range but I'm really struggling to solve this exercise. </p>

<p>Any help? Thanks. </p>
 | formal languages regular expressions | 1 | Formal languages - exercise -- (formal languages regular expressions)
<p>I'm trying to solve this exercise: given $L=\left\{a^kb^k|k>0\right\}$
determine $L^2$ and $L^3$.</p>

<p>So I'm able to solve this kind of exercise if k is given into a defined range but I'm really struggling to solve this exercise... | habedi/stack-exchange-dataset |
72,485 | For every context-free grammar, is there an equivalent grammar in Chomsky normal form? | <p>I thought that, for every CFG, there is an equivalent grammar in CNF. I was told this is false. Can someone explain to me why this is false and possibly provide a counter example?</p>
 | context free formal grammars normal forms | 1 | For every context-free grammar, is there an equivalent grammar in Chomsky normal form? -- (context free formal grammars normal forms)
<p>I thought that, for every CFG, there is an equivalent grammar in CNF. I was told this is false. Can someone explain to me why this is false and possibly provide a counter example?</p>... | habedi/stack-exchange-dataset |
72,498 | Every state in subset automaton is reachable | <p>I'm currently trying to prove that following NFA $\mathcal{M}_0 = (Q, \Sigma, \delta_0,0,\{0\})$ (see picture below) has an exponentially larger DFA $\mathcal{M}$ accepting the same language. </p>

<p>$\mathcal{M} = (2^Q,\Sigma,\delta,\{0\},F)$ is constructed using the subset/powerset algorithm and I'd like ... | regular languages finite automata | 1 | Every state in subset automaton is reachable -- (regular languages finite automata)
<p>I'm currently trying to prove that following NFA $\mathcal{M}_0 = (Q, \Sigma, \delta_0,0,\{0\})$ (see picture below) has an exponentially larger DFA $\mathcal{M}$ accepting the same language. </p>

<p>$\mathcal{M} = (2^Q,\Sig... | habedi/stack-exchange-dataset |
72,503 | (Nontrivial) Algorithms for finding the third largest element of a set | <p>According to the <a href="http://jeffe.cs.illinois.edu/teaching/algorithms/notes/29-adversary.pdf" rel="nofollow noreferrer">lecture note</a> by Jeff Erickson, the lower bound for finding the third largest element of a set of $n$ distinct elements is open. See the <a href="https://cs.stackexchange.com/q/32598/4911">... | reference request lower bounds search problem selection problem | 1 | (Nontrivial) Algorithms for finding the third largest element of a set -- (reference request lower bounds search problem selection problem)
<p>According to the <a href="http://jeffe.cs.illinois.edu/teaching/algorithms/notes/29-adversary.pdf" rel="nofollow noreferrer">lecture note</a> by Jeff Erickson, the lower bound f... | habedi/stack-exchange-dataset |
72,511 | Can the common algorithm to convert to Chomsky Normal Form result in “useless” productions? | <p>I have an example below which seems to lead to a “useless” production.</p>
<p>This is the original grammar:</p>
<p><span class="math-container">\begin{align*} 
 S&\longrightarrow aX\,|\,Yb\\
 X&\longrightarrow S\,|\,\varepsilon\\
 Y&\longrightarrow bY\,|\,b&#... | context free formal grammars | 1 | Can the common algorithm to convert to Chomsky Normal Form result in “useless” productions? -- (context free formal grammars)
<p>I have an example below which seems to lead to a “useless” production.</p>
<p>This is the original grammar:</p>
<p><span class="math-container">\begin{align*} 
 ... | habedi/stack-exchange-dataset |
72,512 | Intersection/Union of Language of PDA, CFG and NFA | <p>I stumbled across the following question. </p>

<p>Say I have given an arbitrary PDA $P$, NFA $N$, and CFG $G$. My question is then if the following language ($L(P) \cap L(N)) \cup L(G)$ is context-free.</p>

<p>How can this be determined?</p>
 | regular languages automata context free | 1 | Intersection/Union of Language of PDA, CFG and NFA -- (regular languages automata context free)
<p>I stumbled across the following question. </p>

<p>Say I have given an arbitrary PDA $P$, NFA $N$, and CFG $G$. My question is then if the following language ($L(P) \cap L(N)) \cup L(G)$ is context-... | habedi/stack-exchange-dataset |
72,515 | A simple Query regarding Modulus Notation? | <p>Aren't these two Modulus equations exactly the same (seems obvious): </p>

<ol>
<li>$ X = 0 \ (mod\ B) $</li>
<li>$ X = B \ (mod\ B) $</li>
</ol>

<p>The reason for the query is the following NP Complete Problem from Garey and Jhonson:</p>

<p>AN2, Simultaneous incongruences. </p>... | discrete mathematics | 1 | A simple Query regarding Modulus Notation? -- (discrete mathematics)
<p>Aren't these two Modulus equations exactly the same (seems obvious): </p>

<ol>
<li>$ X = 0 \ (mod\ B) $</li>
<li>$ X = B \ (mod\ B) $</li>
</ol>

<p>The reason for the query is the following NP Complete Problem from Gar... | habedi/stack-exchange-dataset |
72,521 | How to prove the language as "Recursive"? | <p>How to prove the statement </p>

<blockquote>
 <p>"If the strings of a language $L$ can be enumerated in lexicographically(alphabetic) order, then the language is Recursive but not context free" ?</p>
</blockquote>

<hr>

<p>Basically, My point is how can the strings of $a^nb^nc^n$ c... | computability turing machines | 1 | How to prove the language as "Recursive"? -- (computability turing machines)
<p>How to prove the statement </p>

<blockquote>
 <p>"If the strings of a language $L$ can be enumerated in lexicographically(alphabetic) order, then the language is Recursive but not context free" ?</p>
</blockquote>

... | habedi/stack-exchange-dataset |
72,527 | Superdense coding - What are the individual qubits A and B? | <p>With reference to <a href="https://cs.uwaterloo.ca/~watrous/CPSC519/LectureNotes/03.pdf" rel="nofollow noreferrer">this</a> PDF discussing Superdense coding, it is mentioned that there are two qubits A and B whose superposition gives the system $\frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|11\rangle$. It is sa... | quantum computing | 1 | Superdense coding - What are the individual qubits A and B? -- (quantum computing)
<p>With reference to <a href="https://cs.uwaterloo.ca/~watrous/CPSC519/LectureNotes/03.pdf" rel="nofollow noreferrer">this</a> PDF discussing Superdense coding, it is mentioned that there are two qubits A and B whose superposition gives... | habedi/stack-exchange-dataset |
72,533 | What is the name of the other vertex of an undirected edge? | <p>Let's say I have an <strong>undirected</strong> graph with an edge $e = \{a,b\}$ connecting vertices $a$ and $b$.</p>

<p>Taking vertex $a$, what is the name of the other vertex? Is it the "co-vertex"? Or simply the "other vertex"? Or the "neighbouring vertex"?</p>
 | graphs terminology | 1 | What is the name of the other vertex of an undirected edge? -- (graphs terminology)
<p>Let's say I have an <strong>undirected</strong> graph with an edge $e = \{a,b\}$ connecting vertices $a$ and $b$.</p>

<p>Taking vertex $a$, what is the name of the other vertex? Is it the "co-vertex"? Or simply the "other ve... | habedi/stack-exchange-dataset |
72,542 | Represent a 5 card poker hand | <p>A deck of cards is 52. A hand is 5 cards from the 52 (cannot have a duplicate). </p>

<p>What is the least amount of bits to represent a 5 card hand and how?<br>
A hand is NOT order dependent (KQ = QK). 64329 = 96432</p>

<p>Yes, can use 52 bits. That can represent a hand of any number of cards... | combinatorics | 1 | Represent a 5 card poker hand -- (combinatorics)
<p>A deck of cards is 52. A hand is 5 cards from the 52 (cannot have a duplicate). </p>

<p>What is the least amount of bits to represent a 5 card hand and how?<br>
A hand is NOT order dependent (KQ = QK). 64329 = 96432</p>

<p>Yes, can use 52 bits.... | habedi/stack-exchange-dataset |
72,562 | Transforming 3 SAT to Simultaneous In-Congruence Problem? | <p>Garey and Jhonson mentions that a 3-SAT Problem can be transformed to another NP-Complete Problem - Simultaneous incongruences (AN2):</p>

<p>Given a collection $[(a_1,b_1),…,(a_n,b_n)]$ of ordered pairs of positive integers with $a_i≤b_i$ for $1≤i≤n$, is there an integer $x$ such that for all $i$, $x≢a_i(m... | np complete | 1 | Transforming 3 SAT to Simultaneous In-Congruence Problem? -- (np complete)
<p>Garey and Jhonson mentions that a 3-SAT Problem can be transformed to another NP-Complete Problem - Simultaneous incongruences (AN2):</p>

<p>Given a collection $[(a_1,b_1),…,(a_n,b_n)]$ of ordered pairs of positive integers with $a_i... | habedi/stack-exchange-dataset |
72,564 | Understanding google's user level threads in kernel threads | <p>I came across Paul Turner work on increasing efficiency of M:N threading model. I am not able to grasp the concept at slide 18 of <a href="http://www.linuxplumbersconf.org/2013/ocw/system/presentations/1653/original/LPC%20-%20User%20Threading.pdf#4" rel="nofollow noreferrer">LPC-User-Threading</a></p>

<p>It... | operating systems process scheduling threads | 1 | Understanding google's user level threads in kernel threads -- (operating systems process scheduling threads)
<p>I came across Paul Turner work on increasing efficiency of M:N threading model. I am not able to grasp the concept at slide 18 of <a href="http://www.linuxplumbersconf.org/2013/ocw/system/presentations/1653/... | habedi/stack-exchange-dataset |
72,572 | How many telescoping constructors will I have? | <p>The Builder Pattern solves the problem of Telescoping Constructors; that is, having a single constructor for every possible parameter combination (including those combinations for which a parameter is omitted).</p>

<p>So for example:</p>

<pre><code> public Food(int id, String name) {
 this(... | software engineering | 1 | How many telescoping constructors will I have? -- (software engineering)
<p>The Builder Pattern solves the problem of Telescoping Constructors; that is, having a single constructor for every possible parameter combination (including those combinations for which a parameter is omitted).</p>

<p>So for example:</... | habedi/stack-exchange-dataset |
72,581 | If P is a property of turing machines, does P $\leq_T$ COUNT_P imply that P $\in$ RE $\cup$ coRE? | <p>Fix an input and tape alphabet $\Sigma$ and $\Gamma$. Let P be a property of turing machines over these alphabets, i.e., a subset of $\{\langle M \rangle \mid M \text{ is a TM over the alphabets } \Sigma \text{ and } \Gamma\}$. Define COUNT_P to be the function $\mathbb{N} \to \mathbb{N}$ describing the number of $n... | turing machines | 1 | If P is a property of turing machines, does P $\leq_T$ COUNT_P imply that P $\in$ RE $\cup$ coRE? -- (turing machines)
<p>Fix an input and tape alphabet $\Sigma$ and $\Gamma$. Let P be a property of turing machines over these alphabets, i.e., a subset of $\{\langle M \rangle \mid M \text{ is a TM over the alphabets } \... | habedi/stack-exchange-dataset |
72,585 | What's the complexity of running an algorithm that searches over all cuts on a network and returns the minimum? | <p>It's a question of a problem set. If I search for all possible cuts on a network graph and return the minimum, (so it will be equal to max flow), what will be the complexity of running this?</p>
 | discrete mathematics network flow | 1 | What's the complexity of running an algorithm that searches over all cuts on a network and returns the minimum? -- (discrete mathematics network flow)
<p>It's a question of a problem set. If I search for all possible cuts on a network graph and return the minimum, (so it will be equal to max flow), what will be the com... | habedi/stack-exchange-dataset |
72,592 | Expressing a logical constraint in integer programming | <p>Let $x$ be an integer such that $x \in [ - 10,10]$ and $b$ a binary variable. Apply <strong>integer programming</strong> to express $b = 1 \leftrightarrow x \ge3$</p>

<p><strong>My work:</strong></p>

<p>\begin{equation}
 \begin{cases}
 \text{if}\,\,\,\,\ b = 1, & \text{then}\,\,... | logic integer programming modelling | 1 | Expressing a logical constraint in integer programming -- (logic integer programming modelling)
<p>Let $x$ be an integer such that $x \in [ - 10,10]$ and $b$ a binary variable. Apply <strong>integer programming</strong> to express $b = 1 \leftrightarrow x \ge3$</p>

<p><strong>My work:</strong></p>

<p>... | habedi/stack-exchange-dataset |
72,600 | Best way to merge 2 max heaps into a min heap | <p>Assume we have 2 max heaps, each with n nodes. We want to merge these 2 heaps and build a min heap. What is the best way to do this?</p>

<p>The easiest way is to consider 2 max heaps an array with $2n$ elements and build a min heap with $O(n)$ complexity. Is there an algorithm with a complexity better than ... | algorithms data structures time complexity trees heaps | 1 | Best way to merge 2 max heaps into a min heap -- (algorithms data structures time complexity trees heaps)
<p>Assume we have 2 max heaps, each with n nodes. We want to merge these 2 heaps and build a min heap. What is the best way to do this?</p>

<p>The easiest way is to consider 2 max heaps an array with $2n$ ... | habedi/stack-exchange-dataset |
72,602 | Recurrence which cannot be analyzed by master theorem | <p>Given the following recursion,<br>
$$T(n)=T(\frac{n}{2})+ aT(\frac{n}{4})+n^2, $$
How can I find the minimal value for $a$ such that ${T(n)=ω(n^2)}$? </p>

<p>I tried to do it by <em>tree recursion</em> but I did not succeed to prove it by this method.</p>
 | asymptotics recurrence relation | 1 | Recurrence which cannot be analyzed by master theorem -- (asymptotics recurrence relation)
<p>Given the following recursion,<br>
$$T(n)=T(\frac{n}{2})+ aT(\frac{n}{4})+n^2, $$
How can I find the minimal value for $a$ such that ${T(n)=ω(n^2)}$? </p>

<p>I tried to do it by <em>tree recursion</em> but I... | habedi/stack-exchange-dataset |
72,603 | What is the name of this type of function composition? | <p>If standard function composition is defined as:</p>

<pre><code> (define compose
 { (B → C) → (A → B) 
 → (A → C) }

 F G -> (λ X (F (G X))))
</code></pre>

<p>What type of composition does the below function describe? Is there a particular name for it in catego... | functional programming mathematical foundations category theory | 1 | What is the name of this type of function composition? -- (functional programming mathematical foundations category theory)
<p>If standard function composition is defined as:</p>

<pre><code> (define compose
 { (B → C) → (A → B) 
 → (A → C) }

 F G -> (λ X (F (G X))))
</co... | habedi/stack-exchange-dataset |
72,604 | Difference of Big-Oh terms -- what is the result? | <p>I'd like to double-check my understanding of Big-Oh. </p>

<p>The definition is that $f(n) = O(g(n))$ if $|f(x)| ≤ M\,|g(x)|$ for a natural number $M$ and for sufficiently large values of $x$.</p>

<p>Now, if $g(n) = O(n^2) - O(n^2)$, may we conclude that $g(n) = 0$? If not, what can we say about $g(... | asymptotics landau notation | 1 | Difference of Big-Oh terms -- what is the result? -- (asymptotics landau notation)
<p>I'd like to double-check my understanding of Big-Oh. </p>

<p>The definition is that $f(n) = O(g(n))$ if $|f(x)| ≤ M\,|g(x)|$ for a natural number $M$ and for sufficiently large values of $x$.</p>

<p>Now, if $g(n) = O... | habedi/stack-exchange-dataset |
72,607 | How to find ${O(T(n)=4T(\frac{n-2}{2}) +n^2)}$ | <p>In given:<br>
$${T(n)=4T(\frac{n-2}{2}) +n^2 }$$
How can i find ${O(T(n))}$ ?</p>
 | recurrence relation | 1 | How to find ${O(T(n)=4T(\frac{n-2}{2}) +n^2)}$ -- (recurrence relation)
<p>In given:<br>
$${T(n)=4T(\frac{n-2}{2}) +n^2 }$$
How can i find ${O(T(n))}$ ?</p>
 | habedi/stack-exchange-dataset |
72,616 | Is it possible that the diameter of a graph be shorter than the longest shortest path? | <p>I used networkx to find the diameter of a graph that I have. It gave a diameter of 4. However, I found that between two particular nodes, using networkx's shortest path function, the path length is 5. I also coded dijkstra's algorithm and BFS from scratch and both returned a shortest path length of 5 too.</p>
&#... | graphs shortest path | 1 | Is it possible that the diameter of a graph be shorter than the longest shortest path? -- (graphs shortest path)
<p>I used networkx to find the diameter of a graph that I have. It gave a diameter of 4. However, I found that between two particular nodes, using networkx's shortest path function, the path length is 5. I a... | habedi/stack-exchange-dataset |
72,620 | Getting O-bounds by applying regression methods to execution time measurements | <p>Does anyone of you know how to associate an algorithm execution time (of experimental execution) to a well known complexity time? For example, say a divide and conquer algorithm lasts theoretically O(n·logn·n^2) or Ω(n·logn), in a theoretical way, doing reccurence ecuations and all that stuff. But when you plot the ... | algorithm analysis asymptotics runtime analysis experimental analysis | 1 | Getting O-bounds by applying regression methods to execution time measurements -- (algorithm analysis asymptotics runtime analysis experimental analysis)
<p>Does anyone of you know how to associate an algorithm execution time (of experimental execution) to a well known complexity time? For example, say a divide and con... | habedi/stack-exchange-dataset |
72,624 | Proof Review: Integer Factorization is in NP | <p>I want to prove that integer factorization is in NP
I have a general idea of how to prove this, and was wondering if I could get a sanity check:
I'll show it's in NP by using a non-deterministic TM whose longest computational branch runs in polynomial time.
The TM will do the following:
Given an inpu... | turing machines factoring check my answer | 1 | Proof Review: Integer Factorization is in NP -- (turing machines factoring check my answer)
<p>I want to prove that integer factorization is in NP
I have a general idea of how to prove this, and was wondering if I could get a sanity check:
I'll show it's in NP by using a non-deterministic TM whose longest compu... | habedi/stack-exchange-dataset |
72,626 | Why splitted text files is bigger than a large one with the same content? | <p>I have <a href="http://downloads.dbpedia.org/2016-04/core-i18n/en/long_abstracts_en.ttl.bz2" rel="nofollow noreferrer">this large text file</a> that when unzipped has about 2GB.
I split this one into multiple(more than 5 million) files and now I have a folder of about 20GB, how is this possible? </p>
 | filesystems big data | 1 | Why splitted text files is bigger than a large one with the same content? -- (filesystems big data)
<p>I have <a href="http://downloads.dbpedia.org/2016-04/core-i18n/en/long_abstracts_en.ttl.bz2" rel="nofollow noreferrer">this large text file</a> that when unzipped has about 2GB.
I split this one into multiple(more... | habedi/stack-exchange-dataset |
72,636 | Problem easy for humans and hard for general purpose machine learning, not needing external context? | <p>There are many problems that people can solve more easily than a machine learning algorithm. Often this is attributed to the extra context we have access to.</p>

<p>Image segmentation is an example of a problem that people are good at, but algorithms are not good at, probably because people have lots of ex... | machine learning computer vs human | 1 | Problem easy for humans and hard for general purpose machine learning, not needing external context? -- (machine learning computer vs human)
<p>There are many problems that people can solve more easily than a machine learning algorithm. Often this is attributed to the extra context we have access to.</p>

<p>I... | habedi/stack-exchange-dataset |
72,646 | Unique representation of 5-number sets with values 1-13 | <p>From a simulation I get 5 numbers 1-13. The nature of the simulation is that I do not get the numbers ordered. The value/rank of the the tuple is not order dependent 5 5 5 2 2 = 2 5 2 5 5. Values can repeat but they can repeat at most 4 times (it is a deck of cards). As it turn out there are 6175 combinations. C... | data structures sets encoding scheme | 1 | Unique representation of 5-number sets with values 1-13 -- (data structures sets encoding scheme)
<p>From a simulation I get 5 numbers 1-13. The nature of the simulation is that I do not get the numbers ordered. The value/rank of the the tuple is not order dependent 5 5 5 2 2 = 2 5 2 5 5. Values can repeat but they c... | habedi/stack-exchange-dataset |
72,656 | Is deciding if there's a solution to a single multivariate quadratic equation NP-hard? | <p>I know that given a system of multivariate quadratic equations (i.e, of the form $x^T Ax+b^T x=c$), deciding if there's a solution is NP-hard.</p>

<p>Is deciding if there's a solution to a single multivariate quadratic equation NP-hard too?</p>

<p>I am intersted in the NP-hardness of deciding if th... | complexity theory np complete np hard decision problem | 1 | Is deciding if there's a solution to a single multivariate quadratic equation NP-hard? -- (complexity theory np complete np hard decision problem)
<p>I know that given a system of multivariate quadratic equations (i.e, of the form $x^T Ax+b^T x=c$), deciding if there's a solution is NP-hard.</p>

<p>Is deciding... | habedi/stack-exchange-dataset |
72,659 | Distributing resources for maximum gain | <p>This feels like it would be a well researched (or solved) problem, but I can't find the right words to search for it.</p>

<p>Suppose there is a collection of shared resources, and a collection of possible processes. Each process consumes fixed quantities of each resource and provides a fixed benefit. Each p... | optimization resource allocation | 1 | Distributing resources for maximum gain -- (optimization resource allocation)
<p>This feels like it would be a well researched (or solved) problem, but I can't find the right words to search for it.</p>

<p>Suppose there is a collection of shared resources, and a collection of possible processes. Each process c... | habedi/stack-exchange-dataset |
72,670 | universality of quantum gates | <p>Is there a difference between the set of quantum gates that are:</p>

<ol>
<li><p>"universal" in the sense that you could calculate anything in BQP with a polynomial number of gates,</p></li>
<li><p>"universal" in the sense that you could approximate any arbitrary "gate" (unitary transformation) on a... | complexity theory quantum computing | 1 | universality of quantum gates -- (complexity theory quantum computing)
<p>Is there a difference between the set of quantum gates that are:</p>

<ol>
<li><p>"universal" in the sense that you could calculate anything in BQP with a polynomial number of gates,</p></li>
<li><p>"universal" in the sense that y... | habedi/stack-exchange-dataset |
72,672 | How to use structural induction to prove law on lists | <p>I want to prove that the following equation holds using structural induction on (finite) lists</p>

<pre><code>subs (map f xs) = map (map f) (subs xs)

where subs [] = [[]] (subs.1)
 subs (x:xs) = subs (xs) ++ map (x:) (subs xs) (subs.2)
... | proof techniques induction software verification lists | 1 | How to use structural induction to prove law on lists -- (proof techniques induction software verification lists)
<p>I want to prove that the following equation holds using structural induction on (finite) lists</p>

<pre><code>subs (map f xs) = map (map f) (subs xs)

where subs [] = [[]] ... | habedi/stack-exchange-dataset |
73,686 | Why do we prefer DFS to find connected components? | <p>In finding the connected components in a graph, why do we use DFS, instead of BFS?</p>
 | algorithms search algorithms | 1 | Why do we prefer DFS to find connected components? -- (algorithms search algorithms)
<p>In finding the connected components in a graph, why do we use DFS, instead of BFS?</p>
 | habedi/stack-exchange-dataset |
73,687 | On Plus of empty string | <p>We know $L^+=L^\star\backslash\{\epsilon\}$. How do we interpret that $\{\epsilon\}^+=\{\epsilon\}$?</p>
 | formal languages automata | 1 | On Plus of empty string -- (formal languages automata)
<p>We know $L^+=L^\star\backslash\{\epsilon\}$. How do we interpret that $\{\epsilon\}^+=\{\epsilon\}$?</p>
 | habedi/stack-exchange-dataset |
73,700 | Algorithm to find path with max sum of degrees in a tree structure | <p>Is there an efficient way to <strong>find a path from root to a leaf such that it has the maximum sum of degrees of nodes</strong> from all the paths possible in the tree.</p>

<p>For example if a tree is defined as the one in which each node is an integer and it has <strong>as many child nodes as the perfec... | graphs trees | 1 | Algorithm to find path with max sum of degrees in a tree structure -- (graphs trees)
<p>Is there an efficient way to <strong>find a path from root to a leaf such that it has the maximum sum of degrees of nodes</strong> from all the paths possible in the tree.</p>

<p>For example if a tree is defined as the one ... | habedi/stack-exchange-dataset |
73,702 | Is this a valid proof of uncomputability of a function that doesn't use diagonalization? | <p>Let's take the function $f = \{(0,\pi)\}$. </p>

<p>If I want to prove that such function is uncomputable I can simply say that calculating $\pi$ from $0$ would necessarily require infinitely many steps, since a Turing Machine can only write a single digit to its tape in each step.</p>

<p>Is th... | computability undecidability proof techniques | 1 | Is this a valid proof of uncomputability of a function that doesn't use diagonalization? -- (computability undecidability proof techniques)
<p>Let's take the function $f = \{(0,\pi)\}$. </p>

<p>If I want to prove that such function is uncomputable I can simply say that calculating $\pi$ from $0$ would nec... | habedi/stack-exchange-dataset |
73,707 | Maximizing the boolean combination of given real numbers | <p>Let $x_1, x_2, \dots, x_n \in \mathbb R$ and $b_1, b_2, \dots, b_n \in \{0,1\}$. I want to know which of all the possible boolean combinations is maximal. For example, if $x_1 = 2$ and $x_2 = -2$, </p>

<p>$$\max \sum_i b_i x_i = 2 \implies b_1 = 1, b_2 = 0$$</p>

<p>I can see that a brute force algo... | optimization approximation integer programming | 1 | Maximizing the boolean combination of given real numbers -- (optimization approximation integer programming)
<p>Let $x_1, x_2, \dots, x_n \in \mathbb R$ and $b_1, b_2, \dots, b_n \in \{0,1\}$. I want to know which of all the possible boolean combinations is maximal. For example, if $x_1 = 2$ and $x_2 = -2$, </p>
&#... | habedi/stack-exchange-dataset |
73,710 | Cost of solving a matrix equation using the FFT | <p>I am trying to calculate</p>

<p>$$V = (H^TH+I)^{-1} U$$ </p>

<p>where $H\in\mathbb{R}^{m\times m}$ is a circulant convolution matrix corresponding to a convolution kernel $h$, and $U\in\mathbb{R}^{m\times n}$. The computation of $V$ can be done using the FFT algorithm. </p>

<p>I am confuse... | algorithm analysis runtime analysis matrices numerical algorithms fourier transform | 1 | Cost of solving a matrix equation using the FFT -- (algorithm analysis runtime analysis matrices numerical algorithms fourier transform)
<p>I am trying to calculate</p>

<p>$$V = (H^TH+I)^{-1} U$$ </p>

<p>where $H\in\mathbb{R}^{m\times m}$ is a circulant convolution matrix corresponding to a convolutio... | habedi/stack-exchange-dataset |
73,713 | How can i find $Ω(f(n))$ and $O(f(n))$? | <p>Given the following function,<br>
$$f(n)=\prod_2^n \log i. $$ 
How can I find $f(n)=\Omega (?)$ and $f(n)=O(?)$ ?</p>

<p>I tried to do it, but I have no idea how to do it ..</p>
 | asymptotics | 1 | How can i find $Ω(f(n))$ and $O(f(n))$? -- (asymptotics)
<p>Given the following function,<br>
$$f(n)=\prod_2^n \log i. $$ 
How can I find $f(n)=\Omega (?)$ and $f(n)=O(?)$ ?</p>

<p>I tried to do it, but I have no idea how to do it ..</p>
 | habedi/stack-exchange-dataset |
73,718 | How are the 1s and 0s derived by the minimax algorithm for the game called "nim"? | <p>I'm having trouble figuring out why the 1s and 0s are where they are in this game tree for the game Nim:</p>

<p><a href="https://i.stack.imgur.com/jDrYo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jDrYo.png" alt="Minimax Game Tree from, Luger Artificial Intelligence Structures and Str... | artificial intelligence heuristics game theory | 1 | How are the 1s and 0s derived by the minimax algorithm for the game called "nim"? -- (artificial intelligence heuristics game theory)
<p>I'm having trouble figuring out why the 1s and 0s are where they are in this game tree for the game Nim:</p>

<p><a href="https://i.stack.imgur.com/jDrYo.png" rel="nofollow no... | habedi/stack-exchange-dataset |
73,730 | How to model this constraint using integer linear programming? | <p>Suppose we have $S=\{1,2,\ldots,n\}$, a binary variable $x$ and an integer $p$. I would like to model the following constraint using integer linear programming:</p>

<blockquote>
 <p>If $x = 1$, then there must exists a unique $i\in S$ such that: $x_j=1$ for all $j\in\{i,i+1,\ldots,i+p-1\}$.</p>
</b... | integer programming | 1 | How to model this constraint using integer linear programming? -- (integer programming)
<p>Suppose we have $S=\{1,2,\ldots,n\}$, a binary variable $x$ and an integer $p$. I would like to model the following constraint using integer linear programming:</p>

<blockquote>
 <p>If $x = 1$, then there must exist... | habedi/stack-exchange-dataset |
73,731 | Expected Number of Trials | <p>I have an algorithm problem that I want to share with you and I want to get some idea how can I solve it.</p>

<p>Problem statement:
You have to reach th Nth floor of a building by using a particular elevator: there is only one button that will take you from floor i to floor i+1 with probability p(i) or ... | algorithms probability theory | 1 | Expected Number of Trials -- (algorithms probability theory)
<p>I have an algorithm problem that I want to share with you and I want to get some idea how can I solve it.</p>

<p>Problem statement:
You have to reach th Nth floor of a building by using a particular elevator: there is only one button that will... | habedi/stack-exchange-dataset |
73,746 | Parallel or efficient computation of value with momentum | <p>I have a matrix $A$ with dimensions $M \times N$ and I want to compute $A'$ such that:</p>

<p>$$
A'_{i,j} = \alpha A'_{i,j-1} + (1 - \alpha) A_{i,j} \\
1 \leq i \leq M, 1 \leq j \leq N, \alpha \in [0, 1]
$$</p>

<p>Where $A'_{i,0}$ is some given constant.</p>

<p>I want to perfor... | algorithms parallel computing efficiency | 1 | Parallel or efficient computation of value with momentum -- (algorithms parallel computing efficiency)
<p>I have a matrix $A$ with dimensions $M \times N$ and I want to compute $A'$ such that:</p>

<p>$$
A'_{i,j} = \alpha A'_{i,j-1} + (1 - \alpha) A_{i,j} \\
1 \leq i \leq M, 1 \leq j \leq N, \alpha \in ... | habedi/stack-exchange-dataset |
73,754 | PAC learnability given information about the expectation of the training/true error | <p>Let $ \mathcal{X} $ be a domain set, $ \mathcal{Y}=\{0,1\} $ and $ \mathcal{H}$ an arbitary hypothesis class.</p>

<p>Assuming that there's an algorithm $ \mathcal{A} $ such that for every distribution $ \mathcal{D} $ realizable by $ \mathcal{H}$, it holds that 
$ \mathbb{E}_{S \sim \mathcal{D} ^M}[L^{0-... | machine learning | 1 | PAC learnability given information about the expectation of the training/true error -- (machine learning)
<p>Let $ \mathcal{X} $ be a domain set, $ \mathcal{Y}=\{0,1\} $ and $ \mathcal{H}$ an arbitary hypothesis class.</p>

<p>Assuming that there's an algorithm $ \mathcal{A} $ such that for every distribution $... | habedi/stack-exchange-dataset |
73,757 | Detemine if two DFA's are non-disjoint in polynomial time? | <p>Given two DFA's , $M_1$ and $M_2$, I want to create an algorithm that determines if their languages are disjoint or not. The algorithm will run in polynomial time.</p>

<p>My idea is this: Let's say WLOG that $M_1$ has 1 accepting state. We run DFS from that state and look at paths from the state to a starti... | algorithms automata polynomial time | 1 | Detemine if two DFA's are non-disjoint in polynomial time? -- (algorithms automata polynomial time)
<p>Given two DFA's , $M_1$ and $M_2$, I want to create an algorithm that determines if their languages are disjoint or not. The algorithm will run in polynomial time.</p>

<p>My idea is this: Let's say WLOG that ... | habedi/stack-exchange-dataset |
73,764 | Are there decidable problems that are reducible to undecidable problems? | <p>I've seen a question asking if $A \le_m B$, then if $A$ is decidable, $B$ is also decidable. My initial intuition is that this is not the case, and that there are decidable problems that are reducible to undecidable problems. While I am not sure if this is completely correct, or even how to prove this if it is corre... | reductions undecidability | 1 | Are there decidable problems that are reducible to undecidable problems? -- (reductions undecidability)
<p>I've seen a question asking if $A \le_m B$, then if $A$ is decidable, $B$ is also decidable. My initial intuition is that this is not the case, and that there are decidable problems that are reducible to undecidab... | habedi/stack-exchange-dataset |
73,766 | Complexity of / best algorithm for finding the dichotomy that maximizes information gain? | <p>Suppose that $X$ is a finite set with a probability measure $P$. I want to find the subset $A \subset X$ so that the information gain of conditioning on ${A, A^c}$ is maximal. That is, I want to find $A$ that maximizes</p>

<p>$$H(X) -H(X|\{A,A^c\}) = H(X) - (P(A)H(A) + P(A^c) H(A^c)),$$</p>

<p>wher... | complexity theory optimization machine learning coding theory entropy | 1 | Complexity of / best algorithm for finding the dichotomy that maximizes information gain? -- (complexity theory optimization machine learning coding theory entropy)
<p>Suppose that $X$ is a finite set with a probability measure $P$. I want to find the subset $A \subset X$ so that the information gain of conditioning on... | habedi/stack-exchange-dataset |
73,772 | Lower bound for $k$-sorting an array | <p>This is exercise 2 of the <a href="http://jeffe.cs.illinois.edu/teaching/algorithms/notes/28-lowerbounds.pdf" rel="nofollow noreferrer">lecture note by Jeff Erickson</a> on decision tree lower bounds.</p>
<blockquote>
<p>We say that an array <span class="math-container">$A[1 \ldots n]$</span> is <span class=... | algorithms sorting lower bounds | 1 | Lower bound for $k$-sorting an array -- (algorithms sorting lower bounds)
<p>This is exercise 2 of the <a href="http://jeffe.cs.illinois.edu/teaching/algorithms/notes/28-lowerbounds.pdf" rel="nofollow noreferrer">lecture note by Jeff Erickson</a> on decision tree lower bounds.</p>
<blockquote>
<p>We say that an... | habedi/stack-exchange-dataset |
73,778 | Finding the dichotomy that maximizes information gain for a classifier? | <p>Suppose that $\Omega$ is a finite probability space,with measure $P$ (we can take $P$ uniform). Let $C \in \{\pm 1 \}$ be a random variable on $\Omega$, the classifier. Let</p>

<p>$$H(C) = H(C, \Omega, P) = \sum_{i \in \pm 1} P(C = i) \log P(C = i)$$</p>

<p>be the entropy of $C$. </p>

<p>F... | optimization machine learning probability theory information theory entropy | 1 | Finding the dichotomy that maximizes information gain for a classifier? -- (optimization machine learning probability theory information theory entropy)
<p>Suppose that $\Omega$ is a finite probability space,with measure $P$ (we can take $P$ uniform). Let $C \in \{\pm 1 \}$ be a random variable on $\Omega$, the classif... | habedi/stack-exchange-dataset |
73,784 | Why doesn't 2-opt return an optimal solution? | <p>To find a solution for the Traveling Salesman Problem (TSP), one way to go is an algorithm called 2-opt, which is explained below.</p>

<pre><code>The 2-opt algorithm basically removes two edges
from the tour, and reconnects the two paths created.
This is often refered to as a 2-opt move. There is on... | heuristics traveling salesman | 1 | Why doesn't 2-opt return an optimal solution? -- (heuristics traveling salesman)
<p>To find a solution for the Traveling Salesman Problem (TSP), one way to go is an algorithm called 2-opt, which is explained below.</p>

<pre><code>The 2-opt algorithm basically removes two edges
from the tour, and reconnects... | habedi/stack-exchange-dataset |
73,794 | Having problem understanding the formal definition of NP | <p>So I'm having a tad bit of a problem deciphering the formal definition of NP. In my text book (Algorithm Design, Tardos et al) it says that a problem $X$ belongs to $NP$ iff;</p>

<ul>
<li>there exists a "certificate" string $t$ such that $|t| \le p(|s|)$ for a polynomial function $p$ and an input string... | np decision problem p vs np | 1 | Having problem understanding the formal definition of NP -- (np decision problem p vs np)
<p>So I'm having a tad bit of a problem deciphering the formal definition of NP. In my text book (Algorithm Design, Tardos et al) it says that a problem $X$ belongs to $NP$ iff;</p>

<ul>
<li>there exists a "certificat... | habedi/stack-exchange-dataset |
73,795 | Sorting in a probabilistic order | <p>Given a list of real numbers $p_1, \dots, p_n$, I am looking for a most efficient algorithm to sort this list in a "probabilistic ascending order", meaning that $p_i < p_j$ implies that it is likely for $i$ to be placed before $j$, but not certain. In principle, every permutation is a possible output, but the les... | sorting probability theory | 1 | Sorting in a probabilistic order -- (sorting probability theory)
<p>Given a list of real numbers $p_1, \dots, p_n$, I am looking for a most efficient algorithm to sort this list in a "probabilistic ascending order", meaning that $p_i < p_j$ implies that it is likely for $i$ to be placed before $j$, but not certain. ... | habedi/stack-exchange-dataset |
73,799 | Algorithm for choosing unique options with least overall cost | <h1>Problem And Question</h1>

<p>I am looking for pointers for an efficient algorithm for the following problem.</p>

<p>It is hard to explain without some data so first I will provide some example data:</p>

<pre>
Destination 1:
 Source 1: Cost 26
 Source 2: Cost 32
 Sour... | algorithms optimization time complexity | 1 | Algorithm for choosing unique options with least overall cost -- (algorithms optimization time complexity)
<h1>Problem And Question</h1>

<p>I am looking for pointers for an efficient algorithm for the following problem.</p>

<p>It is hard to explain without some data so first I will provide some exampl... | habedi/stack-exchange-dataset |
73,801 | Integer linear programming formulation of formula in DNF | <p>I have multiple sets, e.g.,</p>

<p>$$\{1, 2\}, \{2, 3, 4\}, \{1, 4\}$$</p>

<p>Each variable $1, 2, 3, 4$ is binary. I need to represent the following condition without additional variables</p>

<p>$$(1 \land 2) \lor (2 \land 3 \land 4) \lor (1 \land 4)$$</p>

<p>Basically, I need to... | linear programming integer programming modelling encoding scheme | 1 | Integer linear programming formulation of formula in DNF -- (linear programming integer programming modelling encoding scheme)
<p>I have multiple sets, e.g.,</p>

<p>$$\{1, 2\}, \{2, 3, 4\}, \{1, 4\}$$</p>

<p>Each variable $1, 2, 3, 4$ is binary. I need to represent the following condition without addi... | habedi/stack-exchange-dataset |
73,814 | Finding missing range in multidimensional domain | <p>Let's suppose that I have a monodimensional numeric domain and a list of ranges in this domain defined as</p>

<pre><code>class Range {
 int lowerBound;
 int upperBound;
}
</code></pre>

<p>then it's trivial to check if the union of the <code>List<Range></code> is covering... | graphs | 1 | Finding missing range in multidimensional domain -- (graphs)
<p>Let's suppose that I have a monodimensional numeric domain and a list of ranges in this domain defined as</p>

<pre><code>class Range {
 int lowerBound;
 int upperBound;
}
</code></pre>

<p>then it's trivial to check i... | habedi/stack-exchange-dataset |
73,815 | How to prove that $n^2$ is not $o(n^2+10^{10}n)$? | <p>I need to prove that $n^2$ is not $o(n^2+10^{10}n)$. I thought of the limit test: 
$$
\lim_{n \to \infty} \frac{n^2}{n^2+10^{10}n} = 1 \Rightarrow n^2 = \Theta(n^2+10^{10}n)
$$</p>

<p>However I'm not sure if the result of the test rules out the possibility of $o(n^2+10^{10}n)$.</p>
 | asymptotics landau notation | 1 | How to prove that $n^2$ is not $o(n^2+10^{10}n)$? -- (asymptotics landau notation)
<p>I need to prove that $n^2$ is not $o(n^2+10^{10}n)$. I thought of the limit test: 
$$
\lim_{n \to \infty} \frac{n^2}{n^2+10^{10}n} = 1 \Rightarrow n^2 = \Theta(n^2+10^{10}n)
$$</p>

<p>However I'm not sure if the r... | habedi/stack-exchange-dataset |
73,831 | Local type argument synthesis when type variable does not appear in arguments | <p>I am implementing the techniques described in the classic <a href="https://www.cis.upenn.edu/~bcpierce/papers/lti.pdf" rel="noreferrer">Local Type Inference</a> paper. Specifically, I am implementing the type argument synthesis algorithm from section 3.</p>

<p>My algorithm seems to mostly work, but it doesn... | type theory type checking typing type inference | 1 | Local type argument synthesis when type variable does not appear in arguments -- (type theory type checking typing type inference)
<p>I am implementing the techniques described in the classic <a href="https://www.cis.upenn.edu/~bcpierce/papers/lti.pdf" rel="noreferrer">Local Type Inference</a> paper. Specifically, I am... | habedi/stack-exchange-dataset |
73,833 | Any problem solved by a finite automaton is in P | <p>After my Theory of Computation class today this question popped in my mind: If a problem can be solved by a finite automaton, this problem belongs to P. </p>

<p>I think its true, since automata recognize very simple languages, therefore all these languages would have polynomial algorithms to solve them. Thu... | complexity theory automata finite automata polynomial time | 1 | Any problem solved by a finite automaton is in P -- (complexity theory automata finite automata polynomial time)
<p>After my Theory of Computation class today this question popped in my mind: If a problem can be solved by a finite automaton, this problem belongs to P. </p>

<p>I think its true, since automata r... | habedi/stack-exchange-dataset |
73,840 | Rice–Shapiro theorem example | <p><a href="https://cs.stackexchange.com/questions/67722/rice-shapiro-theorem">Rice-Shapiro</a> theorem is:</p>

<blockquote>
 <p>Let $Γ$ be a set of computable functions such that the set $R_Γ$ is recursively enumerable. We have $f ∈ Γ$ if and only if there exists a finite function $θ ∈ Γ$ such that $θ ⊆ ... | computability | 1 | Rice–Shapiro theorem example -- (computability)
<p><a href="https://cs.stackexchange.com/questions/67722/rice-shapiro-theorem">Rice-Shapiro</a> theorem is:</p>

<blockquote>
 <p>Let $Γ$ be a set of computable functions such that the set $R_Γ$ is recursively enumerable. We have $f ∈ Γ$ if and only if there ... | habedi/stack-exchange-dataset |
73,844 | Why can there be no reductions from NP-complete problems to P problems under P ≠ NP | <p>Under the assumption that $P \ne NP$, why is it impossible to reduce a problem that is known to be NP-complete to a problem that is known to be of polynomial time complexity? What kind of fundamental theorems would this contradict if it was possible?</p>
 | complexity theory np complete reductions np p vs np | 1 | Why can there be no reductions from NP-complete problems to P problems under P ≠ NP -- (complexity theory np complete reductions np p vs np)
<p>Under the assumption that $P \ne NP$, why is it impossible to reduce a problem that is known to be NP-complete to a problem that is known to be of polynomial time complexity? W... | habedi/stack-exchange-dataset |
73,851 | Semidecidability/Decidability for strings seperated by a non alphabet symbol | <p>I am trying to prove the following:</p>

<p>Let $\Sigma $ be an alphabet not containing the symbol "$;$", and suppose that
$L \subseteq \Sigma^*$; $\Sigma^*$ is recursively enumerable. If this is the case language $L' = \{x \in \Sigma^*: x; y \in L \ for \ some \ y \in \Sigma^*\}$ is recursively enumera... | turing machines undecidability semi decidability | 1 | Semidecidability/Decidability for strings seperated by a non alphabet symbol -- (turing machines undecidability semi decidability)
<p>I am trying to prove the following:</p>

<p>Let $\Sigma $ be an alphabet not containing the symbol "$;$", and suppose that
$L \subseteq \Sigma^*$; $\Sigma^*$ is recursively e... | habedi/stack-exchange-dataset |
73,855 | What kind of LTL formula can be represented by DBAs | <p>I am looking for the portion of LTL formula that can be expressed by deterministic buchi automata. Is there any classification of this such?</p>
 | automata logic linear temporal logic buchi automata | 1 | What kind of LTL formula can be represented by DBAs -- (automata logic linear temporal logic buchi automata)
<p>I am looking for the portion of LTL formula that can be expressed by deterministic buchi automata. Is there any classification of this such?</p>
 | habedi/stack-exchange-dataset |
73,865 | Approximate Similarity Search | <p>I am implementing an <a href="https://www.cs.toronto.edu/~norouzi/research/papers/multi_index_hashing.pdf" rel="nofollow noreferrer">approximate similarity search using multi-index hashing</a>. I have a set (T) of millions of strings (of same length) and I have a query string(P) (or set of strings) that needs to fi... | strings hashing searching | 1 | Approximate Similarity Search -- (strings hashing searching)
<p>I am implementing an <a href="https://www.cs.toronto.edu/~norouzi/research/papers/multi_index_hashing.pdf" rel="nofollow noreferrer">approximate similarity search using multi-index hashing</a>. I have a set (T) of millions of strings (of same length) and ... | habedi/stack-exchange-dataset |
73,873 | Existence of suitable pseudo-random number generators to derandomize BPP to P | <p>I am struggling to understand how the known oracle, and conditional derandomization results connecting $BPP$ and $P$, relate to each other.</p>

<p>My understanding is that if there is a suitably strong pseduo-random number generator that only uses $O(\log n)$ seed bits, then we can derandomize $BPP$ to $P$ ... | complexity theory randomized algorithms pseudo random generators oracle machines | 1 | Existence of suitable pseudo-random number generators to derandomize BPP to P -- (complexity theory randomized algorithms pseudo random generators oracle machines)
<p>I am struggling to understand how the known oracle, and conditional derandomization results connecting $BPP$ and $P$, relate to each other.</p>

... | habedi/stack-exchange-dataset |
73,885 | Showing $1$-reducibility of $\overline{\text{HALT}'}$ to index set | <p>Note: overline denotes complement</p>

<p>I am trying to show that $\overline{\text{HALT}'}\leq_1 \{i\colon\Phi_i=\Phi_e\}:= A$ for some fixed $e$ but I am misunderstanding the problem or method and can't figure out where I'm going wrong. I am using the construction of the proof of Rice's theorem to prove th... | computability logic halting problem | 1 | Showing $1$-reducibility of $\overline{\text{HALT}'}$ to index set -- (computability logic halting problem)
<p>Note: overline denotes complement</p>

<p>I am trying to show that $\overline{\text{HALT}'}\leq_1 \{i\colon\Phi_i=\Phi_e\}:= A$ for some fixed $e$ but I am misunderstanding the problem or method and ca... | habedi/stack-exchange-dataset |
73,892 | logical to physical addressing | <p>Consider the page table below (all numbers are in hex) and assume 1 KB page size. Assume 16-bit logical address and 20-bit physical address.</p>

<p>a.What are the page numbers and offsets for the following logical addresses: 1.1CC4 2.3A98 3.43FC 4.600C 5.2BD0 6.0</p>

<p>b.provide the physical addr... | operating systems virtual memory | 1 | logical to physical addressing -- (operating systems virtual memory)
<p>Consider the page table below (all numbers are in hex) and assume 1 KB page size. Assume 16-bit logical address and 20-bit physical address.</p>

<p>a.What are the page numbers and offsets for the following logical addresses: 1.1CC4 2.3A98... | habedi/stack-exchange-dataset |
73,895 | How to prove that algorithm returns the value which appears more than $n/2$ times in the array? | <p>Given the following algorithm (pseudocode):</p>

<pre><code>alg1(A[1,..,n])
 i <- 1
 candidate <- NULL
 count <- 0
 while(i <= n)
 if(count = 0)
 candidate <- A[i]
 count <- count + 1
 else if(candidate = A[i])&... | correctness proof | 1 | How to prove that algorithm returns the value which appears more than $n/2$ times in the array? -- (correctness proof)
<p>Given the following algorithm (pseudocode):</p>

<pre><code>alg1(A[1,..,n])
 i <- 1
 candidate <- NULL
 count <- 0
 while(i <= n)
 if(count... | habedi/stack-exchange-dataset |
73,910 | What would a language look like in which precise GC was implementable as a library? | <p>Suppose you have some programming language with manual memory management. What features does this language need to have in order to be able to implement precise garbage collection as a library, and not as a fundamental language construct?</p>

<p>By a precise GC I mean one where only pointers to the heap are... | memory management language design garbage collection | 1 | What would a language look like in which precise GC was implementable as a library? -- (memory management language design garbage collection)
<p>Suppose you have some programming language with manual memory management. What features does this language need to have in order to be able to implement precise garbage collec... | habedi/stack-exchange-dataset |
73,917 | Minimally satisfying multiple qualitative requirements at once | <p>I am trying to design an algorithm that will generate the full list of ways to minimally satisfy multiple requirements, given information on how the individual requirements are fulfilled.</p>

<p>For example, let's say you can either have (1) or not have (0) four different foods: Apple, Banana, Carrot, Donut... | algorithms | 1 | Minimally satisfying multiple qualitative requirements at once -- (algorithms)
<p>I am trying to design an algorithm that will generate the full list of ways to minimally satisfy multiple requirements, given information on how the individual requirements are fulfilled.</p>

<p>For example, let's say you can eit... | habedi/stack-exchange-dataset |
73,927 | Which type compilers report if they cannot infer a precise type? | <p>In the presence of subtyping, a type checker can usually infer only some inequality constraints on the type rather than the exact type. Of course, internally it will store the full constraints. But what is the common practice in case it needs to display the inferred type to the programmer?</p>

<p>I thought ... | programming languages type theory type checking type inference types | 1 | Which type compilers report if they cannot infer a precise type? -- (programming languages type theory type checking type inference types)
<p>In the presence of subtyping, a type checker can usually infer only some inequality constraints on the type rather than the exact type. Of course, internally it will store the fu... | habedi/stack-exchange-dataset |
73,942 | Limited number of calls to a black box for finding longest path in graph given an access to oracle | <p>I'm given a black box that on graph $G = (V,E)$ and integer $0< K<|V|$ outputs $1$ iff there is a simple path of length greater than $K$ in $G$. I want to find the actual edges of the longest path in $G$ using as few calls to my black box as possible. </p>

<p>What I've come up with thus far is using t... | complexity theory graphs graph traversal | 1 | Limited number of calls to a black box for finding longest path in graph given an access to oracle -- (complexity theory graphs graph traversal)
<p>I'm given a black box that on graph $G = (V,E)$ and integer $0< K<|V|$ outputs $1$ iff there is a simple path of length greater than $K$ in $G$. I want to find the ac... | habedi/stack-exchange-dataset |
73,945 | Finding any $\epsilon$ vs finding minimal $\epsilon$ for case 3 of Master theorem | <p>I have a recurrence relation:
$$T(n) = 3T(\frac{n}{4}) + n\lg n$$</p>

<p>and I want to prove that $T(n) = \Theta(f(n))$ using Master theorem. There's also an example in my textbook on this relation, they're choosing $\epsilon = 0.2$. For example:</p>

<p>$$n^{\log_b a}=n^{\log_4 3} \Rightarrow ... | time complexity recurrence relation master theorem | 1 | Finding any $\epsilon$ vs finding minimal $\epsilon$ for case 3 of Master theorem -- (time complexity recurrence relation master theorem)
<p>I have a recurrence relation:
$$T(n) = 3T(\frac{n}{4}) + n\lg n$$</p>

<p>and I want to prove that $T(n) = \Theta(f(n))$ using Master theorem. There's also an example ... | habedi/stack-exchange-dataset |
73,949 | Why is the lower bound $m \log n$ for this make-set, union and find-set sequence? | <p>Look at this solution:</p>

<p><img src="https://imgur.com/VXZ95mn.png" alt="solution"></p>

<p>Is the lower bound $m\log n$ because we are only looking at the lower bound for union by rank only? If we make $n$ MAKE-SET operations, then there would be $\log n$ UNION operations, and then $m - 2n + 1$ ... | algorithm analysis data structures lower bounds union find | 1 | Why is the lower bound $m \log n$ for this make-set, union and find-set sequence? -- (algorithm analysis data structures lower bounds union find)
<p>Look at this solution:</p>

<p><img src="https://imgur.com/VXZ95mn.png" alt="solution"></p>

<p>Is the lower bound $m\log n$ because we are only looking at... | habedi/stack-exchange-dataset |
73,952 | A better upper bound to a recursive function | <p>it's my first answer here. </p>

<p>I do have an algorithm to calculate the factorial of a given number $n$ recursively, but without using any multiplication like the usual one, only sums are available. </p>

<p>I've ended up with an algorithm with a complexity function $T(n) = 1 + nT(n - 1)$.</p>&#x... | recurrence relation recursion | 1 | A better upper bound to a recursive function -- (recurrence relation recursion)
<p>it's my first answer here. </p>

<p>I do have an algorithm to calculate the factorial of a given number $n$ recursively, but without using any multiplication like the usual one, only sums are available. </p>

<p>I've ende... | habedi/stack-exchange-dataset |
73,970 | How to show that there are $\binom{M+K}{M}$ different number of type bins? | <p>In textbook by <a href="http://www.cc.gatech.edu/fac/Vijay.Vazirani/book.pdf" rel="nofollow noreferrer">Vazirani's textbook</a>, chapter 9 about Bin Packing. He give the following lemma.</p>

<blockquote>
 <p>Lemma 9.4 Let $\epsilon >1$ be fixed, and let K be a fixed nonnegative integer. Consider the... | algorithms optimization packing | 1 | How to show that there are $\binom{M+K}{M}$ different number of type bins? -- (algorithms optimization packing)
<p>In textbook by <a href="http://www.cc.gatech.edu/fac/Vijay.Vazirani/book.pdf" rel="nofollow noreferrer">Vazirani's textbook</a>, chapter 9 about Bin Packing. He give the following lemma.</p>

<bloc... | habedi/stack-exchange-dataset |
73,976 | To what extent is my interpretation of computable numbers correct? | <p><strong>Interpretation:</strong> Consider the comic strip below, where a person tries to prevent a robot from dismembering them by asking the robot to compute $\pi$ - the robot quickly produces an algorithm to calculate all of the digits of $\pi$ and begins dismembering the person. This is possible because $\pi$ is ... | computability computation models intuition | 1 | To what extent is my interpretation of computable numbers correct? -- (computability computation models intuition)
<p><strong>Interpretation:</strong> Consider the comic strip below, where a person tries to prevent a robot from dismembering them by asking the robot to compute $\pi$ - the robot quickly produces an algor... | habedi/stack-exchange-dataset |
73,980 | Why can't we simulate an NP oracle with an NP machine? | <p>In this question : <a href="https://cs.stackexchange.com/questions/2712/does-npnp-np">Does $NP^{NP}=NP$?</a> ,<br>
it says that one of the reason is that we don't know how to detect 'no' answers from the oracle.<br>
Why is that true though? There is an NTM for any language L in NP, that runs in polynomial ti... | complexity theory turing machines time complexity np oracle machines | 1 | Why can't we simulate an NP oracle with an NP machine? -- (complexity theory turing machines time complexity np oracle machines)
<p>In this question : <a href="https://cs.stackexchange.com/questions/2712/does-npnp-np">Does $NP^{NP}=NP$?</a> ,<br>
it says that one of the reason is that we don't know how to detect 'n... | habedi/stack-exchange-dataset |
73,992 | Let $G = (V,E)$ be an infinite digraph: $E \subset \mathbb{N}\times \mathbb{N}$ is decidable. Does it imply that $\delta (i,j)$ is a total function? | <p><strong>Problem:</strong></p>

<blockquote>
 <p>Let $G = (V,E)$ be an infinite digraph, such that $V = \mathbb{N}$, and $E \subset \mathbb{N}\times \mathbb{N}$ is decidable set. Does it imply
 that $\delta (i,j)$ is a total function? </p>
 
 <p>*(where $\delta (i,j)$ is the shortest path... | algorithms graphs computability | 1 | Let $G = (V,E)$ be an infinite digraph: $E \subset \mathbb{N}\times \mathbb{N}$ is decidable. Does it imply that $\delta (i,j)$ is a total function? -- (algorithms graphs computability)
<p><strong>Problem:</strong></p>

<blockquote>
 <p>Let $G = (V,E)$ be an infinite digraph, such that $V = \mathbb{N}$, an... | habedi/stack-exchange-dataset |
73,993 | How to determine if an automata (DFA) accepts an infinite or finite language? | <p>Given an automata [DFA <span class="math-container">$A=(Q,Σ,δ,q_0,F)$</span>], is there a way to determine whether it accepts an infinite or finite language? </p>
 | formal languages computability finite automata | 1 | How to determine if an automata (DFA) accepts an infinite or finite language? -- (formal languages computability finite automata)
<p>Given an automata [DFA <span class="math-container">$A=(Q,Σ,δ,q_0,F)$</span>], is there a way to determine whether it accepts an infinite or finite language? </p>
 | habedi/stack-exchange-dataset |
73,996 | Finding dimensions of a point cloud - floating point issues | <p>I have $N$ data points of some dimension $D$.</p>

<p>I want to know the dimension of the shape that those data points represent - for instance they might be a 2 dimensional triangle, even though they are in 8 dimensional space.</p>

<p>A way of doing this mathematically is to pick one of the points ... | linear algebra | 1 | Finding dimensions of a point cloud - floating point issues -- (linear algebra)
<p>I have $N$ data points of some dimension $D$.</p>

<p>I want to know the dimension of the shape that those data points represent - for instance they might be a 2 dimensional triangle, even though they are in 8 dimensional space.<... | habedi/stack-exchange-dataset |
73,999 | How to solve this problem of architecture and scalability? | <p>I know this question may seem weird, mainly, why the context (OS, kind of system, etc) isn't explicit. I am studying for an exam, and, according to the studies guide, one of the questions types can be:</p>

<p>"Assuming that a system has a large volume of access, and has a restricted capacity of devices. Wha... | computer architecture software engineering | 1 | How to solve this problem of architecture and scalability? -- (computer architecture software engineering)
<p>I know this question may seem weird, mainly, why the context (OS, kind of system, etc) isn't explicit. I am studying for an exam, and, according to the studies guide, one of the questions types can be:</p>
... | habedi/stack-exchange-dataset |
74,000 | 1 bit register with data flip flop doesn't store bit? | <p>A 1-bit register:</p>

<p><a href="https://i.stack.imgur.com/XjmZNm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XjmZNm.png" alt="1-bit register"></a></p>

<blockquote>
 <p>Credit:<br>
 Elements of Computing Systems<br>
 by Noam Nisan and Shimon Schocken<br>
 ... | computer architecture memory hardware storage | 1 | 1 bit register with data flip flop doesn't store bit? -- (computer architecture memory hardware storage)
<p>A 1-bit register:</p>

<p><a href="https://i.stack.imgur.com/XjmZNm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XjmZNm.png" alt="1-bit register"></a></p>

<blockquote>
 ... | habedi/stack-exchange-dataset |
74,007 | Is javascript scripting? | <p>This one goes both ways at this point in my computer science studies... Is it scripting in the same sense as a Python script (for example)? </p>

<p>Are they the same? </p>

<p>I'm learning Javascript at the moment as part of a Web design textbook but at the very start of my programming lessons I got... | programming languages | 1 | Is javascript scripting? -- (programming languages)
<p>This one goes both ways at this point in my computer science studies... Is it scripting in the same sense as a Python script (for example)? </p>

<p>Are they the same? </p>

<p>I'm learning Javascript at the moment as part of a Web design textbook b... | habedi/stack-exchange-dataset |
74,032 | Tight Bound of the Insertion Sort | <p>I'm asking this question because I was confused by some of the articles in the internet.</p>

<p>I already know that the asymptotic lower and upper bounds of insertion sort is $\Omega(n)$ and $O(n^2)$.</p>

<p>Therefore according to my understanding of the $\Theta$ notation, we cannot make a statemen... | algorithm analysis asymptotics sorting | 1 | Tight Bound of the Insertion Sort -- (algorithm analysis asymptotics sorting)
<p>I'm asking this question because I was confused by some of the articles in the internet.</p>

<p>I already know that the asymptotic lower and upper bounds of insertion sort is $\Omega(n)$ and $O(n^2)$.</p>

<p>Therefore acc... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.