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 |
|---|---|---|---|---|---|---|
24,768 | Shortest path in weighted(positive or negative) undirected graph | <p>I have to find an algorithm that finds the SSSP (single-source shortest path - shortest paths from one source vertex to all other vertices) on a weighted undirected graph. If there are 2 different shortest paths, the algorithm should prefer the one with less edges on it. The time complexity of the algorithm is $O((|... | graphs shortest path | 1 | Shortest path in weighted(positive or negative) undirected graph -- (graphs shortest path)
<p>I have to find an algorithm that finds the SSSP (single-source shortest path - shortest paths from one source vertex to all other vertices) on a weighted undirected graph. If there are 2 different shortest paths, the algorithm... | habedi/stack-exchange-dataset |
24,775 | Timing threads in an algorithm | <p>This question relates to timing threads to go at a very precise rate. Consider the following scenario; A program creates a series of threads that continually add a random set of elements to their local storage. The program finishes and returns the thread that received the shortest number of elements in its random se... | algorithms threads | 1 | Timing threads in an algorithm -- (algorithms threads)
<p>This question relates to timing threads to go at a very precise rate. Consider the following scenario; A program creates a series of threads that continually add a random set of elements to their local storage. The program finishes and returns the thread that re... | habedi/stack-exchange-dataset |
24,776 | Name for this algorithm? | <p>I'm trying to figure out if there is a proper or commonly accepted name for this particular function (<code>f</code>).</p>

<pre><code>float clamp(float min, float max, float v)
{
 if (v < min) return min;
 else if (v > max) return max;
 else return v;
}

float f(fl... | algorithms terminology statistics | 1 | Name for this algorithm? -- (algorithms terminology statistics)
<p>I'm trying to figure out if there is a proper or commonly accepted name for this particular function (<code>f</code>).</p>

<pre><code>float clamp(float min, float max, float v)
{
 if (v < min) return min;
 else if (v > m... | habedi/stack-exchange-dataset |
24,784 | Hilbert's 10th Problem and Chaitin's Diophantine Equation "Computer"? | <p>In Chaitin's <em>Meta Math! The Quest For Omega</em>, he briefly talks about Hilbert's 10th Problem. He then says that any Diophantine Equation $p=0$ can be changed into two equal polynomials with positive integer coefficients: $p=0 \iff p_1 = p_2$.</p>

<p>Then he says that we can think of these equations l... | logic halting problem | 1 | Hilbert's 10th Problem and Chaitin's Diophantine Equation "Computer"? -- (logic halting problem)
<p>In Chaitin's <em>Meta Math! The Quest For Omega</em>, he briefly talks about Hilbert's 10th Problem. He then says that any Diophantine Equation $p=0$ can be changed into two equal polynomials with positive integer coeffi... | habedi/stack-exchange-dataset |
24,786 | Situations where Kleene star of A is context-free, but A is not | <p>This question appeared on my Theory of Computer Science final:</p>

<p>True | False: $A^*$ is context-free $\implies$ $A$ is context-free.</p>

<p>My professor says the answer is false, and I believe him, but am having trouble constructing a counterexample or even just convincing myself why. It seems... | context free closure properties | 1 | Situations where Kleene star of A is context-free, but A is not -- (context free closure properties)
<p>This question appeared on my Theory of Computer Science final:</p>

<p>True | False: $A^*$ is context-free $\implies$ $A$ is context-free.</p>

<p>My professor says the answer is false, and I believe ... | habedi/stack-exchange-dataset |
25,793 | Understanding Monte Carlo Probabilities | <p>I am trying to get a good grasp on Monte Carlo (MC) algorithms, but I feel I am missing something fundamental.</p>

<p>What I don't understand is how MC improves its confidence of giving the correct solution by running more executions.</p>

<p>So please correct me if I am wrong and assume that $Pr[fa... | algorithms probability theory randomized algorithms monte carlo | 1 | Understanding Monte Carlo Probabilities -- (algorithms probability theory randomized algorithms monte carlo)
<p>I am trying to get a good grasp on Monte Carlo (MC) algorithms, but I feel I am missing something fundamental.</p>

<p>What I don't understand is how MC improves its confidence of giving the correct s... | habedi/stack-exchange-dataset |
25,794 | What's the meaning of "Front" in "Pareto-Optimal Front"? | <p>I'm reading a paper about <strong>Multi-Objective Optimization Problem</strong>. I understand <strong>Optimal in Pareto sense</strong>, and I even know what is <strong>Pareto-Optimal Front</strong> somehow. But I can't find a relationship between the word <strong>Front</strong> and the concept. So, what's the meanin... | optimization | 1 | What's the meaning of "Front" in "Pareto-Optimal Front"? -- (optimization)
<p>I'm reading a paper about <strong>Multi-Objective Optimization Problem</strong>. I understand <strong>Optimal in Pareto sense</strong>, and I even know what is <strong>Pareto-Optimal Front</strong> somehow. But I can't find a relationship bet... | habedi/stack-exchange-dataset |
25,798 | Concatenation property of regular languages | <p>If L is the empty set and therefore a regular language, I know that L concatenated with sigma star is equal L; Are there any other languages that, when concatenated with sigma star will result in the same language?</p>
 | regular languages | 1 | Concatenation property of regular languages -- (regular languages)
<p>If L is the empty set and therefore a regular language, I know that L concatenated with sigma star is equal L; Are there any other languages that, when concatenated with sigma star will result in the same language?</p>
 | habedi/stack-exchange-dataset |
25,800 | Can we compute the sum of a range of entries in $O(1)$ time? | <p>I have encountered a few tests in algorithms which ask for 
a data structure which allows to get the sum of all the elements of an array in the range [i..j], in O(1) time.</p>

<p>Is it even possible to do so?</p>
 | algorithms data structures | 1 | Can we compute the sum of a range of entries in $O(1)$ time? -- (algorithms data structures)
<p>I have encountered a few tests in algorithms which ask for 
a data structure which allows to get the sum of all the elements of an array in the range [i..j], in O(1) time.</p>

<p>Is it even possible to do so?</p... | habedi/stack-exchange-dataset |
25,804 | Understanding Expected Running Time of Randomized Algorithms | <p>I want to understand the expected running time and the worse-case expected running time.</p>

<p>I got confused when I saw this figure (<a href="http://courses.cs.washington.edu/courses/cse326/03au/lectures/19-rand-datastr.pdf" rel="nofollow noreferrer">source</a>),</p>

<p><img src="https://i.stack.... | algorithms time complexity probability theory randomized algorithms average case | 1 | Understanding Expected Running Time of Randomized Algorithms -- (algorithms time complexity probability theory randomized algorithms average case)
<p>I want to understand the expected running time and the worse-case expected running time.</p>

<p>I got confused when I saw this figure (<a href="http://courses.cs... | habedi/stack-exchange-dataset |
25,810 | Finding dynamic programming algorithm | <p>I got a matrix of integers of size $3\times n$. Of each one of the three rows, for each column I got to choose one number, with the restriction that, for each $i$, the numbers chosen in the $i$th and $(i+1)$st rows cannot come from the same column.</p>

<p>The problem asks to make an algorithm such that the ... | dynamic programming space complexity | 1 | Finding dynamic programming algorithm -- (dynamic programming space complexity)
<p>I got a matrix of integers of size $3\times n$. Of each one of the three rows, for each column I got to choose one number, with the restriction that, for each $i$, the numbers chosen in the $i$th and $(i+1)$st rows cannot come from the s... | habedi/stack-exchange-dataset |
25,813 | Turing Decidable | <pre><code>M = (Q, Σ, Γ, δ, q1, qaccept, qreject), where
Q ={q1, q2, qaccept, qreject}, 
Σ = {0, 1}, 
Γ = {0, 1, U}, 
</code></pre>

<p>and transition function δ is as follows:</p>

<pre><code>δ (q1, U) = (q1, U, R)
δ (q1, 0) = (q2, U, R)
δ (q1, 1) = (q2, U, R)
δ (q2, U) = (q... | turing machines automata finite automata undecidability | 1 | Turing Decidable -- (turing machines automata finite automata undecidability)
<pre><code>M = (Q, Σ, Γ, δ, q1, qaccept, qreject), where
Q ={q1, q2, qaccept, qreject}, 
Σ = {0, 1}, 
Γ = {0, 1, U}, 
</code></pre>

<p>and transition function δ is as follows:</p>

<pre><code>δ (q1, U) = (q1, ... | habedi/stack-exchange-dataset |
25,814 | Python Prime Numbers Code Problem | <p>I was trying to write my own code for primes in Python. I know that code already exists, but I am doing this to challenge my knowledge and make my own solution. I was wondering if any of you guys would tell me what's wrong with it.</p>

<pre><code>factor_list = [ ]

def integer_test(x):

 ... | primes | 1 | Python Prime Numbers Code Problem -- (primes)
<p>I was trying to write my own code for primes in Python. I know that code already exists, but I am doing this to challenge my knowledge and make my own solution. I was wondering if any of you guys would tell me what's wrong with it.</p>

<pre><code>factor_list = [... | habedi/stack-exchange-dataset |
25,823 | Build a context-free grammar for a context-free language | <p>A context-free language is defined by its description:</p>

<p>$L=(a^{2k} \space b^n \space c^{2n} \mid k \geq 0, \space n > 0)$</p>

<p>For example:</p>

<p>$bcc, aabcc, aabbcccc, bbcccc$</p>

<p><strong>How to build a context-free grammar for this context-free language?</strong>... | context free | 1 | Build a context-free grammar for a context-free language -- (context free)
<p>A context-free language is defined by its description:</p>

<p>$L=(a^{2k} \space b^n \space c^{2n} \mid k \geq 0, \space n > 0)$</p>

<p>For example:</p>

<p>$bcc, aabcc, aabbcccc, bbcccc$</p>

<p><strong>H... | habedi/stack-exchange-dataset |
25,826 | big O of a complex function | <p>I have a complex function, which looks something like this:</p>

<p>$$f(x) = \sum_{k=0}^x{\frac{g(k)}{h(k)}} + l(x)$$</p>

<p>Now, $g(k) = O(\log k)$ and $h(k) = O(k)$, the sum iterates $k$ from $0$ to the parameter $x$ and $l(x)$ is meant to provide a decimal correction, but its form is $\dfrac{a^{b... | time complexity asymptotics | 1 | big O of a complex function -- (time complexity asymptotics)
<p>I have a complex function, which looks something like this:</p>

<p>$$f(x) = \sum_{k=0}^x{\frac{g(k)}{h(k)}} + l(x)$$</p>

<p>Now, $g(k) = O(\log k)$ and $h(k) = O(k)$, the sum iterates $k$ from $0$ to the parameter $x$ and $l(x)$ is meant ... | habedi/stack-exchange-dataset |
25,828 | Effective computation on linear data without random access | <p>recently I've started thinking about caching problems in modern CPUs, where they struggle to adequately fetch program data (not instructions) in time, so that it can be computed further.<br> 
 So then I came up with the idea, why don't we restrict random access on program data and make it all as a continuous s... | compilers cpu cache cpu pipelines | 1 | Effective computation on linear data without random access -- (compilers cpu cache cpu pipelines)
<p>recently I've started thinking about caching problems in modern CPUs, where they struggle to adequately fetch program data (not instructions) in time, so that it can be computed further.<br> 
 So then I came up wi... | habedi/stack-exchange-dataset |
25,829 | Is it possible to repeat a wildcard in regex? | <p><code>.{5}</code> would match any string of 5 symbols (excluding newline). Suppose I wanted to define "a 5-character repetition of a single character."</p>

<p>The immediate way that comes to mind is <code>(.)\1{4}</code>, but this relies on a back reference.</p>

<p>Using a subset of regex which is ... | regular expressions | 1 | Is it possible to repeat a wildcard in regex? -- (regular expressions)
<p><code>.{5}</code> would match any string of 5 symbols (excluding newline). Suppose I wanted to define "a 5-character repetition of a single character."</p>

<p>The immediate way that comes to mind is <code>(.)\1{4}</code>, but this relies... | habedi/stack-exchange-dataset |
25,831 | Sum of all nodes from A to B in a Tree | <p>Given a Tree and pointers to two of it's nodes A and B (a key value of each node is positive).</p>

<p>Find an algorithm that sums up all the values on the path between A and B,
when preproccessing is allowed.</p>
 | algorithms data structures trees | 1 | Sum of all nodes from A to B in a Tree -- (algorithms data structures trees)
<p>Given a Tree and pointers to two of it's nodes A and B (a key value of each node is positive).</p>

<p>Find an algorithm that sums up all the values on the path between A and B,
when preproccessing is allowed.</p>
 | habedi/stack-exchange-dataset |
25,837 | Given a graph, finding if a node has three adjacents from a node subset $N$ | <p>Given a graph $G = (V,E)$, assume that we have two disjoint vertex sets $N = \{n_1, n_2 ...\} \subset V$ and $P = \{p_1, p_2, ...\} \subset V$ such that $N \bigcup P \neq V$.</p>

<p>I want to find if there exists an edge subset such that $\{<n_i,p_l>, <n_j,p_l>, <n_k, p_l>\}$ i.e. three no... | algorithms graphs search problem | 1 | Given a graph, finding if a node has three adjacents from a node subset $N$ -- (algorithms graphs search problem)
<p>Given a graph $G = (V,E)$, assume that we have two disjoint vertex sets $N = \{n_1, n_2 ...\} \subset V$ and $P = \{p_1, p_2, ...\} \subset V$ such that $N \bigcup P \neq V$.</p>

<p>I want to fi... | habedi/stack-exchange-dataset |
25,839 | k-ordered array problem | <blockquote>
<p>An array <span class="math-container">$A[1...n]$</span> is said to be k-ordered if</p>
<p><span class="math-container">$$A[i - k] \leq A[i] \leq A[i + k]$$</span></p>
<p>for all <span class="math-container">$i$</span> such that <span class="math-container">$k < i \leq n - k$</span>.</p>&#... | data structures arrays | 1 | k-ordered array problem -- (data structures arrays)
<blockquote>
<p>An array <span class="math-container">$A[1...n]$</span> is said to be k-ordered if</p>
<p><span class="math-container">$$A[i - k] \leq A[i] \leq A[i + k]$$</span></p>
<p>for all <span class="math-container">$i$</span> such that <span class=... | habedi/stack-exchange-dataset |
25,842 | Example of graph with exponential many s-t minpaths and min cuts | <p>I am trying to find a graph in which both s-t minpaths and min cuts are exponential.</p>

<p>Individually I found examples in which s-t minpaths and s-t min cuts are exponential. Can some one provide me an example of graph which has both min paths and min cuts in exponential size.</p>
 | graphs combinatorics shortest path | 1 | Example of graph with exponential many s-t minpaths and min cuts -- (graphs combinatorics shortest path)
<p>I am trying to find a graph in which both s-t minpaths and min cuts are exponential.</p>

<p>Individually I found examples in which s-t minpaths and s-t min cuts are exponential. Can some one provide me a... | habedi/stack-exchange-dataset |
25,860 | Is it possible to accurately determine the number of instructions required to multiply or add two integers in a modern processor? | <p>I'm not nearly at the experience level in computer science to be able to properly determine the number of instructions involved in basic ALU calculations, and I'm interested in a certain software concept where the difference is important.</p>

<p><strong>Multiplication</strong></p>

<hr>

<pr... | computer architecture binary arithmetic mathematical programming | 1 | Is it possible to accurately determine the number of instructions required to multiply or add two integers in a modern processor? -- (computer architecture binary arithmetic mathematical programming)
<p>I'm not nearly at the experience level in computer science to be able to properly determine the number of instruction... | habedi/stack-exchange-dataset |
25,864 | Draw a graph of DFA for a regular language | <p>I'm trying to draw a DFA graph for the regular language where every chain: </p>

<pre><code>* consists of symbols from the set {1,a,b}. 
* starts with the subchain '1a'.
* includes at least one subchain 'aa'.
</code></pre>

<p>Output chains: $1aa, 1abaa, 1aaba, 1aaa, 1aaab, 1aab1a, \space... | formal languages regular languages finite automata | 1 | Draw a graph of DFA for a regular language -- (formal languages regular languages finite automata)
<p>I'm trying to draw a DFA graph for the regular language where every chain: </p>

<pre><code>* consists of symbols from the set {1,a,b}. 
* starts with the subchain '1a'.
* includes at least one subchain... | habedi/stack-exchange-dataset |
25,867 | Top Down Insertion in a B Tree | <p>I have a B-Tree of order 5. So the keys are between $\lceil n/2 \rceil- 1 \leq keys \leq n - 1$ and children are between $\lceil n/2 \rceil \leq children \leq n $. Am I doing it right? So a full node would be of 4 keys, how do I split that, because when I split that full node, I get uneven keys in any of the childre... | data structures search trees | 1 | Top Down Insertion in a B Tree -- (data structures search trees)
<p>I have a B-Tree of order 5. So the keys are between $\lceil n/2 \rceil- 1 \leq keys \leq n - 1$ and children are between $\lceil n/2 \rceil \leq children \leq n $. Am I doing it right? So a full node would be of 4 keys, how do I split that, because whe... | habedi/stack-exchange-dataset |
25,869 | Session Memory in the Windows Kernel | <p>While reading the paper Effective Data-Race Detection for the Kernel by
John Erickson and Madanlal Musuvathi. I was stuck on a slightly tricky sentence.</p>

<p>"Similarly, a range of kernel-address space, called session memory, is mapped to different address spaces based on the session the process belo... | concurrency memory management os kernel | 1 | Session Memory in the Windows Kernel -- (concurrency memory management os kernel)
<p>While reading the paper Effective Data-Race Detection for the Kernel by
John Erickson and Madanlal Musuvathi. I was stuck on a slightly tricky sentence.</p>

<p>"Similarly, a range of kernel-address space, called session m... | habedi/stack-exchange-dataset |
25,877 | Simplest argument that language decidable in constant time cannot be $\mathsf{NP}$-hard? | <p>My question is specifically about $\emptyset$, but more generally about any language that can be decided in (deterministic or nondeterministic doesn't really make a difference here) constant time. Obviously, $\emptyset$ cannot be $\mathsf{NP}$-hard since there is nothing to map "yes"-instances to, but I'd prefer a o... | complexity theory np hard constant time | 1 | Simplest argument that language decidable in constant time cannot be $\mathsf{NP}$-hard? -- (complexity theory np hard constant time)
<p>My question is specifically about $\emptyset$, but more generally about any language that can be decided in (deterministic or nondeterministic doesn't really make a difference here) c... | habedi/stack-exchange-dataset |
25,888 | Time cost of thread creation | <p>While creating an algorithm, the following question came up:</p>

<blockquote>
 <p>In uniform cost, what is the time cost of a process that creates a thread?</p>
</blockquote>

<p>Is there a difference between creating a thread in a thread pool vs creating a thread in runtime?</p>

<... | algorithms algorithm analysis runtime analysis threads | 1 | Time cost of thread creation -- (algorithms algorithm analysis runtime analysis threads)
<p>While creating an algorithm, the following question came up:</p>

<blockquote>
 <p>In uniform cost, what is the time cost of a process that creates a thread?</p>
</blockquote>

<p>Is there a difference b... | habedi/stack-exchange-dataset |
25,889 | Set of $\mathsf{NP}$-hard languages closed under set inclusion? | <p>As the title says, my question is whether the set of $\mathsf{NP}$-hard languages is closed under set inclusion, i.e. whether for any $\mathsf{NP}$-hard language $L$, all subsets of $L$ are also $\mathsf{NP}$-hard. <a href="https://cs.stackexchange.com/questions/25877/simplest-argument-that-language-decidable-in-con... | complexity theory np hard closure properties | 1 | Set of $\mathsf{NP}$-hard languages closed under set inclusion? -- (complexity theory np hard closure properties)
<p>As the title says, my question is whether the set of $\mathsf{NP}$-hard languages is closed under set inclusion, i.e. whether for any $\mathsf{NP}$-hard language $L$, all subsets of $L$ are also $\mathsf... | habedi/stack-exchange-dataset |
25,892 | Access control matrices: who are the subjects: users or processes? | <p>I'm studying the basics of security in computers. The doubt I have is that the access control matrix is presented as a matrix whose rows are the subjects and the columns are the objects. Also subjects are defined both in Windows and Unix (and Multics for that matter) as processes, threads, not users, but processes. ... | operating systems security access control | 1 | Access control matrices: who are the subjects: users or processes? -- (operating systems security access control)
<p>I'm studying the basics of security in computers. The doubt I have is that the access control matrix is presented as a matrix whose rows are the subjects and the columns are the objects. Also subjects ar... | habedi/stack-exchange-dataset |
25,901 | Partition area using test function | <p>I am looking for an efficient algorithm that can partition an area $B \subset \mathbb{R}^2$ into disjoint subsets $B = \bigoplus_i U_i$ such that a test function is constant on each of the subsets, $f \vert_{U_i} = \mathrm{const.}$</p>

<p>For example, consider the following partitioning:</p>

<p><im... | algorithms computational geometry partitions | 1 | Partition area using test function -- (algorithms computational geometry partitions)
<p>I am looking for an efficient algorithm that can partition an area $B \subset \mathbb{R}^2$ into disjoint subsets $B = \bigoplus_i U_i$ such that a test function is constant on each of the subsets, $f \vert_{U_i} = \mathrm{const.}$<... | habedi/stack-exchange-dataset |
25,906 | Understanding an algorithm for the gas station problem | <p>In the <em>gas station problem</em> we are given $n$ cities $\{ 0, \ldots, n-1 \}$ and roads between them. Each road has length and each city defines price of the fuel. One unit of road costs one unit of fuel. Our goal is to go from a source to a destination in the cheapest possible way. Our tank is limited by some ... | algorithms graphs recurrence relation | 1 | Understanding an algorithm for the gas station problem -- (algorithms graphs recurrence relation)
<p>In the <em>gas station problem</em> we are given $n$ cities $\{ 0, \ldots, n-1 \}$ and roads between them. Each road has length and each city defines price of the fuel. One unit of road costs one unit of fuel. Our goal ... | habedi/stack-exchange-dataset |
25,914 | What is the name of this prime number algorithm? | <p>Does the following recursive algorithm have a name? If so, what is it?</p>

<pre><code>procedure main():
 myFilter = new Filter( myPrime = 2 ) //first prime number
 print 2 //since it would not otherwise be printed
 for each n in 3 to MAX:
 if myFilter.isPrime(n):
 print n

obj... | algorithms reference request primes | 1 | What is the name of this prime number algorithm? -- (algorithms reference request primes)
<p>Does the following recursive algorithm have a name? If so, what is it?</p>

<pre><code>procedure main():
 myFilter = new Filter( myPrime = 2 ) //first prime number
 print 2 //since it would not otherwise be prin... | habedi/stack-exchange-dataset |
25,924 | LR(0) parsing: how can I know sets of items corresponding to states? | <p>I'm studying LR(0) parser. But I don't understand how sets of items corresponding to states can be calculated. I think The author would miss some information readers must know. Given the following LR(0) automaton, How the set of items corresponding to I1, I2, I3, ... , and I11 can be calculated?</p>

<p><img... | context free parsers | 1 | LR(0) parsing: how can I know sets of items corresponding to states? -- (context free parsers)
<p>I'm studying LR(0) parser. But I don't understand how sets of items corresponding to states can be calculated. I think The author would miss some information readers must know. Given the following LR(0) automaton, How the ... | habedi/stack-exchange-dataset |
25,931 | A variant of the set cover problem: Is that a known problem? | <p>Can this problem be solved in poly time?</p>

<blockquote>
 <p><strong>Input:</strong> $S_i \subset \{1,\cdots,n\}$ for $i=1,\cdots, n$.</p>
 
 <p><strong>Question:</strong> Is it possible to select an $a_i \in S_i$ for each $i=1,\cdots,n$, such that $\{a_1,\cdots,a_n\}=\{1,\cdots,n\}$?</p>&#x... | algorithms complexity theory decision problem polynomial time | 1 | A variant of the set cover problem: Is that a known problem? -- (algorithms complexity theory decision problem polynomial time)
<p>Can this problem be solved in poly time?</p>

<blockquote>
 <p><strong>Input:</strong> $S_i \subset \{1,\cdots,n\}$ for $i=1,\cdots, n$.</p>
 
 <p><strong>Question:</... | habedi/stack-exchange-dataset |
25,932 | Construct grammar given the following language | <p><strong>Construct grammar given the following language!</strong></p>

<p>$ L = \{(ab)^{n+1}u(ba)^n|n>0, l_c(u) = 1, u\in\{a,c,d\}^* \}$</p>

<p>My interpretation in a less accurate way:</p>

<ol>
<li>$(ab)^{n+1}$ says we need to concatenate $(ab)$ at leat one time with itself (since $n... | formal languages formal grammars | 1 | Construct grammar given the following language -- (formal languages formal grammars)
<p><strong>Construct grammar given the following language!</strong></p>

<p>$ L = \{(ab)^{n+1}u(ba)^n|n>0, l_c(u) = 1, u\in\{a,c,d\}^* \}$</p>

<p>My interpretation in a less accurate way:</p>

<ol>
<li>$... | habedi/stack-exchange-dataset |
25,936 | How to show that FPATH is in NL? | <p>Consider this problem:</p>

<p>$\qquad\displaystyle \mathsf{FPATH} = \{\langle G, a_1,\dots,a_n\rangle \mid G \text{ is a digraph with directed path } (a_1,\dots,a_n)\}$</p>

<p>It's allowed to visit nodes outside the sequence, but a1 must be visited before a2 and so on.</p>

<p>I am having b... | algorithms complexity theory space complexity | 1 | How to show that FPATH is in NL? -- (algorithms complexity theory space complexity)
<p>Consider this problem:</p>

<p>$\qquad\displaystyle \mathsf{FPATH} = \{\langle G, a_1,\dots,a_n\rangle \mid G \text{ is a digraph with directed path } (a_1,\dots,a_n)\}$</p>

<p>It's allowed to visit nodes outside the... | habedi/stack-exchange-dataset |
25,940 | Computational complexity vs. Chomsky hierarchy | <p>I'm wondering about the relationship between computational complexity and the Chomsky hierarchy, in general.</p>

<p>In particular, if I know that some problem is NP-complete, does it follow that the <em>language</em> of that problem is not context-free?</p>

<p>For example, the clique problem is NP-... | complexity theory formal languages | 1 | Computational complexity vs. Chomsky hierarchy -- (complexity theory formal languages)
<p>I'm wondering about the relationship between computational complexity and the Chomsky hierarchy, in general.</p>

<p>In particular, if I know that some problem is NP-complete, does it follow that the <em>language</em> of t... | habedi/stack-exchange-dataset |
25,945 | How to logarithmic interpolation? | <p>I'm trying to interpolate a logarithmic function but it always reaches a singularity due to $\log(0)$ being $-\infty$</p>

<p>is there a correct way to interpolate logarithmic functions? (as in correct parameters)</p>

<p>What i'm currently going for is</p>

<p>$y=a+b \log(cx)$</p>

<... | numerical analysis | 1 | How to logarithmic interpolation? -- (numerical analysis)
<p>I'm trying to interpolate a logarithmic function but it always reaches a singularity due to $\log(0)$ being $-\infty$</p>

<p>is there a correct way to interpolate logarithmic functions? (as in correct parameters)</p>

<p>What i'm currently go... | habedi/stack-exchange-dataset |
25,952 | Array-like immutable (persistent) data structure implementation with fast indexing, append, prepend, iteration | <p>I'm looking for a <a href="http://en.wikipedia.org/wiki/Persistent_data_structure" rel="noreferrer">persistent</a> data structure similar to array (but immutable), allowing for fast indexing, append, prepend, and iteration (good locality) operations.</p>

<p>Clojure provides persistent Vector, but it's only ... | data structures functional programming persistent data structure | 1 | Array-like immutable (persistent) data structure implementation with fast indexing, append, prepend, iteration -- (data structures functional programming persistent data structure)
<p>I'm looking for a <a href="http://en.wikipedia.org/wiki/Persistent_data_structure" rel="noreferrer">persistent</a> data structure simila... | habedi/stack-exchange-dataset |
25,959 | is there a sorting algorithm of order $\log n!$ | <p>Is there any sorting algorithm that takes order of $\log n!$ in the worst case? I know that this is the lower bound for sorting algorithms using comparison based sorting. I know that there are algorithms of order $n\log n$, but since $n!$ grows much slower than $n^n$, I wish to know of there is any algorithm of this... | algorithms reference request sorting | 1 | is there a sorting algorithm of order $\log n!$ -- (algorithms reference request sorting)
<p>Is there any sorting algorithm that takes order of $\log n!$ in the worst case? I know that this is the lower bound for sorting algorithms using comparison based sorting. I know that there are algorithms of order $n\log n$, but... | habedi/stack-exchange-dataset |
25,960 | Multiple production rules for expressions of the same type? | <p>I often see syntax like</p>

<pre><code>expression = term | expression, "+" , term;
term = factor | term, "*" , factor;
factor = constant | variable | "(" , expression , ")";
variable = "x" | "y" | "z"; 
</code></pre>

<p>You see, all the rules produce an arithmetic value.... | formal grammars | 1 | Multiple production rules for expressions of the same type? -- (formal grammars)
<p>I often see syntax like</p>

<pre><code>expression = term | expression, "+" , term;
term = factor | term, "*" , factor;
factor = constant | variable | "(" , expression , ")";
variable = "x" | "y" | "z"; &... | habedi/stack-exchange-dataset |
25,967 | How to prove that problem is not in P | <p>Given some abstract problem how can I prove that this problem is not in <code>P</code>. I mean, what is the method for proving such thesis?</p>
 | complexity theory proof techniques polynomial time | 1 | How to prove that problem is not in P -- (complexity theory proof techniques polynomial time)
<p>Given some abstract problem how can I prove that this problem is not in <code>P</code>. I mean, what is the method for proving such thesis?</p>
 | habedi/stack-exchange-dataset |
25,968 | The Gas Station Problem - fast implementation | <p>Recently I was asking about the algorithm to solve <a href="https://cs.stackexchange.com/questions/25906/the-gas-station-problem">The Gas Station Problem</a> and I got useful answer. Unfortunately solution with transforming a graph to complete graph and then preparing another one to find the shortest path (as descri... | algorithms graphs recurrence relation dynamic programming | 1 | The Gas Station Problem - fast implementation -- (algorithms graphs recurrence relation dynamic programming)
<p>Recently I was asking about the algorithm to solve <a href="https://cs.stackexchange.com/questions/25906/the-gas-station-problem">The Gas Station Problem</a> and I got useful answer. Unfortunately solution wi... | habedi/stack-exchange-dataset |
25,970 | Why is it necessary to use binary numbers in logspace? | <p>I have noticed that a lot of problems that are in L and NL use binary numbers. I don't understand why this is the case. Does a TM use less space by storing a binary number, than a "normal" one. In my head, it uses less space to store the number 0, than the binary ecquivalent number 0000. Hope someone can help me und... | space complexity | 1 | Why is it necessary to use binary numbers in logspace? -- (space complexity)
<p>I have noticed that a lot of problems that are in L and NL use binary numbers. I don't understand why this is the case. Does a TM use less space by storing a binary number, than a "normal" one. In my head, it uses less space to store the nu... | habedi/stack-exchange-dataset |
25,977 | Understanding Tiernan's Algorithm | <p>I am currently working through Tiernan's paper, "An efficient search algorithm to find the elementary circuits of a graph" (published 1970), and I am stuck on point 3 of the following excerpt:</p>

<blockquote>
 <p>The algorithm is named EC for "elementary circuit." The function blocks of EC are denoted... | algorithms graphs | 1 | Understanding Tiernan's Algorithm -- (algorithms graphs)
<p>I am currently working through Tiernan's paper, "An efficient search algorithm to find the elementary circuits of a graph" (published 1970), and I am stuck on point 3 of the following excerpt:</p>

<blockquote>
 <p>The algorithm is named EC for "e... | habedi/stack-exchange-dataset |
25,988 | Does spectral graph theory say anything about graph isomorphism | <p>Is there research or are there results that discuss graph isomorphism in the context of spectral graph theory?</p>

<p>Two known theorems of spectral graph theory are:</p>

<ol>
<li><p>Two graphs are called isospectral or cospectral if the adjacency matrices of the graphs have equal multisets of ... | graphs linear algebra | 1 | Does spectral graph theory say anything about graph isomorphism -- (graphs linear algebra)
<p>Is there research or are there results that discuss graph isomorphism in the context of spectral graph theory?</p>

<p>Two known theorems of spectral graph theory are:</p>

<ol>
<li><p>Two graphs are called... | habedi/stack-exchange-dataset |
26,009 | Is $L_p$ decidable when p is a trivial property? | <p>If </p>

<p>$\qquad\displaystyle L_p = \{ \langle M \rangle : p \in P(L(M)) \text{ s.t. } p \text{ is a specific trivial property} \}$, </p>

<p>where a trivial property is a property that is shared by <em>all</em> recursively enumerable languages or is <em>not</em> a property of <em>any</em> recursi... | computability | 1 | Is $L_p$ decidable when p is a trivial property? -- (computability)
<p>If </p>

<p>$\qquad\displaystyle L_p = \{ \langle M \rangle : p \in P(L(M)) \text{ s.t. } p \text{ is a specific trivial property} \}$, </p>

<p>where a trivial property is a property that is shared by <em>all</em> recursively enumer... | habedi/stack-exchange-dataset |
26,015 | Having trouble with turing machine over language $L = \{0^n 1^m 0^n 1^m \mid m,n \geq 0\}$ | <p>I am having trouble giving the description of a Turing machine that goes for
$L = \{0^n 1^m 0^n 1^m \mid m,n \geq 0\}$. What I have so far is:</p>

<p>If we start with a blank, the string is empty and it should accept, if not, start reading $0$s and I thought marking the $0$s with $X$ and the $1$s with $... | turing machines | 1 | Having trouble with turing machine over language $L = \{0^n 1^m 0^n 1^m \mid m,n \geq 0\}$ -- (turing machines)
<p>I am having trouble giving the description of a Turing machine that goes for
$L = \{0^n 1^m 0^n 1^m \mid m,n \geq 0\}$. What I have so far is:</p>

<p>If we start with a blank, the string is em... | habedi/stack-exchange-dataset |
26,019 | Confusion in Reducibility | <p>In Sipser's Theory of Computation book, it is stated while reducing A<sub>TM</sub> to REGULAR<sub>TM</sub></p>

<blockquote>
 <p>We let R be a TM that decides REGULAR<sub>TM</sub> and construct TM S to
 decide A<sub>TM</sub>. Then S works in the following manner.</p>
</blockquote>

<p>S... | computability turing machines reductions | 1 | Confusion in Reducibility -- (computability turing machines reductions)
<p>In Sipser's Theory of Computation book, it is stated while reducing A<sub>TM</sub> to REGULAR<sub>TM</sub></p>

<blockquote>
 <p>We let R be a TM that decides REGULAR<sub>TM</sub> and construct TM S to
 decide A<sub>TM</sub>. T... | habedi/stack-exchange-dataset |
26,026 | Ideas for CS-related challenge for teams of high school students? | <p>I am helping design a CS-related activity for a <a href="http://www.letstalkscience.ca">Let's Talk Science</a> competition, which promotes STEM amongst high school students. In the competition, teams of six students will move from station to station, trying to complete each as quickly as possible.</p>

<p>On... | education | 1 | Ideas for CS-related challenge for teams of high school students? -- (education)
<p>I am helping design a CS-related activity for a <a href="http://www.letstalkscience.ca">Let's Talk Science</a> competition, which promotes STEM amongst high school students. In the competition, teams of six students will move from stati... | habedi/stack-exchange-dataset |
26,027 | Number of Different AVL Tree | <p>I studying the related question.</p>

<p><a href="https://stackoverflow.com/questions/13500560/number-of-ways-to-create-an-avl-tree-with-n-nodes-and-l-leaf-node">https://stackoverflow.com/questions/13500560/number-of-ways-to-create-an-avl-tree-with-n-nodes-and-l-leaf-node</a> </p>

<p>but it's not so... | algorithms graphs data structures trees binary trees | 1 | Number of Different AVL Tree -- (algorithms graphs data structures trees binary trees)
<p>I studying the related question.</p>

<p><a href="https://stackoverflow.com/questions/13500560/number-of-ways-to-create-an-avl-tree-with-n-nodes-and-l-leaf-node">https://stackoverflow.com/questions/13500560/number-of-ways-... | habedi/stack-exchange-dataset |
26,044 | Space complexity problem, relation between $DSPACE(log^kn)$ and $DSPACE(log^{k+1}n)$ | <p>I need help with the following:<br>
Let $k\in \mathbb{N}$, define:<br>
$L^k=DSPACE(O(log^k(n)))$<br>
$NL^k=NSPACE(O(log^k(n)))$<br>
and:<br>
$PolyL=\bigcup_{k=1}^{\infty}L^k$<br>
$PolyNL=\bigcup_{k=1}^{\infty}NL^k$ </p>

<p>I need to prove, disprove or to determine if it is an open q... | space complexity | 1 | Space complexity problem, relation between $DSPACE(log^kn)$ and $DSPACE(log^{k+1}n)$ -- (space complexity)
<p>I need help with the following:<br>
Let $k\in \mathbb{N}$, define:<br>
$L^k=DSPACE(O(log^k(n)))$<br>
$NL^k=NSPACE(O(log^k(n)))$<br>
and:<br>
$PolyL=\bigcup_{k=1}^{\infty}L^k$<br>
$PolyNL... | habedi/stack-exchange-dataset |
26,047 | Shortest even path that goes through a vertex | <p>Given an undirected and connected graph $G=(V,E)$ and two vertices $s,t$ and a vertex $d \in V- \{s,t\}$, we would like to define a legal path as a path from $s$ to $t$, passes through $d$ (at least once) and is of even length (regarding number of edges). </p>

<p>We need to find such a path that is the <st... | algorithms graphs | 1 | Shortest even path that goes through a vertex -- (algorithms graphs)
<p>Given an undirected and connected graph $G=(V,E)$ and two vertices $s,t$ and a vertex $d \in V- \{s,t\}$, we would like to define a legal path as a path from $s$ to $t$, passes through $d$ (at least once) and is of even length (regarding number of ... | habedi/stack-exchange-dataset |
26,071 | Running algorithms in parallel | <p>I'm doing a course in Computational Number Theory and am currently looking at algorithms such as Euclid's algorithm, Square-roots modulo a prime, LLL reduction algorithm, McKee's method, Pollard's $p-1$ method, the elliptic curve method and a couple of others.</p>

<p>In an assignment, I'm asked the followin... | parallel computing | 1 | Running algorithms in parallel -- (parallel computing)
<p>I'm doing a course in Computational Number Theory and am currently looking at algorithms such as Euclid's algorithm, Square-roots modulo a prime, LLL reduction algorithm, McKee's method, Pollard's $p-1$ method, the elliptic curve method and a couple of others.</... | habedi/stack-exchange-dataset |
26,076 | Demonstration that every finite set is computable | <p>What is the best demonstration that show that "Every finite set is computable"?</p>

<p>thanks</p>
 | complexity theory computability | 1 | Demonstration that every finite set is computable -- (complexity theory computability)
<p>What is the best demonstration that show that "Every finite set is computable"?</p>

<p>thanks</p>
 | habedi/stack-exchange-dataset |
26,084 | Using induction to prove a big O notation | <p>I'm trying to prove that the following recurrence relation has a runtime of <code>O(n)</code>:</p>

<pre><code> fac(0) = 1
 fac(n+1) = (n + 1) * fac(n)
</code></pre>

<p>I think that I can use induction in the following manner:</p>

<p><strong>Base case</strong></p>

<p>If <... | complexity theory asymptotics | 1 | Using induction to prove a big O notation -- (complexity theory asymptotics)
<p>I'm trying to prove that the following recurrence relation has a runtime of <code>O(n)</code>:</p>

<pre><code> fac(0) = 1
 fac(n+1) = (n + 1) * fac(n)
</code></pre>

<p>I think that I can use induction in the foll... | habedi/stack-exchange-dataset |
26,087 | writing a Context free grammar for a language | <p>Hi I have two question about this language:
<strong>L = {a^i b^j c^k | i = 2*j OR j=2*k }</strong></p>

<p>1)Finding a CFG </p>

<p>2)If in condition part we put <strong>AND</strong> instead of <strong>OR</strong> , is this language remains <strong>CONTEXT FREE</strong> or not ??</p>

<... | context free automata pushdown automata | 1 | writing a Context free grammar for a language -- (context free automata pushdown automata)
<p>Hi I have two question about this language:
<strong>L = {a^i b^j c^k | i = 2*j OR j=2*k }</strong></p>

<p>1)Finding a CFG </p>

<p>2)If in condition part we put <strong>AND</strong> instead of <strong>OR... | habedi/stack-exchange-dataset |
26,098 | In memory paging, how does the S.O. know where the page is in secondary Memory? | <p>So every process has its own Page Table, the page table references the frame where the page is in physical memory and also has a valid-invalid bit that tells whether it is in physical memory or in secondary memory. </p>

<p>But how does the S.O. knows exactly where the page is saved when the valid-invalid bi... | memory management virtual memory | 1 | In memory paging, how does the S.O. know where the page is in secondary Memory? -- (memory management virtual memory)
<p>So every process has its own Page Table, the page table references the frame where the page is in physical memory and also has a valid-invalid bit that tells whether it is in physical memory or in se... | habedi/stack-exchange-dataset |
26,100 | (AVL Trees) What is the maximum possible difference between the number of nodes in the root node's subtrees? | <p>Question: If an AVL tree has height h (assume h ≥ 2), what is the maximum possible difference between the number of nodes in its two subtrees? Prove your answer. Your answer should not use big-Oh or big-Theta.</p>

<p>I drew six trees and drew the max number of nodes I could on one tree and the min number of ... | data structures search trees | 1 | (AVL Trees) What is the maximum possible difference between the number of nodes in the root node's subtrees? -- (data structures search trees)
<p>Question: If an AVL tree has height h (assume h ≥ 2), what is the maximum possible difference between the number of nodes in its two subtrees? Prove your answer. Your answer s... | habedi/stack-exchange-dataset |
26,111 | Proving DPATH is NP-complete by a reduction from HAMPATH | <p>I have a language DPATH that I'm trying to complete is NP-complete. </p>

<pre><code>DPATH = {<G, a1,...,an>|G is a digraph with a directed path that covers the sequence
a1,...,an}
</code></pre>

<p>All of the nodes in the sequence has to be visited exactly one time, but it doesn't matt... | complexity theory np complete reductions hamiltonian path | 1 | Proving DPATH is NP-complete by a reduction from HAMPATH -- (complexity theory np complete reductions hamiltonian path)
<p>I have a language DPATH that I'm trying to complete is NP-complete. </p>

<pre><code>DPATH = {<G, a1,...,an>|G is a digraph with a directed path that covers the sequence
a1,...,an... | habedi/stack-exchange-dataset |
26,115 | Why is this language over {a,b,c} regular? | <p>The language of all words over the alphabet {a,b,c} such that </p>

<ul>
<li>the number of as in the word </li>
<li>minus the number of cs in the word </li>
</ul>

<p>is divisible by three. </p>

<p>How is this language regular? Lecturer notes says that it is, and then provides no... | formal languages regular languages | 1 | Why is this language over {a,b,c} regular? -- (formal languages regular languages)
<p>The language of all words over the alphabet {a,b,c} such that </p>

<ul>
<li>the number of as in the word </li>
<li>minus the number of cs in the word </li>
</ul>

<p>is divisible by three. </p>

<p... | habedi/stack-exchange-dataset |
26,119 | Why is the throughput (performance) of the Slotted Aloha protocol ≈ 0.36 | <p>I've read that the throughput - that is, the amount of good useful messages relative to capacity - of the Slotted ALOHA protocol for communication networks is roughly 0.36%.</p>

<p>But its not clear how we arrived at that number.</p>

<p>Can someone explain it?</p>
 | computer networks performance communication protocols | 1 | Why is the throughput (performance) of the Slotted Aloha protocol ≈ 0.36 -- (computer networks performance communication protocols)
<p>I've read that the throughput - that is, the amount of good useful messages relative to capacity - of the Slotted ALOHA protocol for communication networks is roughly 0.36%.</p>
&#x... | habedi/stack-exchange-dataset |
26,123 | Are cache contents specific to a process? | <p>Suppose the L1 cache is filled up with data from some process. Now CPU loads another process. Does the new process share cache contents? Or the cache has to be invalidated completely in each context switch?</p>
 | computer architecture operating systems cpu cache | 1 | Are cache contents specific to a process? -- (computer architecture operating systems cpu cache)
<p>Suppose the L1 cache is filled up with data from some process. Now CPU loads another process. Does the new process share cache contents? Or the cache has to be invalidated completely in each context switch?</p>
 | habedi/stack-exchange-dataset |
26,125 | Is the length of the shortest quine in a programming language computable? | <p>The length of the shortest program in a given (fixed) programming language that produces a given output is that output's Kolmogorov complexity, which is not a computable function on the set of possible outputs.</p>

<p>This is a classical result and is easily proven; a proof outline appears in <a href="http:... | computability optimization kolmogorov complexity | 1 | Is the length of the shortest quine in a programming language computable? -- (computability optimization kolmogorov complexity)
<p>The length of the shortest program in a given (fixed) programming language that produces a given output is that output's Kolmogorov complexity, which is not a computable function on the set... | habedi/stack-exchange-dataset |
26,131 | Find longest common substring using a rolling hash | <p>The longest common substring (LCS) of two input strings $s,t$ is a common substring (in both of them) of maximum length. We can relax the constraints to generalize the problem: find a common substring of length $k$. We can then use binary search to find the maximum $k$. This takes time $\cal O(n \lg n)$ provided tha... | strings hash substrings longest common substring rolling hash | 1 | Find longest common substring using a rolling hash -- (strings hash substrings longest common substring rolling hash)
<p>The longest common substring (LCS) of two input strings $s,t$ is a common substring (in both of them) of maximum length. We can relax the constraints to generalize the problem: find a common substrin... | habedi/stack-exchange-dataset |
26,133 | Sorting numbers in $O(1)$ | <p>Here is an experiment I came up with (I don't have sufficient material to make it):</p>

<p>Say that, you have a list of $n$ numbers $L = \{l_1, l_2, ..., l_n\}$.<br>
And you have bars representing those numbers like so:</p>

<p><img src="https://i.stack.imgur.com/IXpCi.png" alt="enter image desc... | algorithms algorithm analysis time complexity sorting | 1 | Sorting numbers in $O(1)$ -- (algorithms algorithm analysis time complexity sorting)
<p>Here is an experiment I came up with (I don't have sufficient material to make it):</p>

<p>Say that, you have a list of $n$ numbers $L = \{l_1, l_2, ..., l_n\}$.<br>
And you have bars representing those numbers like so:... | habedi/stack-exchange-dataset |
26,141 | floating point normalised value of -1 | <p>I have, lets say, 8 bits mantissa and 4 bit exponent. Then,</p>

<p><code>-1=1111 1111</code>
there are no 0s so how can I normalise -1 in 2's complement form?</p>
 | floating point number formats | 1 | floating point normalised value of -1 -- (floating point number formats)
<p>I have, lets say, 8 bits mantissa and 4 bit exponent. Then,</p>

<p><code>-1=1111 1111</code>
there are no 0s so how can I normalise -1 in 2's complement form?</p>
 | habedi/stack-exchange-dataset |
26,148 | Create a random graph based on the Degree Distribution and Clustering Coefficient Distribution | <p>I am currently working with a very large Social Network and I want to recreate this graph with a smaller dimension, using the original Degree Distribution and Clustering Coefficient Distribution.</p>

<p>The degree distribution is the relative frequency of vertexes in the original graph that have a certain d... | algorithms graphs social networks | 1 | Create a random graph based on the Degree Distribution and Clustering Coefficient Distribution -- (algorithms graphs social networks)
<p>I am currently working with a very large Social Network and I want to recreate this graph with a smaller dimension, using the original Degree Distribution and Clustering Coefficient D... | habedi/stack-exchange-dataset |
26,158 | Formal language inverse | <p>How can you specify the "inverse" of a word, so:
let's say a word consists of a's and b's the language is:
$ww^{-1}$
the second word is the same as the first but every a is replaced by b and every b by a</p>
 | formal languages terminology | 1 | Formal language inverse -- (formal languages terminology)
<p>How can you specify the "inverse" of a word, so:
let's say a word consists of a's and b's the language is:
$ww^{-1}$
the second word is the same as the first but every a is replaced by b and every b by a</p>
 | habedi/stack-exchange-dataset |
26,164 | Real life description for (~A->A)->A | <p>It can be shown that the logical preposition [ :- (~A->A)->A ] is a theorem (always true).
I want to know if anybody knows a real life description for the preposition above?
I mean an expression in computer, economics, mathematics, politics or anything that fits in that preposition.</p>
 | logic intuition propositional logic | 1 | Real life description for (~A->A)->A -- (logic intuition propositional logic)
<p>It can be shown that the logical preposition [ :- (~A->A)->A ] is a theorem (always true).
I want to know if anybody knows a real life description for the preposition above?
I mean an expression in computer, economics, mathematics,... | habedi/stack-exchange-dataset |
26,181 | directed graph data structure with fast in/out neighbor query | <p>If I store a directed graph <span class="math-container">$G$</span> in adjacency list format, one can find all the out-neighbors <span class="math-container">$j$</span> of a given vertex <span class="math-container">$i$</span> in <span class="math-container">$\mathcal O(d)$</span> time, where <span class="math-conta... | graphs data structures efficiency | 1 | directed graph data structure with fast in/out neighbor query -- (graphs data structures efficiency)
<p>If I store a directed graph <span class="math-container">$G$</span> in adjacency list format, one can find all the out-neighbors <span class="math-container">$j$</span> of a given vertex <span class="math-container">... | habedi/stack-exchange-dataset |
26,182 | Lower-bounding the Membership Problem in the Bitprobe Model | <p>I am working through the following paper "Data Structures for Storing Small Sets in the Bitprobe Model" by Radhakrishnan et al. and am confused regarding one of their arguments about a lower bound.</p>

<p>In particular, they are trying to show that $s_A(2, m, 2) \in \Omega(m^{4/7})$. That is, the goal is to... | data structures sets lower bounds | 1 | Lower-bounding the Membership Problem in the Bitprobe Model -- (data structures sets lower bounds)
<p>I am working through the following paper "Data Structures for Storing Small Sets in the Bitprobe Model" by Radhakrishnan et al. and am confused regarding one of their arguments about a lower bound.</p>

<p>In p... | habedi/stack-exchange-dataset |
26,206 | What algorithms exist for solving natural number linear systems? | <p>I'm looking at the following problem:</p>

<p>Given $n$-dimensional vectors of natural numbers $v_1, \ldots, v_m$ and some input vector $u$, is $u$ a linear combination of the $v_i$'s with natural number coefficients?</p>

<p>i.e. are there some $t_1, \ldots, t_m \in \mathbb{N}$ where $u = t_1 v_1 + ... | algorithms reference request linear algebra integers knapsack problems | 1 | What algorithms exist for solving natural number linear systems? -- (algorithms reference request linear algebra integers knapsack problems)
<p>I'm looking at the following problem:</p>

<p>Given $n$-dimensional vectors of natural numbers $v_1, \ldots, v_m$ and some input vector $u$, is $u$ a linear combination... | habedi/stack-exchange-dataset |
26,212 | Paths between tuples, MSV, decision trees | <p>I'm reading about Multiset Size Verification Problem and in the following paper - <a href="http://www.skynet.ie/~sos/mapviewer/docs/Voronoi_Diagram_Notes_2.pdf" rel="nofollow">http://www.skynet.ie/~sos/mapviewer/docs/Voronoi_Diagram_Notes_2.pdf</a> - I got stuck just on the first lemma. However, since my concrete pr... | decision problem | 1 | Paths between tuples, MSV, decision trees -- (decision problem)
<p>I'm reading about Multiset Size Verification Problem and in the following paper - <a href="http://www.skynet.ie/~sos/mapviewer/docs/Voronoi_Diagram_Notes_2.pdf" rel="nofollow">http://www.skynet.ie/~sos/mapviewer/docs/Voronoi_Diagram_Notes_2.pdf</a> - I ... | habedi/stack-exchange-dataset |
26,214 | Need an algorithm to find the input factors that are most affecting the output | <p>I apologize if this question is already answered and appreciate any pointers to existing answers. I'm not familiar with statistical or data mining terms so my search was limited to basic words used in the title of this question. I did look at some algorithms but could not decide if they serve the purpose. </p>
&... | algorithms machine learning data mining statistics | 1 | Need an algorithm to find the input factors that are most affecting the output -- (algorithms machine learning data mining statistics)
<p>I apologize if this question is already answered and appreciate any pointers to existing answers. I'm not familiar with statistical or data mining terms so my search was limited to b... | habedi/stack-exchange-dataset |
26,216 | Advantage of MTZ problem formulation of TSP | <p>In class, we saw <a href="http://docs.mosek.com/6.0/capi/node015.html" rel="nofollow">the Miller-Tucker-Zemlin formulation</a> of the Travelling Salesmen Problem (TSP). MTZ is a way of formulating the TSP as an integer linear programming instance.</p>

<p>I understand how MTZ works, but I'm confused why MTZ... | algorithms linear programming traveling salesman integer programming | 1 | Advantage of MTZ problem formulation of TSP -- (algorithms linear programming traveling salesman integer programming)
<p>In class, we saw <a href="http://docs.mosek.com/6.0/capi/node015.html" rel="nofollow">the Miller-Tucker-Zemlin formulation</a> of the Travelling Salesmen Problem (TSP). MTZ is a way of formulating t... | habedi/stack-exchange-dataset |
26,223 | Definition of the cyclic shift of a formal language? | <p>Wikipedia says, the context-free languages are closed under</p>

<blockquote>
 <p>the cyclic shift of $L$ (the language $\{vu : uv \in L \}$)</p>
</blockquote>

<p>So I am looking for the definition of the cyclic shift operation on formal languages.</p>

<p>From the quote, what are r... | formal languages | 1 | Definition of the cyclic shift of a formal language? -- (formal languages)
<p>Wikipedia says, the context-free languages are closed under</p>

<blockquote>
 <p>the cyclic shift of $L$ (the language $\{vu : uv \in L \}$)</p>
</blockquote>

<p>So I am looking for the definition of the cyclic shif... | habedi/stack-exchange-dataset |
26,227 | Algorithm to match timestamped events from two sources | <p>does a good known algorithm exists for this problem?</p>

<p>On input I have two series of timestamps "when the event was observed". Theoretically the recorded timestamps should be very well aligned.</p>

<p>Visualized ideal situation on two time lines "s" and "r" as recorded from the two devices:&#x... | algorithms matching | 1 | Algorithm to match timestamped events from two sources -- (algorithms matching)
<p>does a good known algorithm exists for this problem?</p>

<p>On input I have two series of timestamps "when the event was observed". Theoretically the recorded timestamps should be very well aligned.</p>

<p>Visualized id... | habedi/stack-exchange-dataset |
26,236 | Efficient search with removal | <p>I want to search from a given set of elements. Along with that I also want to remove that searched element. The problem is that the number of these queries is $q=O(n)$, where $n$ is the number of total elements. Which data structure should I use. Also, I want to avoid hashing.</p>
 | algorithms data structures | 1 | Efficient search with removal -- (algorithms data structures)
<p>I want to search from a given set of elements. Along with that I also want to remove that searched element. The problem is that the number of these queries is $q=O(n)$, where $n$ is the number of total elements. Which data structure should I use. Also, I ... | habedi/stack-exchange-dataset |
26,249 | Is there a software algorithm that can generate a non-deterministic chaos pattern? | <p>Is there a software algorithm can generate a <strong>non-deterministic</strong> pattern or sequence? In <a href="http://en.wikipedia.org/wiki/Chaos_theory" rel="nofollow noreferrer">Chaos theory</a>, simple processes can create <em>deterministic</em> patterns, and psudo-random number generators can generate determin... | randomized algorithms nondeterminism | 1 | Is there a software algorithm that can generate a non-deterministic chaos pattern? -- (randomized algorithms nondeterminism)
<p>Is there a software algorithm can generate a <strong>non-deterministic</strong> pattern or sequence? In <a href="http://en.wikipedia.org/wiki/Chaos_theory" rel="nofollow noreferrer">Chaos theo... | habedi/stack-exchange-dataset |
26,252 | Random algorithm termination | <p>Suppose I have an algorithm that works as follows when invoked: it calls itself recursively with probability $0 < p < 1$ and terminates with probability $1-p$. Does this algorithm terminate? On the one hand you can show that $\lim_{n \to \infty}p^n = 0$, so it must terminate at some point before infinity. On t... | algorithms terminology randomized algorithms | 1 | Random algorithm termination -- (algorithms terminology randomized algorithms)
<p>Suppose I have an algorithm that works as follows when invoked: it calls itself recursively with probability $0 < p < 1$ and terminates with probability $1-p$. Does this algorithm terminate? On the one hand you can show that $\lim_{... | habedi/stack-exchange-dataset |
26,254 | Can heuristic methods and machine learning approaches be considered alternate methods to solve NP-Complete problems? | <p>I was watching the videos from <a href="http://www.algorithm.cs.sunysb.edu/computationalbiology/" rel="nofollow">Skiena's Computational Biology Lectures</a>, which is also available at youtube. In those videos, the professor made a statement that, most of the problems posed to computer scientists by biologists were ... | machine learning heuristics | 1 | Can heuristic methods and machine learning approaches be considered alternate methods to solve NP-Complete problems? -- (machine learning heuristics)
<p>I was watching the videos from <a href="http://www.algorithm.cs.sunysb.edu/computationalbiology/" rel="nofollow">Skiena's Computational Biology Lectures</a>, which is ... | habedi/stack-exchange-dataset |
26,262 | What is the significance of the vector dimension in semidefinite programming relaxations? | <p>Let's say that we want to design a semi-definite programming approximation for an optimization problem such as MAX-CUT or MAX-SAT or what have you. </p>

<p>So, we first write down an integer quadratic program that solves the problem exactly. For example, in the case of MAX-CUT we would write:
$$
\ma... | optimization approximation max cut | 1 | What is the significance of the vector dimension in semidefinite programming relaxations? -- (optimization approximation max cut)
<p>Let's say that we want to design a semi-definite programming approximation for an optimization problem such as MAX-CUT or MAX-SAT or what have you. </p>

<p>So, we first write dow... | habedi/stack-exchange-dataset |
26,264 | To show that a graph-problem is in $L$ or $NL$ | <p>Consider the following problem: </p>

<p>$$A=\left\{ (G(V,E),s,t)\mid\text{conditions 1, 2, 3 and 4 hold} \right\}$$</p>

<ol>
<li>$G$ is a directed graph.</li>
<li>$s,t\in V$.</li>
<li>There is a simple path from $s$ to $t$ (a simple path is a path that visits every vertex not more than... | complexity theory graphs | 1 | To show that a graph-problem is in $L$ or $NL$ -- (complexity theory graphs)
<p>Consider the following problem: </p>

<p>$$A=\left\{ (G(V,E),s,t)\mid\text{conditions 1, 2, 3 and 4 hold} \right\}$$</p>

<ol>
<li>$G$ is a directed graph.</li>
<li>$s,t\in V$.</li>
<li>There is a simple path fr... | habedi/stack-exchange-dataset |
26,265 | Conditional RB Tree union | <p><strong>Input:</strong> 2 RB Trees A B, so that both values in a certain range, so that B's range is smaller than A in both sides. Ex. B's range can be [100...200] and A's range is [0...1000]<br>
<strong>Output:</strong> Unite A and B to one RB Tree AB.</p>

<p>How can I unite these 2 trees in $O(log(n)... | algorithms graphs | 1 | Conditional RB Tree union -- (algorithms graphs)
<p><strong>Input:</strong> 2 RB Trees A B, so that both values in a certain range, so that B's range is smaller than A in both sides. Ex. B's range can be [100...200] and A's range is [0...1000]<br>
<strong>Output:</strong> Unite A and B to one RB Tree AB.</p>
&... | habedi/stack-exchange-dataset |
26,266 | Does the AND-compression of SAT depends on the number of SAT instances? | <p><a href="http://arxiv.org/abs/1405.4472" rel="nofollow">From a paper</a></p>

<blockquote>
 <p>An AND-compression is a deterministic polynomial-time algorithm that maps a set of SAT-instances $x_1,\dots,x_t$ to a single SAT-instance $y$ of size $poly(\max |x_i|)$ such that $y$ is satisfiable if and only... | satisfiability | 1 | Does the AND-compression of SAT depends on the number of SAT instances? -- (satisfiability)
<p><a href="http://arxiv.org/abs/1405.4472" rel="nofollow">From a paper</a></p>

<blockquote>
 <p>An AND-compression is a deterministic polynomial-time algorithm that maps a set of SAT-instances $x_1,\dots,x_t$ to a... | habedi/stack-exchange-dataset |
26,268 | Size of the instance of a problem | <p>I am unable to find a clear definition of term "size of the instance" when considering some algorithmic problem. I came accross a definition that said, that "Size of the instance corresponds to the size of the input array of numbers (in case the input is numeric) or size of the representation of the input."</p>
... | algorithms algorithm analysis | 1 | Size of the instance of a problem -- (algorithms algorithm analysis)
<p>I am unable to find a clear definition of term "size of the instance" when considering some algorithmic problem. I came accross a definition that said, that "Size of the instance corresponds to the size of the input array of numbers (in case the in... | habedi/stack-exchange-dataset |
26,271 | Finding all (weighted) cycles through a given vertex | <p>For a connected undirected graph $G$, given a particular vertex $v$, is there a known (efficient) algorithm to find all simple cycles in $G$ that contain $v$?</p>

<p>In my case, I have weights for every edge. Ideally I'd like to be able to compute, for every $v \in V(G)$, the product of the edge weights ov... | algorithms graphs | 1 | Finding all (weighted) cycles through a given vertex -- (algorithms graphs)
<p>For a connected undirected graph $G$, given a particular vertex $v$, is there a known (efficient) algorithm to find all simple cycles in $G$ that contain $v$?</p>

<p>In my case, I have weights for every edge. Ideally I'd like to be... | habedi/stack-exchange-dataset |
26,277 | Counting the number of instructions in an instruction set | <blockquote>
 <p>An imaginary processor has the following hardware 
 specification:</p>
 
 <ul>
 <li>8bit data bus</li>
 <li>12bit address bus</li>
 <li>32 × 8bit general purpose registers e.g. <code>S0</code> – <code>S1F</code> </li>
 </ul>
 
 <p>Briefly describe what ... | computer architecture | 1 | Counting the number of instructions in an instruction set -- (computer architecture)
<blockquote>
 <p>An imaginary processor has the following hardware 
 specification:</p>
 
 <ul>
 <li>8bit data bus</li>
 <li>12bit address bus</li>
 <li>32 × 8bit general purpose registers e.g. <code>... | habedi/stack-exchange-dataset |
26,278 | How does one choose an optimal alphabet for finding a Huffman encoding? | <p>Huffman encoding will perform best when the distribution of symbols of an alphabet that the string to be encoded uses is dyadic.</p>

<p>Given an arbitrary bit string <code>S</code>, how can we find the best alphabet for encoding? Suppose <code>S</code> is an ASCII file. Then given the regularity of 1-byte c... | data compression encoding scheme | 1 | How does one choose an optimal alphabet for finding a Huffman encoding? -- (data compression encoding scheme)
<p>Huffman encoding will perform best when the distribution of symbols of an alphabet that the string to be encoded uses is dyadic.</p>

<p>Given an arbitrary bit string <code>S</code>, how can we find ... | habedi/stack-exchange-dataset |
26,287 | Conditional LCS problem | <p>A producer wants to arrange couples of boys and girls for a dance.<br>
There are n boys arranged in a row [A1...An] in some certain order and n girls arranged in a different row [B1...Bn], also in some certain order.
Only a couple in which there is a boy and a girl with exactly the same height can dance.<br>... | algorithms strings | 1 | Conditional LCS problem -- (algorithms strings)
<p>A producer wants to arrange couples of boys and girls for a dance.<br>
There are n boys arranged in a row [A1...An] in some certain order and n girls arranged in a different row [B1...Bn], also in some certain order.
Only a couple in which there is a boy and a ... | habedi/stack-exchange-dataset |
26,292 | Find longest path between two disjoint sub-sets of vertices $V_1, V_2 \subset V$ of a Graph | <p>I have a homework question which I would appreciate some help with:</p>
<blockquote>
<p>Let there be a DAG <span class="math-container">$G=(V,E)$</span> with positive weights. For every two different vertices <span class="math-container">$v_1, v_2$</span> we will define <span class="math-container">$D(v_1, v... | algorithms graphs data structures shortest path | 1 | Find longest path between two disjoint sub-sets of vertices $V_1, V_2 \subset V$ of a Graph -- (algorithms graphs data structures shortest path)
<p>I have a homework question which I would appreciate some help with:</p>
<blockquote>
<p>Let there be a DAG <span class="math-container">$G=(V,E)$</span> with positi... | habedi/stack-exchange-dataset |
26,296 | Time complexity of Dynamic Array via repeated doubling | <p>When we implement dynamic array via repeated doubling (if the current array is full) we simply create a new array that is double the current array size and copy the previous elements and then add the new one? Correct?</p>

<p>So to compute the complexity we have 1 + 2 + 4 + 8 + .... number of steps? Correct?... | complexity theory time complexity asymptotics arrays | 1 | Time complexity of Dynamic Array via repeated doubling -- (complexity theory time complexity asymptotics arrays)
<p>When we implement dynamic array via repeated doubling (if the current array is full) we simply create a new array that is double the current array size and copy the previous elements and then add the new ... | habedi/stack-exchange-dataset |
26,299 | Building a Red Black tree out of a sorted array | <p>If I have a sorted array of size $n$, can I build a Red Black tree out of it in $O(n)$ time in a different algorithm rather than splitting the tree in half every time or the straightforward way that was mentioned in one of the answers?</p>
 | data structures search trees | 1 | Building a Red Black tree out of a sorted array -- (data structures search trees)
<p>If I have a sorted array of size $n$, can I build a Red Black tree out of it in $O(n)$ time in a different algorithm rather than splitting the tree in half every time or the straightforward way that was mentioned in one of the answers?... | habedi/stack-exchange-dataset |
26,305 | Correctness of proof by induction | <p>Suppose a person states the following: $n^2 = (n * n), \forall n > 0$. One can check such equality by saying, via proof by induction, that:</p>

<ul>
<li>for $n := 0:\ 0^2 = (0 * 0)$;</li>
<li>for $n := 1:\ 1^2 = (1 * 1)$;</li>
<li><p>and for $n := n + 1:$</p>

<p>$\ (n + 1)^2 = ((n + ... | proof techniques induction | 1 | Correctness of proof by induction -- (proof techniques induction)
<p>Suppose a person states the following: $n^2 = (n * n), \forall n > 0$. One can check such equality by saying, via proof by induction, that:</p>

<ul>
<li>for $n := 0:\ 0^2 = (0 * 0)$;</li>
<li>for $n := 1:\ 1^2 = (1 * 1)$;</li>
... | habedi/stack-exchange-dataset |
26,307 | NP-complete problems and sub-expenential sized circuits | <p>If one were to show that an NP-complete problem had $2^{n^{O(1)/\log{\log{n}}}}$ circuit complexity, what would the consequences of this be?</p>
 | complexity theory circuits | 1 | NP-complete problems and sub-expenential sized circuits -- (complexity theory circuits)
<p>If one were to show that an NP-complete problem had $2^{n^{O(1)/\log{\log{n}}}}$ circuit complexity, what would the consequences of this be?</p>
 | habedi/stack-exchange-dataset |
26,313 | Nested loops: Still $\mathcal O(n)$? | <p>I have an algorithm similar to this:</p>

<pre><code>i=1
while(i < n) {
 //something in O(1)
 while(i < n && cond) {
 //something in O(1)
 i++
 }
 i++
}
</code></pre>

<p>Where "cond" is some condition which can be checked in $\mathcal O(1)$... | algorithm analysis runtime analysis loops | 1 | Nested loops: Still $\mathcal O(n)$? -- (algorithm analysis runtime analysis loops)
<p>I have an algorithm similar to this:</p>

<pre><code>i=1
while(i < n) {
 //something in O(1)
 while(i < n && cond) {
 //something in O(1)
 i++
 }
 i++
}
</code></pre... | habedi/stack-exchange-dataset |
26,317 | Question about the definition of complexity class oracles | <p>If $B$ is a complexity class, then the class $P^B$ (for example) is defined as the set of problems that can be run in polynomial time, given an oracle to every problem in $B$. That's what they told me in my Theory of Computation class, anyways.</p>

<p>Per this definition, it seems to me that $P^P$ captures... | complexity theory terminology oracle machines | 1 | Question about the definition of complexity class oracles -- (complexity theory terminology oracle machines)
<p>If $B$ is a complexity class, then the class $P^B$ (for example) is defined as the set of problems that can be run in polynomial time, given an oracle to every problem in $B$. That's what they told me in my ... | habedi/stack-exchange-dataset |
26,328 | Maximum sub-matrix sum | <p>Given a $n\times m$ matrix $A$ of integers, find a sub-matrix whose sum is maximal. If there is one row only or one column only, then this is equivalent to finding a <a href="http://en.wikipedia.org/wiki/Maximum_subarray_problem" rel="noreferrer">maximum sub-array</a>.</p>

<p>The 1D version can be solved in... | dynamic programming maximum subarray | 1 | Maximum sub-matrix sum -- (dynamic programming maximum subarray)
<p>Given a $n\times m$ matrix $A$ of integers, find a sub-matrix whose sum is maximal. If there is one row only or one column only, then this is equivalent to finding a <a href="http://en.wikipedia.org/wiki/Maximum_subarray_problem" rel="noreferrer">maxim... | habedi/stack-exchange-dataset |
26,344 | Floyd–Warshall algorithm on undirected graph | <p>I am referring to the algorithm from the Wikipedia page on the <a href="http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm" rel="nofollow">Floyd–Warshall algorithm</a>.</p>

<p>In case of undirected graphs should I change the assignment statement inside the <code>if</code> condition to</p>&#... | algorithms graphs optimization shortest path | 1 | Floyd–Warshall algorithm on undirected graph -- (algorithms graphs optimization shortest path)
<p>I am referring to the algorithm from the Wikipedia page on the <a href="http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm" rel="nofollow">Floyd–Warshall algorithm</a>.</p>

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