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 |
|---|---|---|---|---|---|---|
86,674 | Algorithms for solving Flow game | <p>Lately I've been toying with an automatic solver for the Android/iPhone game <a href="https://play.google.com/store/apps/details?id=com.bigduckgames.flow&hl=en" rel="nofollow noreferrer">Flow</a>.</p>

<p>In this game, you start with several pairs of squares on a grid, and you have to connect each pair, ... | graphs colorings | 1 | Algorithms for solving Flow game -- (graphs colorings)
<p>Lately I've been toying with an automatic solver for the Android/iPhone game <a href="https://play.google.com/store/apps/details?id=com.bigduckgames.flow&hl=en" rel="nofollow noreferrer">Flow</a>.</p>

<p>In this game, you start with several pairs of... | habedi/stack-exchange-dataset |
86,682 | Making a NFA for accepting a string only if it contains the given substrings | <p>First I'll introduce the problem with just two substrings. Say you are asked to construct a NFA which accepts the input string if it has both "bb" and "aba" as substrings. </p>

<p>The solution we came up with in class was that we'll make a NFA with multiple start states (a start state with $\epsilon$-transi... | automata finite automata | 1 | Making a NFA for accepting a string only if it contains the given substrings -- (automata finite automata)
<p>First I'll introduce the problem with just two substrings. Say you are asked to construct a NFA which accepts the input string if it has both "bb" and "aba" as substrings. </p>

<p>The solution we came ... | habedi/stack-exchange-dataset |
86,683 | Why call it 'Time Complexity'? | <p>P.S. I have added the tag 'history', if there is any historical connotation.</p>

<p>Also, I found this question <a href="https://cs.stackexchange.com/questions/56133/what-is-running-time-of-an-algorithm">What is running time of an algorithm?</a> but I am not satisfied with answers. </p>
 | algorithm analysis time complexity terminology runtime analysis history | 1 | Why call it 'Time Complexity'? -- (algorithm analysis time complexity terminology runtime analysis history)
<p>P.S. I have added the tag 'history', if there is any historical connotation.</p>

<p>Also, I found this question <a href="https://cs.stackexchange.com/questions/56133/what-is-running-time-of-an-algorit... | habedi/stack-exchange-dataset |
86,688 | Fastest (fast enough to compute) algorithm for finding permutations | <p>I have a set of letters, and a list of words, and I'd like to find all the possible "sentences" that can be built using the words from the list, while using up all the letters in the process. (A word can be used more than once.)
The maximum amount of words in a sentence is also given.</p>

<p>For example... | time complexity combinatorics | 1 | Fastest (fast enough to compute) algorithm for finding permutations -- (time complexity combinatorics)
<p>I have a set of letters, and a list of words, and I'd like to find all the possible "sentences" that can be built using the words from the list, while using up all the letters in the process. (A word can be used mo... | habedi/stack-exchange-dataset |
86,692 | Psedu-polynomial Time : Conflict with the definition of input size | <p>From <a href="https://en.wikipedia.org/wiki/Pseudo-polynomial_time" rel="nofollow noreferrer">wikipedia</a> </p>

<blockquote>
 <p>In computational complexity theory, a numeric algorithm runs in <strong>pseudo-polynomial</strong> time if its running time is a polynomial in the length of the input (the... | algorithm analysis time complexity runtime analysis knapsack problems pseudo polynomial | 1 | Psedu-polynomial Time : Conflict with the definition of input size -- (algorithm analysis time complexity runtime analysis knapsack problems pseudo polynomial)
<p>From <a href="https://en.wikipedia.org/wiki/Pseudo-polynomial_time" rel="nofollow noreferrer">wikipedia</a> </p>

<blockquote>
 <p>In computat... | habedi/stack-exchange-dataset |
86,694 | Generating bit sequence containing every possible of length 1...n | <p>Generating sequence containing every possible bit sequence of lengths from $1$ to $n$ is trivial - just generate every possible sequence of length $n$.</p>

<p>But how do you generate the <em>shortest</em> sequence containing every possible bit subsequence of lengths from $1$ to $n$ (using the fact that subs... | algorithms complexity theory | 1 | Generating bit sequence containing every possible of length 1...n -- (algorithms complexity theory)
<p>Generating sequence containing every possible bit sequence of lengths from $1$ to $n$ is trivial - just generate every possible sequence of length $n$.</p>

<p>But how do you generate the <em>shortest</em> seq... | habedi/stack-exchange-dataset |
86,700 | What is the point of selection step in a genetic algorithm? | <p>I'm reading about genetic algorithms, and I'm not sure I understand the point of selection step.Let's say we have a population of size $N$.How many chromosomes should we select using any selection method and what's the point if the population size is fixed ? </p>

<p>From what I understood till now we select... | genetic algorithms | 1 | What is the point of selection step in a genetic algorithm? -- (genetic algorithms)
<p>I'm reading about genetic algorithms, and I'm not sure I understand the point of selection step.Let's say we have a population of size $N$.How many chromosomes should we select using any selection method and what's the point if the p... | habedi/stack-exchange-dataset |
86,705 | Proving asymptotic notations for functions | <p>I recently started learning about asymptotic notations. While I was doing practice questions (not HW) I found various question that stumped me totally. So I just want some pointers on how to go by solving these type of questions. So here is a basic question. 
Given the following,</p>

<blockquote>
 ... | asymptotics landau notation | 1 | Proving asymptotic notations for functions -- (asymptotics landau notation)
<p>I recently started learning about asymptotic notations. While I was doing practice questions (not HW) I found various question that stumped me totally. So I just want some pointers on how to go by solving these type of questions. So here is ... | habedi/stack-exchange-dataset |
86,722 | Representation of used space and free space in hard drives | <p>I've read from this <a href="https://physics.stackexchange.com/questions/66914/how-is-data-physically-written-read-and-stored-inside-hard-drives">How data is physically stored in hard drives</a>, that the North/South orientation of the magnetic medium represents data as 0 or 1 physically in the hard drive. Data is s... | data compression memory hardware | 1 | Representation of used space and free space in hard drives -- (data compression memory hardware)
<p>I've read from this <a href="https://physics.stackexchange.com/questions/66914/how-is-data-physically-written-read-and-stored-inside-hard-drives">How data is physically stored in hard drives</a>, that the North/South ori... | habedi/stack-exchange-dataset |
86,730 | Show that the SAT Problem for CNF formulas with at most two occurences of each variable can be solved in polynomial time | <p>Assuming, I have an arbitrary CNF Formula in which each variable has at most two occurences, how can I proof/show that this can be solved in polynomial time?</p>

<p>My first thoughts so far:</p>

<p>because each variable has at most two occurences, the formula contains at most 2*n literals, where n ... | satisfiability polynomial time | 1 | Show that the SAT Problem for CNF formulas with at most two occurences of each variable can be solved in polynomial time -- (satisfiability polynomial time)
<p>Assuming, I have an arbitrary CNF Formula in which each variable has at most two occurences, how can I proof/show that this can be solved in polynomial time?</p... | habedi/stack-exchange-dataset |
86,748 | Why is a sequence of n Push, Pop, Multipop operations O(n²)? | <p>From "<em>Introduction to Algorithms</em>" by Cormen, Leiserson, Rivest, Stein, Third Edition, page 453:</p>

<blockquote>
 <p>Let us analyze a sequence of $n$ Push, Pop, Multipop operations on an initially empty stack. The worst-case cost of a Multipop operation in the sequence is $O\left(n\right)$, si... | algorithm analysis asymptotics runtime analysis amortized analysis stacks | 1 | Why is a sequence of n Push, Pop, Multipop operations O(n²)? -- (algorithm analysis asymptotics runtime analysis amortized analysis stacks)
<p>From "<em>Introduction to Algorithms</em>" by Cormen, Leiserson, Rivest, Stein, Third Edition, page 453:</p>

<blockquote>
 <p>Let us analyze a sequence of $n$ Push... | habedi/stack-exchange-dataset |
86,769 | Why must a Primary Index be sparse? | <p>Reading <a href="https://rads.stackoverflow.com/amzn/click/0133970779" rel="nofollow noreferrer"><em>Fundamentals of Database Systems 7th Edition</em></a>, on Page 603, it says,</p>

<blockquote>
 <p>Indexes can also be characterized as dense or <em>sparse</em>. A dense index has an index entry for ever... | terminology databases | 1 | Why must a Primary Index be sparse? -- (terminology databases)
<p>Reading <a href="https://rads.stackoverflow.com/amzn/click/0133970779" rel="nofollow noreferrer"><em>Fundamentals of Database Systems 7th Edition</em></a>, on Page 603, it says,</p>

<blockquote>
 <p>Indexes can also be characterized as dens... | habedi/stack-exchange-dataset |
86,770 | Is this language in P? | <p>L={ | M is a DFA, |w| is even for all w in L(M)}</p>

<p>Meaning we are looking for a Turing Machine or any algorithm that receives a description of a DFA and decides if all the words this DFA accepts are even in there length(length of 0, 2, 4, 6 ..). DFA stands for Deterministic Finite Automata. My proposal... | complexity theory np complete | 1 | Is this language in P? -- (complexity theory np complete)
<p>L={ | M is a DFA, |w| is even for all w in L(M)}</p>

<p>Meaning we are looking for a Turing Machine or any algorithm that receives a description of a DFA and decides if all the words this DFA accepts are even in there length(length of 0, 2, 4, 6 ..).... | habedi/stack-exchange-dataset |
86,772 | Algorithm to extract line-like contour in 3d | <p>Hello people on the internet,</p>

<p>I'm currently searching for some kind of fast algorithm that allows me to extract curves in three dimensional space that arise as the intersection of two level sets of smooth functions, i.e. 
\begin{align*}\mathcal{C} = \{\vec{x} \in \mathbb{R}^3 | \; F(\vec{x})= l \... | algorithms | 1 | Algorithm to extract line-like contour in 3d -- (algorithms)
<p>Hello people on the internet,</p>

<p>I'm currently searching for some kind of fast algorithm that allows me to extract curves in three dimensional space that arise as the intersection of two level sets of smooth functions, i.e. 
\begin{align*}... | habedi/stack-exchange-dataset |
86,792 | An efficient algorithm to decide if a triangulation is 3-colourable | <p>I don't know how to start with the following exercise:</p>

<blockquote>
 <p>Design an efficient algorithm to decide whether a given triangulation with $n $ points is $3$-colourable.
 The triangulation is given by a sorted edge list, where every edge is given by the indices of its two end points. F... | algorithms graphs colorings | 1 | An efficient algorithm to decide if a triangulation is 3-colourable -- (algorithms graphs colorings)
<p>I don't know how to start with the following exercise:</p>

<blockquote>
 <p>Design an efficient algorithm to decide whether a given triangulation with $n $ points is $3$-colourable.
 The triangulat... | habedi/stack-exchange-dataset |
86,795 | Similarly structured loops with different big-O time complexities? | <p>I have a function:</p>

<pre><code>int sum = 0;
for (int i = 1; i < n; i*= 2)
 for (int j = 0; j < n; j++)
 sum++;
</code></pre>

<p>From my understanding this is $O(n\log(n))$ because the inner loop runs $n$ times for every time the outer loop runs, and the outer loop is ru... | algorithms asymptotics | 1 | Similarly structured loops with different big-O time complexities? -- (algorithms asymptotics)
<p>I have a function:</p>

<pre><code>int sum = 0;
for (int i = 1; i < n; i*= 2)
 for (int j = 0; j < n; j++)
 sum++;
</code></pre>

<p>From my understanding this is $O(n\log(n))$ bec... | habedi/stack-exchange-dataset |
86,801 | How to find max flow in a graph after decrementing an edge capacity? | <p>We're given a graph $G=(V, E)$, with source $s$ and sink $t$, $s\neq t$, and that all capacities are non-negative integers. Also the max flow itself is given, so we receive the value of max flow for each edge. We're also given some edge $e'$. </p>

<p>How can the max flow be found if we decrement the capaci... | algorithms graphs network flow | 1 | How to find max flow in a graph after decrementing an edge capacity? -- (algorithms graphs network flow)
<p>We're given a graph $G=(V, E)$, with source $s$ and sink $t$, $s\neq t$, and that all capacities are non-negative integers. Also the max flow itself is given, so we receive the value of max flow for each edge. W... | habedi/stack-exchange-dataset |
86,802 | maximum matching number decreases when vertices collapse? | <p>It seems that the maximum matching number <strong>decreases</strong> when some <em>independent</em> (not connected) vertices collapse into one vertex, but I don't know if it is absolutely true. 
Would maximum matching number <strong>increases</strong> when two vertices are connected to form a new edge?</p>
&... | graphs matching | 1 | maximum matching number decreases when vertices collapse? -- (graphs matching)
<p>It seems that the maximum matching number <strong>decreases</strong> when some <em>independent</em> (not connected) vertices collapse into one vertex, but I don't know if it is absolutely true. 
Would maximum matching number <strong>i... | habedi/stack-exchange-dataset |
86,803 | Hamiltonian path and minimum spanning tree | <p>Suppose i have a graph and i want to find minimum-spanning-tree. As in imperative languages we have to take specific steps from everynode(example ,we use kruskal's algorithm or prim's algorithm) to find the Minimum spanning tree </p>

<p>but </p>

<p>in declarative language(specially prolog, we can a... | graphs shortest path hamiltonian path prolog | 1 | Hamiltonian path and minimum spanning tree -- (graphs shortest path hamiltonian path prolog)
<p>Suppose i have a graph and i want to find minimum-spanning-tree. As in imperative languages we have to take specific steps from everynode(example ,we use kruskal's algorithm or prim's algorithm) to find the Minimum spanning ... | habedi/stack-exchange-dataset |
86,806 | Checking if the mimimum is unique | <p>We have a finite poset and its subset $S$.</p>

<p>We can enumerate elements of $S$ using an iterator.</p>

<p>I need to check if there are more than one <a href="https://en.wikipedia.org/wiki/Maximal_and_minimal_elements" rel="nofollow noreferrer">minimal</a> elements of $S$ (regarding the above pos... | algorithms decision problem sets enumeration partial order | 1 | Checking if the mimimum is unique -- (algorithms decision problem sets enumeration partial order)
<p>We have a finite poset and its subset $S$.</p>

<p>We can enumerate elements of $S$ using an iterator.</p>

<p>I need to check if there are more than one <a href="https://en.wikipedia.org/wiki/Maximal_an... | habedi/stack-exchange-dataset |
86,815 | An efficient way to get the dual graph from a triangulation | <p>An answer to a <a href="https://cs.stackexchange.com/questions/86792/an-efficient-algorithm-to-decide-if-a-triangulation-is-3-colourable">previous question I asked</a> advised me to find the dual graph of a triangulation. I'm given the graph in the following form:</p>

<p><a href="https://i.stack.imgur.com/... | algorithms graphs | 1 | An efficient way to get the dual graph from a triangulation -- (algorithms graphs)
<p>An answer to a <a href="https://cs.stackexchange.com/questions/86792/an-efficient-algorithm-to-decide-if-a-triangulation-is-3-colourable">previous question I asked</a> advised me to find the dual graph of a triangulation. I'm given t... | habedi/stack-exchange-dataset |
86,817 | Lower bound of complexity of simple problem | <p>Consider the simple problem:</p>

<p>Given a list of objects <em>L</em> of length <em>n</em>, and an object <em>O</em>, determine if <em>O</em> is in <em>L</em>.</p>

<p>It is intuitive that there cannot exist an algorithm a with worst-case time complexity less than O(<em>n</em>) to correctly solve t... | complexity theory time complexity proof techniques | 1 | Lower bound of complexity of simple problem -- (complexity theory time complexity proof techniques)
<p>Consider the simple problem:</p>

<p>Given a list of objects <em>L</em> of length <em>n</em>, and an object <em>O</em>, determine if <em>O</em> is in <em>L</em>.</p>

<p>It is intuitive that there cann... | habedi/stack-exchange-dataset |
86,818 | Why and how geometric series are used for proofs? | <p>I often see that someone uses geometric series for proofs related to time complexity, but also I can't understand why they are used. Are they making proving easier? And how can I use this 'tool' for proofs? Can I transform problems to fit to geometric series?</p>

<p>For example the time complexity of this s... | algorithm analysis runtime analysis proof techniques | 1 | Why and how geometric series are used for proofs? -- (algorithm analysis runtime analysis proof techniques)
<p>I often see that someone uses geometric series for proofs related to time complexity, but also I can't understand why they are used. Are they making proving easier? And how can I use this 'tool' for proofs? Ca... | habedi/stack-exchange-dataset |
86,823 | Constructing a PDA for the language $\{a^mb^n | m > n\}$ | <p>i saw in a book how to construct a PDA for a case with <em>m</em> is equal to <em>n</em> . It's pretty simple, just push a symbol for every <strong>a</strong> and pop this symbol for every <strong>b</strong> that the PDA reads. But, i don't found a way to construct a PDA for this particular case. Every help is welco... | automata pushdown automata | 1 | Constructing a PDA for the language $\{a^mb^n | m > n\}$ -- (automata pushdown automata)
<p>i saw in a book how to construct a PDA for a case with <em>m</em> is equal to <em>n</em> . It's pretty simple, just push a symbol for every <strong>a</strong> and pop this symbol for every <strong>b</strong> that the PDA reads. ... | habedi/stack-exchange-dataset |
86,825 | Minimum expected cost through an unconventional graph with probabilities at which edges are selected | <p>I'm having trouble identifying the approach to minimize the cost of reaching a certain state in an optimization problem. I've modeled it here as a game.</p>

<p><strong>Problem Structure</strong><br>
You buy heroes and send them into a dungeon consisting of rooms containing each two challenges (random nu... | optimization | 1 | Minimum expected cost through an unconventional graph with probabilities at which edges are selected -- (optimization)
<p>I'm having trouble identifying the approach to minimize the cost of reaching a certain state in an optimization problem. I've modeled it here as a game.</p>

<p><strong>Problem Structure</st... | habedi/stack-exchange-dataset |
86,846 | LTL Formula Until with same atoms (aUa) | <p>I am trying to solve some past papers in preparations for my next exam and I've stumbled across the following exercise:
<a href="https://i.stack.imgur.com/htMmX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/htMmX.png" alt="Exercise"></a></p>

<p>While I managed to solve most parts of... | logic linear temporal logic | 1 | LTL Formula Until with same atoms (aUa) -- (logic linear temporal logic)
<p>I am trying to solve some past papers in preparations for my next exam and I've stumbled across the following exercise:
<a href="https://i.stack.imgur.com/htMmX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/htMmX.png" a... | habedi/stack-exchange-dataset |
86,848 | Maximum weighted disjoint set union | <p>I would like to know whether the following problem is a standard problem that has been considered in the research literature. I performed some searches, which have not produced results. I call this problem the <em>Maximum Weighted Disjoint Set Union</em>, which is obviously not the name by which the problem is known... | algorithms set cover | 1 | Maximum weighted disjoint set union -- (algorithms set cover)
<p>I would like to know whether the following problem is a standard problem that has been considered in the research literature. I performed some searches, which have not produced results. I call this problem the <em>Maximum Weighted Disjoint Set Union</em>,... | habedi/stack-exchange-dataset |
86,866 | Viterbi Algorithm: initial state with ONE probability | <p>The <a href="https://en.wikipedia.org/wiki/Viterbi_algorithm" rel="nofollow noreferrer">Viterbi Algorithm</a> can be used to calculate the most likely path, based on observations in a Hidden Markov Model.</p>

<p>Using the same notations as Wikipedia, "each element <code>T1[i, j]</code> of <code>T1</code> st... | probability theory hidden markov models | 1 | Viterbi Algorithm: initial state with ONE probability -- (probability theory hidden markov models)
<p>The <a href="https://en.wikipedia.org/wiki/Viterbi_algorithm" rel="nofollow noreferrer">Viterbi Algorithm</a> can be used to calculate the most likely path, based on observations in a Hidden Markov Model.</p>

... | habedi/stack-exchange-dataset |
86,874 | Improving copy cost of a bit array by using big-endian Patricia Trees (or similar) | <p>I have an algorithm that on each iteration generates a copy of an object containing a bit array and modifies it (the modification is limited to just 1 element per copy)</p>

<p>While doing the time analysis I cannot neglect the copy cost as this bit array is encoding information about the input set, so for a... | data structures time complexity | 1 | Improving copy cost of a bit array by using big-endian Patricia Trees (or similar) -- (data structures time complexity)
<p>I have an algorithm that on each iteration generates a copy of an object containing a bit array and modifies it (the modification is limited to just 1 element per copy)</p>

<p>While doing ... | habedi/stack-exchange-dataset |
86,880 | Are machine codes always numerical? (WIkipedia is Ambiguous) | <p>Wikipedia article on machine code and more in general Wikipedia's take on machine code seems pretty amiguous sometimes.<br>
Often it makes me wonder if there's more, or it is just bad generalization. </p>

<p>Look at this: </p>

<blockquote>
 <p>Machine code or machine language is ......Num... | computer architecture | 1 | Are machine codes always numerical? (WIkipedia is Ambiguous) -- (computer architecture)
<p>Wikipedia article on machine code and more in general Wikipedia's take on machine code seems pretty amiguous sometimes.<br>
Often it makes me wonder if there's more, or it is just bad generalization. </p>

<p>Look at ... | habedi/stack-exchange-dataset |
86,883 | Algorithm to find number of covering sets | <p><strong>UPD</strong>: The following problem comes from error correction codes, to be precise -- either maximum-likelihood or belief-propagation decoding when the spectrum of special failing subsets is known (to some extent). Then the failure probability can be formulated as follows.</p>

<p>Let us say the un... | algorithms coding theory | 1 | Algorithm to find number of covering sets -- (algorithms coding theory)
<p><strong>UPD</strong>: The following problem comes from error correction codes, to be precise -- either maximum-likelihood or belief-propagation decoding when the spectrum of special failing subsets is known (to some extent). Then the failure pro... | habedi/stack-exchange-dataset |
86,884 | Relating indexes for parameters and variables | <p>I am trying to solve a referee assignment problem, but I simply can't think of a way to relate my variable to one of the parameters, and I hope that someone in here can help.</p>

<p>I have the following binary variable</p>

<ul>
<li>x(r,m) = 1 if referee r is assigned match m</li>
</ul>
... | optimization linear programming integer programming variable binding | 1 | Relating indexes for parameters and variables -- (optimization linear programming integer programming variable binding)
<p>I am trying to solve a referee assignment problem, but I simply can't think of a way to relate my variable to one of the parameters, and I hope that someone in here can help.</p>

<p>I have... | habedi/stack-exchange-dataset |
86,893 | What does an "I/O Task" mean? | <p>While reading <a href="https://gabrieletolomei.wordpress.com/miscellanea/operating-systems/multiprogramming-multiprocessing-multitasking-multithreading/" rel="nofollow noreferrer">an article</a>, I noticed the use of term 'I/O Task':</p>
<blockquote>
<p>Indeed, suppose the currently running process is perfor... | operating systems multi tasking | 1 | What does an "I/O Task" mean? -- (operating systems multi tasking)
<p>While reading <a href="https://gabrieletolomei.wordpress.com/miscellanea/operating-systems/multiprogramming-multiprocessing-multitasking-multithreading/" rel="nofollow noreferrer">an article</a>, I noticed the use of term 'I/O Task':</p>
<blockqu... | habedi/stack-exchange-dataset |
86,901 | P=NP, isn't it? | <p>Cook and Levin showed in 1971 how deterministically in polynomial time from every non deterministic Turing machine <strong>M</strong>, that halts in polynomial number of moves/steps, and string <strong>w</strong> to create the boolean formula $\Phi_{M,w}$ in <strong>conjunctive normal form</strong> that is <strong>t... | complexity theory turing machines reductions satisfiability p vs np | 1 | P=NP, isn't it? -- (complexity theory turing machines reductions satisfiability p vs np)
<p>Cook and Levin showed in 1971 how deterministically in polynomial time from every non deterministic Turing machine <strong>M</strong>, that halts in polynomial number of moves/steps, and string <strong>w</strong> to create the b... | habedi/stack-exchange-dataset |
86,902 | Counting to infintiy problem | <p>I came across this explanation for count to infinity problem<a href="https://i.stack.imgur.com/iHjAL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iHjAL.png" alt="enter image description here"></a></p>

<p>However, i don't understand that after the BC link broke, followed by which B erro... | algorithms graphs computer networks | 1 | Counting to infintiy problem -- (algorithms graphs computer networks)
<p>I came across this explanation for count to infinity problem<a href="https://i.stack.imgur.com/iHjAL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iHjAL.png" alt="enter image description here"></a></p>

<p>However, i d... | habedi/stack-exchange-dataset |
86,907 | LTL Until Tautology | <p>Today I had to prove some tautologies as an exercise, one of them was:</p>

<p>(Ga)->(Fb) equivalent aU(b v ¬a)</p>

<p>It is clear that I have to prove the implication in both ways. After putting into negation normal form i get that:</p>

<p>F(¬a v b) -> aU(b v ¬a) and viceversa.</p>
&#x... | logic linear temporal logic | 1 | LTL Until Tautology -- (logic linear temporal logic)
<p>Today I had to prove some tautologies as an exercise, one of them was:</p>

<p>(Ga)->(Fb) equivalent aU(b v ¬a)</p>

<p>It is clear that I have to prove the implication in both ways. After putting into negation normal form i get that:</p>

... | habedi/stack-exchange-dataset |
86,916 | Will a Greedy algorithm give a correct result for minimum partition? | <p>Will a greedy method of picking the item that causes the largest difference each time lead to the optimal result in the minimum partition problem?</p>

<p>Let's say I have a set $\{a_1,a_2,a_3,...a_n\}$, now I have to divide it into two subsets so that the difference between the sums of the two subsets is th... | algorithms greedy algorithms partitions | 1 | Will a Greedy algorithm give a correct result for minimum partition? -- (algorithms greedy algorithms partitions)
<p>Will a greedy method of picking the item that causes the largest difference each time lead to the optimal result in the minimum partition problem?</p>

<p>Let's say I have a set $\{a_1,a_2,a_3,..... | habedi/stack-exchange-dataset |
86,925 | How to prove Halting problem is solvable by oracle machine | <p>How can we prove that the Halting problem is solvable by a machine with access to some oracle?</p>
 | complexity theory | 1 | How to prove Halting problem is solvable by oracle machine -- (complexity theory)
<p>How can we prove that the Halting problem is solvable by a machine with access to some oracle?</p>
 | habedi/stack-exchange-dataset |
86,927 | Not able to prove non regularity using pumping lemma | <p>$L$ = $0^p1^q0^p$. Where $p, q \geq 0$</p>

<p>Here for any string $w \in L$ , I can have $u$=$0^p$, $x$ = $1^q$ and $v$= $0^p$ and $x^i$ will belong to L for all $i \geq 0$</p>

<p>So how do I prove it to be non regular using pumping lemma as there doesn't exist a string $w \in L$ which cannot be de... | formal languages regular languages pumping lemma | 1 | Not able to prove non regularity using pumping lemma -- (formal languages regular languages pumping lemma)
<p>$L$ = $0^p1^q0^p$. Where $p, q \geq 0$</p>

<p>Here for any string $w \in L$ , I can have $u$=$0^p$, $x$ = $1^q$ and $v$= $0^p$ and $x^i$ will belong to L for all $i \geq 0$</p>

<p>So how do I ... | habedi/stack-exchange-dataset |
86,931 | If all computations of non deterministic Turing machine on the input string are all accept then is the boolean formula of them a tautology? | <p>If <strong>M</strong> is non deterministic Turing machine and <strong>w</strong> is any string then $\Phi_{M,w}$ is satisfiable if and only if <strong>M</strong> accepts <strong>w</strong> according to Cook and Levin (1971).</p>

<p>By the definition of non deterministic Turing machine, <strong>M</strong> ac... | complexity theory turing machines satisfiability strings nondeterminism | 1 | If all computations of non deterministic Turing machine on the input string are all accept then is the boolean formula of them a tautology? -- (complexity theory turing machines satisfiability strings nondeterminism)
<p>If <strong>M</strong> is non deterministic Turing machine and <strong>w</strong> is any string then ... | habedi/stack-exchange-dataset |
86,937 | explaining $\lambda$-calculus/functional programming to someone used to Turing machines/procedural programming? | <p><strong>I have the following background:</strong></p>

<ul>
<li><p>I have experience with object-oriented programming languages</p></li>
<li><p>I find Turing machines and the concept of a "procedure" very intuitive. </p></li>
</ul>

<p>Yet I'm interested to understand the idea behind the ... | lambda calculus functional programming | 1 | explaining $\lambda$-calculus/functional programming to someone used to Turing machines/procedural programming? -- (lambda calculus functional programming)
<p><strong>I have the following background:</strong></p>

<ul>
<li><p>I have experience with object-oriented programming languages</p></li>
<li><p>I... | habedi/stack-exchange-dataset |
86,940 | Why doesn't Quantum Turing Machine contradict with Church-Turing thesis | <p>I studied about Quantum Turing machine and i figured out that the difference between QTM and TM is in transition function and also if a problem is unsolvable by a TM then it is unsolvable by a QTM but I need a justifiable reason to claim QTM does not contradict with Church-Turing thesis.</p>
 | complexity theory | 1 | Why doesn't Quantum Turing Machine contradict with Church-Turing thesis -- (complexity theory)
<p>I studied about Quantum Turing machine and i figured out that the difference between QTM and TM is in transition function and also if a problem is unsolvable by a TM then it is unsolvable by a QTM but I need a justifiable ... | habedi/stack-exchange-dataset |
86,942 | What is the computational complexity category of $T(n) = m^{\frac{n-1}{m}}$? | <p>I'm analyzing the computational complexity of an algorithm whose input size is $n$. Finally, I've ended up with 
$T(n) = {m^\frac{n-1}{m}}$ where $m$ is a constant. Can one explain the type name corresponding to this computational complexity (e.g., exponential, etc.)? </p>
 | terminology asymptotics | 1 | What is the computational complexity category of $T(n) = m^{\frac{n-1}{m}}$? -- (terminology asymptotics)
<p>I'm analyzing the computational complexity of an algorithm whose input size is $n$. Finally, I've ended up with 
$T(n) = {m^\frac{n-1}{m}}$ where $m$ is a constant. Can one explain the type name correspondin... | habedi/stack-exchange-dataset |
86,947 | What is the complexity of the following problem? | <p><strong>Input:</strong> $M$ is non deterministic Turing machine that always halts in $cn^k$ moves/steps, where $c$ and $k$ are constants and $n$ is the length of the input string of $M$, $w$ is any string in $\Sigma^*$ and $a$ is another string in $\Sigma^*$ where $\Sigma=\{0,1\}$.</p>

<p><strong>Output</st... | complexity theory turing machines reductions satisfiability decision problem | 1 | What is the complexity of the following problem? -- (complexity theory turing machines reductions satisfiability decision problem)
<p><strong>Input:</strong> $M$ is non deterministic Turing machine that always halts in $cn^k$ moves/steps, where $c$ and $k$ are constants and $n$ is the length of the input string of $M$,... | habedi/stack-exchange-dataset |
86,953 | PDA pushing nothing given an input and the current stack top | <p>If we had a language $$\sum = \{a,b,c\}$$
for a pushdown automata, and the transition 
$$a;A/AA$$
means "If you read in an <code>a</code> and <code>A</code> is at the top of the stack, push <code>A</code>", then would you be able to push nothing if you encounter an <code>a</code> and <code>A</code> is at... | pushdown automata | 1 | PDA pushing nothing given an input and the current stack top -- (pushdown automata)
<p>If we had a language $$\sum = \{a,b,c\}$$
for a pushdown automata, and the transition 
$$a;A/AA$$
means "If you read in an <code>a</code> and <code>A</code> is at the top of the stack, push <code>A</code>", then would you... | habedi/stack-exchange-dataset |
86,954 | How is the traveling salesman problem verifiable in polynomial time? | <p>So I understand the idea that the decision problem is defined as </p>

<blockquote>
 <p>Is there a path P such that the cost is lower than C?</p>
</blockquote>

<p>and you can easily check this is true by verifying a path you receive. </p>

<p>However, what if there is no path that f... | complexity theory time complexity np decision problem traveling salesman | 1 | How is the traveling salesman problem verifiable in polynomial time? -- (complexity theory time complexity np decision problem traveling salesman)
<p>So I understand the idea that the decision problem is defined as </p>

<blockquote>
 <p>Is there a path P such that the cost is lower than C?</p>
</block... | habedi/stack-exchange-dataset |
86,960 | Refuting $H(L_1 \cap L_2) = H(L_1) \cap H(L_2)$ for homomorphisms | <p>I want to prove that $H(L_1 \cap L_2) = H(L_1) \cap H(L_2)$ is not always true.</p>

<p>If $L_1 = (ab)^*$ and $L_2 = (ba)^*$ with mapping $H(a) = 1$ and $H(b) = 1$, $H(\epsilon) = 2$, then $H(L_1 \cap L_2) = 2$ while $H(L_1) \cap H(L_2) = (11)^*$.</p>

<p>Is the above example correct to prove the abo... | formal languages regular languages | 1 | Refuting $H(L_1 \cap L_2) = H(L_1) \cap H(L_2)$ for homomorphisms -- (formal languages regular languages)
<p>I want to prove that $H(L_1 \cap L_2) = H(L_1) \cap H(L_2)$ is not always true.</p>

<p>If $L_1 = (ab)^*$ and $L_2 = (ba)^*$ with mapping $H(a) = 1$ and $H(b) = 1$, $H(\epsilon) = 2$, then $H(L_1 \cap L_... | habedi/stack-exchange-dataset |
86,962 | Can the Same Function Have Different Asymptotic? | <p>Say we had a function $4^k$. </p>

<p>The asymptotic of this function would be $\Theta(4^k)$, and thus we would say the function has exponential run-time.</p>

<p>But what if $k = \log{n}$? Then our same function would be $4^k = 4^{\log{n}} = n^{\log{4}} \in \Theta(n^{\log{4}})$.</p>

<p>(Ste... | asymptotics | 1 | Can the Same Function Have Different Asymptotic? -- (asymptotics)
<p>Say we had a function $4^k$. </p>

<p>The asymptotic of this function would be $\Theta(4^k)$, and thus we would say the function has exponential run-time.</p>

<p>But what if $k = \log{n}$? Then our same function would be $4^k = 4^{\lo... | habedi/stack-exchange-dataset |
86,964 | Is there a heuristic or function to determine if two arrays of integers are alike or similar | <p>What I am trying to do is determine "closeness" or how similar are arrays of integers (or byte arrays, doesn't matter). For example, let's say <code>a = [0, 1, 2, 3, 4]</code>, <code>b = [0, 2, 1, 3, 4]</code>, and <code>c = [1, 4, 2, 0, 3]</code>. Is there a function to determine that <code>a</code> is closer to <... | hash hashing string metrics edit distance | 1 | Is there a heuristic or function to determine if two arrays of integers are alike or similar -- (hash hashing string metrics edit distance)
<p>What I am trying to do is determine "closeness" or how similar are arrays of integers (or byte arrays, doesn't matter). For example, let's say <code>a = [0, 1, 2, 3, 4]</code>, ... | habedi/stack-exchange-dataset |
86,972 | prove that $h(x)$ is partial recursive | <p>If $f:A^*\rightarrow A*$ and $g:A^* \rightarrow A^*$ are partial recursive we want to prove $h:A^* \rightarrow A^*$ with the following definition is partial recursive
$$ h(x) =
 \begin{cases}
 \lambda & f(x) = \lambda\\
 g(x) & \textrm{otherwise}
 \end{cases} $$
for $x ... | computability primitive recursion mu recursion | 1 | prove that $h(x)$ is partial recursive -- (computability primitive recursion mu recursion)
<p>If $f:A^*\rightarrow A*$ and $g:A^* \rightarrow A^*$ are partial recursive we want to prove $h:A^* \rightarrow A^*$ with the following definition is partial recursive
$$ h(x) =
 \begin{cases}
 \lambda &am... | habedi/stack-exchange-dataset |
86,979 | What is the grammar for language $L={a^nb^m : n \neq m-1}$? | <p>What is the grammar for language $L = \{ a^nb^m : n\neq m-1\}$? </p>

<p>I only know I have to write grammar for both $ n<m-1 $ and $ n>m-1 $, so this is what I wrote:</p>

<pre><code>for n<m-1
S->Abb
A->aAb|lambda

for n>m-1
S->aaA
A->aAb|lambda
</... | context free formal grammars | 1 | What is the grammar for language $L={a^nb^m : n \neq m-1}$? -- (context free formal grammars)
<p>What is the grammar for language $L = \{ a^nb^m : n\neq m-1\}$? </p>

<p>I only know I have to write grammar for both $ n<m-1 $ and $ n>m-1 $, so this is what I wrote:</p>

<pre><code>for n<m-1
... | habedi/stack-exchange-dataset |
86,984 | How should I "read" a dereference operator? | <p>For example, when I look at some code like</p>

<pre><code>int x = 1;
int * y = &x;
</code></pre>

<p>I can read it like </p>

<pre><code>x equals 1
y equals the address of x
</code></pre>

<p>but how would I "read" something like</p>

<pre><code>*y = 1;&#x... | memory access c | 1 | How should I "read" a dereference operator? -- (memory access c)
<p>For example, when I look at some code like</p>

<pre><code>int x = 1;
int * y = &x;
</code></pre>

<p>I can read it like </p>

<pre><code>x equals 1
y equals the address of x
</code></pre>

<p>but how... | habedi/stack-exchange-dataset |
86,990 | How do I arrive at the multiplication function in lambda calculus? | <p>I'm familiar with how Church numerals are defined in the lambda calculus, i.e. as functions that take two arguments and apply the first argument $n$ times to the second.</p>

<p>Then I have the successor and addition functions, both of which I managed to derive and understand:</p>

<p>$$\begin{align}... | lambda calculus church numerals | 1 | How do I arrive at the multiplication function in lambda calculus? -- (lambda calculus church numerals)
<p>I'm familiar with how Church numerals are defined in the lambda calculus, i.e. as functions that take two arguments and apply the first argument $n$ times to the second.</p>

<p>Then I have the successor a... | habedi/stack-exchange-dataset |
86,994 | How do I tell if $G$ is a forest in log-space? | <p>How does to prove that language 
$$\textbf{X} = \{G \mid\text{ all connected connected components in $G$ are trees}\} \in \textbf{L}\,?$$ I know how to prove that language of undirected trees is in $\textbf{L}$ but I don't know what to do next.</p>
 | complexity theory | 1 | How do I tell if $G$ is a forest in log-space? -- (complexity theory)
<p>How does to prove that language 
$$\textbf{X} = \{G \mid\text{ all connected connected components in $G$ are trees}\} \in \textbf{L}\,?$$ I know how to prove that language of undirected trees is in $\textbf{L}$ but I don't know what to do next... | habedi/stack-exchange-dataset |
87,006 | How does a buffer overrun corrupt the return address? | <p>I got stuck on the following note while reading a paper about computer security:</p>
<blockquote>
<p>The <strong>stack mixes program data and control data</strong></p>
<p>– by overrunning buffers on the stack we can corrupt the return addresses!</p>
</blockquote>
<p><a href="https://i.stack.imgu... | operating systems memory management virtual memory security | 1 | How does a buffer overrun corrupt the return address? -- (operating systems memory management virtual memory security)
<p>I got stuck on the following note while reading a paper about computer security:</p>
<blockquote>
<p>The <strong>stack mixes program data and control data</strong></p>
<p>– by overrunnin... | habedi/stack-exchange-dataset |
87,009 | Can you give me an example word that is in the language $L = \{w | w ∈ \{a,b\}^∗ ∧ |w|_a = |w|_b\} $ | <p>Again, the language is $L = \{w | w ∈ \{a,b\}^∗ ∧ |w|_a = |w|_b\} $<br>
Now I'm unsure about what the '*' indicates. Whether it means that either a or b can be repeated, or only one of them or if you can repeat a pattern made of a and b.<br>
An explanation would also be appreciated but I thought one or more ... | formal languages | 1 | Can you give me an example word that is in the language $L = \{w | w ∈ \{a,b\}^∗ ∧ |w|_a = |w|_b\} $ -- (formal languages)
<p>Again, the language is $L = \{w | w ∈ \{a,b\}^∗ ∧ |w|_a = |w|_b\} $<br>
Now I'm unsure about what the '*' indicates. Whether it means that either a or b can be repeated, or only one of them ... | habedi/stack-exchange-dataset |
87,016 | Why do Alice and Bob get the same key even after modular reduction in Diffie-Hellman Cryptography? | <p>In this cryptography scheme, we take $g$ and $p$ (a large prime number). and taking the customary clients Alice and Bob who chose $a$ and $b$ secretly whereas $p$ and $g$ are known in public. <em>I haven't mentioned the other requirements taken into consideration for selection of these parameters.</em></p>

... | cryptography number theory | 1 | Why do Alice and Bob get the same key even after modular reduction in Diffie-Hellman Cryptography? -- (cryptography number theory)
<p>In this cryptography scheme, we take $g$ and $p$ (a large prime number). and taking the customary clients Alice and Bob who chose $a$ and $b$ secretly whereas $p$ and $g$ are known in pu... | habedi/stack-exchange-dataset |
87,022 | CFG to PDA - no empty transitions | <p>Working for my exam, this question popped up.</p>

<blockquote>
 <p>Given the production rules below, draw a pushdown automaton to recognise the language it generates:<br>
 S → AB<br>
 A → BA<br>
 B → BB<br>
 B → T<br>
 T → b</p>
</blockquote>

<p>Questions:<br>
... | automata context free formal grammars pushdown automata simulation | 1 | CFG to PDA - no empty transitions -- (automata context free formal grammars pushdown automata simulation)
<p>Working for my exam, this question popped up.</p>

<blockquote>
 <p>Given the production rules below, draw a pushdown automaton to recognise the language it generates:<br>
 S → AB<br>
 A →... | habedi/stack-exchange-dataset |
87,023 | How do I check if two if-stmt blocks are the same? | <p>Consider the following two snipets of code:</p>

<pre><code>If a >= 5:
 If b == 0:
 ....
 Else:
 ....
Else if a <= 5:
 ....
</code></pre>

<hr>

<pre><code>If a > 5:
 ....
Else If a >= 5 and b == 0:
 ....
Else If a >... | algorithms complexity theory computability artificial intelligence | 1 | How do I check if two if-stmt blocks are the same? -- (algorithms complexity theory computability artificial intelligence)
<p>Consider the following two snipets of code:</p>

<pre><code>If a >= 5:
 If b == 0:
 ....
 Else:
 ....
Else if a <= 5:
 ....
</code></pre>&... | habedi/stack-exchange-dataset |
87,038 | Why would this be a deterministic context free language? $L = \{a^n b^n | n>0 \}$ $\cup$ $\{ a^n b^{2n} | n < 100 \}$ | <p>so the book that I'm reading says this is a deterministic context free language 
 $L = \{a^n b^n | n>0 \}$ $\cup$ $\{ a^n b^{2n} | n < 100 \}$</p>

<p>But i think this is wrong Because :</p>

<p>at the beginning of building the DPDA, we have to decide whether we should go with the first on... | automata pushdown automata | 1 | Why would this be a deterministic context free language? $L = \{a^n b^n | n>0 \}$ $\cup$ $\{ a^n b^{2n} | n < 100 \}$ -- (automata pushdown automata)
<p>so the book that I'm reading says this is a deterministic context free language 
 $L = \{a^n b^n | n>0 \}$ $\cup$ $\{ a^n b^{2n} | n < 100 \}$</p>

... | habedi/stack-exchange-dataset |
87,039 | Graph where only two vertices have the same degree | <p>Let's say that $N$ is the number of vertices. We want to create a graph where only two vertices have the same degree. For what kind of $N$ is this possible?</p>

<p>I tried it and I've been able only to come up with such where $N$ is $3$ and $4$.</p>
 | graphs | 1 | Graph where only two vertices have the same degree -- (graphs)
<p>Let's say that $N$ is the number of vertices. We want to create a graph where only two vertices have the same degree. For what kind of $N$ is this possible?</p>

<p>I tried it and I've been able only to come up with such where $N$ is $3$ and $4$.... | habedi/stack-exchange-dataset |
87,042 | Running time with while loop | <p>What's the running time of:</p>

<pre><code>foo(n)
if(n==1) return;
int i=1;
while(i<n)
{
 i=i+2
}
foo(n-2)
</code></pre>

<p>There are $n/2$ recursive calls to <code>foo</code> but how to add to the calculation the while loop</p>
 | runtime analysis | 1 | Running time with while loop -- (runtime analysis)
<p>What's the running time of:</p>

<pre><code>foo(n)
if(n==1) return;
int i=1;
while(i<n)
{
 i=i+2
}
foo(n-2)
</code></pre>

<p>There are $n/2$ recursive calls to <code>foo</code> but how to add to the calculation ... | habedi/stack-exchange-dataset |
87,051 | Does big-Oh notation in optimization follow the same convention as in CS? | <p>I first learned big-Oh (little-Oh, big-Theta.....) complexity for growth of functions using CLRS in a computer science class.</p>
<p>Now I am doing a project on optimization. In our optimization class, we were introduced to the notion of rate of convergence which are characterized by the ratio:</p>
<p><span ... | optimization asymptotics reference request notation | 1 | Does big-Oh notation in optimization follow the same convention as in CS? -- (optimization asymptotics reference request notation)
<p>I first learned big-Oh (little-Oh, big-Theta.....) complexity for growth of functions using CLRS in a computer science class.</p>
<p>Now I am doing a project on optimization. In our ... | habedi/stack-exchange-dataset |
87,053 | Application of difference array for overlapping glass-tint problem | <p>For <a href="https://dmoj.ca/problem/ccc14s4" rel="nofollow noreferrer">this problem</a>, I heard that using a <em>difference array</em> can solve the problem but I can't seem to figure out how to solve this problem. Could anyone give me some advice? Please keep it simple since I am only a high school student prepar... | algorithms data structures computational geometry arrays | 1 | Application of difference array for overlapping glass-tint problem -- (algorithms data structures computational geometry arrays)
<p>For <a href="https://dmoj.ca/problem/ccc14s4" rel="nofollow noreferrer">this problem</a>, I heard that using a <em>difference array</em> can solve the problem but I can't seem to figure ou... | habedi/stack-exchange-dataset |
87,056 | What are "state registers" and "code registers"? | <p>While reading a <a href="https://inst.eecs.berkeley.edu/~cs61c/fa17/lec/10/L10%20HWII%20(1up).pdf" rel="nofollow noreferrer">chapter</a> about <code>FSM</code>, I was stuck on the following slide:</p>

<p><a href="https://i.stack.imgur.com/Juiex.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.... | computer architecture | 1 | What are "state registers" and "code registers"? -- (computer architecture)
<p>While reading a <a href="https://inst.eecs.berkeley.edu/~cs61c/fa17/lec/10/L10%20HWII%20(1up).pdf" rel="nofollow noreferrer">chapter</a> about <code>FSM</code>, I was stuck on the following slide:</p>

<p><a href="https://i.stack.img... | habedi/stack-exchange-dataset |
87,066 | Recurtion equation | <p>Does anyone know how to solve the below? 
I'm guessing that I need to use the Subtraction method or iteration but still I'm having a hard time with it.</p>

<p>$$T(n)=3T(n-1)+3^n\times n^2$$</p>
 | algorithms complexity theory | 1 | Recurtion equation -- (algorithms complexity theory)
<p>Does anyone know how to solve the below? 
I'm guessing that I need to use the Subtraction method or iteration but still I'm having a hard time with it.</p>

<p>$$T(n)=3T(n-1)+3^n\times n^2$$</p>
 | habedi/stack-exchange-dataset |
87,067 | How is Vertex Cover reducable to Independent Set using parametrized reduction with parameter k? | <p>We have the following Lemma and proof:</p>
<blockquote>
<p><strong>Lemma 5.5.</strong> If <span class="math-container">$A$</span> if FPT, then <span class="math-container">$A\leq_{\mathrm{fpt}}$</span> Independent Set.</p>
<p><em>Proof.</em> We reduce <span class="math-container">$A$</span> to Independen... | complexity theory reductions parameterized complexity | 1 | How is Vertex Cover reducable to Independent Set using parametrized reduction with parameter k? -- (complexity theory reductions parameterized complexity)
<p>We have the following Lemma and proof:</p>
<blockquote>
<p><strong>Lemma 5.5.</strong> If <span class="math-container">$A$</span> if FPT, then <span class... | habedi/stack-exchange-dataset |
87,074 | Can a DPDA decide if two letters appear the same number of times mod 5? | <p>$ L = \{ w ∈\{0,1\}^* \mid |w|_0 = |w|_1 \mod 5 \}$</p>

<p>So i tried figuring out why this is CFL and whether its DCFL or not but i couldn't come up with any PDA! </p>

<p>I'm studying for my exam and this was on the book, the book says its CFL but doesn't say whether its DCFL or not and does... | formal languages context free pushdown automata | 1 | Can a DPDA decide if two letters appear the same number of times mod 5? -- (formal languages context free pushdown automata)
<p>$ L = \{ w ∈\{0,1\}^* \mid |w|_0 = |w|_1 \mod 5 \}$</p>

<p>So i tried figuring out why this is CFL and whether its DCFL or not but i couldn't come up with any PDA! </p>

... | habedi/stack-exchange-dataset |
87,084 | Solving diophantine equations -- does having a bound on the size of the solution help? | <p>Let's define the following languages over the alphabet $\Sigma=\{0,1\}$:</p>

<p><strong>H10</strong> is the language of all strings that are encoding of diophantine polynomial equation with integer coefficients and $n$ unknowns/variables that has at least 1 integers root/solution, i.e. there exists a root/s... | complexity theory computability decision problem polynomial time p vs np | 1 | Solving diophantine equations -- does having a bound on the size of the solution help? -- (complexity theory computability decision problem polynomial time p vs np)
<p>Let's define the following languages over the alphabet $\Sigma=\{0,1\}$:</p>

<p><strong>H10</strong> is the language of all strings that are en... | habedi/stack-exchange-dataset |
87,088 | Minimum area of tarp to cover a carpet | <p>This problem takes place on a coordinate plane. I need assistance in creating the algorithm to solve this problem. I am solving this problem in java if you are interested.<br>
I have 1 carpet and 2 tarps.<br>
The 1 tarp covers the carpet (note in some scenarios it may not cover it at all).<br>
The second... | algorithms computational geometry | 1 | Minimum area of tarp to cover a carpet -- (algorithms computational geometry)
<p>This problem takes place on a coordinate plane. I need assistance in creating the algorithm to solve this problem. I am solving this problem in java if you are interested.<br>
I have 1 carpet and 2 tarps.<br>
The 1 tarp covers the ... | habedi/stack-exchange-dataset |
87,092 | Which of the following expressions is TRUE if and only if NOT all three variables a, b, and c have the same value? | <p>I am trying to solve this problem and I am stuck. I think it is B, but I think I'm wrong. Thanks. </p>

<p>Which of the following expressions is TRUE if and only if NOT all three variables a, b, and c have the same value?</p>

<p>A. a != b || b != c</p>

<p>B. (a == b || b == c || a == c)</p... | logic propositional logic | 1 | Which of the following expressions is TRUE if and only if NOT all three variables a, b, and c have the same value? -- (logic propositional logic)
<p>I am trying to solve this problem and I am stuck. I think it is B, but I think I'm wrong. Thanks. </p>

<p>Which of the following expressions is TRUE if and only i... | habedi/stack-exchange-dataset |
87,095 | How to transform Nondeterministic finite automaton (NFA) to regular expression equivalent | <p>Im struggling to understand how to transform Nondeterministic finite automaton (NFA) of the following form:</p>

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

<p>To a regular expre... | regular languages finite automata regular expressions discrete mathematics | 1 | How to transform Nondeterministic finite automaton (NFA) to regular expression equivalent -- (regular languages finite automata regular expressions discrete mathematics)
<p>Im struggling to understand how to transform Nondeterministic finite automaton (NFA) of the following form:</p>

<p><a href="https://i.stac... | habedi/stack-exchange-dataset |
87,100 | Is this possible to solve satisfiability by using Quine McCluskey algorithm to simplify the whole given boolean formula by simplifying subformulas? | <p>In this <a href="https://cs.stackexchange.com/questions/79694/is-this-possible-to-solve-boolean-satisfiablility-by-using-karnaugh-maps-to-simp">question</a></p>

<p>Farewell Stack Exchange suggested to use karnaugh maps to solve the satisfiability problem by simplifying the entire/whole boolean formula by si... | algorithms logic satisfiability decision problem propositional logic | 1 | Is this possible to solve satisfiability by using Quine McCluskey algorithm to simplify the whole given boolean formula by simplifying subformulas? -- (algorithms logic satisfiability decision problem propositional logic)
<p>In this <a href="https://cs.stackexchange.com/questions/79694/is-this-possible-to-solve-boolean... | habedi/stack-exchange-dataset |
87,103 | Does the language of TM's that repeat a configuration infinite times semi-decidable or not? | <p>Let us define the following languages:
<sub>
$$ {L_1 = \{\langle M\rangle : M \ \text{is a TM and $\exists w\in \Sigma^*$ s.t $M(w)$ repeats a configuration infinite times}\}} $$</sub></p>

<p><sub>
$$ L_2 = \{\langle M\rangle : M \ \text{is a TM and on all inputs there exists a configuration... | formal languages computability reductions undecidability semi decidability | 1 | Does the language of TM's that repeat a configuration infinite times semi-decidable or not? -- (formal languages computability reductions undecidability semi decidability)
<p>Let us define the following languages:
<sub>
$$ {L_1 = \{\langle M\rangle : M \ \text{is a TM and $\exists w\in \Sigma^*$ s.t $M(w)$ re... | habedi/stack-exchange-dataset |
87,104 | How can I efficiently plot the inside of an ellipse? | <p>I am given the the coefficients for an ellipse in the form:
$$Ax^2 + Bxy + Cy^2 + Dx + Ey + F=0.$$</p>

<p>I have a 2 dimensional array of point objects (in Python) called "pixels", and I need to give each point a "count" if they lie inside the ellipse.</p>

<p>I initially tried iterating through... | algorithms computational geometry graphics | 1 | How can I efficiently plot the inside of an ellipse? -- (algorithms computational geometry graphics)
<p>I am given the the coefficients for an ellipse in the form:
$$Ax^2 + Bxy + Cy^2 + Dx + Ey + F=0.$$</p>

<p>I have a 2 dimensional array of point objects (in Python) called "pixels", and I need to give eac... | habedi/stack-exchange-dataset |
87,111 | Changing preference in Gale-Shapley algorithm? | <p>Suppose, in the context of the classic marriage problem, two equal size groups of $n$ men and $n$ women are being matched, with the GS algorithm.</p>

<p>If a man were to switch the order of a pair of women, low on his preference list, say $x$ and $y$, would this yield any sort of advantage with regards to b... | algorithms graphs algorithm analysis matching bipartite matching | 1 | Changing preference in Gale-Shapley algorithm? -- (algorithms graphs algorithm analysis matching bipartite matching)
<p>Suppose, in the context of the classic marriage problem, two equal size groups of $n$ men and $n$ women are being matched, with the GS algorithm.</p>

<p>If a man were to switch the order of a... | habedi/stack-exchange-dataset |
87,112 | Sorting by tuples | <p>This is more of a practical question for me, but I have a few team members $n$ who I'd like to sort by two characteristics (just call them $a$ and $b$ for now). These characteristics are just a rating (given from 1-10). Among these $n$ team members, I am trying to find those who fit a definition of being <em>good</e... | algorithms sorting | 1 | Sorting by tuples -- (algorithms sorting)
<p>This is more of a practical question for me, but I have a few team members $n$ who I'd like to sort by two characteristics (just call them $a$ and $b$ for now). These characteristics are just a rating (given from 1-10). Among these $n$ team members, I am trying to find those... | habedi/stack-exchange-dataset |
87,125 | Counting number of permutations respecting partial order | <p>Suppose that we have an array $A$ of $n$ elements with some partial order known, e.g. for example as a $n\times n$ matrix containing $c_{ij} \in \{-1, 0, 1\}$ where $0$ represents unknown and $-1, 1$ represent $A_i < A_j$ and $A_i \geq A_j$ respectively.</p>

<p>Is there an efficient algorithm that counts... | permutations counting partial order | 1 | Counting number of permutations respecting partial order -- (permutations counting partial order)
<p>Suppose that we have an array $A$ of $n$ elements with some partial order known, e.g. for example as a $n\times n$ matrix containing $c_{ij} \in \{-1, 0, 1\}$ where $0$ represents unknown and $-1, 1$ represent $A_i <... | habedi/stack-exchange-dataset |
87,132 | Transforming an array into one with descending order | <h1>Problem Description</h1>

<p>Given an array $A$ of $n$ integers, find the minimum number of operations to turn it into a new array $\widehat{A}$ with a (weakly) <em>descending order</em>: we require that $\hat{a}_i \geq \hat{a}_j$ for all $1\leq i<j\leq n$. Here an operation means either increasing or de... | algorithms time complexity arrays | 1 | Transforming an array into one with descending order -- (algorithms time complexity arrays)
<h1>Problem Description</h1>

<p>Given an array $A$ of $n$ integers, find the minimum number of operations to turn it into a new array $\widehat{A}$ with a (weakly) <em>descending order</em>: we require that $\hat{a}_i \... | habedi/stack-exchange-dataset |
87,141 | Does the k-clique problem became easier on sparse graphs? | <p>Some definitions, just to not create confusion:</p>

<ol>
<li><p>A <em>sparse graph</em> is a graph that contains a number of edges less or equal than the number of vertices.</p></li>
<li><p>In <em>$k$-clique problem</em> we are given a graph and an integer $k$, and the task is to decide whether the ... | complexity theory graphs clique | 1 | Does the k-clique problem became easier on sparse graphs? -- (complexity theory graphs clique)
<p>Some definitions, just to not create confusion:</p>

<ol>
<li><p>A <em>sparse graph</em> is a graph that contains a number of edges less or equal than the number of vertices.</p></li>
<li><p>In <em>$k$-cliq... | habedi/stack-exchange-dataset |
87,152 | return all strings contains given string in suffix tree | <p>Here is my question:</p>

<p>Given a compressed suffix tree of string S and a substring T.
I need to return all substrings of S that begins with the substring T
sorted by lexicographic order.</p>

<p>My approach:
I can traverse the suffix tree and find the edge / node which last letter of... | algorithms data structures strings searching suffix trees | 1 | return all strings contains given string in suffix tree -- (algorithms data structures strings searching suffix trees)
<p>Here is my question:</p>

<p>Given a compressed suffix tree of string S and a substring T.
I need to return all substrings of S that begins with the substring T
sorted by lexicograph... | habedi/stack-exchange-dataset |
87,162 | Is Acceptance by Empty stack and Final state possible in the same PDA? | <p><a href="https://i.stack.imgur.com/1zbOK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1zbOK.png" alt="consider the PDA given below we need to find the language accepted by the given PDA "></a></p>

<p>$L$ is the language accepted by the above PDA :<br>
$L = \{a^n\mid n\geq 0\}\cup\{... | pushdown automata | 1 | Is Acceptance by Empty stack and Final state possible in the same PDA? -- (pushdown automata)
<p><a href="https://i.stack.imgur.com/1zbOK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1zbOK.png" alt="consider the PDA given below we need to find the language accepted by the given PDA "></a></p>
... | habedi/stack-exchange-dataset |
87,173 | Does exist NP language that is Cook Levin deterministic reducible to xor satisfiability in polynomial time? | <p>We say that the language $L$ is Cook Levin deterministic reducible to xor satisfiability in polynomial time if and only if for each word $w\in\Sigma^*:w\in L\iff f(w)\in XORSAT$ where $\Sigma=\{0,1\}$ and $f:\Sigma^*\rightarrow\Sigma^*$ is the function in the Cook Levin reduction that was introduced in 1971.</p>
... | complexity theory reductions logic satisfiability propositional logic | 1 | Does exist NP language that is Cook Levin deterministic reducible to xor satisfiability in polynomial time? -- (complexity theory reductions logic satisfiability propositional logic)
<p>We say that the language $L$ is Cook Levin deterministic reducible to xor satisfiability in polynomial time if and only if for each wo... | habedi/stack-exchange-dataset |
87,174 | Smallest length such that all substrings of that length contain at least 1 common character | <p>Given a string, I have to return the smallest possible value of $k$ such that all of its sub-strings of length $k$ have at least one common character. Each sub-string must have the same common character.</p>

<p>Examples:</p>

<ol>
<li>y d c b f</li>
</ol>

<p>Answer = $3$ (common cha... | algorithms strings substrings | 1 | Smallest length such that all substrings of that length contain at least 1 common character -- (algorithms strings substrings)
<p>Given a string, I have to return the smallest possible value of $k$ such that all of its sub-strings of length $k$ have at least one common character. Each sub-string must have the same comm... | habedi/stack-exchange-dataset |
87,176 | Minimum spanning tree - Prim's algorithm | <p>I have to demonstrate Prim's algorithm for an assignment and I'm surprised that I found two different solutions, with different MSTs as an outcome. Now I now that shouldn't happen, so I wonder what I did wrong ?</p>

<p>Here is the exercise: 
<a href="https://i.stack.imgur.com/dz2lM.png" rel="nofollow no... | algorithms graphs minimum spanning tree prims algorithm | 1 | Minimum spanning tree - Prim's algorithm -- (algorithms graphs minimum spanning tree prims algorithm)
<p>I have to demonstrate Prim's algorithm for an assignment and I'm surprised that I found two different solutions, with different MSTs as an outcome. Now I now that shouldn't happen, so I wonder what I did wrong ?</p>... | habedi/stack-exchange-dataset |
87,182 | How to partition a tree on a fixed budget of edge cuts? | <p>Suppose I have a tree $T=(V,E,w)$ with vertex weights $w(v)\ge 0$ for all $v\in V$. I want to partition this tree into $k+1$ trees by cutting $k$ edges such that the deviation from the mean of the sum of vertex weights in each partition is minimized.</p>

<p>Is there an algorithm to get a good approximation... | graphs trees partitions | 1 | How to partition a tree on a fixed budget of edge cuts? -- (graphs trees partitions)
<p>Suppose I have a tree $T=(V,E,w)$ with vertex weights $w(v)\ge 0$ for all $v\in V$. I want to partition this tree into $k+1$ trees by cutting $k$ edges such that the deviation from the mean of the sum of vertex weights in each part... | habedi/stack-exchange-dataset |
87,189 | Does NFA to DFA conversion give the minimal DFA as result? | <p>When converting NFA to DFA, do I always get the minimal DFA or not?</p>
 | automata finite automata | 1 | Does NFA to DFA conversion give the minimal DFA as result? -- (automata finite automata)
<p>When converting NFA to DFA, do I always get the minimal DFA or not?</p>
 | habedi/stack-exchange-dataset |
87,195 | What does synchronous and asynchronous mean in computer science? | <p>Words synchronous and asynchronous can be met several times, in different contexts, when studying computer science. As an example :</p>

<ol>
<li>Synchronous and asynchronous circuits.</li>
<li>Synchronous and asynchronous calls.</li>
<li>Synchronous and asynchronous messages.</li>
</ol>
... | terminology concurrency | 1 | What does synchronous and asynchronous mean in computer science? -- (terminology concurrency)
<p>Words synchronous and asynchronous can be met several times, in different contexts, when studying computer science. As an example :</p>

<ol>
<li>Synchronous and asynchronous circuits.</li>
<li>Synchronous a... | habedi/stack-exchange-dataset |
87,200 | Packing objects into bins to minimize the number of bins | <p>There is a list of objects. Each object cannot be in a bin with some other objects. How can I find the minimum number of bins required to hold all the objects (and the objects in them)?</p>

<p>My current algorithm:</p>

<p>For each object in the list, see if any of the currently existing bins will h... | space partitioning | 1 | Packing objects into bins to minimize the number of bins -- (space partitioning)
<p>There is a list of objects. Each object cannot be in a bin with some other objects. How can I find the minimum number of bins required to hold all the objects (and the objects in them)?</p>

<p>My current algorithm:</p>

... | habedi/stack-exchange-dataset |
87,205 | Set partition refinement with subtrees | <p>In trying to design an algorithm, I needed a datastructure to implement a restricted kind of <a href="https://en.wikipedia.org/wiki/Partition_refinement" rel="nofollow noreferrer">set partition refinement</a>, where the sets $X$ to split on are subtrees. Specifically, given an arbitrary tree $T$ (computed earlier in... | data structures trees partitions | 1 | Set partition refinement with subtrees -- (data structures trees partitions)
<p>In trying to design an algorithm, I needed a datastructure to implement a restricted kind of <a href="https://en.wikipedia.org/wiki/Partition_refinement" rel="nofollow noreferrer">set partition refinement</a>, where the sets $X$ to split on... | habedi/stack-exchange-dataset |
87,206 | Confused b/w non-deterministic finite state automata vs finite state automata | <p>I am reading this example of FSA from book Martin & Jurafsky "Speech and Language Processing". <a href="https://i.stack.imgur.com/ESKXL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ESKXL.png" alt="enter image description here"></a></p>

<p>As per definition of FSA you can only trans... | formal languages finite automata nondeterminism | 1 | Confused b/w non-deterministic finite state automata vs finite state automata -- (formal languages finite automata nondeterminism)
<p>I am reading this example of FSA from book Martin & Jurafsky "Speech and Language Processing". <a href="https://i.stack.imgur.com/ESKXL.png" rel="nofollow noreferrer"><img src="https... | habedi/stack-exchange-dataset |
87,212 | Does every undecidable problem contain a decidable subset? | <p>I know being a decidable language doesn't necessarily mean that every subset is of it is decidable, but does every undecidable language contain a decidable subset?</p>
 | formal languages undecidability | 1 | Does every undecidable problem contain a decidable subset? -- (formal languages undecidability)
<p>I know being a decidable language doesn't necessarily mean that every subset is of it is decidable, but does every undecidable language contain a decidable subset?</p>
 | habedi/stack-exchange-dataset |
87,225 | Maximizing the sum of adjacent pairs of elements | <p>I encountered the following interesting problem <a href="https://stackoverflow.com/questions/11068275/maximize-the-sum-of-product-of-adjacent-numbers">on stackoverflow</a>:</p>

<blockquote>
 <p>Given numbers $a(1)<\cdots<a(n)$, find a permutation $\pi$ that maximizes $$\sum_{i=1}^{n-1} a(\pi(i)) ... | optimization permutations | 1 | Maximizing the sum of adjacent pairs of elements -- (optimization permutations)
<p>I encountered the following interesting problem <a href="https://stackoverflow.com/questions/11068275/maximize-the-sum-of-product-of-adjacent-numbers">on stackoverflow</a>:</p>

<blockquote>
 <p>Given numbers $a(1)<\cdots... | habedi/stack-exchange-dataset |
87,228 | Evaluating correctness of various definitions countable sets | <p>I was trying to understand the definition of countable set (again!!!). Wikipedia has a very great explanation:</p>

<blockquote>
 <ol>
 <li>A set $S$ is <strong>countable</strong> if there exists an $\color{red}{\text{injective}}$ function $f$ from $S$ to the natural numbers $\mathbb N$.</li>
 ... | sets | 1 | Evaluating correctness of various definitions countable sets -- (sets)
<p>I was trying to understand the definition of countable set (again!!!). Wikipedia has a very great explanation:</p>

<blockquote>
 <ol>
 <li>A set $S$ is <strong>countable</strong> if there exists an $\color{red}{\text{injective}... | habedi/stack-exchange-dataset |
87,232 | If set $C$ is recursively enumerable and $B$ is Recursive, and if $B-C$ is recursively enumerable then is $C$ recursive or not? | <p>So this is how i solve it but someone told me its wrong:</p>

<p>$B-C = B\cap \overline C $ and since $B\cap \overline C $ is r.e and B is recursive recursive sets are closed under intersection then $\overline C $ is not Recursive(because if both of them were recursive then the intersection would be recursiv... | turing machines computability undecidability recursion | 1 | If set $C$ is recursively enumerable and $B$ is Recursive, and if $B-C$ is recursively enumerable then is $C$ recursive or not? -- (turing machines computability undecidability recursion)
<p>So this is how i solve it but someone told me its wrong:</p>

<p>$B-C = B\cap \overline C $ and since $B\cap \overline C ... | habedi/stack-exchange-dataset |
87,238 | What is standardization in computer science? | <p>I was reading about the differences standards and specifications for C.<br>
I understood that programming languages are usually stadardized and I learnt that there are different approches to stadardization.<br>
Anyway I did not understand yet what this terms refer to.<br>
If I think to C, I believe it r... | terminology programming languages c | 1 | What is standardization in computer science? -- (terminology programming languages c)
<p>I was reading about the differences standards and specifications for C.<br>
I understood that programming languages are usually stadardized and I learnt that there are different approches to stadardization.<br>
Anyway I di... | habedi/stack-exchange-dataset |
87,240 | What are some problems in the class P which we used to think were in the class of NP? | <p>I was recently watching a video on the classes of P and NP, in which it was claimed that there have been 'several' problems that were presumed to be in the class of NP, which have since been shown to be in the class of P. Unfortunately, no examples of such problems were given. Could anyone verify this statement by p... | complexity theory np | 1 | What are some problems in the class P which we used to think were in the class of NP? -- (complexity theory np)
<p>I was recently watching a video on the classes of P and NP, in which it was claimed that there have been 'several' problems that were presumed to be in the class of NP, which have since been shown to be in... | habedi/stack-exchange-dataset |
87,245 | Why isn't deque implemented as a dynamic array? | <p>We know that <code>std::vector</code> in C++ is implemented as a dynamic array with specific pattern of reallocation (multiplying capacity by a constant), which allows it to reach O(1) amortized <code>push_back</code> time. But changing capacity of a vector is essentially allocation of new memory block and copying o... | algorithms queues c++ | 1 | Why isn't deque implemented as a dynamic array? -- (algorithms queues c++)
<p>We know that <code>std::vector</code> in C++ is implemented as a dynamic array with specific pattern of reallocation (multiplying capacity by a constant), which allows it to reach O(1) amortized <code>push_back</code> time. But changing capac... | habedi/stack-exchange-dataset |
87,247 | Reverse cartesian product matching all given rows | <p>I´m looking for an efficient algorithm that will find reverse cartesian products.</p>

<p>Mathematically, given $S \subseteq T^n$, I want to express $S$ as a union of sets $A_{i,1} \times A_{i,2} \times \dots \times A_{i,n}$, for $i=1,2,\dots,k$; and I want to minimize the number $k$. Is there an efficient ... | algorithms combinatorics sets set cover | 1 | Reverse cartesian product matching all given rows -- (algorithms combinatorics sets set cover)
<p>I´m looking for an efficient algorithm that will find reverse cartesian products.</p>

<p>Mathematically, given $S \subseteq T^n$, I want to express $S$ as a union of sets $A_{i,1} \times A_{i,2} \times \dots \time... | habedi/stack-exchange-dataset |
87,275 | Relation with the perfect partition problem and the single machine task schedule problem | <p>Perfect partition problem (PPP): given $x_1,...,x_n\in \mathbb{N}$ we want to know if there's a set $S\subset \{1,2,...,n\}$ such that $$\sum_{i\in S}x_i=\sum_{j\notin S}x_j.$$</p>

<p>Single machine task schedule problem (SMP): a machine can perform only one task $T_i$ with duration $d_i$ at a time and we w... | complexity theory np complete reductions | 1 | Relation with the perfect partition problem and the single machine task schedule problem -- (complexity theory np complete reductions)
<p>Perfect partition problem (PPP): given $x_1,...,x_n\in \mathbb{N}$ we want to know if there's a set $S\subset \{1,2,...,n\}$ such that $$\sum_{i\in S}x_i=\sum_{j\notin S}x_j.$$</p>&#... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.