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 |
|---|---|---|---|---|---|---|
119,873 | PTAS vs. FPTAS input | <p>I am trying to understand what is the PTAS, FPTAS and what is the difference between them. </p>

<p>I found this analysis:</p>

<p><a href="https://cs.stackexchange.com/questions/51495/ptas-definition-vs-fptas">PTAS definition vs. FPTAS</a></p>

<p>but I cannot understand what do we mean by s... | time complexity | 1 | PTAS vs. FPTAS input -- (time complexity)
<p>I am trying to understand what is the PTAS, FPTAS and what is the difference between them. </p>

<p>I found this analysis:</p>

<p><a href="https://cs.stackexchange.com/questions/51495/ptas-definition-vs-fptas">PTAS definition vs. FPTAS</a></p>

<p>bu... | habedi/stack-exchange-dataset |
119,897 | Finding minimal strongly connected graph | <p>I have this question:
Given a strongly connected and directed graph <span class="math-container">$G = (V,E)$</span> with positive weights define <span class="math-container">$E(t)$</span> to be the group of edges whose weight is at most <span class="math-container">$t$</span>. Find an algorithm that calculates t... | algorithms graphs weighted graphs | 1 | Finding minimal strongly connected graph -- (algorithms graphs weighted graphs)
<p>I have this question:
Given a strongly connected and directed graph <span class="math-container">$G = (V,E)$</span> with positive weights define <span class="math-container">$E(t)$</span> to be the group of edges whose weight is at m... | habedi/stack-exchange-dataset |
119,905 | Shortest path between all pairs with colored nodes | <p>I got a question from my homework in each I have the solution, but not the algorithm. I want to check if I understood it correctly. The question is: </p>

<p>Let's say we have a directed graph with no cycles, it has <code>N</code> vertices and <code>M</code> edges. 
<strong>Exactly</strong> 2018 vertice... | shortest path | 1 | Shortest path between all pairs with colored nodes -- (shortest path)
<p>I got a question from my homework in each I have the solution, but not the algorithm. I want to check if I understood it correctly. The question is: </p>

<p>Let's say we have a directed graph with no cycles, it has <code>N</code> vertice... | habedi/stack-exchange-dataset |
119,918 | Demonstrating that probability for every possible result is uniform at the end of an algorithm | <p>I have memory of <span class="math-container">$k$</span> elements that you can imagine being represented by an array. One by one, the array receives a value corresponding to the time index, for example at <span class="math-container">$t=1$</span> the value will be <span class="math-container">$1$</span>.
At some... | algorithms algorithm analysis probability theory sets probabilistic algorithms | 1 | Demonstrating that probability for every possible result is uniform at the end of an algorithm -- (algorithms algorithm analysis probability theory sets probabilistic algorithms)
<p>I have memory of <span class="math-container">$k$</span> elements that you can imagine being represented by an array. One by one, the arra... | habedi/stack-exchange-dataset |
119,922 | Repeated addition and comparisons of floating point numbers | <p>In the following program where I repeatedly <em>half</em> an integer, it takes until <code>i = 1074</code> for my integer to be equal to zero (I know that ideally the while loop shouldn't have ended, and the reason why it stopped was because of the memory limit of the computer).</p>

<pre><code>a = 1.0
i... | python number formats | 1 | Repeated addition and comparisons of floating point numbers -- (python number formats)
<p>In the following program where I repeatedly <em>half</em> an integer, it takes until <code>i = 1074</code> for my integer to be equal to zero (I know that ideally the while loop shouldn't have ended, and the reason why it stopped ... | habedi/stack-exchange-dataset |
119,930 | Is every program is equivalent to a Push Down Automata? | <p>so I was reading about <a href="http://upscfever.com/upsc-fever/en/gatecse/en-gatecse-chp159.html" rel="nofollow noreferrer">stack-organized computer</a>. Does a stack-organized computer implies that every program is equivalent to (and not more powerful than) a Push Down Automata?</p>
 | automata | 1 | Is every program is equivalent to a Push Down Automata? -- (automata)
<p>so I was reading about <a href="http://upscfever.com/upsc-fever/en/gatecse/en-gatecse-chp159.html" rel="nofollow noreferrer">stack-organized computer</a>. Does a stack-organized computer implies that every program is equivalent to (and not more po... | habedi/stack-exchange-dataset |
119,935 | Is there an algorithm to find all connected sub-graphs of size K? | <p>I was just wondering if there is an efficient algorithm that given a undirected graph <code>G</code>, finds all the sub-graphs whose size is <code>k</code> (or less)?</p>

<p>I searched around, and only found problems about finding the connected components. But I am interested in the smaller and more local c... | graphs | 1 | Is there an algorithm to find all connected sub-graphs of size K? -- (graphs)
<p>I was just wondering if there is an efficient algorithm that given a undirected graph <code>G</code>, finds all the sub-graphs whose size is <code>k</code> (or less)?</p>

<p>I searched around, and only found problems about finding... | habedi/stack-exchange-dataset |
119,938 | What is the shortest superstring for $\{c (ab)^k, (ba)^k, (ab)^k c\}$? | <p>In <a href="http://www.cs.cmu.edu/~avrim/Papers/superstring.pdf" rel="nofollow noreferrer">this paper</a> on PDF page 3, they give <span class="math-container">$\{c (ab)^k, (ba)^k, (ab)^k c\}$</span> as an example of an input to the GREEDY algorithm for shortest superstring that causes it to have an approximation ra... | substrings | 1 | What is the shortest superstring for $\{c (ab)^k, (ba)^k, (ab)^k c\}$? -- (substrings)
<p>In <a href="http://www.cs.cmu.edu/~avrim/Papers/superstring.pdf" rel="nofollow noreferrer">this paper</a> on PDF page 3, they give <span class="math-container">$\{c (ab)^k, (ba)^k, (ab)^k c\}$</span> as an example of an input to t... | habedi/stack-exchange-dataset |
119,946 | Algorithm for finding the limit of unkown function | <p>I have a case of costly calculations method like this:</p>

<pre><code>Input -> Output
0 -> 8
8 -> 9
9 -> 9.5
9.5 -> 9.6
9.6 -> 9.65
9.65 -> 9.654
</code></pre>

<p>I use the output for the next input so this way im trying to find where the output exac... | algorithms | 1 | Algorithm for finding the limit of unkown function -- (algorithms)
<p>I have a case of costly calculations method like this:</p>

<pre><code>Input -> Output
0 -> 8
8 -> 9
9 -> 9.5
9.5 -> 9.6
9.6 -> 9.65
9.65 -> 9.654
</code></pre>

<p>I use the output for... | habedi/stack-exchange-dataset |
119,955 | Is call stack compile time or runtime detail? | <p>I'm sorry if the question is quite naive, but I don't understand if a call stack is a <strong>language</strong> implementation detail or it depends on OS?</p>

<p>What I'm trying to understand is what decides how to store local variables and parameters of a function - the language's compiler or OS while runn... | compilers stacks memory allocation c | 1 | Is call stack compile time or runtime detail? -- (compilers stacks memory allocation c)
<p>I'm sorry if the question is quite naive, but I don't understand if a call stack is a <strong>language</strong> implementation detail or it depends on OS?</p>

<p>What I'm trying to understand is what decides how to store... | habedi/stack-exchange-dataset |
119,962 | Reactiveness, cpu and caches | <p>I was messing around with a reactive-based frameworks and found it very expressive. Unfortunately, most of them are using techniques that are not very efficient on CPU cashing mechanism such as calling indirect code, and traversing sometimes big collections of subscribers, some of which are readonly, but some can mu... | cpu cache cpu | 1 | Reactiveness, cpu and caches -- (cpu cache cpu)
<p>I was messing around with a reactive-based frameworks and found it very expressive. Unfortunately, most of them are using techniques that are not very efficient on CPU cashing mechanism such as calling indirect code, and traversing sometimes big collections of subscrib... | habedi/stack-exchange-dataset |
119,968 | Minimum number of edges to remove to disconnect two node sets $A$ and $B$ in a directed graph | <p>We have directed graph <span class="math-container">$G$</span> (not necessarily a DAG), two disjoint sets <span class="math-container">$A$</span>, <span class="math-container">$B$</span>, of vertices.<br>
I need to plan an algorithm returning the minimum number of edges that need to be removed, such that there w... | algorithms graphs | 1 | Minimum number of edges to remove to disconnect two node sets $A$ and $B$ in a directed graph -- (algorithms graphs)
<p>We have directed graph <span class="math-container">$G$</span> (not necessarily a DAG), two disjoint sets <span class="math-container">$A$</span>, <span class="math-container">$B$</span>, of vertices.... | habedi/stack-exchange-dataset |
119,987 | Given a list of strings, find every pair $(x,y)$ where $x$ is a substring of $y$. Possible to do better than $O(n^2)$? | <p>Consider the following algorithmic problem: Given a list of strings <span class="math-container">$L = [s_1, s_2, \dots, s_n]$</span>, we want to know all pairs <span class="math-container">$(x,y)$</span> where <span class="math-container">$x$</span> is a substring of <span class="math-container">$y$</span>. We can ... | algorithms strings substrings string matching | 1 | Given a list of strings, find every pair $(x,y)$ where $x$ is a substring of $y$. Possible to do better than $O(n^2)$? -- (algorithms strings substrings string matching)
<p>Consider the following algorithmic problem: Given a list of strings <span class="math-container">$L = [s_1, s_2, \dots, s_n]$</span>, we want to kn... | habedi/stack-exchange-dataset |
119,990 | Checking disjointness between subsets of a poset | <p>If there is a poset <span class="math-container">$(P, \le)$</span> and two sets <span class="math-container">$X \subseteq P$</span> and <span class="math-container">$Y \subseteq P$</span>, and we have a way <span class="math-container">$f : P^2 \to 2$</span> to efficiently compute for any <span class="math-container... | lattices | 1 | Checking disjointness between subsets of a poset -- (lattices)
<p>If there is a poset <span class="math-container">$(P, \le)$</span> and two sets <span class="math-container">$X \subseteq P$</span> and <span class="math-container">$Y \subseteq P$</span>, and we have a way <span class="math-container">$f : P^2 \to 2$</s... | habedi/stack-exchange-dataset |
119,997 | Can I use the following method to prove an algorithm is correct? | <p>I'm trying to show that a solution I have obtained via an algorithm is correct. The way I plan on doing this is first by showing that an optimal solution does indeed exist. Then, I plan on showing that every other solution that is not the solution provided by my algorithm cannot be optimal. Finally, I show that the ... | correctness proof | 1 | Can I use the following method to prove an algorithm is correct? -- (correctness proof)
<p>I'm trying to show that a solution I have obtained via an algorithm is correct. The way I plan on doing this is first by showing that an optimal solution does indeed exist. Then, I plan on showing that every other solution that i... | habedi/stack-exchange-dataset |
119,999 | An Exact Method for Solving Small Instances of XORSAT | <p>I have a couple of small instances for XORSAT for which I am to design and implement an exact method. However, there are a few catches. It is guaranteed that there always exists and answer but I need to find the one solution with the minimal (non-zero) number of TRUE variables.</p>

<p>As I understand, XORSA... | satisfiability | 1 | An Exact Method for Solving Small Instances of XORSAT -- (satisfiability)
<p>I have a couple of small instances for XORSAT for which I am to design and implement an exact method. However, there are a few catches. It is guaranteed that there always exists and answer but I need to find the one solution with the minimal (... | habedi/stack-exchange-dataset |
120,024 | Are there any NP-hard problems for which the following statement is true: | <p><span class="math-container">$\overline{A} \le A\ and $</span> <span class="math-container">$A \le \overline{A}$</span></p>

<p>Is the following proof correct? </p>

<p>If <span class="math-container">$\overline{A} \le A \Rightarrow \overline{A} \in NP$</span> since A is NP-hard <span class="math-con... | complexity theory np hard np | 1 | Are there any NP-hard problems for which the following statement is true: -- (complexity theory np hard np)
<p><span class="math-container">$\overline{A} \le A\ and $</span> <span class="math-container">$A \le \overline{A}$</span></p>

<p>Is the following proof correct? </p>

<p>If <span class="math-con... | habedi/stack-exchange-dataset |
120,035 | Question about system calls | <p>I had read about the various functionalities of system calls recently in one of my coursebooks and about how they are used to allocate memory for new processes. The book didn't specify whether it was possible to combine multiple memory allocation requests within a single system call. 
So I asked one of my teache... | operating systems | 1 | Question about system calls -- (operating systems)
<p>I had read about the various functionalities of system calls recently in one of my coursebooks and about how they are used to allocate memory for new processes. The book didn't specify whether it was possible to combine multiple memory allocation requests within a s... | habedi/stack-exchange-dataset |
120,037 | Counting strings with balanced substrings | <p>Consider a <em>string</em> of characters <span class="math-container">$a, b, c$</span> only. Such a string is called <em>good</em> if the <em>number</em> of <span class="math-container">$a$</span>'s + <em>number</em> of <span class="math-container">$b$</span>'s is equal to the <em>number</em> of <span class="math-co... | algorithms dynamic programming combinatorics | 1 | Counting strings with balanced substrings -- (algorithms dynamic programming combinatorics)
<p>Consider a <em>string</em> of characters <span class="math-container">$a, b, c$</span> only. Such a string is called <em>good</em> if the <em>number</em> of <span class="math-container">$a$</span>'s + <em>number</em> of <span... | habedi/stack-exchange-dataset |
120,043 | Probability of terminating in a state in a probabilistic algorithm | <p>Suppose i have a circular array of <span class="math-container">$n$</span> elements.
At time <span class="math-container">$t=0$</span> i am in position 0 of the array. The algorithm moves left or right with probability <span class="math-container">$p=1/2$</span> (since the array is circular when it moves left fr... | algorithms probability theory matrices probabilistic algorithms markov chains | 1 | Probability of terminating in a state in a probabilistic algorithm -- (algorithms probability theory matrices probabilistic algorithms markov chains)
<p>Suppose i have a circular array of <span class="math-container">$n$</span> elements.
At time <span class="math-container">$t=0$</span> i am in position 0 of the ar... | habedi/stack-exchange-dataset |
120,060 | Is the number of NP-complete problems finite? | <p>It should be straight forward to show that there are infinitely many NP-hard problems:</p>

<p><strong>Proof:</strong>
Take the problem <em>Remove 1 Vertex 3-COL</em> (<span class="math-container">$R1V3COL$</span>) which takes a graph <span class="math-container">$G=(V,E)$</span> as an instance and yield... | complexity theory np complete reductions np hard | 1 | Is the number of NP-complete problems finite? -- (complexity theory np complete reductions np hard)
<p>It should be straight forward to show that there are infinitely many NP-hard problems:</p>

<p><strong>Proof:</strong>
Take the problem <em>Remove 1 Vertex 3-COL</em> (<span class="math-container">$R1V3COL... | habedi/stack-exchange-dataset |
120,071 | Can we find a Turing machine such that there is no Turing machine to decide whether it halts on $\epsilon$? | <p>The halting problem states that there is no Turing machine that can determine whether an arbitrary Turing machine halts on <span class="math-container">$\epsilon$</span>. But I try to ask something different, can we find a specific Turing machine <span class="math-container">$M$</span> such that <span class="math-co... | turing machines halting problem | 1 | Can we find a Turing machine such that there is no Turing machine to decide whether it halts on $\epsilon$? -- (turing machines halting problem)
<p>The halting problem states that there is no Turing machine that can determine whether an arbitrary Turing machine halts on <span class="math-container">$\epsilon$</span>. B... | habedi/stack-exchange-dataset |
120,087 | Why is $O(|V| + |E|)$ the bound on DFS and BFS instead of just $O(|E|)$? | <p>In one sense I understand why the bound on BFS and DFS is <span class="math-container">$O(|V| + |E|)$</span>. Every vertex gets considered, hence the <span class="math-container">$O(|V|)$</span>, and over the course of considering all adjacent vertices, we end up considering <span class="math-container">$2|E| = O(|E... | algorithms time complexity | 1 | Why is $O(|V| + |E|)$ the bound on DFS and BFS instead of just $O(|E|)$? -- (algorithms time complexity)
<p>In one sense I understand why the bound on BFS and DFS is <span class="math-container">$O(|V| + |E|)$</span>. Every vertex gets considered, hence the <span class="math-container">$O(|V|)$</span>, and over the cou... | habedi/stack-exchange-dataset |
120,088 | Find and prove a linear algorithm that identifies all cycles and the length in a graph where each vertex has exactly one outgoing edge | <blockquote>
 <p>Consider a directed graph on n vertices, where each vertex has exactly
 one outgoing edge. This graph consists of a collection of cycles as
 well as additional vertices that have paths to the cycles, which we
 call the branches. Describe a linear time algorithm that identifies
 ... | algorithms complexity theory graphs algorithm analysis | 1 | Find and prove a linear algorithm that identifies all cycles and the length in a graph where each vertex has exactly one outgoing edge -- (algorithms complexity theory graphs algorithm analysis)
<blockquote>
 <p>Consider a directed graph on n vertices, where each vertex has exactly
 one outgoing edge. This gr... | habedi/stack-exchange-dataset |
120,089 | What is the lower bound for the following equation | <p>f(n) = 32n^2 + 17n + 1.</p>

<p>The lecture slide says that lower bound can be Omega(n^2) or Omega(n).</p>

<p>Some body please guide me why the lower bound can be Omega (n). i know the upper bound which is O(n^2).</p>

<p>Zulfi.</p>
 | asymptotics | 1 | What is the lower bound for the following equation -- (asymptotics)
<p>f(n) = 32n^2 + 17n + 1.</p>

<p>The lecture slide says that lower bound can be Omega(n^2) or Omega(n).</p>

<p>Some body please guide me why the lower bound can be Omega (n). i know the upper bound which is O(n^2).</p>

<p>Zu... | habedi/stack-exchange-dataset |
120,094 | Round Robin time slice(quantum time) | <p>In all books about this topic, I read that there is a rule of thumb is that 80% of the process execution time is lower than time slice. But how do I calculate this value? I looked at every article possible and I found like nothing. Can someone help me understand this topic?</p>

<p>I know that there is a top... | process scheduling | 1 | Round Robin time slice(quantum time) -- (process scheduling)
<p>In all books about this topic, I read that there is a rule of thumb is that 80% of the process execution time is lower than time slice. But how do I calculate this value? I looked at every article possible and I found like nothing. Can someone help me unde... | habedi/stack-exchange-dataset |
120,098 | Measures of performance in machine learning | <p>I'm new to machine learning and struggle to interpret the results I get from different measures of performance. If for several prediction models I have e.g. accuracy, precision, recall, F1, FPR, and MCC and want to find out which model performs best, what do I look for? I would assume accuracy is most important? </p... | machine learning statistics | 1 | Measures of performance in machine learning -- (machine learning statistics)
<p>I'm new to machine learning and struggle to interpret the results I get from different measures of performance. If for several prediction models I have e.g. accuracy, precision, recall, F1, FPR, and MCC and want to find out which model perf... | habedi/stack-exchange-dataset |
120,113 | Can quantum computers really compute a vast number of possible solutions simultaneously? | <p><a href="https://www.roche.com/quantum-computing.htm" rel="nofollow noreferrer">This</a> link says</p>

<blockquote>
 <p>They are not constrained to stepwise calculations but, rather, can
 compute a vast number of possible solutions simultaneously—and at a
 speed that is far beyond anything we... | quantum computing | 1 | Can quantum computers really compute a vast number of possible solutions simultaneously? -- (quantum computing)
<p><a href="https://www.roche.com/quantum-computing.htm" rel="nofollow noreferrer">This</a> link says</p>

<blockquote>
 <p>They are not constrained to stepwise calculations but, rather, can
... | habedi/stack-exchange-dataset |
120,117 | Maximum Subsequence Sum : Mark Weiss: | <p><a href="https://i.stack.imgur.com/cT1R2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cT1R2.png" alt="enter image description here"></a></p>

<p>In the highlighted part below how is Weiss concluding that the array starting at an arbitrary index "p" and ending at "j" can never be larger ... | algorithms algorithm analysis subsequences maximum subarray | 1 | Maximum Subsequence Sum : Mark Weiss: -- (algorithms algorithm analysis subsequences maximum subarray)
<p><a href="https://i.stack.imgur.com/cT1R2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cT1R2.png" alt="enter image description here"></a></p>

<p>In the highlighted part below how is We... | habedi/stack-exchange-dataset |
120,127 | LP - given m constraints for 2 variables find maximal radius of circle | <p>Given <span class="math-container">$m$</span> constraints for 2 variables <span class="math-container">$x_1,x_2$</span> :</p>

<p><span class="math-container">$d_ix_1 + e_ix_2 \leq b_i$</span> for <span class="math-container">$i = 1,...m$</span></p>

<p>need to create a linear program that finds the ... | linear programming | 1 | LP - given m constraints for 2 variables find maximal radius of circle -- (linear programming)
<p>Given <span class="math-container">$m$</span> constraints for 2 variables <span class="math-container">$x_1,x_2$</span> :</p>

<p><span class="math-container">$d_ix_1 + e_ix_2 \leq b_i$</span> for <span class="math... | habedi/stack-exchange-dataset |
120,142 | $O(n \log n)$ algorithm to find next interval that is also disjoint | <p>Say there are some intervals <span class="math-container">$\{1, \ldots ,n\}$</span> with starting times and ending times, and they're sorted in order of starting time from first to last in an array intervals<span class="math-container">$[]$</span>. Now I want create an array next<span class="math-container">$[]$</sp... | algorithms | 1 | $O(n \log n)$ algorithm to find next interval that is also disjoint -- (algorithms)
<p>Say there are some intervals <span class="math-container">$\{1, \ldots ,n\}$</span> with starting times and ending times, and they're sorted in order of starting time from first to last in an array intervals<span class="math-containe... | habedi/stack-exchange-dataset |
120,150 | Context-free grammar for ${a^n b^n a^n}$ | <p>I am trying to figure out a formal grammar for the above language. This language describes palindromes, so it is context-free, if I am not wrong. I came up with a context-sensitive grammar, but I can not find a context-free one. Any ideas?</p>
 | formal languages context free formal grammars | 1 | Context-free grammar for ${a^n b^n a^n}$ -- (formal languages context free formal grammars)
<p>I am trying to figure out a formal grammar for the above language. This language describes palindromes, so it is context-free, if I am not wrong. I came up with a context-sensitive grammar, but I can not find a context-free o... | habedi/stack-exchange-dataset |
120,152 | Two peaks finding algorithm | <p>We are given an array of length N with exactly 2 peaks (a peak is an element which is no less than the left and right neighbors). Is there an algorithm to compute those peaks faster than <em>O(N)</em>, maybe similar with the single peak finding in <em>O(log N)</em>?</p>
 | algorithms divide and conquer | 1 | Two peaks finding algorithm -- (algorithms divide and conquer)
<p>We are given an array of length N with exactly 2 peaks (a peak is an element which is no less than the left and right neighbors). Is there an algorithm to compute those peaks faster than <em>O(N)</em>, maybe similar with the single peak finding in <em>O(... | habedi/stack-exchange-dataset |
120,158 | How to prove the language of suffixes of a regular language is still regular? | <p>Prove that if <span class="math-container">$ L \subseteq \Sigma^\star$</span> is regular, <span class="math-container">$L'$</span> is also regular where</p>

<p><span class="math-container">$$ L' = \{w\mid{uw \in L \mbox{ for some string }u \in \Sigma^\star}\}$$</span></p>

<p>I'm new learning forma... | formal languages regular languages | 1 | How to prove the language of suffixes of a regular language is still regular? -- (formal languages regular languages)
<p>Prove that if <span class="math-container">$ L \subseteq \Sigma^\star$</span> is regular, <span class="math-container">$L'$</span> is also regular where</p>

<p><span class="math-container">... | habedi/stack-exchange-dataset |
120,168 | Creating a PDA for the language L = {$a^{m}$ $b^{n}$ : m $\neq$ n} | <p>I didn‘t find a DPDA for the language L = {<span class="math-container">$a^{m}$</span> <span class="math-container">$b^{n}$</span> : m <span class="math-container">$\neq$</span> n}, so I guess an NPDA is the only option. </p>

<p>NPDA are not very intuitive to me. The only solution I found online is: <a href... | context free pushdown automata | 1 | Creating a PDA for the language L = {$a^{m}$ $b^{n}$ : m $\neq$ n} -- (context free pushdown automata)
<p>I didn‘t find a DPDA for the language L = {<span class="math-container">$a^{m}$</span> <span class="math-container">$b^{n}$</span> : m <span class="math-container">$\neq$</span> n}, so I guess an NPDA is the only o... | habedi/stack-exchange-dataset |
120,176 | Is there a name for a graph whose vertices consist of edges of an existing graph connected by an edge if they shared a common vertex? | <p>I was wondering if there is a name for this construction:
Take a graph <span class="math-container">$G$</span> and construct a new graph <span class="math-container">$G'$</span> in which the edges of <span class="math-container">$G$</span> now become vertices, and "vertices become edges" in the sense that vertic... | graphs terminology | 1 | Is there a name for a graph whose vertices consist of edges of an existing graph connected by an edge if they shared a common vertex? -- (graphs terminology)
<p>I was wondering if there is a name for this construction:
Take a graph <span class="math-container">$G$</span> and construct a new graph <span class="math-... | habedi/stack-exchange-dataset |
120,182 | A Hexastore data structure | <p>I'm reading an <a href="https://redis.io/topics/indexes" rel="nofollow noreferrer">article</a> about indexing in Redis. There is a link to so-called Hexastore, it's referred to as a data structure. The link <a href="http://www.vldb.org/pvldb/1/1453965.pdf" rel="nofollow noreferrer">doesn't</a> work, which makes me f... | data structures | 1 | A Hexastore data structure -- (data structures)
<p>I'm reading an <a href="https://redis.io/topics/indexes" rel="nofollow noreferrer">article</a> about indexing in Redis. There is a link to so-called Hexastore, it's referred to as a data structure. The link <a href="http://www.vldb.org/pvldb/1/1453965.pdf" rel="nofollo... | habedi/stack-exchange-dataset |
120,186 | Time complexity - Algorithm to find the lowest common ancestor of all deepest leaves | <p>This is the problem statement I came across today.</p>

<p>Given a binary tree, find the lowest common ancestor of all deepest leaves.</p>

<p>I came up with a correct algorithm, but I would like to confirm the running time of this approach.</p>

<p>The algorithm is as follows:</p>

<... | algorithms time complexity binary trees | 1 | Time complexity - Algorithm to find the lowest common ancestor of all deepest leaves -- (algorithms time complexity binary trees)
<p>This is the problem statement I came across today.</p>

<p>Given a binary tree, find the lowest common ancestor of all deepest leaves.</p>

<p>I came up with a correct alg... | habedi/stack-exchange-dataset |
120,187 | How can merging two sorted arrays of N items require at least 2N - 1 comparisons in every case? | <p>The HW question, on page 362 of <em>Data Structures and Algorithms in C++</em>: Fourth Editionby Mark Allen Weiss, reads as follows:</p>

<blockquote>
 <p>Prove that merging two sorted arrays of <em>N</em> items requires at least 2 * <em>N</em> - 1 comparisons. You must show that if two elements in the ... | runtime analysis arrays mergesort | 1 | How can merging two sorted arrays of N items require at least 2N - 1 comparisons in every case? -- (runtime analysis arrays mergesort)
<p>The HW question, on page 362 of <em>Data Structures and Algorithms in C++</em>: Fourth Editionby Mark Allen Weiss, reads as follows:</p>

<blockquote>
 <p>Prove that mer... | habedi/stack-exchange-dataset |
120,205 | Time complexity of removing duplicates in lists | <h2>Question</h2>

<p>I am wondering what is the minimum time complexity of get the unique value of a array in two conditions: keep the order or not.</p>

<p>For example, suppose we have a original array <code>[3,6,1,1,2]</code>. I want to get <code>[3,6,1,2]</code>, this result keeps the original order... | time complexity arrays | 1 | Time complexity of removing duplicates in lists -- (time complexity arrays)
<h2>Question</h2>

<p>I am wondering what is the minimum time complexity of get the unique value of a array in two conditions: keep the order or not.</p>

<p>For example, suppose we have a original array <code>[3,6,1,1,2]</code>... | habedi/stack-exchange-dataset |
120,215 | Developing a Context Free Grammar whilst knowing the number of terminals | <p>I am trying to develop a CFG for the language <span class="math-container">$L$</span> defined by:</p>
<blockquote>
<p><span class="math-container">$L = \{a^{n+2}bba^{n-2} | n > 1\}$</span></p>
</blockquote>
<p>The problem I am having is that I cannot develop the CFG for this language no matter wha... | formal languages context free pushdown automata | 1 | Developing a Context Free Grammar whilst knowing the number of terminals -- (formal languages context free pushdown automata)
<p>I am trying to develop a CFG for the language <span class="math-container">$L$</span> defined by:</p>
<blockquote>
<p><span class="math-container">$L = \{a^{n+2}bba^{n-2} | n > 1\}... | habedi/stack-exchange-dataset |
120,216 | Why are all polymorphic functions between functors natural transformations? | <p>Bartosz Milewski's Category Theory for Programmers <a href="https://bartoszmilewski.com/2015/04/07/natural-transformations/#Beyond_naturality" rel="nofollow noreferrer">says the following</a>:</p>

<blockquote>
 <p>A parametrically polymorphic function between two functors (including the edge case of th... | category theory polymorphisms | 1 | Why are all polymorphic functions between functors natural transformations? -- (category theory polymorphisms)
<p>Bartosz Milewski's Category Theory for Programmers <a href="https://bartoszmilewski.com/2015/04/07/natural-transformations/#Beyond_naturality" rel="nofollow noreferrer">says the following</a>:</p>

... | habedi/stack-exchange-dataset |
120,218 | Max no. of keys of B-Tree of height h | <p>I am reading about B-Tree through CLRS. One of the exercise problem is to express maximum number of keys in a BTree of height <span class="math-container">$h$</span> and minimum degree <span class="math-container">$t$</span>.</p>

<p>Properties of BTree of <span class="math-container">$t$</span>:</p>
&#x... | b tree | 1 | Max no. of keys of B-Tree of height h -- (b tree)
<p>I am reading about B-Tree through CLRS. One of the exercise problem is to express maximum number of keys in a BTree of height <span class="math-container">$h$</span> and minimum degree <span class="math-container">$t$</span>.</p>

<p>Properties of BTree of <s... | habedi/stack-exchange-dataset |
120,224 | Big-O Notation: Runtime Analysis | <p>I have a problem with an exercise, I have to analyze the following
<a href="https://i.stack.imgur.com/JIhER.jpg" rel="nofollow noreferrer">For-Loops</a></p>

<p>Then I have to write down the explicit notation, my problem is that I don't know how to get the right m.
I tried <a href="https://i.stack.im... | loops big o notation | 1 | Big-O Notation: Runtime Analysis -- (loops big o notation)
<p>I have a problem with an exercise, I have to analyze the following
<a href="https://i.stack.imgur.com/JIhER.jpg" rel="nofollow noreferrer">For-Loops</a></p>

<p>Then I have to write down the explicit notation, my problem is that I don't know how ... | habedi/stack-exchange-dataset |
120,230 | Proving that $ L = \{ 0^{{2n}\choose{n}} : n\in\mathbb{N} \}$ is not regular | <p>I was asked to prove that <span class="math-container">$ L = \{ 0^{{2n}\choose{n}} : n\in\mathbb{N} \}$</span> is not regular. I can't solve this, could anyone help me?</p>
<p>This was an exam question from previous year. I looked your answers, but I can't really understand Yuval's solution and Matt's solution w... | formal languages regular languages pumping lemma | 1 | Proving that $ L = \{ 0^{{2n}\choose{n}} : n\in\mathbb{N} \}$ is not regular -- (formal languages regular languages pumping lemma)
<p>I was asked to prove that <span class="math-container">$ L = \{ 0^{{2n}\choose{n}} : n\in\mathbb{N} \}$</span> is not regular. I can't solve this, could anyone help me?</p>
<p>This w... | habedi/stack-exchange-dataset |
120,236 | Problem with understanding two sided Matching Algorithm: maximium cardinality | <p>I am trying to understand the maximum cardinality problem in the context of stable matching algorithm. I am reading the following article at the link:</p>

<p><a href="https://www.hindawi.com/journals/mpe/2015/241379/" rel="nofollow noreferrer">A Two-Sided Matching Decision Model Based on Uncertain Preferenc... | matching | 1 | Problem with understanding two sided Matching Algorithm: maximium cardinality -- (matching)
<p>I am trying to understand the maximum cardinality problem in the context of stable matching algorithm. I am reading the following article at the link:</p>

<p><a href="https://www.hindawi.com/journals/mpe/2015/241379/... | habedi/stack-exchange-dataset |
120,247 | How could one prove that for every finite alphabet Σ, ∀ n ∈ ℕ. |Σⁿ| = |Σ|ⁿ? Using induction | <p>I am currently working on ways to prove this and got stuck proving it with induction.</p>

<p>Any tips?</p>

<p><strong>How could i prove that for every finite alphabet Σ, ∀ n ∈ ℕ. |Σⁿ| = |Σ|ⁿ?</strong></p>
 | formal languages | 1 | How could one prove that for every finite alphabet Σ, ∀ n ∈ ℕ. |Σⁿ| = |Σ|ⁿ? Using induction -- (formal languages)
<p>I am currently working on ways to prove this and got stuck proving it with induction.</p>

<p>Any tips?</p>

<p><strong>How could i prove that for every finite alphabet Σ, ∀ n ∈ ℕ. |Σⁿ| ... | habedi/stack-exchange-dataset |
120,260 | Ford-Fulkerson pseudo-polynomial | <p>Can somebody explain please why Ford-Fulkerson Algorithm has pseudo-polynomial complexity? I understand that the complexity in this case strongly depends on the capacities of the edges of the network, since we have <span class="math-container">$O(|E|*f_{max})$</span>, but why is the algorithm still not polynomial? <... | ford fulkerson | 1 | Ford-Fulkerson pseudo-polynomial -- (ford fulkerson)
<p>Can somebody explain please why Ford-Fulkerson Algorithm has pseudo-polynomial complexity? I understand that the complexity in this case strongly depends on the capacities of the edges of the network, since we have <span class="math-container">$O(|E|*f_{max})$</sp... | habedi/stack-exchange-dataset |
120,273 | Is there an algorithm to minimize working set during a topological traversal? | <p>I have a dependency graph of tasks, which forms a DAG. I'm looking for an algorithm to calculate the optimal topological traverse to minimize the "working set". Specifically, I define the current working set as the set of nodes which have been visited, and which have at least one outgoing edge which is untraversed.<... | graphs topological ordering | 1 | Is there an algorithm to minimize working set during a topological traversal? -- (graphs topological ordering)
<p>I have a dependency graph of tasks, which forms a DAG. I'm looking for an algorithm to calculate the optimal topological traverse to minimize the "working set". Specifically, I define the current working se... | habedi/stack-exchange-dataset |
120,277 | why does $ A≤_p \#SAT$ if $A \in BPP$ | <p>hello and thank you for helping me understand the following:</p>

<p>I really don't understand this, why if language <span class="math-container">$A \in BPP$</span> then <span class="math-container">$A≤_P\#SAT$</span>? </p>

<p>language A is in BPP class, if for a probabilistic turing machine M, M ou... | complexity theory turing machines computability reductions probabilistic turing machines | 1 | why does $ A≤_p \#SAT$ if $A \in BPP$ -- (complexity theory turing machines computability reductions probabilistic turing machines)
<p>hello and thank you for helping me understand the following:</p>

<p>I really don't understand this, why if language <span class="math-container">$A \in BPP$</span> then <span c... | habedi/stack-exchange-dataset |
120,287 | How will I calculate the time and space complexity for this pyramid algo? | <p>This is an algo. programmed for displaying a letter pyramid if the buildPyramids() method is passed argument str, i.e. "12345":</p>

<pre><code> 1
 121
 12321
 1234321
123454321
</code></pre>

<p>Code:</p>

<pre><code>void buildPyramids(string str) {
 size_t l... | complexity theory time complexity space complexity c++ | 1 | How will I calculate the time and space complexity for this pyramid algo? -- (complexity theory time complexity space complexity c++)
<p>This is an algo. programmed for displaying a letter pyramid if the buildPyramids() method is passed argument str, i.e. "12345":</p>

<pre><code> 1
 121
 12321&#x... | habedi/stack-exchange-dataset |
120,289 | Proof that language is not regular. $L=\{w\bar{w}|w\in \{0,1\}^* and\ \bar{w}\ is\ one's\ complement\ of\ w\}$ | <p>I'm trying to proof that the following language is not regular using pumping lemma.
<span class="math-container">$L=\{w\bar{w}|w\in \{0,1\}^* and\ \bar{w}\ is\ one's\ complement\ of\ w\}$</span></p>

<p>I started by stating that:</p>

<p><span class="math-container">$|w\bar{w}| = 2p = |xyz|$</spa... | formal languages regular languages formal grammars pumping lemma | 1 | Proof that language is not regular. $L=\{w\bar{w}|w\in \{0,1\}^* and\ \bar{w}\ is\ one's\ complement\ of\ w\}$ -- (formal languages regular languages formal grammars pumping lemma)
<p>I'm trying to proof that the following language is not regular using pumping lemma.
<span class="math-container">$L=\{w\bar{w}|w\in ... | habedi/stack-exchange-dataset |
120,299 | Design a DFA that recognizes the following language | <p>My assignment asked to design a DFA that computes the language:</p>

<p><span class="math-container">$L = \{ w \in \{a,b,c\}^\star | \#_a(w) $</span> is even, <span class="math-container">$\#_b(w)$</span> is odd, <span class="math-container">$\#_c(w)$</span> is even} </p>

<p>I have been stuck on thi... | regular languages finite automata | 1 | Design a DFA that recognizes the following language -- (regular languages finite automata)
<p>My assignment asked to design a DFA that computes the language:</p>

<p><span class="math-container">$L = \{ w \in \{a,b,c\}^\star | \#_a(w) $</span> is even, <span class="math-container">$\#_b(w)$</span> is odd, <span... | habedi/stack-exchange-dataset |
120,300 | Understanding how convolution of images work in cnn | <p>I'd like to understand convolutional neural network.<br>
Consider this quote from Stanford CS notes on <em>Convolutional Neural Networks for Visual Recognition</em> (CNNs/ConvNets):</p>

<blockquote>
 <p><em>Example Architecture: Overview</em>. We will go into more details below, but a simple ConvNe... | neural networks | 1 | Understanding how convolution of images work in cnn -- (neural networks)
<p>I'd like to understand convolutional neural network.<br>
Consider this quote from Stanford CS notes on <em>Convolutional Neural Networks for Visual Recognition</em> (CNNs/ConvNets):</p>

<blockquote>
 <p><em>Example Architectur... | habedi/stack-exchange-dataset |
120,304 | Is there a term for these "descendancy" subgraphs of directed acyclic graphs? | <p>Consider a directed acyclic graph <span class="math-container">$G$</span> with vertex set <span class="math-container">$V$</span>. Choose a vertex <span class="math-container">$v$</span>, and let <span class="math-container">$H$</span> be the subgraph containing <span class="math-container">$v$</span> and all other... | graphs dag | 1 | Is there a term for these "descendancy" subgraphs of directed acyclic graphs? -- (graphs dag)
<p>Consider a directed acyclic graph <span class="math-container">$G$</span> with vertex set <span class="math-container">$V$</span>. Choose a vertex <span class="math-container">$v$</span>, and let <span class="math-containe... | habedi/stack-exchange-dataset |
120,311 | Recurrence relation and time complexity of recursive factorial | <p>I'm trying to find out time complexity of a recursive factorial algorithm which can be written as:
 </p>

<pre><code>fact(n)
{
 if(n == 1)
 return 1;
 else
 return n*fact(n-1)
 }
</code></pre>

<p> 
So I write the recurrence relation as 
 </p>

<pre><c... | time complexity recurrence relation | 1 | Recurrence relation and time complexity of recursive factorial -- (time complexity recurrence relation)
<p>I'm trying to find out time complexity of a recursive factorial algorithm which can be written as:
 </p>

<pre><code>fact(n)
{
 if(n == 1)
 return 1;
 else
 return n*fact(n-1)
... | habedi/stack-exchange-dataset |
120,318 | Euclidean algorithm - runtime in specific case | <p>I'm going to solving many times this specific equations:</p>

<p><span class="math-container">$$2^{x+y} \cdot c - a^{y} \cdot z = 1$$</span></p>

<p>in which <span class="math-container">$$a$$</span> can be equal to: <span class="math-container">$$-7,-5,-3,-1,1,3,5,7.$$</span> And <span class="math-c... | runtime analysis diophantine equation | 1 | Euclidean algorithm - runtime in specific case -- (runtime analysis diophantine equation)
<p>I'm going to solving many times this specific equations:</p>

<p><span class="math-container">$$2^{x+y} \cdot c - a^{y} \cdot z = 1$$</span></p>

<p>in which <span class="math-container">$$a$$</span> can be equa... | habedi/stack-exchange-dataset |
120,319 | Greyscale image to binary image conversion using operations on pixel | <p>Previously, I tried convert a color image into a greyscale image by using pixel values of an image from a simple formula :-</p>

<pre><code>Grey = 0.3*Red + 0.58*Green + 0.11*Blue
</code></pre>

<p>After that, I wanted to convert the greyscale image into a binary image & I used two different ... | image processing digital image processing | 1 | Greyscale image to binary image conversion using operations on pixel -- (image processing digital image processing)
<p>Previously, I tried convert a color image into a greyscale image by using pixel values of an image from a simple formula :-</p>

<pre><code>Grey = 0.3*Red + 0.58*Green + 0.11*Blue
</code></... | habedi/stack-exchange-dataset |
120,321 | Scheduling: Existence of specific total order | <p>A question arising from a scheduling problem:
I have a finite set <span class="math-container">$X$</span> with elements <span class="math-container">$x_i$</span> and some preorder <span class="math-container">$\leq$</span>.<br>
I have pairs <span class="math-container">$p_j$</span> of <span class="math-conta... | graphs partial order | 1 | Scheduling: Existence of specific total order -- (graphs partial order)
<p>A question arising from a scheduling problem:
I have a finite set <span class="math-container">$X$</span> with elements <span class="math-container">$x_i$</span> and some preorder <span class="math-container">$\leq$</span>.<br>
I have pa... | habedi/stack-exchange-dataset |
120,325 | Need help in understanding these relational algebra queries | <p>I just finished reading about operators in relational algebra and tried to solve this problem. But I dont even understand what the first statement is doing. From what I know, <span class="math-container">$π$</span> (project) is a unary opeartor that takes a single relation and selects some attributes from all of the... | database theory relational algebra | 1 | Need help in understanding these relational algebra queries -- (database theory relational algebra)
<p>I just finished reading about operators in relational algebra and tried to solve this problem. But I dont even understand what the first statement is doing. From what I know, <span class="math-container">$π$</span> (p... | habedi/stack-exchange-dataset |
120,334 | Can a 32-bit processor work with a 64-bit size word? | <p>In a 32-bit byte addressable memory system, each "row" has 4 bytes and each byte has a 32-bit address.</p>

<p>My question is: <strong>can I read and/or write word of length 64 bits from/to memory?</strong> 
In other terms, can my word length be 8 bytes long or is the maximum number of bytes/word 4?</p>&... | computer architecture memory hardware assembly | 1 | Can a 32-bit processor work with a 64-bit size word? -- (computer architecture memory hardware assembly)
<p>In a 32-bit byte addressable memory system, each "row" has 4 bytes and each byte has a 32-bit address.</p>

<p>My question is: <strong>can I read and/or write word of length 64 bits from/to memory?</stron... | habedi/stack-exchange-dataset |
120,339 | Reduce $L_c=\{\langle M_1 \rangle, \langle M_2 \rangle):L(M_1)\cap L(M_2)\neq \emptyset\}$ to $A_{TM} $ | <p>How to reduce <span class="math-container">$L_c=\{\langle M_1 \rangle, \langle M_2 \rangle):L(M_1)\cap L(M_2)\neq \emptyset\}$</span> to <span class="math-container">$A_{TM} =\{\langle M,w \rangle: M$</span> is a Turing machine that accepts <span class="math-container">$w$</span>}.</p>

<p>My try:
Constr... | complexity theory turing machines computability reductions | 1 | Reduce $L_c=\{\langle M_1 \rangle, \langle M_2 \rangle):L(M_1)\cap L(M_2)\neq \emptyset\}$ to $A_{TM} $ -- (complexity theory turing machines computability reductions)
<p>How to reduce <span class="math-container">$L_c=\{\langle M_1 \rangle, \langle M_2 \rangle):L(M_1)\cap L(M_2)\neq \emptyset\}$</span> to <span class=... | habedi/stack-exchange-dataset |
120,341 | Is following grammar LR(0)? | <p>I know how to verify whether grammar is LR(0) or not. But this particular case is little tricky and hence the question.</p>

<blockquote>
 <p>Grammar:</p>
 
 <p><span class="math-container">$SL \rightarrow SL ; S \space | \space \epsilon$</span></p>
 
 <p><span class="math-container"... | compilers parsers lr k | 1 | Is following grammar LR(0)? -- (compilers parsers lr k)
<p>I know how to verify whether grammar is LR(0) or not. But this particular case is little tricky and hence the question.</p>

<blockquote>
 <p>Grammar:</p>
 
 <p><span class="math-container">$SL \rightarrow SL ; S \space | \space \epsilon$... | habedi/stack-exchange-dataset |
120,342 | In an NFA that recognizes L(ab) where ab is a regular expression, what is the point of the empty string transition? | <p>I'm reading Introduction to Computational Theory by Michael Sipser. He provides the NFA below as one that recognizes the language of the regular expression <span class="math-container">$ab$</span>.</p>

<p>What is the purpose of the middle two states and the <span class="math-container">$\varepsilon$</span> ... | regular languages finite automata regular expressions | 1 | In an NFA that recognizes L(ab) where ab is a regular expression, what is the point of the empty string transition? -- (regular languages finite automata regular expressions)
<p>I'm reading Introduction to Computational Theory by Michael Sipser. He provides the NFA below as one that recognizes the language of the regul... | habedi/stack-exchange-dataset |
120,344 | Determining if match is possible | <p>I have a list of patterns with each pattern containing one or more wildcards. For example:</p>

<ul>
<li><code>abc*</code></li>
<li><code>a*</code></li>
<li><code>*a*z*</code></li>
<li><code>*z</code></li>
</ul>

<p>Wildcard (<code>*</code>) matches one or more characters. For exa... | algorithms graphs | 1 | Determining if match is possible -- (algorithms graphs)
<p>I have a list of patterns with each pattern containing one or more wildcards. For example:</p>

<ul>
<li><code>abc*</code></li>
<li><code>a*</code></li>
<li><code>*a*z*</code></li>
<li><code>*z</code></li>
</ul>

<p>Wildcard ... | habedi/stack-exchange-dataset |
120,349 | What does {a,b}* for DFA's mean? | <p>For instance when the question contains <span class="math-container">$\{a,b\}^*$</span> does this mean that the DFA must have at least one <span class="math-container">$a$</span> and one <span class="math-container">$b$</span> on top of whatever conditions it has?<br>
For example a DFA that accepts <span class="... | regular languages finite automata formal grammars kleene star | 1 | What does {a,b}* for DFA's mean? -- (regular languages finite automata formal grammars kleene star)
<p>For instance when the question contains <span class="math-container">$\{a,b\}^*$</span> does this mean that the DFA must have at least one <span class="math-container">$a$</span> and one <span class="math-container">$... | habedi/stack-exchange-dataset |
120,365 | Two way communication using asymmetric encryption | <p>According to image 1, for two way communication, each person needs to generate a pair of keys. However, according to image 2, only one pair of keys is required for two way communication. Thanks to anyone who can settle my confusion.</p>

<p><a href="https://www.amazon.co.uk/Cambridge-International-Level-Comp... | security encryption | 1 | Two way communication using asymmetric encryption -- (security encryption)
<p>According to image 1, for two way communication, each person needs to generate a pair of keys. However, according to image 2, only one pair of keys is required for two way communication. Thanks to anyone who can settle my confusion.</p>
&... | habedi/stack-exchange-dataset |
120,367 | pseudocode to split number value to array of numbers | <p>How to write a pseudocode to split a number value to array of numbers? Let's say the number value is 12345. I need to convert it into [1,2,3,4,5].</p>
 | arrays integers pseudocode | 1 | pseudocode to split number value to array of numbers -- (arrays integers pseudocode)
<p>How to write a pseudocode to split a number value to array of numbers? Let's say the number value is 12345. I need to convert it into [1,2,3,4,5].</p>
 | habedi/stack-exchange-dataset |
120,370 | Time complexity of $O(n)$ loop which has a multiplication ($O(n^2)$) in it | <p>Assume we know that the implementation for the multiplication operator for a language is known to be <span class="math-container">$O(n^2)$</span>.</p>

<p>Given this pseudocode:</p>

<pre><code>func wibble_wobble(List<Integer> input):
 Integer constant = input.length;
 return List... | time complexity big o notation | 1 | Time complexity of $O(n)$ loop which has a multiplication ($O(n^2)$) in it -- (time complexity big o notation)
<p>Assume we know that the implementation for the multiplication operator for a language is known to be <span class="math-container">$O(n^2)$</span>.</p>

<p>Given this pseudocode:</p>

<pre><c... | habedi/stack-exchange-dataset |
120,374 | From a randomized algorithm with expected time $O(n)$ to a reliable with determined running time | <p>Let <span class="math-container">$A$</span> be a randomised algorithm and <span class="math-container">$F$</span> be a function such that <span class="math-container">$A$</span> returns <span class="math-container">$F(x)$</span> on any input <span class="math-container">$x$</span>. Furthermore suppose that, for inpu... | algorithms probability theory | 1 | From a randomized algorithm with expected time $O(n)$ to a reliable with determined running time -- (algorithms probability theory)
<p>Let <span class="math-container">$A$</span> be a randomised algorithm and <span class="math-container">$F$</span> be a function such that <span class="math-container">$A$</span> returns... | habedi/stack-exchange-dataset |
120,391 | Is this correct grammar definition of Backus-Naur form? | <p>I've been given a grammar definition of "Simple C language" in Backus-Naur to write a compiler for a class assignment. I've been trying to implement the parser for some time now and I just can't move forward due to some endless loops and I think the definition might be wrong.</p>

<p>This is the full definit... | formal grammars compilers parsers | 1 | Is this correct grammar definition of Backus-Naur form? -- (formal grammars compilers parsers)
<p>I've been given a grammar definition of "Simple C language" in Backus-Naur to write a compiler for a class assignment. I've been trying to implement the parser for some time now and I just can't move forward due to some en... | habedi/stack-exchange-dataset |
120,398 | Evenly Spaced Points On Smooth Surface | <p>I want to space points evenly (i.e. maximizing minimal distance between two points) on some smooth surface <span class="math-container">$S\subseteq\mathbf{R}^n$</span> (usually <span class="math-container">$n=3$</span>), where I have a projection operator <span class="math-container">$p:\mathbf{R}^n\to S$</span> whi... | computational geometry physics | 1 | Evenly Spaced Points On Smooth Surface -- (computational geometry physics)
<p>I want to space points evenly (i.e. maximizing minimal distance between two points) on some smooth surface <span class="math-container">$S\subseteq\mathbf{R}^n$</span> (usually <span class="math-container">$n=3$</span>), where I have a projec... | habedi/stack-exchange-dataset |
120,401 | Solving a recurrence relation with T(n) = 2 * T(n/3) + 5n | <p>I have no idea how to solve this one - I end up with <span class="math-container">$\sum_{i=0}^k (2^k * 5 * 3^i)$</span> but I have no clue how to get any further than that (e.g. resolve the sum even further, if it's even correct to begin with).</p>

<p>This is the task - masters theorem is not allowed:</p>&#... | recurrence relation | 1 | Solving a recurrence relation with T(n) = 2 * T(n/3) + 5n -- (recurrence relation)
<p>I have no idea how to solve this one - I end up with <span class="math-container">$\sum_{i=0}^k (2^k * 5 * 3^i)$</span> but I have no clue how to get any further than that (e.g. resolve the sum even further, if it's even correct to be... | habedi/stack-exchange-dataset |
120,411 | Algorithm to compute decomposition of a union of sets to a disjoint union of intersections | <p>A union of sets can be decomposed into a disjoint union of intersections. Rather than writing confusing notation, this is easiest to to see in an example of three sets. <a href="https://i.stack.imgur.com/kkyZW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kkyZW.png" alt="enter image description ... | algorithms sets | 1 | Algorithm to compute decomposition of a union of sets to a disjoint union of intersections -- (algorithms sets)
<p>A union of sets can be decomposed into a disjoint union of intersections. Rather than writing confusing notation, this is easiest to to see in an example of three sets. <a href="https://i.stack.imgur.com/k... | habedi/stack-exchange-dataset |
120,431 | Probability of selecting a particular set, by sampling without replacement from a categorical distribution | <p>Suppose I have a categorical distribution on items <span class="math-container">$1,\dots,n$</span>, that assigns probability <span class="math-container">$p_i$</span> to item <span class="math-container">$i$</span>. I now repeatedly sample from this distribution, until I have obtained <span class="math-container">$... | probability theory | 1 | Probability of selecting a particular set, by sampling without replacement from a categorical distribution -- (probability theory)
<p>Suppose I have a categorical distribution on items <span class="math-container">$1,\dots,n$</span>, that assigns probability <span class="math-container">$p_i$</span> to item <span class... | habedi/stack-exchange-dataset |
120,432 | Asymptotic growth of a function containing a sum | <p>How to compare the asymptotic growth of a function containing a sum with another function? I'm not sure how I'm supposed to dissolve the sum. Usually I just take the limis of f(x)/g(x). If that fails I take the limis of f'(x)/g'(x). But I'm not sure what to do in the following task (to prove whether the marked state... | time complexity landau notation big o notation | 1 | Asymptotic growth of a function containing a sum -- (time complexity landau notation big o notation)
<p>How to compare the asymptotic growth of a function containing a sum with another function? I'm not sure how I'm supposed to dissolve the sum. Usually I just take the limis of f(x)/g(x). If that fails I take the limis... | habedi/stack-exchange-dataset |
120,436 | Values of k that make this true, $\log^k n \in \Omega(\sqrt n)$ | <p>I have seen some algorithms with complexities like <span class="math-container">$\log^3 n$</span> and <span class="math-container">$\sqrt n$</span>. In view of getting a better idea on how to compare these I wanted to know for which values of <span class="math-container">$k$</span> does <span class="math-container">... | asymptotics | 1 | Values of k that make this true, $\log^k n \in \Omega(\sqrt n)$ -- (asymptotics)
<p>I have seen some algorithms with complexities like <span class="math-container">$\log^3 n$</span> and <span class="math-container">$\sqrt n$</span>. In view of getting a better idea on how to compare these I wanted to know for which val... | habedi/stack-exchange-dataset |
120,456 | Minimum no. of coin flips (switch) needed so that all coins face the same side (Heads or Tails) | <p>Consider this, I have n coins and I have placed them in a random order (1st coin is Head, 2nd is Tails etc.). You do not know the order. You can flip one coin at a time and then I tell you if all the coins face the same side or not. You continue flipping until all coins are facing the same side.<br> <br>
I tried... | algorithms data structures recurrence relation recursion | 1 | Minimum no. of coin flips (switch) needed so that all coins face the same side (Heads or Tails) -- (algorithms data structures recurrence relation recursion)
<p>Consider this, I have n coins and I have placed them in a random order (1st coin is Head, 2nd is Tails etc.). You do not know the order. You can flip one coin ... | habedi/stack-exchange-dataset |
120,464 | Model for formula $\Box (\psi \vee \phi) \Rightarrow (\Box \psi) \vee (\Box \phi)$ | <p>I am new to <a href="https://en.wikipedia.org/wiki/Linear_temporal_logic" rel="nofollow noreferrer">LTL</a> and I am trying to understand how it works. My question is: is there such <span class="math-container">$\sigma$</span> that: </p>

<p><span class="math-container">$ \sigma \models [\Box (\psi \vee \phi... | logic linear temporal logic temporal logic | 1 | Model for formula $\Box (\psi \vee \phi) \Rightarrow (\Box \psi) \vee (\Box \phi)$ -- (logic linear temporal logic temporal logic)
<p>I am new to <a href="https://en.wikipedia.org/wiki/Linear_temporal_logic" rel="nofollow noreferrer">LTL</a> and I am trying to understand how it works. My question is: is there such <spa... | habedi/stack-exchange-dataset |
120,483 | Are weakly polynomial time algorithms truly polynomial? | <p>I've been looking through a ton of sources to try and understand the definitions of strongly and weakly polynomial time algorithms. <a href="https://en.wikipedia.org/wiki/Time_complexity#Strongly_and_weakly_polynomial_time" rel="noreferrer">Wikipedia</a>
states an algorithm runs in strongly polynomial time if</p... | algorithms complexity theory turing machines computation models | 1 | Are weakly polynomial time algorithms truly polynomial? -- (algorithms complexity theory turing machines computation models)
<p>I've been looking through a ton of sources to try and understand the definitions of strongly and weakly polynomial time algorithms. <a href="https://en.wikipedia.org/wiki/Time_complexity#Stron... | habedi/stack-exchange-dataset |
120,496 | Is the exponent bias $2^{n-1}-1$ or $2^{n-1}$ | <p>I'm a bit confused with the exponent bias. The sources I found online claim that it is either <span class="math-container">$2^{n-1}-1$</span> or <span class="math-container">$2^{n-1}$</span>, <span class="math-container">$n$</span> is the number of bits used for the exponent. In my book when given examples on the bi... | floating point numerical analysis | 1 | Is the exponent bias $2^{n-1}-1$ or $2^{n-1}$ -- (floating point numerical analysis)
<p>I'm a bit confused with the exponent bias. The sources I found online claim that it is either <span class="math-container">$2^{n-1}-1$</span> or <span class="math-container">$2^{n-1}$</span>, <span class="math-container">$n$</span> ... | habedi/stack-exchange-dataset |
120,518 | Maximun distance that can be reached | <p>A stone is located at the point (0,0) of an infinite grid. The stone has exactly <span class="math-container">$n$</span> possible moves, <strong>not</strong> necessarily unique, each described by a <span class="math-container">$vector$</span> of integer coordinates. The stone can make each move at most once , and t... | computational geometry dynamic programming | 1 | Maximun distance that can be reached -- (computational geometry dynamic programming)
<p>A stone is located at the point (0,0) of an infinite grid. The stone has exactly <span class="math-container">$n$</span> possible moves, <strong>not</strong> necessarily unique, each described by a <span class="math-container">$vect... | habedi/stack-exchange-dataset |
120,533 | Slowest growing upper bound for the minimum length of a complementary prefix regular expression | <p>A postfix regular expression acting on a binary alphabet (specification from <a href="https://codegolf.stackexchange.com/q/161108/41805">this post</a>) can be described using the following grammar,</p>

<p><code>R → 0 or 1 or _ or ! or RR; or RR| or R+</code></p>

<p>where,</p>

<p><code>0</c... | regular languages finite automata regular expressions | 1 | Slowest growing upper bound for the minimum length of a complementary prefix regular expression -- (regular languages finite automata regular expressions)
<p>A postfix regular expression acting on a binary alphabet (specification from <a href="https://codegolf.stackexchange.com/q/161108/41805">this post</a>) can be des... | habedi/stack-exchange-dataset |
120,536 | Special Monotone SAT problem: NP complete? | <p>Say we have the set <span class="math-container">$X=\{ x_1, x_2, \dots \}$</span> of variables. Then we consider the following problem: Is the formula 
<span class="math-container">$$\bigwedge_{(a,b,c) \in A}(a \vee b \vee c) \wedge \bigwedge_{(a,b,c) \in B}(\neg a \vee \neg b \vee \neg c)$$</span>
for <span... | complexity theory np complete satisfiability | 1 | Special Monotone SAT problem: NP complete? -- (complexity theory np complete satisfiability)
<p>Say we have the set <span class="math-container">$X=\{ x_1, x_2, \dots \}$</span> of variables. Then we consider the following problem: Is the formula 
<span class="math-container">$$\bigwedge_{(a,b,c) \in A}(a \vee b \v... | habedi/stack-exchange-dataset |
120,540 | polynomial reduction & co np complete | <p>I would like to know how we can demonstrate these two problems :</p>

<ul>
<li><span class="math-container">$A \leqslant_p B$</span> implies <span class="math-container">$\overline A \leqslant_p \overline B$</span></li>
<li>The complement of 3-SAT is co-NP-complete</li>
</ul>
 | np complete polynomial time reductions | 1 | polynomial reduction & co np complete -- (np complete polynomial time reductions)
<p>I would like to know how we can demonstrate these two problems :</p>

<ul>
<li><span class="math-container">$A \leqslant_p B$</span> implies <span class="math-container">$\overline A \leqslant_p \overline B$</span></li>&#x... | habedi/stack-exchange-dataset |
120,541 | Does input space size contribute at all to the runtime of an algorithm? | <p>I just started learning about NP-Complete problems and one of the first examples they give is Set Cover:</p>

<blockquote>
 <p>Given a set <span class="math-container">$U$</span> of <span class="math-container">$n$</span> elements, a collection <span class="math-container">$S_1, \ldots, S_m$</span> of s... | algorithms complexity theory | 1 | Does input space size contribute at all to the runtime of an algorithm? -- (algorithms complexity theory)
<p>I just started learning about NP-Complete problems and one of the first examples they give is Set Cover:</p>

<blockquote>
 <p>Given a set <span class="math-container">$U$</span> of <span class="mat... | habedi/stack-exchange-dataset |
120,556 | P = NP clarification | <p>Let's use Traveling Salesman as the example, unless you think there's a simpler, more understable example.</p>

<p>My understanding of P=NP question is that, given the optimal solution of a difficult problem, it's easy to check the answer, but very difficult to find the solution.</p>

<p>With the Tra... | np complete p vs np | 1 | P = NP clarification -- (np complete p vs np)
<p>Let's use Traveling Salesman as the example, unless you think there's a simpler, more understable example.</p>

<p>My understanding of P=NP question is that, given the optimal solution of a difficult problem, it's easy to check the answer, but very difficult to f... | habedi/stack-exchange-dataset |
120,562 | What algorithms for unification over (multidimensional) array terms? | <p>I am looking for references on implementing unification over multidimensional array terms.</p>

<p>Are there specialized unification algorithms for those cases? I wasn't able to find satisfactory literature on the topic, and I am attempting to write a logic programming library for the J language.</p>
 | logic arrays unification logic programming | 1 | What algorithms for unification over (multidimensional) array terms? -- (logic arrays unification logic programming)
<p>I am looking for references on implementing unification over multidimensional array terms.</p>

<p>Are there specialized unification algorithms for those cases? I wasn't able to find satisfact... | habedi/stack-exchange-dataset |
120,577 | minimizing the maximum between a degree of a tree and its height | <p>I'm interested in asymptotically minimizing the maximum between the height of a tree of degree <span class="math-container">$k$</span> with <span class="math-container">$n$</span> leaves, and <span class="math-container">$k$</span>, i.e. minimizing <span class="math-container">$\max(k, \log_kn)$</span> asymptoticall... | asymptotics trees | 1 | minimizing the maximum between a degree of a tree and its height -- (asymptotics trees)
<p>I'm interested in asymptotically minimizing the maximum between the height of a tree of degree <span class="math-container">$k$</span> with <span class="math-container">$n$</span> leaves, and <span class="math-container">$k$</spa... | habedi/stack-exchange-dataset |
120,596 | Prove that the language $\{a^ib^i | i\geq 0\}$ is not regular? (Do we just consider $a^nb^n$, where $n$ is the pumping length? | <p>I think to prove that <span class="math-container">$\{a^ib^i | i\geq 0\}$</span> is not regular, we just have to consider the string <span class="math-container">$a^nb^n$</span> (which is in the language) and apply the pumping lemma. But I'm not sure how to proceed using the pumping lemma (even though I know it appl... | formal languages regular languages regular expressions pumping lemma | 1 | Prove that the language $\{a^ib^i | i\geq 0\}$ is not regular? (Do we just consider $a^nb^n$, where $n$ is the pumping length? -- (formal languages regular languages regular expressions pumping lemma)
<p>I think to prove that <span class="math-container">$\{a^ib^i | i\geq 0\}$</span> is not regular, we just have to con... | habedi/stack-exchange-dataset |
120,606 | Collision entropy definition | <p>The collision entropy is defined as the Renyi entropy for the case <span class="math-container">$\alpha = 2$</span>. It is given by</p>

<p><span class="math-container">$$\mathrm{H}_{2}(X)=-\log \sum_{i=1}^{n} p_{i}^{2} \tag{1}$$</span></p>

<p>Take two random variables <span class="math-container">$... | information theory entropy | 1 | Collision entropy definition -- (information theory entropy)
<p>The collision entropy is defined as the Renyi entropy for the case <span class="math-container">$\alpha = 2$</span>. It is given by</p>

<p><span class="math-container">$$\mathrm{H}_{2}(X)=-\log \sum_{i=1}^{n} p_{i}^{2} \tag{1}$$</span></p>
&#x... | habedi/stack-exchange-dataset |
120,610 | Distinction between 2 languages.One is regular the other is not | <p>whenever it needs to be determined if langage is regular or not, I use the notion that it is impossible for a machine to "remember" an infinte states.</p>

<p>given 2 languages:<span class="math-container">$L_1=\{(01)^{n}(10)^{n}|n \in \mathbb{N}\}$</span> </p>

<p><span class="math-container">$L_2=\... | automata regular languages finite automata pumping lemma | 1 | Distinction between 2 languages.One is regular the other is not -- (automata regular languages finite automata pumping lemma)
<p>whenever it needs to be determined if langage is regular or not, I use the notion that it is impossible for a machine to "remember" an infinte states.</p>

<p>given 2 languages:<span ... | habedi/stack-exchange-dataset |
120,614 | Finding C-convex holes in a planar point set | <p>I am looking for an efficient algorithm to find convex holes in a given point set.
The problem is </p>

<blockquote>
 <p>Given <span class="math-container">$n$</span> points in the Euclidan plane, and a constant <span class="math-container">$c$</span>, determine how many empty convex polygons <span ... | algorithms reference request computational geometry | 1 | Finding C-convex holes in a planar point set -- (algorithms reference request computational geometry)
<p>I am looking for an efficient algorithm to find convex holes in a given point set.
The problem is </p>

<blockquote>
 <p>Given <span class="math-container">$n$</span> points in the Euclidan plane, a... | habedi/stack-exchange-dataset |
120,618 | Matching two sets when you cannot do within-set comparisons | <p>Suppose you have two lists, <code>A</code> and <code>B</code>, each with length n. The elements of A cannot be compared with other elements of <code>A</code>--there is no order relation among them--and likewise for <code>B</code>. However, elements of <code>A</code> can be compared with elements of <code>B</code>.... | algorithms | 1 | Matching two sets when you cannot do within-set comparisons -- (algorithms)
<p>Suppose you have two lists, <code>A</code> and <code>B</code>, each with length n. The elements of A cannot be compared with other elements of <code>A</code>--there is no order relation among them--and likewise for <code>B</code>. However,... | habedi/stack-exchange-dataset |
120,621 | Time complexity of insertion in linked list | <p>Apologies if this question feels like a solution verification, but this question was asked in my graduate admission test and there's a lot riding on this:</p>

<blockquote>
 <p>What is the worst case time complexity of inserting <span class="math-container">$n$</span> elements into an empty linked list,... | sorting linked lists | 1 | Time complexity of insertion in linked list -- (sorting linked lists)
<p>Apologies if this question feels like a solution verification, but this question was asked in my graduate admission test and there's a lot riding on this:</p>

<blockquote>
 <p>What is the worst case time complexity of inserting <span... | habedi/stack-exchange-dataset |
120,632 | Proving the regularity of the following language | <p>I have a question about the following problem:</p>

<blockquote>
 <p>Prove that the language <span class="math-container">$\{a^nva^n | v \in \Sigma^*, n \ge 1\}$</span> is regular over
 <span class="math-container">$\Sigma = \{a,b\}.$</span></p>
</blockquote>

<p>I know that in proving ... | formal languages regular languages | 1 | Proving the regularity of the following language -- (formal languages regular languages)
<p>I have a question about the following problem:</p>

<blockquote>
 <p>Prove that the language <span class="math-container">$\{a^nva^n | v \in \Sigma^*, n \ge 1\}$</span> is regular over
 <span class="math-contai... | habedi/stack-exchange-dataset |
120,658 | Good algorithm to find all pairs of strings between 2 sets so that all words from the 1st string are all contained in the 2nd string? | <p>I have 2 large sets of strings (actually they are product names). "Large" means few millions of strings.</p>

<p>Example:</p>

<p>Set 1:</p>

<pre><code>Some good product
Another product
Some name
Blah
</code></pre>

<p>Set 2:</p>

<pre><code>Very long some pro... | strings sets substrings | 1 | Good algorithm to find all pairs of strings between 2 sets so that all words from the 1st string are all contained in the 2nd string? -- (strings sets substrings)
<p>I have 2 large sets of strings (actually they are product names). "Large" means few millions of strings.</p>

<p>Example:</p>

<p>Set 1:</... | habedi/stack-exchange-dataset |
120,664 | How many snakes there can be in the "snakes and ladders" game? | <p>How to calculate the maximum allowed number of snakes in the game of <a href="https://en.wikipedia.org/wiki/Snakes_and_Ladders" rel="nofollow noreferrer">"snakes and ladders"</a> from mathematical/algorithmic point of view assuming that there is a nxn board? </p>

<p>UPD: My thoughts are simple, but they mig... | algorithms discrete mathematics board games | 1 | How many snakes there can be in the "snakes and ladders" game? -- (algorithms discrete mathematics board games)
<p>How to calculate the maximum allowed number of snakes in the game of <a href="https://en.wikipedia.org/wiki/Snakes_and_Ladders" rel="nofollow noreferrer">"snakes and ladders"</a> from mathematical/algorith... | habedi/stack-exchange-dataset |
120,681 | Why L' is not regular? | <p><span class="math-container">$$L'=\{ww|w\in L\}$$</span></p>

<p>I need to give an example of regular language L for which the concatenation of 2's <span class="math-container">$w$</span> gives <span class="math-container">$L'$</span> which is not regular.</p>

<p>How can I give such an example if ac... | automata regular languages regular expressions closure properties | 1 | Why L' is not regular? -- (automata regular languages regular expressions closure properties)
<p><span class="math-container">$$L'=\{ww|w\in L\}$$</span></p>

<p>I need to give an example of regular language L for which the concatenation of 2's <span class="math-container">$w$</span> gives <span class="math-con... | habedi/stack-exchange-dataset |
120,689 | Given a set of integers $D$ and a positive value$P$, find an algorithm to find set of integers satisfying a condition | <p>Given a set of positive integers : </p>

<p><span class="math-container">$ \\ D = \{ D_1, D_2, ..., D_n\}$</span> </p>

<p>and a non-negative integer <span class="math-container">$P$</span>, where <span class="math-container">$P$</span> is divisible by every elem... | algorithms algorithm analysis sets number theory linear algebra | 1 | Given a set of integers $D$ and a positive value$P$, find an algorithm to find set of integers satisfying a condition -- (algorithms algorithm analysis sets number theory linear algebra)
<p>Given a set of positive integers : </p>

<p><span class="math-container">$ \\ D = \{ D_1, D_2, ..., D_... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.