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 |
|---|---|---|---|---|---|---|
93,047 | Minimal number of nodes needed to connect a disconnected graph | <p>Given a graph $G = (V, E)$ with $V = U \uplus T$ (let's say the vertices are
labelled $U$ or $T$), I am looking for the smallest set $U' \subseteq U$ such
that $G[U' \cup T]$ is connected.</p>

<p>If we eleminate all the type-U nodes from the graph, the type-T nodes (terminals) might form several dis... | algorithms graphs optimization | 1 | Minimal number of nodes needed to connect a disconnected graph -- (algorithms graphs optimization)
<p>Given a graph $G = (V, E)$ with $V = U \uplus T$ (let's say the vertices are
labelled $U$ or $T$), I am looking for the smallest set $U' \subseteq U$ such
that $G[U' \cup T]$ is connected.</p>

<p>If we... | habedi/stack-exchange-dataset |
93,051 | Calculate the number of trailing zeros in equation f(n) = f(n-1) * f(n-2) where f(0) and f(1) are any given arbitary numbers | <p>This question is doable if you can calculate the number by multiplying <code>f(n-1) and f(n-2)</code>. </p>

<p><strong>Is it possible to do this question if we entirely want to skip multiplying these 2 numbers and still be able to calculate say the number of trailing zeros in f(20).</strong></p>

<... | dynamic programming recurrence relation program optimization | 1 | Calculate the number of trailing zeros in equation f(n) = f(n-1) * f(n-2) where f(0) and f(1) are any given arbitary numbers -- (dynamic programming recurrence relation program optimization)
<p>This question is doable if you can calculate the number by multiplying <code>f(n-1) and f(n-2)</code>. </p>

<p><stro... | habedi/stack-exchange-dataset |
93,061 | An online algorithm to maintain the Pareto frontier elements | <p>I'm looking for an online algorithm/datastructure that is able to maintain a pareto frontier for two dimensional elements in an online scenario where elements can be added and deleted.</p>

<p>For example: </p>

<ul>
<li><p><code>insert((3,7))</code></p>

<ul>
<li>since the pareto fro... | algorithms data structures pareto | 1 | An online algorithm to maintain the Pareto frontier elements -- (algorithms data structures pareto)
<p>I'm looking for an online algorithm/datastructure that is able to maintain a pareto frontier for two dimensional elements in an online scenario where elements can be added and deleted.</p>

<p>For example: </p... | habedi/stack-exchange-dataset |
93,078 | Defining decision-problem complexity classes by counting branches of a polynomial-time NTM | <p><a href="https://quantumcomputing.stackexchange.com/a/1361/551">This answer</a> on another SE community discusses the concept of a "counting complexity class". As far as I can tell, the author is using that term in a slightly nonstandard way: <a href="http://www.win.tue.nl/~sthite/countingcomplexity.ps" rel="nofollo... | complexity theory complexity classes randomized algorithms counting | 1 | Defining decision-problem complexity classes by counting branches of a polynomial-time NTM -- (complexity theory complexity classes randomized algorithms counting)
<p><a href="https://quantumcomputing.stackexchange.com/a/1361/551">This answer</a> on another SE community discusses the concept of a "counting complexity c... | habedi/stack-exchange-dataset |
93,081 | Water Jug Problem | <p>I was reading an article on <a href="https://www.geeksforgeeks.org/two-water-jug-puzzle/" rel="nofollow noreferrer">Water Jug Problem</a>. The problem is -You are given a m litre jug and a n litre jug where 0 < m < n. Both the jugs are initially empty. The jugs don’t have markings to allow measuring smaller qu... | algorithms recursion | 1 | Water Jug Problem -- (algorithms recursion)
<p>I was reading an article on <a href="https://www.geeksforgeeks.org/two-water-jug-puzzle/" rel="nofollow noreferrer">Water Jug Problem</a>. The problem is -You are given a m litre jug and a n litre jug where 0 < m < n. Both the jugs are initially empty. The jugs don’t... | habedi/stack-exchange-dataset |
93,089 | A question about proving Rice's Theorem by reducing it to the Halting Problem | <p>I've read the definition for Rice's Theorem, here's the one from Wikipedia: </p>

<blockquote>
 <p>In computability theory, Rice's theorem states that all non-trivial,
 semantic properties of programs are undecidable. </p>
</blockquote>

<p>The classical proof for proving Rice's Theore... | computability undecidability rice theorem | 1 | A question about proving Rice's Theorem by reducing it to the Halting Problem -- (computability undecidability rice theorem)
<p>I've read the definition for Rice's Theorem, here's the one from Wikipedia: </p>

<blockquote>
 <p>In computability theory, Rice's theorem states that all non-trivial,
 seman... | habedi/stack-exchange-dataset |
93,090 | Count nodes within K-distance from all nodes in a set | <p>The problem is - Given an undirected tree with some marked nodes in a set and a positive number K. We need to print the count of all such nodes which have distance from all marked nodes less than K. </p>

<p>My first approach-</p>

<p>I ran bfs on every from each marked node given in the set and take... | algorithms graphs | 1 | Count nodes within K-distance from all nodes in a set -- (algorithms graphs)
<p>The problem is - Given an undirected tree with some marked nodes in a set and a positive number K. We need to print the count of all such nodes which have distance from all marked nodes less than K. </p>

<p>My first approach-</p>&#... | habedi/stack-exchange-dataset |
93,093 | Convert for loop into math sigma notation | <p>Have some code (written in C), need the equivalent notation for mathematics.
Is it possible using if-statements and sigma notation for this, and if so, how?</p>

<pre><code>int res = 0;
for (int i=0; i < (N/2)+1; i=i+1)
 if (N % pow(2, i) == 0) res = i;
</code></pre>

<p>I have go... | notation c | 1 | Convert for loop into math sigma notation -- (notation c)
<p>Have some code (written in C), need the equivalent notation for mathematics.
Is it possible using if-statements and sigma notation for this, and if so, how?</p>

<pre><code>int res = 0;
for (int i=0; i < (N/2)+1; i=i+1)
 if (N % pow(2,... | habedi/stack-exchange-dataset |
93,097 | Is Coq synthetic or analytic? | <p>In CMU's HoTT course, lecture 1, which can be found here: <a href="https://scs.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=0945cc7f-48b7-4803-81af-e7193a3f461d" rel="noreferrer">https://scs.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=0945cc7f-48b7-4803-81af-e7193a3f461d</a></p>

<p>At 33:52, Harper w... | type theory proof assistants philosophy | 1 | Is Coq synthetic or analytic? -- (type theory proof assistants philosophy)
<p>In CMU's HoTT course, lecture 1, which can be found here: <a href="https://scs.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=0945cc7f-48b7-4803-81af-e7193a3f461d" rel="noreferrer">https://scs.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=... | habedi/stack-exchange-dataset |
93,104 | Complexity of Longest Palindromic Subsequence Algorithm | <p>I'm trying to find the longest palindromic subsequence for any string and I've tried two approaches: </p>

<ol>
<li>Recursive Algoritm</li>
<li>Dynamic Programming</li>
</ol>

<p>Dynamic programming should be the better option in this case because of the time complexity but the time compl... | algorithms time complexity strings subsequences | 1 | Complexity of Longest Palindromic Subsequence Algorithm -- (algorithms time complexity strings subsequences)
<p>I'm trying to find the longest palindromic subsequence for any string and I've tried two approaches: </p>

<ol>
<li>Recursive Algoritm</li>
<li>Dynamic Programming</li>
</ol>

<p>D... | habedi/stack-exchange-dataset |
93,109 | Will this program terminate for every Integer? | <p>In a Part Test for GATE Preparation there was a question :</p>

<pre><code>f(n):
 if n is even: f(n) = n/2
 else f(n) = f(f(n-1))
</code></pre>

<p>I answered "It will terminate for all integers", because even for some negative integers, it will terminate as <strong>Stack Overflow... | algorithms recursion pseudocode | 1 | Will this program terminate for every Integer? -- (algorithms recursion pseudocode)
<p>In a Part Test for GATE Preparation there was a question :</p>

<pre><code>f(n):
 if n is even: f(n) = n/2
 else f(n) = f(f(n-1))
</code></pre>

<p>I answered "It will terminate for all integers", ... | habedi/stack-exchange-dataset |
93,115 | Turing machine that does not halt on any input | <p>I'm struggling to find a way to show that 
$$T = \{ \langle M \rangle\mid M \text{does not halt on any input}\}$$
is undecidable.
Should I use reduction? If so, reduce this to what &ndashp the halting problem?</p>
 | turing machines undecidability | 1 | Turing machine that does not halt on any input -- (turing machines undecidability)
<p>I'm struggling to find a way to show that 
$$T = \{ \langle M \rangle\mid M \text{does not halt on any input}\}$$
is undecidable.
Should I use reduction? If so, reduce this to what &ndashp the halting problem?</p>... | habedi/stack-exchange-dataset |
93,117 | Clone an Undirected Graph | <p>I was reading an article on <a href="https://www.geeksforgeeks.org/clone-an-undirected-graph/" rel="nofollow noreferrer">Clone an Undirected Graph</a>, It says I have do do bfs and have to keep track of visited/cloned nodes. </p>

<p>I have another approach- I will initialize an empty adjacency list and then... | algorithms graphs | 1 | Clone an Undirected Graph -- (algorithms graphs)
<p>I was reading an article on <a href="https://www.geeksforgeeks.org/clone-an-undirected-graph/" rel="nofollow noreferrer">Clone an Undirected Graph</a>, It says I have do do bfs and have to keep track of visited/cloned nodes. </p>

<p>I have another approach- I... | habedi/stack-exchange-dataset |
93,122 | Cover k edges to minimize the length of the longest uncovered path in a tree | <blockquote>
<p>You are given a <strong>tree</strong> <span class="math-container">$G\langle V, E\rangle$</span> and an integer <span class="math-container">$k$</span>. The goal is to cover <span class="math-container">$k$</span> edges of the graph, to minimize the length of the longest uncovered path in the tree (... | algorithms graphs trees | 1 | Cover k edges to minimize the length of the longest uncovered path in a tree -- (algorithms graphs trees)
<blockquote>
<p>You are given a <strong>tree</strong> <span class="math-container">$G\langle V, E\rangle$</span> and an integer <span class="math-container">$k$</span>. The goal is to cover <span class="math-co... | habedi/stack-exchange-dataset |
93,124 | Show how lack of universe levels would create contradiction in homotopy type theory (in Agda) | <p>The homotopy type theory book claims in section 1.3 that "As in naive set theory, we might wish for a universe of all types" but from this one could "deduce from it that every type, including the empty type representing the proposition False, is inhabited"</p>

<p>The reference that it gives uses notation th... | dependent types homotopy type theory | 1 | Show how lack of universe levels would create contradiction in homotopy type theory (in Agda) -- (dependent types homotopy type theory)
<p>The homotopy type theory book claims in section 1.3 that "As in naive set theory, we might wish for a universe of all types" but from this one could "deduce from it that every type,... | habedi/stack-exchange-dataset |
93,129 | Is there an $O(n^2)$ or $O(n^3)$ time algorithm to check if a number is a sum of $k$ elements of sorted array? | <blockquote>
 <p>Let $A$ be a sorted array of $n$ positive integers (sorted in non-decreasing order, that is there can be equal consecutive elements). Can we check whether some positive integer $x$ is a sum of $k$ elements of $A$ in $O(n^2)$ or $O(n^3)$ time complexity? If yes what would be the pseudocode?</p>
... | algorithms time complexity knapsack problems | 1 | Is there an $O(n^2)$ or $O(n^3)$ time algorithm to check if a number is a sum of $k$ elements of sorted array? -- (algorithms time complexity knapsack problems)
<blockquote>
 <p>Let $A$ be a sorted array of $n$ positive integers (sorted in non-decreasing order, that is there can be equal consecutive elements). Can... | habedi/stack-exchange-dataset |
93,132 | Least fix point of CTL formula | <p>In the book <a href="http://www.dahlan.web.id/files/ebooks/2004%20LOGIC%20IN%20COMPUTER%20SCIENCE%20Modelling%20and%20Reasoning%20about%20Systems.pdf" rel="nofollow noreferrer">Logic in Computer Science</a> on page 244, there is a proof that $[[E(\phi U\psi)]]$ is the least fixed point of $G(X)=[[\psi]] \cup ([[\phi... | logic model checking computation tree logic | 1 | Least fix point of CTL formula -- (logic model checking computation tree logic)
<p>In the book <a href="http://www.dahlan.web.id/files/ebooks/2004%20LOGIC%20IN%20COMPUTER%20SCIENCE%20Modelling%20and%20Reasoning%20about%20Systems.pdf" rel="nofollow noreferrer">Logic in Computer Science</a> on page 244, there is a proof ... | habedi/stack-exchange-dataset |
93,136 | Confusion in 2's complement of 00000000 | <p>I'm solving the end of the chapter problems of Morris Mano's Digital Design (4th Edition, if that's relevant). In one of the problems, it is asked to simply find the 1's and 2's complement of 00000000. It's 1's complement would be 11111111. Now, for 2's complement, adding 1 to will give 100000000. But in the answer ... | number theory number formats binary | 1 | Confusion in 2's complement of 00000000 -- (number theory number formats binary)
<p>I'm solving the end of the chapter problems of Morris Mano's Digital Design (4th Edition, if that's relevant). In one of the problems, it is asked to simply find the 1's and 2's complement of 00000000. It's 1's complement would be 11111... | habedi/stack-exchange-dataset |
93,143 | How to prove existence of the language | <p>Consider such question:</p>

<p>(<em>Prove or disprove</em>) There exists a language in $TIME(2^{n^2})$ that is not in $NTIME(n)$.</p>

<p>I guess that answer is yes because $TIME(2^{n^2})$ and $NTIME(n)$ are totally different classes ($TIME(2^{n})$ and $NTIME(n)$ are the same classes, i guess). How ... | complexity theory np decision problem nondeterminism | 1 | How to prove existence of the language -- (complexity theory np decision problem nondeterminism)
<p>Consider such question:</p>

<p>(<em>Prove or disprove</em>) There exists a language in $TIME(2^{n^2})$ that is not in $NTIME(n)$.</p>

<p>I guess that answer is yes because $TIME(2^{n^2})$ and $NTIME(n)$... | habedi/stack-exchange-dataset |
93,144 | Why is this grammar an LL(2) grammar? | <p>I had a question regarding LL(<span class="math-container">$k$</span>) grammars. I came across a problem that I attempted to solve, but my answer varied from the solution and I wasn't sure why.</p>

<p><span class="math-container">$$L = \{a^{n + 2}b^mc^{n + m}\ :\ n \ge 1,\ m \ge 1\}$$</span></p>

<p... | formal languages context free formal grammars | 1 | Why is this grammar an LL(2) grammar? -- (formal languages context free formal grammars)
<p>I had a question regarding LL(<span class="math-container">$k$</span>) grammars. I came across a problem that I attempted to solve, but my answer varied from the solution and I wasn't sure why.</p>

<p><span class="math-... | habedi/stack-exchange-dataset |
93,150 | P, NP Problem and Turing Machines | <p>My first question here, I think this will be an easy one.</p>

<p>As for definition:</p>

<p>NP:
NP is the set of decision problems solvable in polynomial time by a theoretical non-deterministic Turing machine. (wiki)</p>

<p>P:
P Contains all decision problems that can be solved by a... | complexity theory turing machines | 1 | P, NP Problem and Turing Machines -- (complexity theory turing machines)
<p>My first question here, I think this will be an easy one.</p>

<p>As for definition:</p>

<p>NP:
NP is the set of decision problems solvable in polynomial time by a theoretical non-deterministic Turing machine. (wiki)</p>&#x... | habedi/stack-exchange-dataset |
93,153 | What is $C_4$ + two "ears" called? | <p>A graph with $C_3$ + 3 "ears" is called a <a href="http://mathworld.wolfram.com/NetGraph.html" rel="nofollow noreferrer">net graph</a>. </p>

<p><a href="https://i.stack.imgur.com/IoiUZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IoiUZ.png" alt="enter image description here"></a></p>&#... | graphs terminology | 1 | What is $C_4$ + two "ears" called? -- (graphs terminology)
<p>A graph with $C_3$ + 3 "ears" is called a <a href="http://mathworld.wolfram.com/NetGraph.html" rel="nofollow noreferrer">net graph</a>. </p>

<p><a href="https://i.stack.imgur.com/IoiUZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.c... | habedi/stack-exchange-dataset |
93,162 | Is there an algorithm to find out if a truthtable can be represented as 2-sat, and if so find its 2-cnf? | <p>I know that not all truthtables have a corresponding 2-cnf representation, but is there a way to find out if a given truthtable has a 2-cnf representation, and if so to find what that is?</p>
 | satisfiability 2 sat | 1 | Is there an algorithm to find out if a truthtable can be represented as 2-sat, and if so find its 2-cnf? -- (satisfiability 2 sat)
<p>I know that not all truthtables have a corresponding 2-cnf representation, but is there a way to find out if a given truthtable has a 2-cnf representation, and if so to find what that is... | habedi/stack-exchange-dataset |
93,170 | Compute unknown matrices that minimize a sum | <p>This problem is about <a href="https://dsp.stackexchange.com/questions/49870/estimate-smartphone-accelerometer-bias/49934#49934">working with smart-phone accelerometers</a>.</p>

<p>To calibrate accelerometer, I need to find three unknown matrices T, K and B that minimize this sum:
$$\sum_{i=0}^N(|g|^2 -... | optimization matrices linear algebra signal processing | 1 | Compute unknown matrices that minimize a sum -- (optimization matrices linear algebra signal processing)
<p>This problem is about <a href="https://dsp.stackexchange.com/questions/49870/estimate-smartphone-accelerometer-bias/49934#49934">working with smart-phone accelerometers</a>.</p>

<p>To calibrate accelerom... | habedi/stack-exchange-dataset |
93,185 | Time complexity of travelling salesman problem | <p>Time complexity of travelling salesman problem is $O(n^2*2^n)$ using held-karp algorithm. Now, if don't use dynamic programming and solve it using the recursive procedure, time complexity is still $O(n^2*2^n)$. I know there are overlapping of subproblems and there will be less computations but the time complexity i... | algorithms graphs | 1 | Time complexity of travelling salesman problem -- (algorithms graphs)
<p>Time complexity of travelling salesman problem is $O(n^2*2^n)$ using held-karp algorithm. Now, if don't use dynamic programming and solve it using the recursive procedure, time complexity is still $O(n^2*2^n)$. I know there are overlapping of sub... | habedi/stack-exchange-dataset |
93,188 | Count all paths between two vertices | <p>The problem is we have to count number of paths between a source and a destination in a graph. The brute force approach is using backtracking which is $O(n!)$. </p>

<p>Is there any better solution to this problem?</p>

<p>Note that we have to count paths so we can't visit the same node again in a pa... | algorithms graphs | 1 | Count all paths between two vertices -- (algorithms graphs)
<p>The problem is we have to count number of paths between a source and a destination in a graph. The brute force approach is using backtracking which is $O(n!)$. </p>

<p>Is there any better solution to this problem?</p>

<p>Note that we have ... | habedi/stack-exchange-dataset |
93,189 | CSMA/CD with binary exponential backoff: Do both back off or just the loser? | <p>I've been given two PC's that are connected via Ethernet, and as such are using CSMA-CD with binary exponential backoff.</p>

<p>Now, both PC's, let's call them $A$ and $B$, are trying to send data simultaneously. So, the first time both randomly choose a number from $\{0,1\}$. Let's say $A$ wins (i.e. $A$ p... | computer networks | 1 | CSMA/CD with binary exponential backoff: Do both back off or just the loser? -- (computer networks)
<p>I've been given two PC's that are connected via Ethernet, and as such are using CSMA-CD with binary exponential backoff.</p>

<p>Now, both PC's, let's call them $A$ and $B$, are trying to send data simultaneou... | habedi/stack-exchange-dataset |
93,192 | Systematically altering functions | <p>Let A and B be two integers, where their size is constrained to 2 bits in binary. There exists a function F, which outputs integers of the same size, where F(A) = F(B) = Y. For example, A = 01, B = 10, and Y = 11.</p>

<p>There exist some possible functions, such as G(X) = X xor 10. Another could be H(X) = X... | number theory | 1 | Systematically altering functions -- (number theory)
<p>Let A and B be two integers, where their size is constrained to 2 bits in binary. There exists a function F, which outputs integers of the same size, where F(A) = F(B) = Y. For example, A = 01, B = 10, and Y = 11.</p>

<p>There exist some possible function... | habedi/stack-exchange-dataset |
93,197 | Algorithm analysis | <p><a href="https://i.stack.imgur.com/Mx2uM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mx2uM.jpg" alt="enter image description here"></a></p>

<p>why option c is the answer ? And why not option B ?</p>
 | algorithm analysis | 1 | Algorithm analysis -- (algorithm analysis)
<p><a href="https://i.stack.imgur.com/Mx2uM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mx2uM.jpg" alt="enter image description here"></a></p>

<p>why option c is the answer ? And why not option B ?</p>
 | habedi/stack-exchange-dataset |
93,203 | Is writing a number as two squares and writing the factors of a number equally hard? | <p>Let $L_1$ and $L_2$ be the following: </p>

<p>$L_1=\{r:\exists x,y \in \mathbb{Z} \text{ such that } x^2+y^2=r\}$</p>

<p>$L_2=\{(N,M): M<N, \exists 1<d\leq M \text{ such that d|N} \}$</p>

<p>Claim $L_1 \leq_P L_2$</p>

<p>Sketch Proof</p>

<p>If I want to know whethe... | complexity theory time complexity np decision problem | 1 | Is writing a number as two squares and writing the factors of a number equally hard? -- (complexity theory time complexity np decision problem)
<p>Let $L_1$ and $L_2$ be the following: </p>

<p>$L_1=\{r:\exists x,y \in \mathbb{Z} \text{ such that } x^2+y^2=r\}$</p>

<p>$L_2=\{(N,M): M<N, \exists 1&l... | habedi/stack-exchange-dataset |
93,205 | General version of pumping lemma for regular languages, how many partitions to consider | <p>The pumping lemma for regular languages states, that one should consider a string $w = xyz, w\in L$, that is, every possible division of $w$ into $xyz$. </p>

<p><a href="https://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages#General_version_of_pumping_lemma_for_regular_languages" rel="nofollow no... | formal languages pumping lemma | 1 | General version of pumping lemma for regular languages, how many partitions to consider -- (formal languages pumping lemma)
<p>The pumping lemma for regular languages states, that one should consider a string $w = xyz, w\in L$, that is, every possible division of $w$ into $xyz$. </p>

<p><a href="https://en.wik... | habedi/stack-exchange-dataset |
93,230 | Rectangular Automata | <p>have a question regarding rectangular automata and their derivatives.</p>

<p>In each location the derivates are defined by a interval, how are the derivates applied on the variables? 
Is one value chosen out of the interval and added to the value or do we reset the value to one value in the interval ? <... | automata | 1 | Rectangular Automata -- (automata)
<p>have a question regarding rectangular automata and their derivatives.</p>

<p>In each location the derivates are defined by a interval, how are the derivates applied on the variables? 
Is one value chosen out of the interval and added to the value or do we reset the val... | habedi/stack-exchange-dataset |
93,232 | Need pointers for problem formulation | <p><em>I have very little experience with graph DBs but i imagine this problem suits one</em></p>

<p>Assume a dataset with two entities , <strong>Users</strong> and <strong>Foods</strong>. A user can have a relationship with a <strong>Food</strong>, specifically they can score it from 0 to 100.</p>

<p... | graphs | 1 | Need pointers for problem formulation -- (graphs)
<p><em>I have very little experience with graph DBs but i imagine this problem suits one</em></p>

<p>Assume a dataset with two entities , <strong>Users</strong> and <strong>Foods</strong>. A user can have a relationship with a <strong>Food</strong>, specificall... | habedi/stack-exchange-dataset |
93,235 | functional vs state-based | <p>As mentioned in <a href="https://www.youtube.com/watch?v=eis11j_iGMs" rel="nofollow noreferrer">Lambda Calculus - Computerphile</a>, </p>

<blockquote>
 <p>Alonzo Church's method is functional where a function as a blackbox,
 takes an input, processes, and produces an output, and Turing machines&#x... | functional programming turing machines | 1 | functional vs state-based -- (functional programming turing machines)
<p>As mentioned in <a href="https://www.youtube.com/watch?v=eis11j_iGMs" rel="nofollow noreferrer">Lambda Calculus - Computerphile</a>, </p>

<blockquote>
 <p>Alonzo Church's method is functional where a function as a blackbox,
 tak... | habedi/stack-exchange-dataset |
93,240 | Understanding the algorithm behind day of week calculation | <p>I came across this algorithm recently to calculate day of the week for any year.</p>

<pre><code>int y0 = year - (14 - month) / 12;
int x = y0 + y0/4 - y0/100 + y0/400;
int m0 = month + 12*((14 - month)/12) - 2;
int d0 = (date + x + (31*m0)/12)%7;
switch (d0) {
 case 1: return "Monday"... | algorithms | 1 | Understanding the algorithm behind day of week calculation -- (algorithms)
<p>I came across this algorithm recently to calculate day of the week for any year.</p>

<pre><code>int y0 = year - (14 - month) / 12;
int x = y0 + y0/4 - y0/100 + y0/400;
int m0 = month + 12*((14 - month)/12) - 2;
int d0 = (... | habedi/stack-exchange-dataset |
93,241 | Linked List in Maximal Scoring Subsequences Algorithm | <p>For a project, I'm implementing the <a href="https://homes.cs.washington.edu/~ruzzo/papers/maxseq.pdf" rel="nofollow noreferrer">All Maximal Scoring Subsequences</a> algorithm. In the analysis portion of the paper, it describes an optimization that makes the algorithm run in linear time. Namely, when doing the searc... | algorithms algorithm analysis efficiency linked lists | 1 | Linked List in Maximal Scoring Subsequences Algorithm -- (algorithms algorithm analysis efficiency linked lists)
<p>For a project, I'm implementing the <a href="https://homes.cs.washington.edu/~ruzzo/papers/maxseq.pdf" rel="nofollow noreferrer">All Maximal Scoring Subsequences</a> algorithm. In the analysis portion of ... | habedi/stack-exchange-dataset |
93,245 | Prove np-hardness of dividing items from the lists | <p>I have the following problem.</p>

<p>Given a finite number of lists of items. The same item can appear in many lists. I would like to color items with <strong>3</strong> colors, such at least two colors appear in each list.</p>

<p>I would like to show that this problem is NP-hard. I would like to p... | graphs np complete reductions np hard colorings | 1 | Prove np-hardness of dividing items from the lists -- (graphs np complete reductions np hard colorings)
<p>I have the following problem.</p>

<p>Given a finite number of lists of items. The same item can appear in many lists. I would like to color items with <strong>3</strong> colors, such at least two colors a... | habedi/stack-exchange-dataset |
93,255 | How to Efficiently Define the Natural Numbers in Type Theory | <p>A while ago I wondered about how Proof Assistants like Coq <a href="https://math.stackexchange.com/questions/1398519/do-proof-assistants-like-coq-really-need-to-actually-perform-computations-to-pro">prove $m \leq n$</a> and the like. It looks like they actually need to traverse the natural numbers based on the succe... | type theory proof assistants | 1 | How to Efficiently Define the Natural Numbers in Type Theory -- (type theory proof assistants)
<p>A while ago I wondered about how Proof Assistants like Coq <a href="https://math.stackexchange.com/questions/1398519/do-proof-assistants-like-coq-really-need-to-actually-perform-computations-to-pro">prove $m \leq n$</a> an... | habedi/stack-exchange-dataset |
93,270 | Optimal strategy in repeated cake-cutting | <p>Alice and Bob play the famous game of <a href="https://en.wikipedia.org/wiki/Divide_and_choose" rel="nofollow noreferrer">divide and choose</a> $n$ times with $n$ identical cakes. Each time, Alice cuts the cake to two pieces, and Bob chooses the piece he prefers. Alice does not know Bob's preferences, but she assume... | game theory | 1 | Optimal strategy in repeated cake-cutting -- (game theory)
<p>Alice and Bob play the famous game of <a href="https://en.wikipedia.org/wiki/Divide_and_choose" rel="nofollow noreferrer">divide and choose</a> $n$ times with $n$ identical cakes. Each time, Alice cuts the cake to two pieces, and Bob chooses the piece he pre... | habedi/stack-exchange-dataset |
93,275 | How curves are represented in a computer | <p>I am confused now (in thinking about limits and continuity) how curves are represented in a typical modern computer. Curves are "continuous" in that there is no discrete change from one angle to the next. Wondering how the computer approximates this and/or what equations it uses/approximates.</p>
 | graphics | 1 | How curves are represented in a computer -- (graphics)
<p>I am confused now (in thinking about limits and continuity) how curves are represented in a typical modern computer. Curves are "continuous" in that there is no discrete change from one angle to the next. Wondering how the computer approximates this and/or what ... | habedi/stack-exchange-dataset |
93,283 | How to specify a robot go always right relative to itself from absolute perspective (north west east south) | <p>I have a robot that has a start and goal position within a maze. Each point in the maze-grid is simply a Position object containing x and y. I need an algorithm that specifies the robot only moving to its relative right only using goEast, west, east and south from the perspective of the maze. 
There is an implem... | algorithms logic object oriented adjacency matrix | 1 | How to specify a robot go always right relative to itself from absolute perspective (north west east south) -- (algorithms logic object oriented adjacency matrix)
<p>I have a robot that has a start and goal position within a maze. Each point in the maze-grid is simply a Position object containing x and y. I need an alg... | habedi/stack-exchange-dataset |
93,290 | Can the subset sum problem work with an undefined set? | <p>To give a brief outline of my actual problem, I'm attempting to identify possible impurities in proteins. I have a theoretical mass and an experimental mass, and the difference between the two would in theory be caused by any impurities present in the proteins. Impurities could take the form of an amino acid inserti... | subset sum | 1 | Can the subset sum problem work with an undefined set? -- (subset sum)
<p>To give a brief outline of my actual problem, I'm attempting to identify possible impurities in proteins. I have a theoretical mass and an experimental mass, and the difference between the two would in theory be caused by any impurities present i... | habedi/stack-exchange-dataset |
93,293 | What does "cavallier extension claim" in The Algorithm Design Manual mean | <p>I have been reading the Algorithm Design Manual by Steven S. Skienna and on page 15 it mentions a term called "cavallier extension claim" and I have been desperately trying to find a definition for this. A search in Google just returns quotes of the same book.</p>

<p>Possibly my confusion lies in the misspe... | algorithms | 1 | What does "cavallier extension claim" in The Algorithm Design Manual mean -- (algorithms)
<p>I have been reading the Algorithm Design Manual by Steven S. Skienna and on page 15 it mentions a term called "cavallier extension claim" and I have been desperately trying to find a definition for this. A search in Google just... | habedi/stack-exchange-dataset |
93,297 | Will hardware/implementation affect the time/space complexity of algorithms? | <p>I’m not even a CS student, so this might be a stupid question, but please bear with me...</p>

<p>In the pre-computer era, we can only implement an array data structure with something like an array of drawers. Since one have to locate the drawer with corresponding index before extracting the value from it, t... | algorithms algorithm analysis data structures runtime analysis | 1 | Will hardware/implementation affect the time/space complexity of algorithms? -- (algorithms algorithm analysis data structures runtime analysis)
<p>I’m not even a CS student, so this might be a stupid question, but please bear with me...</p>

<p>In the pre-computer era, we can only implement an array data struc... | habedi/stack-exchange-dataset |
93,299 | Is k -rainbow coloring of a hypergraph NP-complete or not? | <p>**A hypergraph is k-rainbow colorable if there exists a vertex coloring using k colors such that each hyperedge has all the k colors. Is k-rainbow coloring of a hypergraph is NP-complete or not? The problem is also called "polychromatic coloring" **</p>

<p>I looked at some reference papers such as "Hardness... | complexity theory discrete mathematics | 1 | Is k -rainbow coloring of a hypergraph NP-complete or not? -- (complexity theory discrete mathematics)
<p>**A hypergraph is k-rainbow colorable if there exists a vertex coloring using k colors such that each hyperedge has all the k colors. Is k-rainbow coloring of a hypergraph is NP-complete or not? The problem is also... | habedi/stack-exchange-dataset |
93,305 | Restrictions needed on ADT for totality | <p>In the paper <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.106.364&rep=rep1&type=pdf" rel="nofollow noreferrer">Total Functional Programming</a> by D.A. Turner three rules are given for a programming language to remain total:</p>

<ol>
<li>complete case analysis</li>
<li>c... | type theory inductive datatypes abstract data types | 1 | Restrictions needed on ADT for totality -- (type theory inductive datatypes abstract data types)
<p>In the paper <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.106.364&rep=rep1&type=pdf" rel="nofollow noreferrer">Total Functional Programming</a> by D.A. Turner three rules are given for a prog... | habedi/stack-exchange-dataset |
93,312 | Efficiently find elements which are out of place in an otherwise sorted list | <p>I have some data that includes two columns for dates, and I want to retrieve - based on these two columns - all the instances where an illegal operation has occured. An operation is illegal if the value in <code>Col B</code> breaks chronology in the column.</p>

<p><strong>Structure</strong></p>

<pr... | algorithms sorting efficiency | 1 | Efficiently find elements which are out of place in an otherwise sorted list -- (algorithms sorting efficiency)
<p>I have some data that includes two columns for dates, and I want to retrieve - based on these two columns - all the instances where an illegal operation has occured. An operation is illegal if the value in... | habedi/stack-exchange-dataset |
93,321 | Given a Turing machine M, is there a TM that computes the number of states M has? | <p>I've seen it used but I can't think of a way to construct such TM. Would appreciate any help!</p>
 | turing machines | 1 | Given a Turing machine M, is there a TM that computes the number of states M has? -- (turing machines)
<p>I've seen it used but I can't think of a way to construct such TM. Would appreciate any help!</p>
 | habedi/stack-exchange-dataset |
93,324 | How to understand the complexity of Kruskal implemented with Quick-Union by rank and path compression? | <p>I'm trying to understand the complexity of the Kruskal algorithm implemented with the Quick-Union by rank and with the path compression.</p>

<p>Now there is a theorem for the last structure above:</p>

<blockquote>
 <p>The complexity of any sequence of <strong>m</strong> operations of Makeset, ... | algorithms complexity theory graphs minimum spanning tree union find | 1 | How to understand the complexity of Kruskal implemented with Quick-Union by rank and path compression? -- (algorithms complexity theory graphs minimum spanning tree union find)
<p>I'm trying to understand the complexity of the Kruskal algorithm implemented with the Quick-Union by rank and with the path compression.</p>... | habedi/stack-exchange-dataset |
93,330 | How can segment be 60KB | <p>I read that each segment is 64KB,but how?
If you have address ABCD:EFGH , then 1 segment is 16B if it is addreses by bytes.
How do they don't overlap?
Example:
 0000:0010 = 00010
 0001:0000 = 00010 , is is same address.</p>
 | operating systems | 1 | How can segment be 60KB -- (operating systems)
<p>I read that each segment is 64KB,but how?
If you have address ABCD:EFGH , then 1 segment is 16B if it is addreses by bytes.
How do they don't overlap?
Example:
 0000:0010 = 00010
 0001:0000 = 00010 , is is same address.</p>
 | habedi/stack-exchange-dataset |
93,333 | How to Specify the Behavior of Automata for Verification | <p>I am wondering what it takes to "verify" or "prove" that an automaton is correct. What the components are that are required. It seems that an automaton would be an easier thing to formally verify as sound than say an arbitrary function. Not sure though what needs to be verified in an automaton, which is what brings ... | automata proof techniques software verification | 1 | How to Specify the Behavior of Automata for Verification -- (automata proof techniques software verification)
<p>I am wondering what it takes to "verify" or "prove" that an automaton is correct. What the components are that are required. It seems that an automaton would be an easier thing to formally verify as sound th... | habedi/stack-exchange-dataset |
93,339 | A fuzzy string matching algorithm for finding all occurrences from a set of strings in a large string | <p>I have thousands of documents, and a term list with thousands of entries. The entries in the term list range in length from an acronym of two characters to a 14-word phrase with 96 characters. I would like to find every occurrence of any term in the term list in each document in the order that they appear.</p>
&... | algorithms string matching | 1 | A fuzzy string matching algorithm for finding all occurrences from a set of strings in a large string -- (algorithms string matching)
<p>I have thousands of documents, and a term list with thousands of entries. The entries in the term list range in length from an acronym of two characters to a 14-word phrase with 96 ch... | habedi/stack-exchange-dataset |
93,343 | Naive Bayes' Classification and Using the Entire Vocabulary in the Denominator | <p>I am working through the NLP notes for Naive Bayes' classification here: <a href="https://web.stanford.edu/~jurafsky/slp3/6.pdf" rel="nofollow noreferrer">https://web.stanford.edu/~jurafsky/slp3/6.pdf</a></p>

<p>Below $c$ is the class of the observation and $w_i$ is the $i$th word of a text document.</p>&#x... | machine learning natural language processing | 1 | Naive Bayes' Classification and Using the Entire Vocabulary in the Denominator -- (machine learning natural language processing)
<p>I am working through the NLP notes for Naive Bayes' classification here: <a href="https://web.stanford.edu/~jurafsky/slp3/6.pdf" rel="nofollow noreferrer">https://web.stanford.edu/~jurafsk... | habedi/stack-exchange-dataset |
93,356 | Example divide and conquer algorithm with recurrence T(n) = T(n/2) + O(n) | <p>I'm working on some lecture notes and wondered if there was a good example algorithm for the recurrence equation</p>

<p>$$T(n) = T(n/2) + n$$</p>

<p>I know that I can do selection in this running time, but that is a probabilistic algorithm, and I was hoping not to introduce this algorithm at this p... | divide and conquer | 1 | Example divide and conquer algorithm with recurrence T(n) = T(n/2) + O(n) -- (divide and conquer)
<p>I'm working on some lecture notes and wondered if there was a good example algorithm for the recurrence equation</p>

<p>$$T(n) = T(n/2) + n$$</p>

<p>I know that I can do selection in this running time,... | habedi/stack-exchange-dataset |
93,363 | What exactly state is in Model Checking | <p>So I finally realized the difference between <em>transition systems</em> and <em>automata</em>, and now am closer to understanding Model Checking. One of the last pieces is understanding what exactly "state" is in Model Checking.</p>

<p>It is mentioned that you create a Kripke Structure, which is pretty muc... | data structures formal methods model checking | 1 | What exactly state is in Model Checking -- (data structures formal methods model checking)
<p>So I finally realized the difference between <em>transition systems</em> and <em>automata</em>, and now am closer to understanding Model Checking. One of the last pieces is understanding what exactly "state" is in Model Checki... | habedi/stack-exchange-dataset |
93,368 | Removing conflicts of LR(1) parsing tables | <pre><code>S' -> S $

S -> I ; S
S -> return E ; S
S -> return I ; S
S -> ''

I -> id
I -> id = E
I -> id = I

E -> C && C
E -> C || C
E -> ! C
E -> C

C -> A > A
C -> A < A
C -> A >= A&... | parsers lr k | 1 | Removing conflicts of LR(1) parsing tables -- (parsers lr k)
<pre><code>S' -> S $

S -> I ; S
S -> return E ; S
S -> return I ; S
S -> ''

I -> id
I -> id = E
I -> id = I

E -> C && C
E -> C || C
E -> ! C
E -> C

... | habedi/stack-exchange-dataset |
93,371 | How to define the Atomic Propositions in Model Checking | <p>The atomic propositions in Symbolic Model Checking form the state in the state-transition graph (the model $\mathcal{M}$ in Model Checking). The other part of Model Checking is the <em>specification</em>, which is usually some sort of temporal logic formula over the atomic propositions in the model.</p>

<p>... | propositional logic model checking software verification | 1 | How to define the Atomic Propositions in Model Checking -- (propositional logic model checking software verification)
<p>The atomic propositions in Symbolic Model Checking form the state in the state-transition graph (the model $\mathcal{M}$ in Model Checking). The other part of Model Checking is the <em>specification<... | habedi/stack-exchange-dataset |
93,372 | What does machine code actually look like while being run? | <p>When machine code is actually being executed by hardware and the CPU, what does it look like?</p>

<p>Would it look like binary, as in instructions being represented by ones and zeros, or would it be something made up of hexadecimal digits where opcodes are bytes presented as hex numbers which can be broken ... | computer architecture cpu | 1 | What does machine code actually look like while being run? -- (computer architecture cpu)
<p>When machine code is actually being executed by hardware and the CPU, what does it look like?</p>

<p>Would it look like binary, as in instructions being represented by ones and zeros, or would it be something made up o... | habedi/stack-exchange-dataset |
93,381 | Does the undecidability of the halting problem require Turing Machines to be enumerable? | <p>I (think I) understand the enumeration and then diagonalization proof of the undecidability of the halting problem, but I came cross <a href="https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-26.html#%25_thm_4.15" rel="nofollow noreferrer">this proof in SICP</a> below, which does not seem to ... | turing machines undecidability halting problem | 1 | Does the undecidability of the halting problem require Turing Machines to be enumerable? -- (turing machines undecidability halting problem)
<p>I (think I) understand the enumeration and then diagonalization proof of the undecidability of the halting problem, but I came cross <a href="https://mitpress.mit.edu/sites/def... | habedi/stack-exchange-dataset |
93,388 | Context Free Grammar Exercise | <p>I'm studying Context free Grammar and I have a question to a specific Exercise:</p>

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

<p>Why is <strong>i.</strong> True? How is this p... | context free | 1 | Context Free Grammar Exercise -- (context free)
<p>I'm studying Context free Grammar and I have a question to a specific Exercise:</p>

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

<... | habedi/stack-exchange-dataset |
93,391 | Why does the Pumping-lemma for context-free languages use uvwxy, but the one for regular ones uvw? | <p>Basically what the title says. Why can you "ignore" the "xy" part if you want to prove whether a language is regular?</p>
 | regular languages pumping lemma chomsky hierarchy | 1 | Why does the Pumping-lemma for context-free languages use uvwxy, but the one for regular ones uvw? -- (regular languages pumping lemma chomsky hierarchy)
<p>Basically what the title says. Why can you "ignore" the "xy" part if you want to prove whether a language is regular?</p>
 | habedi/stack-exchange-dataset |
93,400 | An example of something you can formally verify with proofs in Software Development | <p>I have been working on understanding <a href="https://en.wikipedia.org/wiki/Formal_verification#Software" rel="noreferrer">formal verification</a> of software. <a href="https://en.wikipedia.org/wiki/Formal_methods#In_software_development" rel="noreferrer">Formal methods</a> include things like modeling your software... | proof techniques formal methods software verification | 1 | An example of something you can formally verify with proofs in Software Development -- (proof techniques formal methods software verification)
<p>I have been working on understanding <a href="https://en.wikipedia.org/wiki/Formal_verification#Software" rel="noreferrer">formal verification</a> of software. <a href="https... | habedi/stack-exchange-dataset |
93,402 | How to reach data segment from global pointer in MIPS? | <p>The global pointer is initialized to 01x10008000. The data segment starts at 0x1000000. </p>

<p>I want to load the first word found in the data segment. So I place 0x8000 in the address field of lw.</p>

<p>lw $a0, 8000<sub>hex</sub>(\$gp)</p>

<p>Apparently 0x8000 in binary is 1000 0000 000... | computer architecture mips | 1 | How to reach data segment from global pointer in MIPS? -- (computer architecture mips)
<p>The global pointer is initialized to 01x10008000. The data segment starts at 0x1000000. </p>

<p>I want to load the first word found in the data segment. So I place 0x8000 in the address field of lw.</p>

<p>lw $a0... | habedi/stack-exchange-dataset |
93,405 | Given all maximal independent sets of a graph, find the maximum indepdent set | <p>I am new to this independent set problem in graph theory. As per my understanding so far an independent set is a set of vertices in which no two vertices are adjacent. And the maximal independent set is a set of vertices in which if some vertex is added it will construct an edge. </p>

<p>I understand this n... | graphs | 1 | Given all maximal independent sets of a graph, find the maximum indepdent set -- (graphs)
<p>I am new to this independent set problem in graph theory. As per my understanding so far an independent set is a set of vertices in which no two vertices are adjacent. And the maximal independent set is a set of vertices in whi... | habedi/stack-exchange-dataset |
93,408 | Finding the smallest positive missing number in array of integers contains negative and duplicates number | <p>I found this solution but I don't understand it. Can anyone explain the idea behind it ?</p>

<p><a href="https://www.geeksforgeeks.org/find-the-smallest-positive-number-missing-from-an-unsorted-array/" rel="nofollow noreferrer">the solution</a>:</p>

<blockquote>
 <p><strong>A O(n) time and O(1... | algorithms arrays | 1 | Finding the smallest positive missing number in array of integers contains negative and duplicates number -- (algorithms arrays)
<p>I found this solution but I don't understand it. Can anyone explain the idea behind it ?</p>

<p><a href="https://www.geeksforgeeks.org/find-the-smallest-positive-number-missing-fr... | habedi/stack-exchange-dataset |
93,416 | Does O(f(n)) + O(g(n)) = O(max{f(n), g(n)})? | <p>A question from a lecture of mine.
The way I see it, while summing sets is meaningless, O(f(n)) + O(g(n)) is obviously limited from above by the greatest function in either, which means that I practically take the maximum of O(f(n)) and the maximum O(g(n)), and claim that either is the maximal one, or they are e... | asymptotics | 1 | Does O(f(n)) + O(g(n)) = O(max{f(n), g(n)})? -- (asymptotics)
<p>A question from a lecture of mine.
The way I see it, while summing sets is meaningless, O(f(n)) + O(g(n)) is obviously limited from above by the greatest function in either, which means that I practically take the maximum of O(f(n)) and the maximum O(... | habedi/stack-exchange-dataset |
93,421 | How does "solving" a game like connect four or tic-tac-toe work? | <p>To mathematically solve a game you have to prove, using various tehniques, that some player will win, lose or draw the game. Specifically I'm interested in solving games by brute force (trying out all the possible combinations).</p>

<p>If I were to try every possible move for some game I would get a tree of... | algorithms game theory | 1 | How does "solving" a game like connect four or tic-tac-toe work? -- (algorithms game theory)
<p>To mathematically solve a game you have to prove, using various tehniques, that some player will win, lose or draw the game. Specifically I'm interested in solving games by brute force (trying out all the possible combinatio... | habedi/stack-exchange-dataset |
93,425 | Justification behind this heuristic in SMA*+ | <p>I'm reading the paper <a href="https://easychair.org/publications/open/TL2M" rel="nofollow noreferrer">Enhanced Simplified Memory-bounded A Star (SMA*+)</a>. In short, the authors propose a limited-memory version of A* where we cull nodes if we are out of memory, to re-expand them later on.</p>

<p>To do thi... | search algorithms heuristics | 1 | Justification behind this heuristic in SMA*+ -- (search algorithms heuristics)
<p>I'm reading the paper <a href="https://easychair.org/publications/open/TL2M" rel="nofollow noreferrer">Enhanced Simplified Memory-bounded A Star (SMA*+)</a>. In short, the authors propose a limited-memory version of A* where we cull nodes... | habedi/stack-exchange-dataset |
93,428 | Identification of Formal Language | <p>$$L = \{a^{m+n}b^{m+k}c^{n+k}\mid m,n,k\ge 1\}.$$</p>

<p>Is $L$ DCFL or not?</p>

<p>According to me it should be DCFL since we can write $L$ as $\{a^{n}a^{m}b^{m}b^{k}c^{k}c^{n}\mid m,n,k\ge1\}$. So, now after push and pop on the stack, it will be empty. So, according to me it will be DCFL but I ha... | formal languages context free | 1 | Identification of Formal Language -- (formal languages context free)
<p>$$L = \{a^{m+n}b^{m+k}c^{n+k}\mid m,n,k\ge 1\}.$$</p>

<p>Is $L$ DCFL or not?</p>

<p>According to me it should be DCFL since we can write $L$ as $\{a^{n}a^{m}b^{m}b^{k}c^{k}c^{n}\mid m,n,k\ge1\}$. So, now after push and pop on the ... | habedi/stack-exchange-dataset |
93,434 | Show that NP is not equal to SPACE(n) | <p>I want to show that $\text{NP} \neq \text{SPACE}(n)$ and tried it like this:</p>

<p>Let $L$ be in $\text{SPACE}(n)$ so there is a deterministic $k$-tape TM which decides $L$ in polynomial time. Let's consider a binary alphabet. There are $2^{kn}$ possible strings on the working tapes so for an input of leng... | complexity theory time complexity space complexity | 1 | Show that NP is not equal to SPACE(n) -- (complexity theory time complexity space complexity)
<p>I want to show that $\text{NP} \neq \text{SPACE}(n)$ and tried it like this:</p>

<p>Let $L$ be in $\text{SPACE}(n)$ so there is a deterministic $k$-tape TM which decides $L$ in polynomial time. Let's consider a bin... | habedi/stack-exchange-dataset |
93,443 | Rice's theorem application on a language that resembles ETM | <p>I'm working on an exercise that involves checking if the Rice's theorem can be applied on a two languages.</p>

<p>The first language is $E_{TM} = \{ \langle M \rangle \text{ | M is a Turing Machine and } L(M) = \emptyset \} $.</p>

<p>I already know it's undecidable, thus Rice's theorem should apply... | turing machines undecidability rice theorem | 1 | Rice's theorem application on a language that resembles ETM -- (turing machines undecidability rice theorem)
<p>I'm working on an exercise that involves checking if the Rice's theorem can be applied on a two languages.</p>

<p>The first language is $E_{TM} = \{ \langle M \rangle \text{ | M is a Turing Machine a... | habedi/stack-exchange-dataset |
93,450 | Can we easily check if we can place two not-intersecting circles inside a convex polygon | <p>We have given convex polygon of $N$ vertices, and two circles of radius $r$. Is it possible to check if we can place those two circles completely inside the polygon, such that they don't intersect, but they might have one point in common.</p>

<p>For example if we have given square with sides of length $1$, ... | computational geometry | 1 | Can we easily check if we can place two not-intersecting circles inside a convex polygon -- (computational geometry)
<p>We have given convex polygon of $N$ vertices, and two circles of radius $r$. Is it possible to check if we can place those two circles completely inside the polygon, such that they don't intersect, bu... | habedi/stack-exchange-dataset |
93,459 | Password authentication over an insecure connection | <p>I was thinking a way to send password to server secure way without using secure connection,I found one solution.I want to find flaw in this.(Note: I am begginer,dont judge me, I know little about cryptography and little about networks)</p>

<p>So server contains hashed version of my password.
When i want... | computer networks security authentication | 1 | Password authentication over an insecure connection -- (computer networks security authentication)
<p>I was thinking a way to send password to server secure way without using secure connection,I found one solution.I want to find flaw in this.(Note: I am begginer,dont judge me, I know little about cryptography and littl... | habedi/stack-exchange-dataset |
93,464 | Infinite Union operation of Formal Languages | <p>Is every formal language not closed under infinite union operation ? 
I know that Regual Languages are not closed under infinite union operation and I have counter-example for it but I don't have any counter-example for other languages. Intuitively , I think it should not be closed but intuition could be wrong ... | formal languages | 1 | Infinite Union operation of Formal Languages -- (formal languages)
<p>Is every formal language not closed under infinite union operation ? 
I know that Regual Languages are not closed under infinite union operation and I have counter-example for it but I don't have any counter-example for other languages. Intuitiv... | habedi/stack-exchange-dataset |
93,467 | Data structure or algorithm for quickly finding differences between strings | <p>I have an array of 100,000 strings, all of length $k$. I want to compare each string to every other string to see if any two strings differ by 1 character. Right now, as I add each string to the array, I'm checking it against every string already in the array, which has a time complexity of $\frac{n(n-1)}{2} k$.<... | algorithms data structures program optimization comparison | 1 | Data structure or algorithm for quickly finding differences between strings -- (algorithms data structures program optimization comparison)
<p>I have an array of 100,000 strings, all of length $k$. I want to compare each string to every other string to see if any two strings differ by 1 character. Right now, as I add... | habedi/stack-exchange-dataset |
93,473 | Exhaustive search algorithm solving vertex cover of size $k$ in time $2^{k}n^{O(1)}$? | <p>In the wiki page of <a href="https://en.wikipedia.org/wiki/Vertex_cover" rel="nofollow noreferrer">Vertex Cover</a>, it is claimed that an exhaustive search algorithm can solve the problem(the decision version of vertex cover problem) in time $2^{k}n^{O(1)}$. </p>

<p>Intuitively, with a fixed parameter $k$,... | np complete parameterized complexity | 1 | Exhaustive search algorithm solving vertex cover of size $k$ in time $2^{k}n^{O(1)}$? -- (np complete parameterized complexity)
<p>In the wiki page of <a href="https://en.wikipedia.org/wiki/Vertex_cover" rel="nofollow noreferrer">Vertex Cover</a>, it is claimed that an exhaustive search algorithm can solve the problem(... | habedi/stack-exchange-dataset |
93,475 | Turing Machine DTime(log(n)) | <p>An Exercise from a Textbook:</p>

<blockquote>
 <p>L3 := {ε,01,0011}</p>
 
 <p>is L3 ∈ DTime(log(n))</p>
</blockquote>

<p>The answer says yes it is, it is even in DTime(1).</p>

<p>How is this possible? I would say it takes at least n steps to check the word. How is it pos... | complexity theory turing machines | 1 | Turing Machine DTime(log(n)) -- (complexity theory turing machines)
<p>An Exercise from a Textbook:</p>

<blockquote>
 <p>L3 := {ε,01,0011}</p>
 
 <p>is L3 ∈ DTime(log(n))</p>
</blockquote>

<p>The answer says yes it is, it is even in DTime(1).</p>

<p>How is this possible? I ... | habedi/stack-exchange-dataset |
93,479 | How could you characterize "true randomness" of a finite sequence? | <p>This question occurred to me while reading <a href="http://arxiv.org/abs/1806.08762/" rel="nofollow noreferrer">http://arxiv.org/abs/1806.08762/</a> Any observed sequence is necessarily finite, and any finite sequence is computable, either by explicitly storing all the data and just printing it, or by fitting an $n^... | randomness | 1 | How could you characterize "true randomness" of a finite sequence? -- (randomness)
<p>This question occurred to me while reading <a href="http://arxiv.org/abs/1806.08762/" rel="nofollow noreferrer">http://arxiv.org/abs/1806.08762/</a> Any observed sequence is necessarily finite, and any finite sequence is computable, e... | habedi/stack-exchange-dataset |
93,480 | Reduce Max-Cut to Max-2SAT | <p>I would like to find a reduction from <a href="https://en.wikipedia.org/wiki/Maximum_cut" rel="nofollow noreferrer">Max-Cut</a> to <a href="https://en.wikipedia.org/wiki/2-satisfiability#Maximum-2-satisfiability" rel="nofollow noreferrer">Max-2Sat</a>.
Could someone shed light on this problem, preferably spiced ... | complexity theory graphs satisfiability | 1 | Reduce Max-Cut to Max-2SAT -- (complexity theory graphs satisfiability)
<p>I would like to find a reduction from <a href="https://en.wikipedia.org/wiki/Maximum_cut" rel="nofollow noreferrer">Max-Cut</a> to <a href="https://en.wikipedia.org/wiki/2-satisfiability#Maximum-2-satisfiability" rel="nofollow noreferrer">Max-2S... | habedi/stack-exchange-dataset |
93,485 | NP Class Definition of a Certificate | <p>Given the definition for all x ∈ Σ∗</p>

<blockquote>
 <p>x ∈ L ⇔ ∃ u ∈ Σ∗ with |u| ≤ p(|x|) and M(x, u) = 1</p>
</blockquote>

<p>Lets say the input x = ababab</p>

<p>Then the certificate u shouldn't be longer than p(|x|).</p>

<p>But what would be p(|x|)? In my example?</p... | np nondeterminism polynomial time | 1 | NP Class Definition of a Certificate -- (np nondeterminism polynomial time)
<p>Given the definition for all x ∈ Σ∗</p>

<blockquote>
 <p>x ∈ L ⇔ ∃ u ∈ Σ∗ with |u| ≤ p(|x|) and M(x, u) = 1</p>
</blockquote>

<p>Lets say the input x = ababab</p>

<p>Then the certificate u shouldn't be lon... | habedi/stack-exchange-dataset |
93,488 | How many bits does a data bus need to have? | <p>Using the following context as an example for the calculations:</p>

<blockquote>
 <p><strong>Data bus</strong> connecting the processor to a memory <strong>32 bits</strong>, considering a memory with capacity of <strong>16kB</strong>.</p>
</blockquote>

<hr>

<h2>How many bits does ... | computer architecture | 1 | How many bits does a data bus need to have? -- (computer architecture)
<p>Using the following context as an example for the calculations:</p>

<blockquote>
 <p><strong>Data bus</strong> connecting the processor to a memory <strong>32 bits</strong>, considering a memory with capacity of <strong>16kB</strong... | habedi/stack-exchange-dataset |
93,498 | Time complexity for this simple loop | <p>This is the code:</p>

<pre><code>j=2
while j<(n*n)
 j=j*j
</code></pre>

<hr>

<p>At first my approach was to treat this like this loop</p>

<pre><code>i=1
while (i<n)
 i=i*2
</code></pre>

<p>Which generates on $i$ various powers of $2$ ... | algorithm analysis time complexity runtime analysis polynomial time | 1 | Time complexity for this simple loop -- (algorithm analysis time complexity runtime analysis polynomial time)
<p>This is the code:</p>

<pre><code>j=2
while j<(n*n)
 j=j*j
</code></pre>

<hr>

<p>At first my approach was to treat this like this loop</p>

<pre><code>i=1... | habedi/stack-exchange-dataset |
93,509 | What will happen if input is larger than required in a NFA | <p><a href="https://i.stack.imgur.com/3x7Vy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3x7Vy.jpg" alt="enter image description here"></a></p>

<p>This is my first time in the field of TOC so I am not able to provide any self-approach while asking .In the above example what will happen if... | finite automata nondeterminism | 1 | What will happen if input is larger than required in a NFA -- (finite automata nondeterminism)
<p><a href="https://i.stack.imgur.com/3x7Vy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3x7Vy.jpg" alt="enter image description here"></a></p>

<p>This is my first time in the field of TOC so I ... | habedi/stack-exchange-dataset |
93,519 | How to properly calculate the order of growth of an exponential algorithm? | <p>I'm reading SICP, and I'm a little bit confuse about this statement:</p>

<blockquote>
 <p>Consider the problem of computing the exponential of a given number.
 We would like a procedure that takes as arguments a base b and a
 positive integer exponent n and computes b n . One way to do this i... | algorithms | 1 | How to properly calculate the order of growth of an exponential algorithm? -- (algorithms)
<p>I'm reading SICP, and I'm a little bit confuse about this statement:</p>

<blockquote>
 <p>Consider the problem of computing the exponential of a given number.
 We would like a procedure that takes as argumen... | habedi/stack-exchange-dataset |
93,522 | Confusion about the definition of de Bruijn terms in the TAPL book | <p>I'm working through <a href="https://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow noreferrer">Types and Programming Languages</a> right now, and I'm a little confused about the recursive definition given for nameless/de Bruijn terms (<a href="https://www.asc.ohio-state.edu/pollard.4/type/books/pierce-tpl.pdf#pa... | programming languages lambda calculus type theory | 1 | Confusion about the definition of de Bruijn terms in the TAPL book -- (programming languages lambda calculus type theory)
<p>I'm working through <a href="https://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow noreferrer">Types and Programming Languages</a> right now, and I'm a little confused about the recursive defi... | habedi/stack-exchange-dataset |
93,526 | Scheduling Algorithm for Video Player | <p><strong>Background:</strong><br>
In a nutshell. I coded a video player application (on linux). I used a proprietary library/API, with this, video and audio frames comes with well defined format. After decoding (via API), I call scheduling() function for video and audio frames and library does the rest. For argum... | scheduling video | 1 | Scheduling Algorithm for Video Player -- (scheduling video)
<p><strong>Background:</strong><br>
In a nutshell. I coded a video player application (on linux). I used a proprietary library/API, with this, video and audio frames comes with well defined format. After decoding (via API), I call scheduling() function for... | habedi/stack-exchange-dataset |
93,532 | Lower upper bound on # variables in k-SAT with m clauses | <p>If I have an instance of $k$-SAT with $m$ clauses, then a trivial upper bound on the number of variables $n$ is given by $n \leq mk$. But we can only have $n = mk$ when no variable is repeated and that would be a trivial yes-case of k-SAT. I am making some running time analysis based on number of clauses, and theref... | satisfiability | 1 | Lower upper bound on # variables in k-SAT with m clauses -- (satisfiability)
<p>If I have an instance of $k$-SAT with $m$ clauses, then a trivial upper bound on the number of variables $n$ is given by $n \leq mk$. But we can only have $n = mk$ when no variable is repeated and that would be a trivial yes-case of k-SAT. ... | habedi/stack-exchange-dataset |
93,536 | Minimise given size using dynamic programming | <blockquote>
<p>Given numbers <span class="math-container">$0<x_1<x_2< \dots<x_{n^2}<1,$</span> for every subset of <span class="math-container">$n$</span> of them <span class="math-container">$x_{i_1}<x_{i_2}< \dots<x_{i_n},$</span> let us consider the size: <span class="math-container">$$\... | algorithms dynamic programming | 1 | Minimise given size using dynamic programming -- (algorithms dynamic programming)
<blockquote>
<p>Given numbers <span class="math-container">$0<x_1<x_2< \dots<x_{n^2}<1,$</span> for every subset of <span class="math-container">$n$</span> of them <span class="math-container">$x_{i_1}<x_{i_2}< \d... | habedi/stack-exchange-dataset |
93,540 | Resolution of Barber paradox | <p>I am trying to prove using the resolution technique that the following two clauses are contradicting:</p>

<ol>
<li>$\forall_x Shaves(Barber, x) \iff \neg Shaves(x, x)$</li>
<li>$\exists_x Shaves(x, Barber)$</li>
</ol>

<p>After turing those into the conjunctive normal form and <a href="h... | first order logic | 1 | Resolution of Barber paradox -- (first order logic)
<p>I am trying to prove using the resolution technique that the following two clauses are contradicting:</p>

<ol>
<li>$\forall_x Shaves(Barber, x) \iff \neg Shaves(x, x)$</li>
<li>$\exists_x Shaves(x, Barber)$</li>
</ol>

<p>After turing t... | habedi/stack-exchange-dataset |
93,541 | $DTIME(f(n)) \subset of DSPACE(f(n))$ | <p>I think this is again an easy one:</p>

<blockquote>
 <p>$DTIME(f(n)) \subset DSPACE(f(n))$</p>
</blockquote>

<p>They say its trivial but I dont see it, why?</p>

<p>And would </p>

<blockquote>
 <p>$DTIME(f(n^2)) \subset DSPACE(f(n^2))$</p>
</blockquote>

<... | complexity theory time complexity polynomial time | 1 | $DTIME(f(n)) \subset of DSPACE(f(n))$ -- (complexity theory time complexity polynomial time)
<p>I think this is again an easy one:</p>

<blockquote>
 <p>$DTIME(f(n)) \subset DSPACE(f(n))$</p>
</blockquote>

<p>They say its trivial but I dont see it, why?</p>

<p>And would </p>

... | habedi/stack-exchange-dataset |
93,558 | Efficient membership check in multiple ranges | <p>Suppose a program has a set $S$ of $n$ numerical ranges, each described by a pair: (lower bound $l_n$, upper bound $u_n$).</p>

<p>The program receives a number $x$; it must return all ranges in $S$ that enclose $x$.</p>

<p>An example in practical terms: in timeseries data, you have a set of $n$ ind... | complexity theory search algorithms | 1 | Efficient membership check in multiple ranges -- (complexity theory search algorithms)
<p>Suppose a program has a set $S$ of $n$ numerical ranges, each described by a pair: (lower bound $l_n$, upper bound $u_n$).</p>

<p>The program receives a number $x$; it must return all ranges in $S$ that enclose $x$.</p>&#... | habedi/stack-exchange-dataset |
93,567 | How to find a possibility of match in Naive Bayes Classifier? | <p>My math level is very very poor so I can't get the statistics.<br>
Can anyone explain in simple words?
I.e. if I have frequency data: </p>

<pre><code>Apple:
 Colors:
 Green = 3, Red = 2, Orange = 0;
 Shape:
 Sphere = 5, Ellipsoid = 0.
Orange:
 Colors:&... | classification statistics | 1 | How to find a possibility of match in Naive Bayes Classifier? -- (classification statistics)
<p>My math level is very very poor so I can't get the statistics.<br>
Can anyone explain in simple words?
I.e. if I have frequency data: </p>

<pre><code>Apple:
 Colors:
 Green = 3, Red = 2, O... | habedi/stack-exchange-dataset |
93,570 | Centre, diameter, and radius of graph | <p>I have been thinking a lot on some questions related to centres, diameter ($D$), and radius ($R$) of an undirected connected graph, but couldn't find anywhere the answers, so am posting here.</p>

<p>Ques1. If $x,y$ are two vertices such that distance between them is $D$, then is it true that any shortest pa... | graphs combinatorics discrete mathematics | 1 | Centre, diameter, and radius of graph -- (graphs combinatorics discrete mathematics)
<p>I have been thinking a lot on some questions related to centres, diameter ($D$), and radius ($R$) of an undirected connected graph, but couldn't find anywhere the answers, so am posting here.</p>

<p>Ques1. If $x,y$ are two ... | habedi/stack-exchange-dataset |
93,572 | A tree which each node selected as a root results in a different topology? | <p>Show that, for every n >= 7, there exists a tree of n non-labeled nodes such that picking each of the n nodes as a root results in a different rooted tree.</p>
 | graphs trees | 1 | A tree which each node selected as a root results in a different topology? -- (graphs trees)
<p>Show that, for every n >= 7, there exists a tree of n non-labeled nodes such that picking each of the n nodes as a root results in a different rooted tree.</p>
 | habedi/stack-exchange-dataset |
93,577 | Construct a pushdown automaton for $\{a^{2n}b^{3n}|n\ge0\}$ | <p>My idea is to (not formal) push an 'a' when we see an a, nondeterministically guess when n a's were seen from the input word, go to the next state. From there, when we see an a, push 2 'a's into the stack and again guess when n a's were seen (now there should be 3n 'a's in the stack) and go to the final state, where... | automata context free pushdown automata | 1 | Construct a pushdown automaton for $\{a^{2n}b^{3n}|n\ge0\}$ -- (automata context free pushdown automata)
<p>My idea is to (not formal) push an 'a' when we see an a, nondeterministically guess when n a's were seen from the input word, go to the next state. From there, when we see an a, push 2 'a's into the stack and aga... | habedi/stack-exchange-dataset |
93,579 | Get count of longest zigzag sub-sequences | <p>I know how to get longest zigzag sub-sequence and length of it. There are several methods available for that. But some times there are many sub-sequences available which have same length. How to obtain that?</p>
 | dynamic programming longest common substring | 1 | Get count of longest zigzag sub-sequences -- (dynamic programming longest common substring)
<p>I know how to get longest zigzag sub-sequence and length of it. There are several methods available for that. But some times there are many sub-sequences available which have same length. How to obtain that?</p>
 | habedi/stack-exchange-dataset |
93,583 | The relationship between degree and the number of leaves of a tree? | <p>What is the relationship between $\text{deg}(T)$ and the number of leaves of $T$, if $T$ is a tree?</p>
 | graphs trees network topology | 1 | The relationship between degree and the number of leaves of a tree? -- (graphs trees network topology)
<p>What is the relationship between $\text{deg}(T)$ and the number of leaves of $T$, if $T$ is a tree?</p>
 | habedi/stack-exchange-dataset |
93,587 | Identifying/equating constants in a term rewrite system | <p>Suppose we have a term rewrite system $\mathcal{R} = (R, \Sigma)$ with basic rewrite rules $R$ over a signature $\Sigma$. Suppose also that this rewrite system $\mathcal{R}$ is confluent and terminating, and that each constant symbol of $\Sigma$ is a normal form with respect to $\mathcal{R}$.</p>

<p>Now sup... | normal forms term rewriting termination | 1 | Identifying/equating constants in a term rewrite system -- (normal forms term rewriting termination)
<p>Suppose we have a term rewrite system $\mathcal{R} = (R, \Sigma)$ with basic rewrite rules $R$ over a signature $\Sigma$. Suppose also that this rewrite system $\mathcal{R}$ is confluent and terminating, and that eac... | habedi/stack-exchange-dataset |
93,608 | How to find MST for each source | <p>Let's say I have a map with factories and selling points. I want to trace the paths from factories to the selling points with the lower possible cost.
The image bellow is an example of a possible solution for that map, then the output of the algorithm should be two trees with the edges of those trees.
<a hre... | algorithms graphs shortest path spanning trees | 1 | How to find MST for each source -- (algorithms graphs shortest path spanning trees)
<p>Let's say I have a map with factories and selling points. I want to trace the paths from factories to the selling points with the lower possible cost.
The image bellow is an example of a possible solution for that map, then the o... | habedi/stack-exchange-dataset |
93,612 | Proving the equivalence of an LTL and a CTL formula | <p>For a lecture I am attending, we have to prove that</p>

<p>$$\forall \big(a \textsf{U} (b \land \forall \square a)\big) \equiv \big(a \textsf{U} (b \land \square a)\big).$$</p>

<p>That is, we need to prove that for the CTL formula $\forall \big(a \textsf{U} (b \land \forall \square a)\big)$, the LT... | linear temporal logic computation tree logic | 1 | Proving the equivalence of an LTL and a CTL formula -- (linear temporal logic computation tree logic)
<p>For a lecture I am attending, we have to prove that</p>

<p>$$\forall \big(a \textsf{U} (b \land \forall \square a)\big) \equiv \big(a \textsf{U} (b \land \square a)\big).$$</p>

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