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 |
|---|---|---|---|---|---|---|
52,647 | Language is decidable or not? | <p>Prove each languages decidable or undecidable.</p>

<pre><code>{ <M> | L(M) is not recognizable}
</code></pre>

<p>I am not able to understand how this works. And what is recognizable language? What are the angle brackets? And of course how is language undecidable?</p>
 | computability undecidability | 1 | Language is decidable or not? -- (computability undecidability)
<p>Prove each languages decidable or undecidable.</p>

<pre><code>{ <M> | L(M) is not recognizable}
</code></pre>

<p>I am not able to understand how this works. And what is recognizable language? What are the angle brackets? And ... | habedi/stack-exchange-dataset |
52,655 | Is the halting problem decidable for 3 symbol one dimensional cellular automata? | <p>I've been trying to figure out if the halting problem is decidable for 3-symbol one-dimensional cellular automata.</p>

<p><em>Definition</em> Let $f(w,i)$ denote the configuration of the system at time step $i$. More formally $f:A^*\times \mathbb{N} \to A^*$, where $A$ is the alphabet.</p>

<p><em>D... | computability decision problem halting problem cellular automata | 1 | Is the halting problem decidable for 3 symbol one dimensional cellular automata? -- (computability decision problem halting problem cellular automata)
<p>I've been trying to figure out if the halting problem is decidable for 3-symbol one-dimensional cellular automata.</p>

<p><em>Definition</em> Let $f(w,i)$ de... | habedi/stack-exchange-dataset |
52,657 | Select a subset of the columns in $2\times n$ matrix, is it easy? | <p>I want to know if this problem is polynomial-time solvable or not?</p>

<p>The problem is: Given a nonnegative integer-valued matrix of size $2\times n$ and two nonnegative integer numbers $b<n$ and $c$. </p>

<p>The question is: Find a subset of the columns of cardinality at most $b$ such that th... | algorithms complexity classes | 1 | Select a subset of the columns in $2\times n$ matrix, is it easy? -- (algorithms complexity classes)
<p>I want to know if this problem is polynomial-time solvable or not?</p>

<p>The problem is: Given a nonnegative integer-valued matrix of size $2\times n$ and two nonnegative integer numbers $b<n$ and $c$. <... | habedi/stack-exchange-dataset |
52,660 | Red-black tree amortized cost of the rebalancing | <p>I've read in different sources that the amortized cost of a red-black tree rebalancing is constant (at least during the tree creation using only insertions).</p>
<p>How can it be proven?</p>
 | algorithm analysis data structures search trees amortized analysis balanced search trees | 1 | Red-black tree amortized cost of the rebalancing -- (algorithm analysis data structures search trees amortized analysis balanced search trees)
<p>I've read in different sources that the amortized cost of a red-black tree rebalancing is constant (at least during the tree creation using only insertions).</p>
<p>How c... | habedi/stack-exchange-dataset |
52,668 | Complexity of dynamic card game algorithm | <p>Consider the following dynamic card game with a regular deck of 26 red cards and 26 black cards. A dealer draws the unturned cards one by one, and we can ask him to stop at any time. For every red card drawn, we get 1 dollar and lose 1 dollar for every black card drawn. The problem consists in finding an algorithm w... | algorithms algorithm analysis runtime analysis probability theory recursion | 1 | Complexity of dynamic card game algorithm -- (algorithms algorithm analysis runtime analysis probability theory recursion)
<p>Consider the following dynamic card game with a regular deck of 26 red cards and 26 black cards. A dealer draws the unturned cards one by one, and we can ask him to stop at any time. For every r... | habedi/stack-exchange-dataset |
52,670 | Proving correctness of a loop that calculates the sum of array | <p>I am trying to mathematically prove that the following program is correct:</p>

<pre><code>int ArraySumC(int[] a) {
 int i = 0;
 int j = 0;

 while (i <= n) {
 j = j + a[i];
 i = i + 1;
 }

 return j;
}
</code></pre>

<p>When... | loops loop invariants program correctness | 1 | Proving correctness of a loop that calculates the sum of array -- (loops loop invariants program correctness)
<p>I am trying to mathematically prove that the following program is correct:</p>

<pre><code>int ArraySumC(int[] a) {
 int i = 0;
 int j = 0;

 while (i <= n) {
 ... | habedi/stack-exchange-dataset |
52,683 | Where can I find an original reference for this integer square root algorithm | <p>As an exercise, I converted an old method I learned for calculating square roots on a rotary decimal hand calculator to binary.</p>

<p>I'm sure this is not original; can anyone provide a reference?</p>

<pre><code>// All arithmetic is truncating unsigned integer arithmetic
// Actual implementati... | algorithms reference request integers numerical algorithms | 1 | Where can I find an original reference for this integer square root algorithm -- (algorithms reference request integers numerical algorithms)
<p>As an exercise, I converted an old method I learned for calculating square roots on a rotary decimal hand calculator to binary.</p>

<p>I'm sure this is not original; ... | habedi/stack-exchange-dataset |
52,684 | Polynomial hierarchy: inclusion between spaces | <p>Using the definition for the polynomial hierarchy:</p>

<p>$$ \Sigma_{i+1}^P = NP^{\Sigma_i^P} $$
$$ \Pi_{i+1}^P = coNP^{\Sigma_i^P} $$</p>

<p>I have been asked to to show that:</p>

<p>$$ P^{\Pi_k^P } \subseteq \Pi_{k+1}^P $$</p>

<p>I don't really have many ideas on how to go f... | complexity theory complexity classes polynomial time simulation oracle machines | 1 | Polynomial hierarchy: inclusion between spaces -- (complexity theory complexity classes polynomial time simulation oracle machines)
<p>Using the definition for the polynomial hierarchy:</p>

<p>$$ \Sigma_{i+1}^P = NP^{\Sigma_i^P} $$
$$ \Pi_{i+1}^P = coNP^{\Sigma_i^P} $$</p>

<p>I have been asked to ... | habedi/stack-exchange-dataset |
52,685 | How can I draw a Moore diagram for a given circuit? | <p>I have a circuit and I should draw a moore diagram (state diagram) for that. The problem is that every state can have 5 inputs and this makes the question hard for me. I tried about 20 times to draw that diagram and every time I failed. Can anyone help? </p>

<p><a href="https://i.stack.imgur.com/IEwR... | automata finite automata | 1 | How can I draw a Moore diagram for a given circuit? -- (automata finite automata)
<p>I have a circuit and I should draw a moore diagram (state diagram) for that. The problem is that every state can have 5 inputs and this makes the question hard for me. I tried about 20 times to draw that diagram and every time I fa... | habedi/stack-exchange-dataset |
52,695 | What is the origin of using Q to denote a set of states in an automaton? | <p>When talking about DFAs and NFAs as 5-tuples, it's common to use the letter $Q$ to denote the set of states in the automaton and to denote individual states with names like $q_0$, $q_1$, etc.</p>

<p>Is there a particular reason why the letter $Q$ was chosen? As in, is $Q$ the first letter of a word historic... | automata finite automata notation history | 1 | What is the origin of using Q to denote a set of states in an automaton? -- (automata finite automata notation history)
<p>When talking about DFAs and NFAs as 5-tuples, it's common to use the letter $Q$ to denote the set of states in the automaton and to denote individual states with names like $q_0$, $q_1$, etc.</p>&#... | habedi/stack-exchange-dataset |
52,702 | Can any algorithm efficiently be implemented as a SIMT problem? | <p>Many algorithms can be implemented more efficiently using SIMT instructions (e.g. CUDA) than using sequential instructions.</p>

<p>Excluding overhead due to hardware limitations (specifically, memory copy times when using a GPU) - are there algorithms whose efficiency <em>can <strong>only</strong> be made w... | efficiency parallel computing | 1 | Can any algorithm efficiently be implemented as a SIMT problem? -- (efficiency parallel computing)
<p>Many algorithms can be implemented more efficiently using SIMT instructions (e.g. CUDA) than using sequential instructions.</p>

<p>Excluding overhead due to hardware limitations (specifically, memory copy time... | habedi/stack-exchange-dataset |
52,720 | String searching, where we allow characters to almost-match | <p>Let $\Sigma= \{1,...,n\}$. Let $T$ and $Q$ be two strings with characters from the alphabet $\Sigma$ of lengths $n,k$, respectively. I am looking for an algorithm to test whether $Q$ appears as a substring of $T$, except that I have a more relaxed notion of when two characters match.</p>

<p>Two characters... | algorithms strings string metrics substrings | 1 | String searching, where we allow characters to almost-match -- (algorithms strings string metrics substrings)
<p>Let $\Sigma= \{1,...,n\}$. Let $T$ and $Q$ be two strings with characters from the alphabet $\Sigma$ of lengths $n,k$, respectively. I am looking for an algorithm to test whether $Q$ appears as a substring... | habedi/stack-exchange-dataset |
52,722 | Why is FACTOR in Co-NP? | <p>I'm having trouble wrapping my head around the problems PRIME, COMPOSITE, FACTOR and how they're related in terms of complexity. I understand that PRIME has been shown to be in $P$ by the AKS primality test, and I believe this works for COMPOSITE as well.</p>

<p>As for FACTOR,</p>

<p>$$FACTOR = \{(... | complexity theory factoring | 1 | Why is FACTOR in Co-NP? -- (complexity theory factoring)
<p>I'm having trouble wrapping my head around the problems PRIME, COMPOSITE, FACTOR and how they're related in terms of complexity. I understand that PRIME has been shown to be in $P$ by the AKS primality test, and I believe this works for COMPOSITE as well.</p>&... | habedi/stack-exchange-dataset |
52,729 | merge sort merge phase | <p>I'm watching a video, demonstrating merge sort, <a href="https://www.youtube.com/watch?v=EeQ8pwjQxTM" rel="nofollow">https://www.youtube.com/watch?v=EeQ8pwjQxTM</a></p>

<p>At 5:42, happens something I do not understand. </p>

<p>We are merging last 2 big arrays, <code>[4,15,50,108]</code> and <code>... | algorithms algorithm analysis sorting | 1 | merge sort merge phase -- (algorithms algorithm analysis sorting)
<p>I'm watching a video, demonstrating merge sort, <a href="https://www.youtube.com/watch?v=EeQ8pwjQxTM" rel="nofollow">https://www.youtube.com/watch?v=EeQ8pwjQxTM</a></p>

<p>At 5:42, happens something I do not understand. </p>

<p>We ar... | habedi/stack-exchange-dataset |
52,735 | Why does garbage collection extend only to memory and not other resource types? | <p>It seems like people got tired of manual memory management, so they invented garbage collection, and life was reasonably good. But what about every other resource types? File descriptors, sockets, or even user created data like database connections?</p>

<p>This feels like a naive question but I cannot fin... | garbage collection resource allocation | 1 | Why does garbage collection extend only to memory and not other resource types? -- (garbage collection resource allocation)
<p>It seems like people got tired of manual memory management, so they invented garbage collection, and life was reasonably good. But what about every other resource types? File descriptors, soc... | habedi/stack-exchange-dataset |
52,748 | Relationship of algorithm complexity and automata class | <p>I have been unable to find a graph depicting or text answering the following question: Is there a direct relationship between the complexity of an algorithm (such as best / worst case of quick sort), and class of automata that can implement the algorithm. For example is there a range of complexity push down automata... | complexity theory automata reference request complexity classes | 1 | Relationship of algorithm complexity and automata class -- (complexity theory automata reference request complexity classes)
<p>I have been unable to find a graph depicting or text answering the following question: Is there a direct relationship between the complexity of an algorithm (such as best / worst case of quick... | habedi/stack-exchange-dataset |
52,752 | Applying information theory to processor clocks | <p>Has there been any research on the subject of applying information theory to a processors clock? It occurred to me that a clock is actually transmitting data that is used for synchronization of different processor components. Once I started to apply information theory concepts to the clock a lot of interesting ideas... | computer architecture information theory cpu clocks | 1 | Applying information theory to processor clocks -- (computer architecture information theory cpu clocks)
<p>Has there been any research on the subject of applying information theory to a processors clock? It occurred to me that a clock is actually transmitting data that is used for synchronization of different processo... | habedi/stack-exchange-dataset |
52,763 | Why is the dynamic programming algorithm of the knapsack problem not polynomial? | <p>The dynamic programming algorithm for the <a href="https://en.wikipedia.org/wiki/Knapsack_problem" rel="noreferrer">knapsack problem</a> has a time complexity of $O(nW)$ where $n$ is the number of items and $W$ is the capacity of the knapsack.</p>

<p>Why is this not a polynomial-time algorithm?</p>

... | algorithm analysis runtime analysis dynamic programming knapsack problems pseudo polynomial | 1 | Why is the dynamic programming algorithm of the knapsack problem not polynomial? -- (algorithm analysis runtime analysis dynamic programming knapsack problems pseudo polynomial)
<p>The dynamic programming algorithm for the <a href="https://en.wikipedia.org/wiki/Knapsack_problem" rel="noreferrer">knapsack problem</a> ha... | habedi/stack-exchange-dataset |
52,772 | Algorithm for finding a mouse hole in a wall in O(n) time | <p>There is this question:</p>

<blockquote>
 <p>As a result of the US Election, a wall is built along the entire Canadian border. You have been told
 there is a mouse hole in the wall, but it can only be seen when you are standing in front of it. Your
 task is to find the mouse hole by walking a... | algorithms data structures asymptotics | 1 | Algorithm for finding a mouse hole in a wall in O(n) time -- (algorithms data structures asymptotics)
<p>There is this question:</p>

<blockquote>
 <p>As a result of the US Election, a wall is built along the entire Canadian border. You have been told
 there is a mouse hole in the wall, but it can onl... | habedi/stack-exchange-dataset |
52,773 | Calculi for a computability class | <p>Proving two push down automata equivalent is undecidable. But proving two finite state machines equivalent is decidable. You also cannot write a programming language that allows expressing the complete set of push down automata, with nothing more powerful.</p>

<p>First question: Can a language exist that ex... | computability finite automata formal grammars programming languages pushdown automata | 1 | Calculi for a computability class -- (computability finite automata formal grammars programming languages pushdown automata)
<p>Proving two push down automata equivalent is undecidable. But proving two finite state machines equivalent is decidable. You also cannot write a programming language that allows expressing the... | habedi/stack-exchange-dataset |
52,775 | Using FFT to solve pattern matching problem with don't cares | <p>I've studied about $FFT$ and it's use in string matching, but there are several issues that bother me. First I'll describe the problem and the solution I've seen in class:<br/>
Suppose we have alphabet $\Sigma = (a, b, \phi)$ where $\phi$ is "<em>don't care</em>", meaning it matches with every letter, including ... | algorithms | 1 | Using FFT to solve pattern matching problem with don't cares -- (algorithms)
<p>I've studied about $FFT$ and it's use in string matching, but there are several issues that bother me. First I'll describe the problem and the solution I've seen in class:<br/>
Suppose we have alphabet $\Sigma = (a, b, \phi)$ where $\ph... | habedi/stack-exchange-dataset |
52,776 | Difference between the tilde and big-O notations | <p>Robert Sedgewick, at his <strong>Algorithms - Part 1</strong> course in Coursera, states that people usually misunderstand the <strong>big-O</strong> notation when using it to show the order of growth of algorithms. Instead, he advocates for the <strong>tilde</strong> notation.</p>

<p>I understand the <stro... | asymptotics | 1 | Difference between the tilde and big-O notations -- (asymptotics)
<p>Robert Sedgewick, at his <strong>Algorithms - Part 1</strong> course in Coursera, states that people usually misunderstand the <strong>big-O</strong> notation when using it to show the order of growth of algorithms. Instead, he advocates for the <stro... | habedi/stack-exchange-dataset |
52,790 | Deleted data remains on a disk until? | <p>I am little bit confused between the two answers below.
What is the exact answer of this question?</p>

<p>My query is,
"Deleted data remains on a disk until...?"</p>

<ol>
<li>The data is overwritten;</li>
<li>The recycle bin is emptied.</li>
</ol>

<p>I have searched it ... | operating systems memory hardware filesystems | 1 | Deleted data remains on a disk until? -- (operating systems memory hardware filesystems)
<p>I am little bit confused between the two answers below.
What is the exact answer of this question?</p>

<p>My query is,
"Deleted data remains on a disk until...?"</p>

<ol>
<li>The data is overwritten... | habedi/stack-exchange-dataset |
52,792 | Blank tape halting problem vs. Emptiness problem ($H_0$ vs. $E_{TM}$) | <p>I have difficulties to differentiate the $H_0$ from the $E_{TM}$ problem.</p>

<p>What exactly means $L(M)= \emptyset $? Is it dffierent from $input~ \varepsilon$ or is $L(M)= \emptyset \leftrightarrow input~ \varepsilon$</p>

<p><strong>Emptiness problem:</strong><br>
$E_{TM} = \{\langle M \rang... | computability turing machines halting problem | 1 | Blank tape halting problem vs. Emptiness problem ($H_0$ vs. $E_{TM}$) -- (computability turing machines halting problem)
<p>I have difficulties to differentiate the $H_0$ from the $E_{TM}$ problem.</p>

<p>What exactly means $L(M)= \emptyset $? Is it dffierent from $input~ \varepsilon$ or is $L(M)= \emptyset \l... | habedi/stack-exchange-dataset |
52,802 | Finding a small Moore machine that checks the last four bits | <p>I am looking for a Moore finite state machine that returns true if and only if the last 4 bits (the input is of bits) are 0011 or 0101, the FSM can return any value at the first 4 bits (yes, even at the 4th).</p>

<p>The issue is that I was asked for a 7 conditions (vertexes) limit, and despite my efforts co... | automata finite automata | 1 | Finding a small Moore machine that checks the last four bits -- (automata finite automata)
<p>I am looking for a Moore finite state machine that returns true if and only if the last 4 bits (the input is of bits) are 0011 or 0101, the FSM can return any value at the first 4 bits (yes, even at the 4th).</p>

<p>T... | habedi/stack-exchange-dataset |
52,804 | How and which component of an Operating System is responsible for the transition of a process from the blocked state to the ready queue? | <p>A process in an Operating System is considered to occupy several states and a process transitions between these states. A scheduler is responsible for assigning CPU time to a process. However, a process that is performing an Input Output Operation and has gone into the blocked state must transition to the ready stat... | operating systems scheduling process scheduling | 1 | How and which component of an Operating System is responsible for the transition of a process from the blocked state to the ready queue? -- (operating systems scheduling process scheduling)
<p>A process in an Operating System is considered to occupy several states and a process transitions between these states. A sched... | habedi/stack-exchange-dataset |
52,815 | Is a graph of zero nodes/vertices connected? | <p>Suppose there is a graph <em>G</em> of zero nodes, there is an even number of nodes. By definition of <a href="https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph" rel="nofollow">connectivity</a>, the graph <em>G</em> is connected when there is a path between every pair of nodes. But there are ... | graphs | 1 | Is a graph of zero nodes/vertices connected? -- (graphs)
<p>Suppose there is a graph <em>G</em> of zero nodes, there is an even number of nodes. By definition of <a href="https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph" rel="nofollow">connectivity</a>, the graph <em>G</em> is connected when th... | habedi/stack-exchange-dataset |
52,816 | Structural induction on generic list | <p>In preparation for an exam, I've come upon the following problem. Given the constructors :</p>

<pre><code>[]: -> T LIST


[a]:T-> T LIST


cons(a,x) : T x T LIST -> T LIST ( a is added to the beginning of the list)
</code></pre>

<p>And the functions : </p>
... | correctness proof induction proof assistants | 1 | Structural induction on generic list -- (correctness proof induction proof assistants)
<p>In preparation for an exam, I've come upon the following problem. Given the constructors :</p>

<pre><code>[]: -> T LIST


[a]:T-> T LIST


cons(a,x) : T x T LIST -> T LIST ( a is added to... | habedi/stack-exchange-dataset |
52,822 | Is it correct to use the pinhole camera model to get the mapping of a 3D line to a line in an image? | <p>I've been working on a computer vision project in which I'm using the pinhole camera model to map one line of the world to one line in an image.</p>

<p>From previous research on the topic, I know that it is possible to map a point in the 3D world to a point in one image using the projection matrix obtained ... | computer vision | 1 | Is it correct to use the pinhole camera model to get the mapping of a 3D line to a line in an image? -- (computer vision)
<p>I've been working on a computer vision project in which I'm using the pinhole camera model to map one line of the world to one line in an image.</p>

<p>From previous research on the topi... | habedi/stack-exchange-dataset |
52,824 | example for weakly fair v.s. strongly fair scheduling in concurrency | <p>I am having difficult time understanding the difference between weakly fair and strongly fair schedulers. Can someone provide an example and explain how they are different?</p>

<p>for reference, here are the definitions I have of each:</p>

<p>weakly fair: A condition becomes true and remains true a... | concurrency process scheduling | 1 | example for weakly fair v.s. strongly fair scheduling in concurrency -- (concurrency process scheduling)
<p>I am having difficult time understanding the difference between weakly fair and strongly fair schedulers. Can someone provide an example and explain how they are different?</p>

<p>for reference, here are... | habedi/stack-exchange-dataset |
52,831 | Analysis of the following integer program | <p>So the knapsack problem has an integer programming formulation as follows,</p>

<p>$$ \max_x v\cdot x\\s.t \\x_i \in \{0,1\}\\w\cdot x \leq C$$</p>

<p>Now consider the second integer program which might be a variation of the knapsack integer program.</p>

<p>$$ \max_x v\cdot x\\s.t \\x_i \in... | algorithms knapsack problems integer programming | 1 | Analysis of the following integer program -- (algorithms knapsack problems integer programming)
<p>So the knapsack problem has an integer programming formulation as follows,</p>

<p>$$ \max_x v\cdot x\\s.t \\x_i \in \{0,1\}\\w\cdot x \leq C$$</p>

<p>Now consider the second integer program which might b... | habedi/stack-exchange-dataset |
52,833 | Difference between system calls, system call interface and API? | <p>Lets take POSIX, whats the difference between POSIX API, libc and actual system calls? </p>
 | terminology operating systems | 1 | Difference between system calls, system call interface and API? -- (terminology operating systems)
<p>Lets take POSIX, whats the difference between POSIX API, libc and actual system calls? </p>
 | habedi/stack-exchange-dataset |
52,841 | What is a stateful computation? | <p>I am reading about a specific field of probabilistic programming, and trying to understand what the term "stateful computation" means.</p>

<p>See: <a href="http://projects.csail.mit.edu/church/wiki/Simple_Generative_Models" rel="nofollow">http://projects.csail.mit.edu/church/wiki/Simple_Generative_Models</a... | terminology programming languages randomized algorithms | 1 | What is a stateful computation? -- (terminology programming languages randomized algorithms)
<p>I am reading about a specific field of probabilistic programming, and trying to understand what the term "stateful computation" means.</p>

<p>See: <a href="http://projects.csail.mit.edu/church/wiki/Simple_Generative... | habedi/stack-exchange-dataset |
52,852 | How internet speed is manipulated at the physical level | <p>Although I am a computer science major, I am having a hard time understanding how internet providers have control over internet speed (example: offer different speeds to different customers, one with a higher price, etc.). </p>

<p>And I mean how is it that they do it at the physical level or bit level if I ... | computer networks | 1 | How internet speed is manipulated at the physical level -- (computer networks)
<p>Although I am a computer science major, I am having a hard time understanding how internet providers have control over internet speed (example: offer different speeds to different customers, one with a higher price, etc.). </p>

<... | habedi/stack-exchange-dataset |
52,865 | Where can I find information on Data Structures used in common software? | <p>As part of a course I am teaching on Data Structures, I want students to research and present the use of Data Structures in popular software/services. However, basic googling shows me that this information is not so readily available.</p>

<p>Can someone point me to the right resources that I may share with ... | data structures reference request applied theory | 1 | Where can I find information on Data Structures used in common software? -- (data structures reference request applied theory)
<p>As part of a course I am teaching on Data Structures, I want students to research and present the use of Data Structures in popular software/services. However, basic googling shows me that t... | habedi/stack-exchange-dataset |
52,889 | Prize collecting Steiner tree on graph without weights on edges | <p>I have been trying to find an easy-to-implement approximation algorithm on the problem of Prize collecting Steiner tree on node-weighted graph without weights on the edges. The closest I have come is the one in <a href="http://dl.acm.org/citation.cfm?id=338637" rel="nofollow">The prize collecting Steiner tree proble... | algorithms approximation spanning trees | 1 | Prize collecting Steiner tree on graph without weights on edges -- (algorithms approximation spanning trees)
<p>I have been trying to find an easy-to-implement approximation algorithm on the problem of Prize collecting Steiner tree on node-weighted graph without weights on the edges. The closest I have come is the one ... | habedi/stack-exchange-dataset |
52,897 | How is the space hierarchy theorem different for non space constructible functions? | <p>Sipser first introduces space constructible functions. Then uses the definition to prove the space hierarchy theorem: </p>

<blockquote>
 <p>if f(n) is a space constructible function then there are languages that can be decided in O(f(n)) space but not in o(f(n)) space. </p>
</blockquote>

<... | complexity theory space complexity lower bounds | 1 | How is the space hierarchy theorem different for non space constructible functions? -- (complexity theory space complexity lower bounds)
<p>Sipser first introduces space constructible functions. Then uses the definition to prove the space hierarchy theorem: </p>

<blockquote>
 <p>if f(n) is a space constru... | habedi/stack-exchange-dataset |
52,907 | How to iterate through all values of an array? | <p>I'm trying to implement a brute-force algorithm.</p>

<p>If I have one variable <code>x</code>, I can iterate through all its values using a <code>for</code> loop: </p>

<pre><code>for x in {1,2,..,MAX}:
 do something with x
</code></pre>

<p>But what if I have an array <code>A</... | algorithms | 1 | How to iterate through all values of an array? -- (algorithms)
<p>I'm trying to implement a brute-force algorithm.</p>

<p>If I have one variable <code>x</code>, I can iterate through all its values using a <code>for</code> loop: </p>

<pre><code>for x in {1,2,..,MAX}:
 do something with x
... | habedi/stack-exchange-dataset |
52,916 | Finding a way out of a polygon | <p>There is a simply-connected polygon $C$. It contains $n$ pairwise-interior-disjoint simply-connected polygons, $D_1,\dots,D_n$:</p>

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

<... | reference request computational geometry | 1 | Finding a way out of a polygon -- (reference request computational geometry)
<p>There is a simply-connected polygon $C$. It contains $n$ pairwise-interior-disjoint simply-connected polygons, $D_1,\dots,D_n$:</p>

<p><a href="https://i.stack.imgur.com/ygE3b.png" rel="nofollow noreferrer"><img src="https://i.stac... | habedi/stack-exchange-dataset |
52,926 | MIS complexity in cubic triangle-free graphs | <p>The question <a href="https://cs.stackexchange.com/questions/33171/complexity-of-independent-set-on-triangle-free-planar-cubic-graphs">Complexity of Independent Set on Triangle-Free Planar Cubic Graphs</a> asks for the complexity of the independent set problem in triangle-free planar cubic graphs. In the statement o... | complexity theory reference request np complete reductions | 1 | MIS complexity in cubic triangle-free graphs -- (complexity theory reference request np complete reductions)
<p>The question <a href="https://cs.stackexchange.com/questions/33171/complexity-of-independent-set-on-triangle-free-planar-cubic-graphs">Complexity of Independent Set on Triangle-Free Planar Cubic Graphs</a> as... | habedi/stack-exchange-dataset |
52,927 | Difference between 2f+1, 2f and 3f+1 | <p>I am currently reading the <a href="http://www.pmg.lcs.mit.edu/papers/osdi99.pdf" rel="nofollow">Practical Byzantine Fault Tolerance</a> paper. I am unable to completely understand the difference between <code>2f</code> and <code>2f+1</code>. If <code>2f+1</code> means that a majority of the nodes are non-faulty the... | distributed systems computer networks | 1 | Difference between 2f+1, 2f and 3f+1 -- (distributed systems computer networks)
<p>I am currently reading the <a href="http://www.pmg.lcs.mit.edu/papers/osdi99.pdf" rel="nofollow">Practical Byzantine Fault Tolerance</a> paper. I am unable to completely understand the difference between <code>2f</code> and <code>2f+1</c... | habedi/stack-exchange-dataset |
52,939 | Big O Algorithm Analysis | <p>I'm confused about the complexity of the following code:</p>

<pre><code>for(i=1; i<=n; i = 2*i)
 for(j=1; j<=i; j++)
 print A[j]
</code></pre>

<p>I know that the first loop is logn, but I'm confused on what the second for loop would be since j is bound to i. Is this sim... | algorithms algorithm analysis | 1 | Big O Algorithm Analysis -- (algorithms algorithm analysis)
<p>I'm confused about the complexity of the following code:</p>

<pre><code>for(i=1; i<=n; i = 2*i)
 for(j=1; j<=i; j++)
 print A[j]
</code></pre>

<p>I know that the first loop is logn, but I'm confused on what the... | habedi/stack-exchange-dataset |
52,949 | Understanding proof for Busy Beaver being uncomputable | <p>I found this proof on <a href="http://jeremykun.com/2012/02/08/busy-beavers-and-the-quest-for-big-numbers/" rel="nofollow">http://jeremykun.com/2012/02/08/busy-beavers-and-the-quest-for-big-numbers/</a> and have highlighted the part I don't understand in bold.</p>

<p>(BB(n) is defined as the number of steps... | computability turing machines halting problem busy beaver | 1 | Understanding proof for Busy Beaver being uncomputable -- (computability turing machines halting problem busy beaver)
<p>I found this proof on <a href="http://jeremykun.com/2012/02/08/busy-beavers-and-the-quest-for-big-numbers/" rel="nofollow">http://jeremykun.com/2012/02/08/busy-beavers-and-the-quest-for-big-numbers/<... | habedi/stack-exchange-dataset |
52,960 | Finding examples of languages that are "anti-palindromic" | <p>Let $\Sigma = \{ 0, 1 \}$. A language $L \subseteq \Sigma^* $ is said to have the "anti-palindrome" property if for every string $w$ that is a palindrome, $w\notin L$. In addition, for every string $u$ that is <strong>not</strong> a palindrome either $u\in L$ or $\mathrm{Reverse}(u) \in L$, but not both(!) (exclusiv... | formal languages | 1 | Finding examples of languages that are "anti-palindromic" -- (formal languages)
<p>Let $\Sigma = \{ 0, 1 \}$. A language $L \subseteq \Sigma^* $ is said to have the "anti-palindrome" property if for every string $w$ that is a palindrome, $w\notin L$. In addition, for every string $u$ that is <strong>not</strong> a pali... | habedi/stack-exchange-dataset |
52,982 | Voronoi cells for rectangles | <p>I am looking for a reference on the following variant of a <a href="https://en.wikipedia.org/wiki/Voronoi_diagram" rel="nofollow">Voronoi diagram</a>:</p>

<ul>
<li>Instead of seed points, there are seed rectangles which are axis-parallel and pairwise-disjoint.</li>
<li>Instead of Euclidean distance,... | reference request computational geometry | 1 | Voronoi cells for rectangles -- (reference request computational geometry)
<p>I am looking for a reference on the following variant of a <a href="https://en.wikipedia.org/wiki/Voronoi_diagram" rel="nofollow">Voronoi diagram</a>:</p>

<ul>
<li>Instead of seed points, there are seed rectangles which are axis-... | habedi/stack-exchange-dataset |
52,984 | Datalog - Single Step Operator | <p>I am currently taking a class called Logic for Computer Scientist. During the first four weeks or so now we have been studying a concept Datalog with subsections Syntax and Formal Semantics and Fixed-Point Semantics. In these weeks we have looked at several definitions atoms, ground atoms, herbrand interpretations, ... | logic sets | 1 | Datalog - Single Step Operator -- (logic sets)
<p>I am currently taking a class called Logic for Computer Scientist. During the first four weeks or so now we have been studying a concept Datalog with subsections Syntax and Formal Semantics and Fixed-Point Semantics. In these weeks we have looked at several definitions ... | habedi/stack-exchange-dataset |
52,987 | Showing undecidability | <p>I'm given the set $T = \{\langle M, w\rangle : M $ is a Turing Machine that accepts $w^\mathcal R$ whenever it accepts $w \}$ and I want to show it's undecidable but recognizable. (I'm using the bracket notation to denote the encoding of the TM and input string)</p>

<p>Given that I know the set $A = \{\lang... | computability turing machines reductions undecidability semi decidability | 1 | Showing undecidability -- (computability turing machines reductions undecidability semi decidability)
<p>I'm given the set $T = \{\langle M, w\rangle : M $ is a Turing Machine that accepts $w^\mathcal R$ whenever it accepts $w \}$ and I want to show it's undecidable but recognizable. (I'm using the bracket notation to ... | habedi/stack-exchange-dataset |
52,990 | What are differences between Static Scope and Dynamic Scope? | <p>My teacher has provided the following pseudo-code, and says that the output using static scope is <code>1 2 3</code>, but the output using dynamic scope is <code>2 3 4</code>.</p>

<pre><code>void fun1(void);
void fun2(void);

int a = 1, b = 2, c = 3;

int main() {
 c = 4;
 ... | programming languages compilers functional programming variable binding | 1 | What are differences between Static Scope and Dynamic Scope? -- (programming languages compilers functional programming variable binding)
<p>My teacher has provided the following pseudo-code, and says that the output using static scope is <code>1 2 3</code>, but the output using dynamic scope is <code>2 3 4</code>.</p>... | habedi/stack-exchange-dataset |
52,997 | Why there's a single accepting state in G-NFA's? | <p>It's clear that we can only have a single start state in <a href="https://en.wikipedia.org/wiki/Generalized_nondeterministic_finite_automaton" rel="nofollow">G-NFA's</a> but I would like to know why we can't have more than one accepting state in G-NFA's.I think it's better to have more accepting states so that we co... | finite automata | 1 | Why there's a single accepting state in G-NFA's? -- (finite automata)
<p>It's clear that we can only have a single start state in <a href="https://en.wikipedia.org/wiki/Generalized_nondeterministic_finite_automaton" rel="nofollow">G-NFA's</a> but I would like to know why we can't have more than one accepting state in G... | habedi/stack-exchange-dataset |
53,003 | Revisiting Fixed Point: What does it mean in the world of computer science? | <p>A while ago I asked <a href="https://cs.stackexchange.com/questions/3466/fixed-point-what-does-it-mean-in-the-world-of-computer-science">Fixed point, what does it mean in the world of computer science?</a></p>

<p>While the answers did help me to understand what Fixed point meant, the answers left me in a mu... | terminology recursion | 1 | Revisiting Fixed Point: What does it mean in the world of computer science? -- (terminology recursion)
<p>A while ago I asked <a href="https://cs.stackexchange.com/questions/3466/fixed-point-what-does-it-mean-in-the-world-of-computer-science">Fixed point, what does it mean in the world of computer science?</a></p>
... | habedi/stack-exchange-dataset |
53,012 | Does the following modified Two-Phase Locking protocol ensure serializability and freedom from deadlock? | <p>Consider the following variant of the two phase locking protocol. Suppose a transaction $T$ accesses (for read or write operations), a certain set of objects ${O_1,...,O_k}$.</p>

<p>The modified algorithm works as :</p>

<p>Step 1. $T$ acquires exclusive locks to $O_1, . . . , O_k$
in increasing... | concurrency database theory deadlocks | 1 | Does the following modified Two-Phase Locking protocol ensure serializability and freedom from deadlock? -- (concurrency database theory deadlocks)
<p>Consider the following variant of the two phase locking protocol. Suppose a transaction $T$ accesses (for read or write operations), a certain set of objects ${O_1,...,O... | habedi/stack-exchange-dataset |
53,026 | Select the maximum number of links to satisfy the constraint on each link. How to prove is NP-hard? | <p><em>Instance</em>: $n$ non-negative real numbers $P_1,\ldots,P_n$, a positive number $k\le n$, and a positive number $\epsilon$.</p>

<p><em>Question</em>: Is there a subset $S$ of $\{1,\ldots,n\}$ of cardinality $|S|\geq k$ such that</p>

<p>$$\dfrac{P_i}{\epsilon-P_i+\sum_{j\in S}P_j}\geq 1,\text{ ... | np hard | 1 | Select the maximum number of links to satisfy the constraint on each link. How to prove is NP-hard? -- (np hard)
<p><em>Instance</em>: $n$ non-negative real numbers $P_1,\ldots,P_n$, a positive number $k\le n$, and a positive number $\epsilon$.</p>

<p><em>Question</em>: Is there a subset $S$ of $\{1,\ldots,n\}... | habedi/stack-exchange-dataset |
53,027 | what is the difference between memory access and data memory access? | <p>what is the difference between <strong>memory access</strong> and <strong>data memory access</strong>?</p>

<p>for example, here are the examples of register transfer language instructions:</p>

<p><ul>
 <li> $R1 ←[18]$</li>
 <li> $R2 ←[R1 +3]$ </li>
 <LI> $R1 ← R1 +2$</li>
 ... | computer architecture memory access | 1 | what is the difference between memory access and data memory access? -- (computer architecture memory access)
<p>what is the difference between <strong>memory access</strong> and <strong>data memory access</strong>?</p>

<p>for example, here are the examples of register transfer language instructions:</p>
&... | habedi/stack-exchange-dataset |
53,029 | Select the maximum number of links to satisfy per-link constraint. How to prove is NP-hard? | <p>I asked, <strong>incorrectly</strong>, my previous question <a href="https://cs.stackexchange.com/questions/53026/select-the-maximum-number-of-links-to-satisfy-the-constraint-on-each-link-how-t">here</a>. I would like to thank D.W. for his answer though. He answeres that the problem is polynomial time solvable. The ... | np hard | 1 | Select the maximum number of links to satisfy per-link constraint. How to prove is NP-hard? -- (np hard)
<p>I asked, <strong>incorrectly</strong>, my previous question <a href="https://cs.stackexchange.com/questions/53026/select-the-maximum-number-of-links-to-satisfy-the-constraint-on-each-link-how-t">here</a>. I would... | habedi/stack-exchange-dataset |
53,031 | What is the difference between modulo and modulus? | <p>Throughout my education in computer science, I feel like I've heard the terms "modulo" and "modulus" used interchangeably. It looks like even Wikipedia claims that "modulo" is "sometimes called 'modulus'" (see the first sentence of <a href="https://en.wikipedia.org/wiki/Modulo_operation" rel="noreferrer">the page o... | terminology modular arithmetic | 1 | What is the difference between modulo and modulus? -- (terminology modular arithmetic)
<p>Throughout my education in computer science, I feel like I've heard the terms "modulo" and "modulus" used interchangeably. It looks like even Wikipedia claims that "modulo" is "sometimes called 'modulus'" (see the first sentence ... | habedi/stack-exchange-dataset |
53,034 | Proving $A$ avoiding $B$ regular if $A$ and $B$ are regular | <p>Suppose we define an operation such that </p>

<p>$$A \text{ avoiding } B = \{w \in A \mid w\text{ has no substring in }B\}\,.$$</p>

<p>How can I prove that, if $A$ and $B$ are regular then $A\text{ avoiding }B$ is regular too?
I know I should either construct a DFA/NFA or use closure properties... | formal languages regular languages closure properties dfa | 1 | Proving $A$ avoiding $B$ regular if $A$ and $B$ are regular -- (formal languages regular languages closure properties dfa)
<p>Suppose we define an operation such that </p>

<p>$$A \text{ avoiding } B = \{w \in A \mid w\text{ has no substring in }B\}\,.$$</p>

<p>How can I prove that, if $A$ and $B$ are ... | habedi/stack-exchange-dataset |
53,038 | Unconditional arithmetic circuit lower bounds for permanent/determinant | <p>In this <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.12.1090&rep=rep1&type=pdf" rel="nofollow">http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.12.1090&rep=rep1&type=pdf</a> an unconditional lower bound (provided constants used are bounded by absolute value smaller than $... | complexity theory circuits | 1 | Unconditional arithmetic circuit lower bounds for permanent/determinant -- (complexity theory circuits)
<p>In this <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.12.1090&rep=rep1&type=pdf" rel="nofollow">http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.12.1090&rep=rep1&type=pd... | habedi/stack-exchange-dataset |
53,040 | Single-source shortest paths as a linear program | <p>I saw that I can formulate single-source shortest path as the following linear program:</p>

<p>Given $G=(V,E)$ and $w\colon E\to R$ and with negative cycles, find
$\max\,d(s,t)$ such that </p>

<p>\begin{align*}
 d(s,v) &\le d(s,u)+w(u,v) \quad \forall (u,v)\in E \\
 d(s,s) &am... | graphs linear programming | 1 | Single-source shortest paths as a linear program -- (graphs linear programming)
<p>I saw that I can formulate single-source shortest path as the following linear program:</p>

<p>Given $G=(V,E)$ and $w\colon E\to R$ and with negative cycles, find
$\max\,d(s,t)$ such that </p>

<p>\begin{align*}
... | habedi/stack-exchange-dataset |
53,041 | A Shortest Path Strange Formulation, or new modeling? | <p>We have a directed Graph $G=(V,E)$ with vertex set $V=\left\{ 1,2,...,n\right\}$. weight of each edge $(i,j)$ is shown with $w(i, j)$. if edge $(i,j)$ is not present, set $ w(i,j)= + \infty $. For each vertex $i$ put $w(i,i)=0$. we want using Dynamic Programming to find shortest path between any two vertex in this ... | algorithms graphs data structures trees shortest path | 1 | A Shortest Path Strange Formulation, or new modeling? -- (algorithms graphs data structures trees shortest path)
<p>We have a directed Graph $G=(V,E)$ with vertex set $V=\left\{ 1,2,...,n\right\}$. weight of each edge $(i,j)$ is shown with $w(i, j)$. if edge $(i,j)$ is not present, set $ w(i,j)= + \infty $. For each v... | habedi/stack-exchange-dataset |
53,046 | Question on interpreting logical notation, relating to alphabets, theoretical comp sci | <p>$\exists x \in \Sigma^* (t=sx)$</p>

<p>Have I interpreted the above into words correctly?:</p>

<p>"There exists a symbol 'x', which is a member of the set which contains all possible strings of alphabet sigma, where sigma contains string 't', which is a concatenation of string x and string s."</p>&... | logic notation | 1 | Question on interpreting logical notation, relating to alphabets, theoretical comp sci -- (logic notation)
<p>$\exists x \in \Sigma^* (t=sx)$</p>

<p>Have I interpreted the above into words correctly?:</p>

<p>"There exists a symbol 'x', which is a member of the set which contains all possible strings o... | habedi/stack-exchange-dataset |
53,052 | Probability bounds on size of smaller partition in randomized quicksort | <p>Let $0 < a < 0.5$ be some constant. We have an $n$-element array as input. Randomized quicksort chooses one element from array uniformly at random as a pivot and partitions. With probability $1-2a$ the smallest section be greater than $an$.
How we can Calculate this probability?
after 72 hours try i re... | algorithms sorting probability theory probabilistic algorithms quicksort | 1 | Probability bounds on size of smaller partition in randomized quicksort -- (algorithms sorting probability theory probabilistic algorithms quicksort)
<p>Let $0 < a < 0.5$ be some constant. We have an $n$-element array as input. Randomized quicksort chooses one element from array uniformly at random as a pivot and... | habedi/stack-exchange-dataset |
53,065 | Checking my understanding of right quotient | <p>So I am trying to fully understand the concept of quotient languages.</p>

<p>I will give some examples, let me know if this is correct:
Say that </p>

<pre><code>L1={} and L2 is {ot}, then L1/L2 is {carr}
Or if L1=ab*c and L2 is b*c then L1/L2 is a.
</code></pre>

<p>If this is i... | regular languages | 1 | Checking my understanding of right quotient -- (regular languages)
<p>So I am trying to fully understand the concept of quotient languages.</p>

<p>I will give some examples, let me know if this is correct:
Say that </p>

<pre><code>L1={} and L2 is {ot}, then L1/L2 is {carr}
Or if L1=ab*c and L2... | habedi/stack-exchange-dataset |
53,072 | Understanding Murmur3 | <p>The Bloom filter data structure requires a set of hashing functions. The Murmur3 family is a great fit, as it contains the <code>seed</code> parameter to easily create a variety of different functions (plus it has good distribution of values and adequate speed).</p>

<h3>Choosing the <code>seed</code></h3>&#... | hash bloom filters | 1 | Understanding Murmur3 -- (hash bloom filters)
<p>The Bloom filter data structure requires a set of hashing functions. The Murmur3 family is a great fit, as it contains the <code>seed</code> parameter to easily create a variety of different functions (plus it has good distribution of values and adequate speed).</p>
... | habedi/stack-exchange-dataset |
53,079 | regular expression to accept all strings other than one containing ads or adlib | <p><a href="https://i.stack.imgur.com/5flQn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5flQn.png" alt="click here for image "></a></p>

<p>My intention is to select only those packages whose name do not contain adlib or ads. But if i add <code>*adlib* and *ads*</code> it selects all p... | formal languages regular expressions dfa | 1 | regular expression to accept all strings other than one containing ads or adlib -- (formal languages regular expressions dfa)
<p><a href="https://i.stack.imgur.com/5flQn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5flQn.png" alt="click here for image "></a></p>

<p>My intention is to sele... | habedi/stack-exchange-dataset |
53,081 | Elimination rule for the equality type aka J axiom | <p>I'm implementing a interpreter for lambda calculus,
and now I want to add the equality type.
The introduction rule for it is easy,
but the elimination rule is rather obscure for me.
I found <a href="https://stackoverflow.com/questions/27091668/refl-in-agda-explaining-congruence-property/27100693#2710... | lambda calculus intuition equality | 1 | Elimination rule for the equality type aka J axiom -- (lambda calculus intuition equality)
<p>I'm implementing a interpreter for lambda calculus,
and now I want to add the equality type.
The introduction rule for it is easy,
but the elimination rule is rather obscure for me.
I found <a href="https://sta... | habedi/stack-exchange-dataset |
53,082 | How to show ExactOneSAT is NP-Complete? | <p>$\text{ExactOneSAT}= \{\phi\;|\;\phi\; \text{is a boolean formula}$ $\text{ such that it has a satisfying assignment with only one true literal per clause} \}$ </p>

<p>I am trying to reduce 3SAT to this problem but can't find a way. I tried taking a small example $\phi=(x_1 \vee x_2) \wedge (\overline{x_1} ... | complexity theory np complete satisfiability 3 sat | 1 | How to show ExactOneSAT is NP-Complete? -- (complexity theory np complete satisfiability 3 sat)
<p>$\text{ExactOneSAT}= \{\phi\;|\;\phi\; \text{is a boolean formula}$ $\text{ such that it has a satisfying assignment with only one true literal per clause} \}$ </p>

<p>I am trying to reduce 3SAT to this problem b... | habedi/stack-exchange-dataset |
53,094 | Building static hash table with particular collisions | <h2>Is there efficient algorithm to encode keys in hash function with provided collisions?</h2>
<p>By efficient I mean with low-<em>ish</em> runtime of <strong>lookup operation</strong> (taking constants into account) and <strong>realistic time of finding such function</strong>.<br />
Keys are floating point va... | data structures efficiency hash hash tables | 1 | Building static hash table with particular collisions -- (data structures efficiency hash hash tables)
<h2>Is there efficient algorithm to encode keys in hash function with provided collisions?</h2>
<p>By efficient I mean with low-<em>ish</em> runtime of <strong>lookup operation</strong> (taking constants into acco... | habedi/stack-exchange-dataset |
53,101 | Sum of Maximum of continuous blocks of length k | <p>Given a array of N elements and a number k, then find the sum of maximum of a all continuous blocks of length k?</p>

<p>Examples :</p>

<ol>
<li>A = {2,5,2}, k = 2, Max for 1st block = 5, 2nd block = 5, So sum is 10.</li>
<li>A = {3,1,8}, k = 2, Max for 1st block = 3, 2nd block = 8, So sum i... | arrays maximum subarray | 1 | Sum of Maximum of continuous blocks of length k -- (arrays maximum subarray)
<p>Given a array of N elements and a number k, then find the sum of maximum of a all continuous blocks of length k?</p>

<p>Examples :</p>

<ol>
<li>A = {2,5,2}, k = 2, Max for 1st block = 5, 2nd block = 5, So sum is 10.</l... | habedi/stack-exchange-dataset |
53,112 | Is it correct to say that CPU's only compute threads? | <p>New to the world of parallel computation. Would it be correct to say that CPU's are actually <code>thread</code> calculators? My understanding currently: a <code>process</code> is composed of multiple <code>threads</code> and a single core on a cpu is capable of executing instructions from 1 <code>thread</code> at a... | parallel computing threads | 1 | Is it correct to say that CPU's only compute threads? -- (parallel computing threads)
<p>New to the world of parallel computation. Would it be correct to say that CPU's are actually <code>thread</code> calculators? My understanding currently: a <code>process</code> is composed of multiple <code>threads</code> and a sin... | habedi/stack-exchange-dataset |
53,115 | Is it legal to draw an NFA with fewer nodes than what I normally see? | <p>Is it Ok to express an NFA accepting 1*0 like the one above? All examples in books are represented like the bottom one. I'd like to know is that only a convention or it must have two extra nodes?</p>

<p><a href="https://i.stack.imgur.com/NVDwt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.c... | automata finite automata regular expressions | 1 | Is it legal to draw an NFA with fewer nodes than what I normally see? -- (automata finite automata regular expressions)
<p>Is it Ok to express an NFA accepting 1*0 like the one above? All examples in books are represented like the bottom one. I'd like to know is that only a convention or it must have two extra nodes?</... | habedi/stack-exchange-dataset |
53,117 | Counting all $x,y,z$ such that $a[x] > a[y] + a[z]$ | <p>Given an array $a$, I want to count all triplets of indices $x,y,z$ such that $a[x] > a[y] + a[z]$.</p>

<p>I can think of two solutions:</p>

<ol>
<li><p>Go over all triplets of indices $x,y,z$ directly. This takes time $O(n^3)$ and constant space.</p></li>
<li><p>Compute a new array cons... | time complexity space complexity | 1 | Counting all $x,y,z$ such that $a[x] > a[y] + a[z]$ -- (time complexity space complexity)
<p>Given an array $a$, I want to count all triplets of indices $x,y,z$ such that $a[x] > a[y] + a[z]$.</p>

<p>I can think of two solutions:</p>

<ol>
<li><p>Go over all triplets of indices $x,y,z$ directly.... | habedi/stack-exchange-dataset |
53,122 | The most efficient algorithm for computing cardinality of sumset | <p>Let A and B be two finite non-empty sets of positive integers. Their sumset is the set of all possible sums a + b where a is from A and b is from B. For example, if A = {1, 2} and B = {2, 3, 6} then A + B = {1 + 2, 1 + 3, 1 + 6, 2 + 2, 2 + 3, 2 + 6} = {3, 4, 5, 7, 8}.</p>

<p>As we can see, cardinality #(A +... | algorithms counting | 1 | The most efficient algorithm for computing cardinality of sumset -- (algorithms counting)
<p>Let A and B be two finite non-empty sets of positive integers. Their sumset is the set of all possible sums a + b where a is from A and b is from B. For example, if A = {1, 2} and B = {2, 3, 6} then A + B = {1 + 2, 1 + 3, 1 + 6... | habedi/stack-exchange-dataset |
53,124 | Does Huffman algorithm generate a minimal weight of a tree? | <p>Does <a href="https://en.wikipedia.org/wiki/Huffman_coding" rel="nofollow">Huffman algorithm</a> generate a minimal weight of a tree?</p>

<p>I noticed that by trying to make two different trees with the same frequencies of letters, I get different weights of the trees.</p>

<p>We defined the weight ... | algorithms algorithm analysis huffman coding | 1 | Does Huffman algorithm generate a minimal weight of a tree? -- (algorithms algorithm analysis huffman coding)
<p>Does <a href="https://en.wikipedia.org/wiki/Huffman_coding" rel="nofollow">Huffman algorithm</a> generate a minimal weight of a tree?</p>

<p>I noticed that by trying to make two different trees with... | habedi/stack-exchange-dataset |
53,130 | Decidability of dependent typing on primitive recursive languages | <p>With a dependent type system in a normal functional language type checking may never halt. This is partially because dependent typing removes the isolation between types, and code. My question is this: would an implementation of dependent typing for a primitive recursive language(not Turing-complete) be guaranteed t... | computability undecidability type checking dependent types primitive recursion | 1 | Decidability of dependent typing on primitive recursive languages -- (computability undecidability type checking dependent types primitive recursion)
<p>With a dependent type system in a normal functional language type checking may never halt. This is partially because dependent typing removes the isolation between typ... | habedi/stack-exchange-dataset |
53,133 | Transform grammar for repeating characters into LL(1) | <p>I have the following simple production rule: </p>

<p>S -> Sa | a</p>

<p>Which is left-recursive, and can recognize strings such as a or aa, etc</p>

<p>I tried to make it right-recursive, but I cannot find a way without creating ambigious grammars<br>
(e.g.<br>
 S -> aS'<br>
S'... | formal languages left recursion | 1 | Transform grammar for repeating characters into LL(1) -- (formal languages left recursion)
<p>I have the following simple production rule: </p>

<p>S -> Sa | a</p>

<p>Which is left-recursive, and can recognize strings such as a or aa, etc</p>

<p>I tried to make it right-recursive, but I canno... | habedi/stack-exchange-dataset |
53,143 | Edge-connectivity of a weighted undirected graph | <p>My question consists of two parts.</p>

<ol>
<li>Let say the edge connectivity of a graph is <em>K</em>. I would like to change the edge connectivity value to <em>L (> K)</em>. What is the best possible way to do so?</li>
</ol>

<p>My guess: Obviously, we have to increase the edge weight of o... | graphs weighted graphs | 1 | Edge-connectivity of a weighted undirected graph -- (graphs weighted graphs)
<p>My question consists of two parts.</p>

<ol>
<li>Let say the edge connectivity of a graph is <em>K</em>. I would like to change the edge connectivity value to <em>L (> K)</em>. What is the best possible way to do so?</li>
</... | habedi/stack-exchange-dataset |
53,147 | Select a set of elements from a 2D matrix, such that each element comes from distinct row and column | <p>We're facing following problem - an n * n 2D Matrix contains doubles (Java). Find a Set of elements such that </p>

<ol>
<li>Each element in the set comes from a unique row and column combination. That is, once you've selected an element (i, j) as a candidate for a set, that set cannot contain any elemen... | algorithms graphs arrays | 1 | Select a set of elements from a 2D matrix, such that each element comes from distinct row and column -- (algorithms graphs arrays)
<p>We're facing following problem - an n * n 2D Matrix contains doubles (Java). Find a Set of elements such that </p>

<ol>
<li>Each element in the set comes from a unique row a... | habedi/stack-exchange-dataset |
53,150 | Quicksort $T(n)_{best}=\Omega(n\log n) $ proof | <p>About the proof that quicksort has $T(n)_{best}=\Omega(n\log n)$.</p>

<p>I can't find this specific aspect anywhere online which is strange. I'm going through a proof for this in a book and I don't understand something, it says that about analyzing the "cost" of a level in the recursion tree that:</p>
&... | asymptotics correctness proof quicksort | 1 | Quicksort $T(n)_{best}=\Omega(n\log n) $ proof -- (asymptotics correctness proof quicksort)
<p>About the proof that quicksort has $T(n)_{best}=\Omega(n\log n)$.</p>

<p>I can't find this specific aspect anywhere online which is strange. I'm going through a proof for this in a book and I don't understand somethi... | habedi/stack-exchange-dataset |
53,154 | What is the role of mathematics in programming? | <p>I am almost totally uneducated in programming and computer science in general, though I am really fascinated by these topics. I read that mathematics is important in programming and that nowadays many mathematicians specialise in applied mathematics in this field. So, I wonder how these two branches are linked with ... | programming languages mathematical foundations | 1 | What is the role of mathematics in programming? -- (programming languages mathematical foundations)
<p>I am almost totally uneducated in programming and computer science in general, though I am really fascinated by these topics. I read that mathematics is important in programming and that nowadays many mathematicians s... | habedi/stack-exchange-dataset |
53,165 | Proving that English is not a regular language | <p>I am wanting to try and prove that the English language is not regular.
The alphabet is the set of all words in the English dictionary.</p>

<p>Looking at sentences, I was able to use this pattern of sentences</p>

<p>{ [ (determiner) (noun)]<sup>n</sup> (verb)<sup>n</sup> where n is >= 1} ⊆ of t... | formal languages regular languages natural language processing | 1 | Proving that English is not a regular language -- (formal languages regular languages natural language processing)
<p>I am wanting to try and prove that the English language is not regular.
The alphabet is the set of all words in the English dictionary.</p>

<p>Looking at sentences, I was able to use this p... | habedi/stack-exchange-dataset |
53,166 | Proving that a programming language is not regular | <p>I am wanting to show that the C programming language is not a regular
language.</p>

<p>The alphabet would be ASCII characters and
comments, strings, char can contain arbitrary characters.</p>

<p>Would I best approach this potentially with a pumping lemma?
There's not really constraints ... | formal languages regular languages | 1 | Proving that a programming language is not regular -- (formal languages regular languages)
<p>I am wanting to show that the C programming language is not a regular
language.</p>

<p>The alphabet would be ASCII characters and
comments, strings, char can contain arbitrary characters.</p>

<p>Would... | habedi/stack-exchange-dataset |
53,173 | How broken is LCG in the case of partial output? | <p>Suppose we have a <a href="https://en.wikipedia.org/wiki/Linear_congruential_generator" rel="nofollow">linear congruential generator</a> defined by $X_{n+1} = (a X_n + c) \mod 2^n$ where $a, c, n$ are all known and we would like to determine the initial value $X_0$. However, if we can only see the $k$ high-order bit... | algorithms cryptography randomness sampling pseudo random generators | 1 | How broken is LCG in the case of partial output? -- (algorithms cryptography randomness sampling pseudo random generators)
<p>Suppose we have a <a href="https://en.wikipedia.org/wiki/Linear_congruential_generator" rel="nofollow">linear congruential generator</a> defined by $X_{n+1} = (a X_n + c) \mod 2^n$ where $a, c, ... | habedi/stack-exchange-dataset |
53,180 | Acceptance behavior of L and NL with and without cycling | <p>The complexity class NL seems to allow cycling, otherwise we wouldn't have SL $\subset$ NL. What about L? If an algorithm from L cycles for a given input, it certainly cannot accept (because it won't enter the accepting state), so we could define that it rejects in this case (which would be consistent with NL). Or i... | complexity theory space complexity | 1 | Acceptance behavior of L and NL with and without cycling -- (complexity theory space complexity)
<p>The complexity class NL seems to allow cycling, otherwise we wouldn't have SL $\subset$ NL. What about L? If an algorithm from L cycles for a given input, it certainly cannot accept (because it won't enter the accepting ... | habedi/stack-exchange-dataset |
53,187 | Is there any uncountable Turing decidable language? | <p>There are many(and I mean many) countable languages which are Turing-decidable. Can any uncountable language be Turing decidable?</p>
 | formal languages turing machines regular languages church turing thesis | 1 | Is there any uncountable Turing decidable language? -- (formal languages turing machines regular languages church turing thesis)
<p>There are many(and I mean many) countable languages which are Turing-decidable. Can any uncountable language be Turing decidable?</p>
 | habedi/stack-exchange-dataset |
53,189 | What is the correct way to define time constructible functions? | <p>Sipser defines a time constructible function as</p>

<blockquote>
 <p>$f(n)$ is time constructible if there exists a turing machine which given input $1^n$ writes value of $f(n)$ in binary to the output tape in $O(f(n))$ time.</p>
</blockquote>

<p>whereas Sanjeev Arora and Barak defines it ... | complexity theory time complexity | 1 | What is the correct way to define time constructible functions? -- (complexity theory time complexity)
<p>Sipser defines a time constructible function as</p>

<blockquote>
 <p>$f(n)$ is time constructible if there exists a turing machine which given input $1^n$ writes value of $f(n)$ in binary to the outpu... | habedi/stack-exchange-dataset |
53,192 | Dijkstra's algorithm to compute shortest paths using k edges? | <p>I am aware of using Bellman-Ford on a graph $G=(V,E)$ with no negative cycles to find the single-source single-destination shortest paths from source $s$ to target $t$ (both in $V$) using at most $k$ edges. Assuming we have no negative edge weights at all, can we use Dijkstra's algorithm for the same? </p>

... | algorithms graphs dynamic programming shortest path weighted graphs | 1 | Dijkstra's algorithm to compute shortest paths using k edges? -- (algorithms graphs dynamic programming shortest path weighted graphs)
<p>I am aware of using Bellman-Ford on a graph $G=(V,E)$ with no negative cycles to find the single-source single-destination shortest paths from source $s$ to target $t$ (both in $V$) ... | habedi/stack-exchange-dataset |
53,199 | Index of a language and its reversal | <p>The index of a language is the number of Myhill-Nerode classes that it has. It is also equal to the number of states in the minimal DFA for the language. What is an example of a language that has a different index from its reversal?</p>
 | formal languages regular languages finite automata | 1 | Index of a language and its reversal -- (formal languages regular languages finite automata)
<p>The index of a language is the number of Myhill-Nerode classes that it has. It is also equal to the number of states in the minimal DFA for the language. What is an example of a language that has a different index from its r... | habedi/stack-exchange-dataset |
53,206 | Approximation Algorithm for Independet Set Problem: Any Explanation Please? | <p>I am reading this note <a href="https://courses.engr.illinois.edu/cs598csc/sp2011/lectures/lecture_7.pdf" rel="nofollow">on approximation algorithms for independet set problem</a>. I am confused of <em>Theorem 1.</em> and <em>Corollary 3.</em></p>

<p>Here is the statement of <em>Theorem 1.</em></p>

... | approximation | 1 | Approximation Algorithm for Independet Set Problem: Any Explanation Please? -- (approximation)
<p>I am reading this note <a href="https://courses.engr.illinois.edu/cs598csc/sp2011/lectures/lecture_7.pdf" rel="nofollow">on approximation algorithms for independet set problem</a>. I am confused of <em>Theorem 1.</em> and ... | habedi/stack-exchange-dataset |
53,208 | How to make sense of this context-sensitive production in a textbook? (a typo perhaps?) | <p>In Chapter 1 of Kenneth Slonneger and Barry L. Kurtz's <a href="https://cdn.preterhuman.net/texts/science_and_technology/artificial_intelligence/Formal%20Syntax%20and%20Semantics%20of%20Programming%20Languages%20-%20Kenneth%20Slonneger.pdf" rel="nofollow"><em>Formal Syntax and Semantics of Programming Languages: A L... | formal grammars context sensitive | 1 | How to make sense of this context-sensitive production in a textbook? (a typo perhaps?) -- (formal grammars context sensitive)
<p>In Chapter 1 of Kenneth Slonneger and Barry L. Kurtz's <a href="https://cdn.preterhuman.net/texts/science_and_technology/artificial_intelligence/Formal%20Syntax%20and%20Semantics%20of%20Prog... | habedi/stack-exchange-dataset |
53,210 | Clarification of the definition of a POMDP | <p>From what I understand, a $MDP=(G, A, P, R)$ (markov decision process) is represented as:</p>

<ul>
<li>A complete directed graph $G=(V, E)$</li>
<li>A set of actions $A_u$ for each vertex $u \in V$</li>
<li>A reward function $R$ that maps any vertex to some reward, i.e., $R \colon V \mapsto \mat... | automata artificial intelligence markov chains agent based computing | 1 | Clarification of the definition of a POMDP -- (automata artificial intelligence markov chains agent based computing)
<p>From what I understand, a $MDP=(G, A, P, R)$ (markov decision process) is represented as:</p>

<ul>
<li>A complete directed graph $G=(V, E)$</li>
<li>A set of actions $A_u$ for each ve... | habedi/stack-exchange-dataset |
53,212 | Huffman Coding and Depth Calculation? | <p>I'd like to as a variation on <a href="https://stackoverflow.com/questions/28833747/huffman-height-calculation-and-some-challenges">this question regarding Huffman tree building</a>. Is there any theory or rule of thumb to calculate the depth of a Huffman tree from the input (or frequency), without drawing tree. </p... | algorithms data structures trees probability theory coding theory | 1 | Huffman Coding and Depth Calculation? -- (algorithms data structures trees probability theory coding theory)
<p>I'd like to as a variation on <a href="https://stackoverflow.com/questions/28833747/huffman-height-calculation-and-some-challenges">this question regarding Huffman tree building</a>. Is there any theory or ru... | habedi/stack-exchange-dataset |
53,222 | Simplifying Boolean Expression | <p>I am designing a 4-bit comparator with a look ahead unit using a bit slice approach. I have to break the propagation of the Logical expressions for <code>(A<B)i</code> and <code>(A>B)i</code>. The main question is, could I use the following to simplify the boolean expressions.. The i is a subscript meaning the... | logic boolean algebra digital circuits karnaugh map | 1 | Simplifying Boolean Expression -- (logic boolean algebra digital circuits karnaugh map)
<p>I am designing a 4-bit comparator with a look ahead unit using a bit slice approach. I have to break the propagation of the Logical expressions for <code>(A<B)i</code> and <code>(A>B)i</code>. The main question is, could I ... | habedi/stack-exchange-dataset |
53,225 | What are the reasons to learn different algorithms / data structures serving the same purpose? | <p>I have been wondering about this question since I was an undergraduate student.
It is a general question but I will elaborate with examples below.</p>

<p>I have seen a lot of algorithms - for example, for maximum flow problems, I know around 3 algorithms which can solve the problem: Ford-Fulkerson, Edmo... | algorithms data structures education didactics | 1 | What are the reasons to learn different algorithms / data structures serving the same purpose? -- (algorithms data structures education didactics)
<p>I have been wondering about this question since I was an undergraduate student.
It is a general question but I will elaborate with examples below.</p>

<p>I h... | habedi/stack-exchange-dataset |
53,227 | What is the difference between Cased-based Reasoning and Rule-based reasoning? | <p>As stated <a href="https://cs.stackexchange.com/a/4976/46482">here</a>, Rule-based Reasoning systems are considered to be "old style" AI that uses rules prepared by humans - as opposed to Neural Networks where machine recognizes pattern i.e. acquires new knowledge and takes decision based upon that. </p>

<p... | terminology machine learning artificial intelligence case based reasoning | 1 | What is the difference between Cased-based Reasoning and Rule-based reasoning? -- (terminology machine learning artificial intelligence case based reasoning)
<p>As stated <a href="https://cs.stackexchange.com/a/4976/46482">here</a>, Rule-based Reasoning systems are considered to be "old style" AI that uses rules prepar... | habedi/stack-exchange-dataset |
53,229 | Regular languages and constructing a regular grammar | <p>I'm pretty new to computer science and just read about the concept of grammars. Now, I have a practical problem to solve. Here is the alphabet <code>{a, b, c, d}</code>. </p>

<p>How can I determine if the language consisting of all strings <code>a^k b^n c^m d^l</code>, where all <code>k,n,m,l >= 1</code>... | formal languages regular languages formal grammars | 1 | Regular languages and constructing a regular grammar -- (formal languages regular languages formal grammars)
<p>I'm pretty new to computer science and just read about the concept of grammars. Now, I have a practical problem to solve. Here is the alphabet <code>{a, b, c, d}</code>. </p>

<p>How can I determine i... | habedi/stack-exchange-dataset |
53,232 | Certificate Definition of NL | <p>As per the Sanjeev Arora book, for a certificate based definition of $NL$, the machine is allowed a "read-once" certificate tape to store the certificate along with $O(log n)$ read/write work tape for a deterministic verifier machine.</p>

<p>My doubt is that for a $3-SAT$ problem, if instead of storing an a... | complexity theory turing machines space complexity 3 sat computational complexity | 1 | Certificate Definition of NL -- (complexity theory turing machines space complexity 3 sat computational complexity)
<p>As per the Sanjeev Arora book, for a certificate based definition of $NL$, the machine is allowed a "read-once" certificate tape to store the certificate along with $O(log n)$ read/write work tape for ... | habedi/stack-exchange-dataset |
53,239 | Question about DFA for exact string matching | <p>In the <a href="http://www-igm.univ-mlv.fr/%7Elecroq/string/node4.html#SECTION0040" rel="nofollow noreferrer">Handbook of Exact String Matching</a> algorithms, it describes the <a href="http://www-igm.univ-mlv.fr/%7Elecroq/string/node2.html#SECTION0025" rel="nofollow noreferrer">transition set</a> for a basic string... | finite automata strings exact string matching | 1 | Question about DFA for exact string matching -- (finite automata strings exact string matching)
<p>In the <a href="http://www-igm.univ-mlv.fr/%7Elecroq/string/node4.html#SECTION0040" rel="nofollow noreferrer">Handbook of Exact String Matching</a> algorithms, it describes the <a href="http://www-igm.univ-mlv.fr/%7Elecro... | habedi/stack-exchange-dataset |
53,249 | Find the minimum count of elements summing to a pre-defined sum | <p>We have the following problem: Given an array of integers $\{a_1, a_2,...,a_n\}$ and a number $s$, find a contiguous sub-array of elements that sum exactly to $s$. If multiple solutions exist, find a solution that is smallest in terms of length (length of sub-array). If there is no such contiguous sub-array, output ... | algorithms | 1 | Find the minimum count of elements summing to a pre-defined sum -- (algorithms)
<p>We have the following problem: Given an array of integers $\{a_1, a_2,...,a_n\}$ and a number $s$, find a contiguous sub-array of elements that sum exactly to $s$. If multiple solutions exist, find a solution that is smallest in terms of... | habedi/stack-exchange-dataset |
53,250 | Normalized measure from dynamic time warping | <p>I am trying to find the similarity between two time series, but not in terms of distance, in something more sensible such as percentage of similarity. In other words I need something that shows the similarity, not dis-similarity.</p>

<p>The dynamic time warping gives a very good response, when trying to com... | machine learning pattern recognition time series analysis | 1 | Normalized measure from dynamic time warping -- (machine learning pattern recognition time series analysis)
<p>I am trying to find the similarity between two time series, but not in terms of distance, in something more sensible such as percentage of similarity. In other words I need something that shows the similarity,... | habedi/stack-exchange-dataset |
53,251 | How is n-gram different from k-mer? | <p>How is n-gram different from k-mer? Both seem to be (n or k) length substrings of a larger string. Are these just terms common with different practitioners? viz. Computer Scientists and Bioinformaticians?</p>
 | strings string metrics substrings subsequences bioinformatics | 1 | How is n-gram different from k-mer? -- (strings string metrics substrings subsequences bioinformatics)
<p>How is n-gram different from k-mer? Both seem to be (n or k) length substrings of a larger string. Are these just terms common with different practitioners? viz. Computer Scientists and Bioinformaticians?</p>
 | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.