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
54,445
How many times can you pour milk among 3 buckets?
<p>This is a problem from usaco, which I solved, but I don't know how to estimate the number of times you can pour milk among the jugs, my solutions just uses a big enough number.</p>&#xA;&#xA;<p>Here's the problem statement:</p>&#xA;&#xA;<blockquote>&#xA; <p>Farmer John has three milking buckets of capacity A, B, and...
algorithms
1
How many times can you pour milk among 3 buckets? -- (algorithms) <p>This is a problem from usaco, which I solved, but I don't know how to estimate the number of times you can pour milk among the jugs, my solutions just uses a big enough number.</p>&#xA;&#xA;<p>Here's the problem statement:</p>&#xA;&#xA;<blockquote>&#x...
habedi/stack-exchange-dataset
54,448
Producing an algebric equation from a graph
<p>I'm writing a computer game and one of my game's objects must follow a movement path that is very similar to the following graph.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/fEo9e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fEo9e.png" alt="enter image description here"></a></p>&#xA;&#xA...
algebra
1
Producing an algebric equation from a graph -- (algebra) <p>I'm writing a computer game and one of my game's objects must follow a movement path that is very similar to the following graph.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/fEo9e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fEo9e....
habedi/stack-exchange-dataset
54,450
Give a specific case where calling a polynomial time function n times gives an exponential time algorithm
<p>We were asked this question in exam and I am not satisfied with the answer the teacher gave.</p>&#xA;&#xA;<p>Let me justify my point of view. Let there be a polynomial time function having time complexity $n^{c_1}$. If we call the function polynomial times, say $n^{c_2}$ times, then the time complexity of the algori...
complexity theory np
1
Give a specific case where calling a polynomial time function n times gives an exponential time algorithm -- (complexity theory np) <p>We were asked this question in exam and I am not satisfied with the answer the teacher gave.</p>&#xA;&#xA;<p>Let me justify my point of view. Let there be a polynomial time function hav...
habedi/stack-exchange-dataset
54,453
One-dimensional k-center problem. Finding minimum distance
<p>This is a follow-up to this question: <a href="https://cs.stackexchange.com/questions/54428/array-covering-problem">Array covering problem</a></p>&#xA;&#xA;<p>Suppose that we have $N$ integer points on coordinate line: $X = \{x_1, ..., x_N\}$ and we have to add $M$ more points (their coordinates can be rational). </...
optimization
1
One-dimensional k-center problem. Finding minimum distance -- (optimization) <p>This is a follow-up to this question: <a href="https://cs.stackexchange.com/questions/54428/array-covering-problem">Array covering problem</a></p>&#xA;&#xA;<p>Suppose that we have $N$ integer points on coordinate line: $X = \{x_1, ..., x_N\...
habedi/stack-exchange-dataset
54,460
Converting context-free grammar to Chomsky/Greibach Normal Form
<p>Is it necessary to remove all lambda productions, unit productions and useless productions from a context free grammar(CFG) before converting to Chomsky Normal Form(CNF) or Greibach normal form (GNF). If so why is it required?</p>&#xA;&#xA;<p>Also my Professor said that we should convert a CFG into CNF before conver...
context free formal grammars normal forms
1
Converting context-free grammar to Chomsky/Greibach Normal Form -- (context free formal grammars normal forms) <p>Is it necessary to remove all lambda productions, unit productions and useless productions from a context free grammar(CFG) before converting to Chomsky Normal Form(CNF) or Greibach normal form (GNF). If so...
habedi/stack-exchange-dataset
54,464
calculating overlap of modular ranges
<p>So, this might be a really simple problem but I can't seem to find a nice algorithm to solve it:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given two ranges, <em>[a1, a2]</em>, <em>[b1, b2]</em> (all real numbers) and a real number <em>n</em>, find the length of the overlapping segment between the two ranges over a modulo ...
algorithms
1
calculating overlap of modular ranges -- (algorithms) <p>So, this might be a really simple problem but I can't seem to find a nice algorithm to solve it:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given two ranges, <em>[a1, a2]</em>, <em>[b1, b2]</em> (all real numbers) and a real number <em>n</em>, find the length of the ove...
habedi/stack-exchange-dataset
54,466
Confusion in the solution to first readers-writers synchronization
<p>I am studying the solution to “First Readers-Writers Problem” from the book <a href="http://rads.stackoverflow.com/amzn/click/1118063333" rel="nofollow">Operating System Concepts (9th edition)</a> and it describes:</p>&#xA;&#xA;<blockquote>&#xA; <p>First readers–writers problem, requires that no reader be kept wait...
operating systems concurrency synchronization mutual exclusion
1
Confusion in the solution to first readers-writers synchronization -- (operating systems concurrency synchronization mutual exclusion) <p>I am studying the solution to “First Readers-Writers Problem” from the book <a href="http://rads.stackoverflow.com/amzn/click/1118063333" rel="nofollow">Operating System Concepts (9t...
habedi/stack-exchange-dataset
54,469
Algorithm to find a subgraph such that all of its edges has an anti edge
<blockquote>&#xA;<p>Let <span class="math-container">$G=(V,E)$</span> be a directed graph. The &quot;invertible&quot; part of <span class="math-container">$G$</span> is the subgraph <span class="math-container">$H=(V,E_2)$</span> such that <span class="math-container">$(u,v)\in E_2 \iff (u,v)\in E \land (v,u)\in E$</s...
algorithms graphs
1
Algorithm to find a subgraph such that all of its edges has an anti edge -- (algorithms graphs) <blockquote>&#xA;<p>Let <span class="math-container">$G=(V,E)$</span> be a directed graph. The &quot;invertible&quot; part of <span class="math-container">$G$</span> is the subgraph <span class="math-container">$H=(V,E_2)$</...
habedi/stack-exchange-dataset
54,470
Finding a simple cycle that goes through two vertices
<p>Given a directed graph $G$ and two vertices $u$ and $w$, how can we find a simple cycle that goes through $u$ and $w$?</p>&#xA;&#xA;<p>One can try putting together paths from $u$ to $w$ and $w$ to $u$ — but these might have edges or nodes in common, even if they are chosen to be shortest paths.</p>&#xA;
algorithms graphs
1
Finding a simple cycle that goes through two vertices -- (algorithms graphs) <p>Given a directed graph $G$ and two vertices $u$ and $w$, how can we find a simple cycle that goes through $u$ and $w$?</p>&#xA;&#xA;<p>One can try putting together paths from $u$ to $w$ and $w$ to $u$ — but these might have edges or nodes i...
habedi/stack-exchange-dataset
54,474
Combine $k$ sorted lists into one
<p>Say I have $k$ sorted lists of the same size $n/k$, and I want to combine them into one sorted array in $O(n\log k)$ time. </p>&#xA;&#xA;<p>The solution I came up with is to recursively halve the lists until you have sections of two lists. Then you combine them by setting a pointer at the start of each one, and plac...
time complexity sorting
1
Combine $k$ sorted lists into one -- (time complexity sorting) <p>Say I have $k$ sorted lists of the same size $n/k$, and I want to combine them into one sorted array in $O(n\log k)$ time. </p>&#xA;&#xA;<p>The solution I came up with is to recursively halve the lists until you have sections of two lists. Then you combi...
habedi/stack-exchange-dataset
54,484
Showing that a language satisfies the pumping lemma
<p>I am wanting to show that this language fails to show that it is not context-free. So, in essence, it satisfies the pumping lemma</p>&#xA;&#xA;<p>If L = {a<sup>m</sup>b<sup>n</sup>c<sup>n</sup>d<sup>n</sup> | m,n >= 1 }</p>&#xA;&#xA;<p>Should I have n be the constant of the pumping lemma? Is z=a<sup>m</sup>b<sup>n</...
formal languages context free pumping lemma
1
Showing that a language satisfies the pumping lemma -- (formal languages context free pumping lemma) <p>I am wanting to show that this language fails to show that it is not context-free. So, in essence, it satisfies the pumping lemma</p>&#xA;&#xA;<p>If L = {a<sup>m</sup>b<sup>n</sup>c<sup>n</sup>d<sup>n</sup> | m,n >= ...
habedi/stack-exchange-dataset
54,497
Categorization of Binary search as Divide and Conquer
<p>Why do we call binary search as 'Divide' and 'Conquer' strategy? It does not combine the results unlike other Divide and Conquer strategies.</p>&#xA;
divide and conquer binary search
1
Categorization of Binary search as Divide and Conquer -- (divide and conquer binary search) <p>Why do we call binary search as 'Divide' and 'Conquer' strategy? It does not combine the results unlike other Divide and Conquer strategies.</p>&#xA;
habedi/stack-exchange-dataset
54,506
Does a reduction with $\infty$ work?
<p>Lately, I saw an NP-complete proof that involves creating an instance of a problem using $\infty$. Is this a polynomial-time reduction?</p>&#xA;&#xA;<p>More precisely, let a problem $\Pi$ has an instance $I=(n, A, v)$ where $A$ is a matrix of size $n\times n$, $A=[a_{ij}]$, and $v$ is positive.</p>&#xA;&#xA;<p>The p...
reductions
1
Does a reduction with $\infty$ work? -- (reductions) <p>Lately, I saw an NP-complete proof that involves creating an instance of a problem using $\infty$. Is this a polynomial-time reduction?</p>&#xA;&#xA;<p>More precisely, let a problem $\Pi$ has an instance $I=(n, A, v)$ where $A$ is a matrix of size $n\times n$, $A=...
habedi/stack-exchange-dataset
54,516
Is it possible to reduce the number of variables in bin packing?
<p>The bin packing problem can be formulated as:&#xA;\begin{align}&#xA; &amp; \underset{x,y}{\min}&#xA; &amp; &amp; B = \sum_{i=1}^n y_i\\&#xA; &amp; \text{subject to} &#xA; &amp; &amp; B \geq 1,\\&#xA; &amp; &amp; &amp; \sum_{j=1}^n a_j x_{ij} \leq V y_i,\forall i \in \{1,\ldots,n\}\\&#xA; &amp; &amp; &amp; \sum_{i...
np complete integer programming
1
Is it possible to reduce the number of variables in bin packing? -- (np complete integer programming) <p>The bin packing problem can be formulated as:&#xA;\begin{align}&#xA; &amp; \underset{x,y}{\min}&#xA; &amp; &amp; B = \sum_{i=1}^n y_i\\&#xA; &amp; \text{subject to} &#xA; &amp; &amp; B \geq 1,\\&#xA; &amp; &amp; &am...
habedi/stack-exchange-dataset
54,540
A criterion for the planar graph to have unique dual
<p>I get stuck with the following two criteria both about the uniqueness of plane embeddings of a given planar graph. The first one says that a planar graph admits unique plane embedding iff it is a subdivision of 3-connected planar graph (e.g. from the book "Planar Graphs: Theory and Algorithms"). The second one (is f...
graphs planar graphs
1
A criterion for the planar graph to have unique dual -- (graphs planar graphs) <p>I get stuck with the following two criteria both about the uniqueness of plane embeddings of a given planar graph. The first one says that a planar graph admits unique plane embedding iff it is a subdivision of 3-connected planar graph (e...
habedi/stack-exchange-dataset
54,543
heapify last 3 lines
<p>I'm following &#xA;<a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/MIT6_006F11_lec04.pdf" rel="nofollow">http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-...
algorithms sorting heaps
1
heapify last 3 lines -- (algorithms sorting heaps) <p>I'm following &#xA;<a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/MIT6_006F11_lec04.pdf" rel="nofollow">http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/...
habedi/stack-exchange-dataset
54,546
Vertex cover problem with 2-element vertices
<p>Let $G = (W, E)$ be an undirected graph, where $W = \{(v_i,v_j) \in V \times V : v_i &gt; v_j\}$ and $E$ is a set of $2$-element subsets of $W$ such that, given two edges $e_1 = (w_1, w_2)$ and $e_2 = (w_1, w_3)$, $(w_2, w_3) \in E$ necessarily if there exists some $v$ belonging to $w_1$, $w_2$ and $w_3$. (For examp...
algorithms graphs optimization
1
Vertex cover problem with 2-element vertices -- (algorithms graphs optimization) <p>Let $G = (W, E)$ be an undirected graph, where $W = \{(v_i,v_j) \in V \times V : v_i &gt; v_j\}$ and $E$ is a set of $2$-element subsets of $W$ such that, given two edges $e_1 = (w_1, w_2)$ and $e_2 = (w_1, w_3)$, $(w_2, w_3) \in E$ nec...
habedi/stack-exchange-dataset
54,548
"Minimal" intuitionistic type theory?
<p>I'm surprised that people keep adding new types in type theories but no one seems to mention a minimal theory (or I can't find it). I thought mathaticians love minimal stuff, don't they?</p>&#xA;&#xA;<p>If I understand correctly, in a type theory with a impredicative <code>Prop</code>, λ-abstraction and Π-types suff...
type theory dependent types
1
"Minimal" intuitionistic type theory? -- (type theory dependent types) <p>I'm surprised that people keep adding new types in type theories but no one seems to mention a minimal theory (or I can't find it). I thought mathaticians love minimal stuff, don't they?</p>&#xA;&#xA;<p>If I understand correctly, in a type theory...
habedi/stack-exchange-dataset
54,562
Running time of selection sort
<p>I wrote pseudocode for <code>Selection Sort</code>, but I'm not sure what is the running time of my algorithm, can you help me with that?</p>&#xA;&#xA;<hr>&#xA;&#xA;<p><strong>My Pseudocode: Selection Sort(int a[], int n)</strong></p>&#xA;&#xA;<p>Input: array of length $n$</p>&#xA;&#xA;<p>Output: sorted array</p>&#x...
algorithms data structures runtime analysis
1
Running time of selection sort -- (algorithms data structures runtime analysis) <p>I wrote pseudocode for <code>Selection Sort</code>, but I'm not sure what is the running time of my algorithm, can you help me with that?</p>&#xA;&#xA;<hr>&#xA;&#xA;<p><strong>My Pseudocode: Selection Sort(int a[], int n)</strong></p>&#x...
habedi/stack-exchange-dataset
54,567
Runtime of a recursive algorithm to find a path in a DAG
<p>About the following algorithm:</p>&#xA;&#xA;<pre><code>reach(Vertex s, Vertex t):&#xA; if s = t return TRUE&#xA; else&#xA; for v in Adj(s) do&#xA; if reach(v,t) return TRUE&#xA; return FALSE&#xA;</code></pre>&#xA;&#xA;<p>Why can we say that its runtime on a directed acyclic graph is $O...
algorithms graphs runtime analysis
1
Runtime of a recursive algorithm to find a path in a DAG -- (algorithms graphs runtime analysis) <p>About the following algorithm:</p>&#xA;&#xA;<pre><code>reach(Vertex s, Vertex t):&#xA; if s = t return TRUE&#xA; else&#xA; for v in Adj(s) do&#xA; if reach(v,t) return TRUE&#xA; return FALS...
habedi/stack-exchange-dataset
54,575
A Graph's Density and Sparsity
<ol>&#xA;<li>A graph is dense when |E| (edges) is closest to $|V|^2$.</li>&#xA;<li>A graph is sparse when |E| is closer to $|V|$.</li>&#xA;</ol>&#xA;&#xA;<p>What does it mean to take the magnitude of the vertices? Secondly, I am having a hard time conceptualizing why the above two rules are true. </p>&#xA;&#xA;<p>Also ...
graphs
1
A Graph's Density and Sparsity -- (graphs) <ol>&#xA;<li>A graph is dense when |E| (edges) is closest to $|V|^2$.</li>&#xA;<li>A graph is sparse when |E| is closer to $|V|$.</li>&#xA;</ol>&#xA;&#xA;<p>What does it mean to take the magnitude of the vertices? Secondly, I am having a hard time conceptualizing why the above...
habedi/stack-exchange-dataset
54,576
What does it mean to be Turing reducible?
<p>I'm confused about what it means to be Turing reducible. I thought I understood what it meant, but apparently not.</p>&#xA;&#xA;<p>$A \leq B $ Means that A is Turing reducible to B. This means that given an oracle for Machine B, A can be solved.</p>&#xA;&#xA;<p>I'm confused in the case of SUPERHALT which decides whe...
computability reductions halting problem
1
What does it mean to be Turing reducible? -- (computability reductions halting problem) <p>I'm confused about what it means to be Turing reducible. I thought I understood what it meant, but apparently not.</p>&#xA;&#xA;<p>$A \leq B $ Means that A is Turing reducible to B. This means that given an oracle for Machine B, ...
habedi/stack-exchange-dataset
54,579
How to pick w for the Pumping lemma if the language has no clear pattern?
<p>I'm trying to understanding using the pumping lemma to prove that a language is not regular. I sort of understand how it works when the language describes strings with a particular form, like in <a href="http://www.tutorialspoint.com/automata_theory/pumping_lemma_for_regular_grammar.htm" rel="nofollow">this example<...
formal languages regular languages pumping lemma
1
How to pick w for the Pumping lemma if the language has no clear pattern? -- (formal languages regular languages pumping lemma) <p>I'm trying to understanding using the pumping lemma to prove that a language is not regular. I sort of understand how it works when the language describes strings with a particular form, li...
habedi/stack-exchange-dataset
54,582
Pushdown Automata: How can I recognize a ratio threshold between two symbols in a string?
<p>I'm trying to design a pushdown automata where there are two symbols in the alphabet and the accept state is when there is >= 60% of symbol A.</p>&#xA;&#xA;<p>I'm trying to think in terms of what to save on the stack. The problem of telling when there are 50% or more is trivial. You can just pop and push As and Bs o...
formal languages context free automata pushdown automata
1
Pushdown Automata: How can I recognize a ratio threshold between two symbols in a string? -- (formal languages context free automata pushdown automata) <p>I'm trying to design a pushdown automata where there are two symbols in the alphabet and the accept state is when there is >= 60% of symbol A.</p>&#xA;&#xA;<p>I'm tr...
habedi/stack-exchange-dataset
54,599
Complexity of sorting a 1-sorted array
<p>A $k$-sorted array is one in which every element is at most distance $k$ from its position when the array is sorted. The complexity of sorting such array is $O(n\log k)$. But if $k=1$, then $\log k=0$ so what happens? What is the complexity of sorting an array where each element is at most one place away from its s...
complexity theory sorting
1
Complexity of sorting a 1-sorted array -- (complexity theory sorting) <p>A $k$-sorted array is one in which every element is at most distance $k$ from its position when the array is sorted. The complexity of sorting such array is $O(n\log k)$. But if $k=1$, then $\log k=0$ so what happens? What is the complexity of so...
habedi/stack-exchange-dataset
54,602
Resending old frame when a damaged frame has been received in one bit sliding window protocol
<p>I'm reading Tanenbaum's and Wheterall's book on Computer Networks.&#xA;I'm trying out some examples of situations that can occur in the <strong>one bit sliding window protocol</strong> for a datalink layer.</p>&#xA;&#xA;<p>The code for the protocol can be found <a href="http://authors.phptr.com/tanenbaumcn4/samples/...
computer networks communication protocols
1
Resending old frame when a damaged frame has been received in one bit sliding window protocol -- (computer networks communication protocols) <p>I'm reading Tanenbaum's and Wheterall's book on Computer Networks.&#xA;I'm trying out some examples of situations that can occur in the <strong>one bit sliding window protocol<...
habedi/stack-exchange-dataset
54,607
How do RNN's handle providing output with different dimension than input
<p>It seems like an RNN has to have the h<sub>t-1</sub> needs to be the same size as the input vector since they're being added to one another, but if you're doing something like modeling to another language or classification, how would you handle this? I'd imagine you'd just have a fully connected layer that would pr...
neural networks
1
How do RNN's handle providing output with different dimension than input -- (neural networks) <p>It seems like an RNN has to have the h<sub>t-1</sub> needs to be the same size as the input vector since they're being added to one another, but if you're doing something like modeling to another language or classification,...
habedi/stack-exchange-dataset
54,608
Sieving to compute first values of totient function
<p>What i want to do is to compute the first $n$ values of Euler's totient function effectively. As far as i know the best way to do it is to run a sieving algorithm and for each prime encountered to update current totient-value for all its multiples. My realization in Python is given below. I use two facts about totie...
number theory
1
Sieving to compute first values of totient function -- (number theory) <p>What i want to do is to compute the first $n$ values of Euler's totient function effectively. As far as i know the best way to do it is to run a sieving algorithm and for each prime encountered to update current totient-value for all its multiple...
habedi/stack-exchange-dataset
54,614
Linear Search Algorithm - Why allow a user to input a start and end index to LS?
<p>Here is the linear search algorithm provided in class:</p>&#xA;&#xA;<pre><code>bool LinearSearch(int [] a, int l, int u, int e) { &#xA; for(int i:=l; i ≤ u ; i := i + 1) {&#xA; if (a[i] = e) return true;&#xA; }&#xA; return false;&#xA;}&#xA;</code></pre>&#xA;&#xA;<p>If the intention of this fu...
algorithms
1
Linear Search Algorithm - Why allow a user to input a start and end index to LS? -- (algorithms) <p>Here is the linear search algorithm provided in class:</p>&#xA;&#xA;<pre><code>bool LinearSearch(int [] a, int l, int u, int e) { &#xA; for(int i:=l; i ≤ u ; i := i + 1) {&#xA; if (a[i] = e) return true;&#x...
habedi/stack-exchange-dataset
54,616
Solving systems of linear equations over semirings
<p>So I have come across an issue where it would be very nice to solve systems of linear equations over semirings but I have no clue how to do that. Over a field I would use Gaussian elimination but I'm at a loss of how to find solution spaces to even rings much less semirings. In fact I'm not 100% sure this is decidab...
algorithms undecidability linear algebra algebra
1
Solving systems of linear equations over semirings -- (algorithms undecidability linear algebra algebra) <p>So I have come across an issue where it would be very nice to solve systems of linear equations over semirings but I have no clue how to do that. Over a field I would use Gaussian elimination but I'm at a loss of...
habedi/stack-exchange-dataset
54,617
Showing the the language represented by a set is regular
<p>Is the language $L = \{ w \mid w $ is $ 3^n - 1 $ in some given representation $, n &gt; 0 \}$ regular? I know that it is regular. If each element in $L$ is represented as decimal numbers, $L = \{ 2, 8, 26, 80, 242, \ldots \}$. If in binary, $L = \{ 10, 1000, 11010, 1010000, 11110010, \ldots \}$. However, if in tern...
formal languages regular languages
1
Showing the the language represented by a set is regular -- (formal languages regular languages) <p>Is the language $L = \{ w \mid w $ is $ 3^n - 1 $ in some given representation $, n &gt; 0 \}$ regular? I know that it is regular. If each element in $L$ is represented as decimal numbers, $L = \{ 2, 8, 26, 80, 242, \ldo...
habedi/stack-exchange-dataset
54,619
Quantum computer simulators with proper measurements
<p>I have been looking for quantum computer simulators and came across QCAD (<a href="http://qcad.osdn.jp/" rel="nofollow">http://qcad.osdn.jp/</a>). It is stated on their website that "Measurement gates on QCAD are different from real measurements." </p>&#xA;&#xA;<p>I wonder if other simulators, like those listed on Q...
quantum computing simulation
1
Quantum computer simulators with proper measurements -- (quantum computing simulation) <p>I have been looking for quantum computer simulators and came across QCAD (<a href="http://qcad.osdn.jp/" rel="nofollow">http://qcad.osdn.jp/</a>). It is stated on their website that "Measurement gates on QCAD are different from re...
habedi/stack-exchange-dataset
54,621
Enumeration of winning coalitions
<p>Taken from Wikipedeia:</p>&#xA;<blockquote>&#xA;<p>A simple voting game, taken from Game Theory and Strategy by Phillip D. Straffin:</p>&#xA;<p>[6; 4, 3, 2, 1]</p>&#xA;<p>The numbers in the brackets mean a measure requires 6 votes to pass, and voter A can cast four votes, B three votes, C two, and D one. The winning...
algorithms enumeration voting
1
Enumeration of winning coalitions -- (algorithms enumeration voting) <p>Taken from Wikipedeia:</p>&#xA;<blockquote>&#xA;<p>A simple voting game, taken from Game Theory and Strategy by Phillip D. Straffin:</p>&#xA;<p>[6; 4, 3, 2, 1]</p>&#xA;<p>The numbers in the brackets mean a measure requires 6 votes to pass, and vote...
habedi/stack-exchange-dataset
54,623
Runtime of algorithem when the internal for depend on the external for
<p>I'm trying to find the running time of this pseodocose:</p>&#xA;&#xA;<pre><code>int x=0,i,j&#xA;for (i=1;i&lt;=n;i++)&#xA; for(j=1;j&lt;=n+r;j=j+i)&#xA; x=x+j;&#xA;</code></pre>&#xA;&#xA;<p>What I did: First I checked what happened on the first iteration of the external <code>for</code>:</p>&#xA;&#xA;<ul>&...
algorithm analysis runtime analysis loops
1
Runtime of algorithem when the internal for depend on the external for -- (algorithm analysis runtime analysis loops) <p>I'm trying to find the running time of this pseodocose:</p>&#xA;&#xA;<pre><code>int x=0,i,j&#xA;for (i=1;i&lt;=n;i++)&#xA; for(j=1;j&lt;=n+r;j=j+i)&#xA; x=x+j;&#xA;</code></pre>&#xA;&#xA;<p>...
habedi/stack-exchange-dataset
54,634
How do you determine the inputs to a neural network?
<p>I'm looking at <a href="https://takinginitiative.wordpress.com/2008/04/23/basic-neural-network-tutorial-c-implementation-and-source-code/">this tutorial</a> on neural networks. The data that is given from the UCI study includes various attributes, such as "mean x of on pixels", "total # on pixels" etc, which are tak...
neural networks
1
How do you determine the inputs to a neural network? -- (neural networks) <p>I'm looking at <a href="https://takinginitiative.wordpress.com/2008/04/23/basic-neural-network-tutorial-c-implementation-and-source-code/">this tutorial</a> on neural networks. The data that is given from the UCI study includes various attribu...
habedi/stack-exchange-dataset
54,643
Kolmogorov complexity vs purposefully inefficient Turing machines
<p>It's a theorem that, although the Kolmogorov complexity of a string is relative to the Turing machine you're working with, it differs by at most a constant (basically the amount of space it takes to write an interpreter for Turing machine A inside of Turing machine B).</p>&#xA;&#xA;<p>My question is: how does this t...
turing machines kolmogorov complexity
1
Kolmogorov complexity vs purposefully inefficient Turing machines -- (turing machines kolmogorov complexity) <p>It's a theorem that, although the Kolmogorov complexity of a string is relative to the Turing machine you're working with, it differs by at most a constant (basically the amount of space it takes to write an ...
habedi/stack-exchange-dataset
54,647
Efficiently split a point cloud into two parts by a hyperplane to maximize the total sum of values associated with one part
<p>I have the following problem in mind. Suppose we have an $n$-dimensional point cloud with $m$ points. Each point in the cloud is associated with a value $X_i,1\leq i\leq m$. I would like to use a hyperplane to partition this point cloud into two parts, $S$ and $S^c$, in order to maximize $\sum_{i\in S} X_i$. Are the...
algorithms optimization computational geometry approximation discrete mathematics
1
Efficiently split a point cloud into two parts by a hyperplane to maximize the total sum of values associated with one part -- (algorithms optimization computational geometry approximation discrete mathematics) <p>I have the following problem in mind. Suppose we have an $n$-dimensional point cloud with $m$ points. Each...
habedi/stack-exchange-dataset
54,651
How many languages exist over a finite alphabet?
<p>I'm currently reviewing my Automata and Languages Theory course and I stumbled upon the following exercise exams.&#xA;<a href="http://minds.jacobs-university.de/sites/default/files/uploads/teaching/share/ExercisesExamsACS1Fall04Solved.pdf" rel="nofollow">Link</a></p>&#xA;&#xA;<p>In "Exercises for ACS 1, Fall 2004, s...
formal languages automata finite automata
1
How many languages exist over a finite alphabet? -- (formal languages automata finite automata) <p>I'm currently reviewing my Automata and Languages Theory course and I stumbled upon the following exercise exams.&#xA;<a href="http://minds.jacobs-university.de/sites/default/files/uploads/teaching/share/ExercisesExamsACS...
habedi/stack-exchange-dataset
54,662
Should planar Euclidean graphs be planar straight-line graphs?
<p>An <a href="http://mathworld.wolfram.com/EuclideanGraph.html" rel="nofollow noreferrer">Euclidean graph</a>, by definition is </p>&#xA;&#xA;<blockquote>&#xA; <p>A weighted graph in which the weights are equal to the Euclidean&#xA; lengths of the edges in a specified embedding</p>&#xA;</blockquote>&#xA;&#xA;<p>and ...
graphs euclidean distance
1
Should planar Euclidean graphs be planar straight-line graphs? -- (graphs euclidean distance) <p>An <a href="http://mathworld.wolfram.com/EuclideanGraph.html" rel="nofollow noreferrer">Euclidean graph</a>, by definition is </p>&#xA;&#xA;<blockquote>&#xA; <p>A weighted graph in which the weights are equal to the Euclid...
habedi/stack-exchange-dataset
54,667
Existence of Hamming code
<p>We are given a number $n \geq 3$ and we know that the Hamming bound is satisfied. Does this imply that there is a Hamming code with length $\frac{q^r-1}{q-1}$, dimension $\frac{q^r-1}{q-1}-r$ and Hamming-distance $3$ or do we have to construct such a code, given that the bound is satisfied?</p>&#xA;
coding theory
1
Existence of Hamming code -- (coding theory) <p>We are given a number $n \geq 3$ and we know that the Hamming bound is satisfied. Does this imply that there is a Hamming code with length $\frac{q^r-1}{q-1}$, dimension $\frac{q^r-1}{q-1}-r$ and Hamming-distance $3$ or do we have to construct such a code, given that the...
habedi/stack-exchange-dataset
54,668
Modal logic axiom S4, transitive and reflexive frame, tableaux solver
<p>I have a difficult problem to solve which as mentioned in the title is related to <strong>modal logic axiom S4.</strong>&#xA;So, here is some background knowledge that can be useful:</p>&#xA;&#xA;<ul>&#xA;<li>S4 axiom is a class of transitive and reflexive frames</li>&#xA;<li>S4 satisfiability problem is PSpace-Comp...
logic proof techniques satisfiability correctness proof modal logic
1
Modal logic axiom S4, transitive and reflexive frame, tableaux solver -- (logic proof techniques satisfiability correctness proof modal logic) <p>I have a difficult problem to solve which as mentioned in the title is related to <strong>modal logic axiom S4.</strong>&#xA;So, here is some background knowledge that can be...
habedi/stack-exchange-dataset
54,674
How to give an approximation algorithm for this unusual bin packing problem?
<p>The usual bin packing problem can be formulated as:&#xA;\begin{align}&#xA; &amp; \underset{x,y}{\min}&#xA; &amp; &amp; B = \sum_{i=1}^n y_i\\&#xA; &amp; \text{subject to} &#xA; &amp; &amp; B \geq 1,\\&#xA; &amp; &amp; &amp; \sum_{j=1}^n a_j x_{ij} \leq V y_i,\forall i \in \{1,\ldots,n\}\\&#xA; &amp; &amp; &amp; \...
approximation algorithm design
1
How to give an approximation algorithm for this unusual bin packing problem? -- (approximation algorithm design) <p>The usual bin packing problem can be formulated as:&#xA;\begin{align}&#xA; &amp; \underset{x,y}{\min}&#xA; &amp; &amp; B = \sum_{i=1}^n y_i\\&#xA; &amp; \text{subject to} &#xA; &amp; &amp; B \geq 1,\\&#xA...
habedi/stack-exchange-dataset
54,675
A clarification on $PP$
<p>Wiki in <a href="https://en.wikipedia.org/wiki/PP_(complexity)" rel="nofollow">https://en.wikipedia.org/wiki/PP_(complexity)</a> says "a PP algorithm is permitted to do something like the following:</p>&#xA;&#xA;<p>On a YES instance, output YES with probability $1/2 + 1/2^n$, where n is the length of the input.&#xA;...
complexity theory complexity classes randomized algorithms probabilistic algorithms
1
A clarification on $PP$ -- (complexity theory complexity classes randomized algorithms probabilistic algorithms) <p>Wiki in <a href="https://en.wikipedia.org/wiki/PP_(complexity)" rel="nofollow">https://en.wikipedia.org/wiki/PP_(complexity)</a> says "a PP algorithm is permitted to do something like the following:</p>&#...
habedi/stack-exchange-dataset
54,680
Maths Co-Processors
<p>I want to know how Maths Co-Processors are made and how they work. I do understand that these are based upon electrical (yet chemical) switches, but how do they calculate things ? </p>&#xA;&#xA;<p>I don't understand how switching something on and off not only make something tick but also make it do much more. &#xA;I...
cpu
1
Maths Co-Processors -- (cpu) <p>I want to know how Maths Co-Processors are made and how they work. I do understand that these are based upon electrical (yet chemical) switches, but how do they calculate things ? </p>&#xA;&#xA;<p>I don't understand how switching something on and off not only make something tick but also...
habedi/stack-exchange-dataset
54,682
Difference between graph-partitioning and graph-coarsening
<p>What is the difference between graph-partitioning and graph-coarsening with respect to scale-free networks? I am trying to analyze graphs generated using the data from social networks. Do both the terms mean the same or are they different?</p>&#xA;
complexity theory graphs
1
Difference between graph-partitioning and graph-coarsening -- (complexity theory graphs) <p>What is the difference between graph-partitioning and graph-coarsening with respect to scale-free networks? I am trying to analyze graphs generated using the data from social networks. Do both the terms mean the same or are they...
habedi/stack-exchange-dataset
54,683
Difference between graph-partitioning and graph-clustering
<p>What is the difference between graph-partitioning and graph-clustering in graph theory?</p>&#xA;
graphs
1
Difference between graph-partitioning and graph-clustering -- (graphs) <p>What is the difference between graph-partitioning and graph-clustering in graph theory?</p>&#xA;
habedi/stack-exchange-dataset
54,687
Calculating product of totient functions
<p>Suppose that i need to compute product $~\phi(1) \dots \phi(n)~$ modulo prime $500009$ as fast as possible. Memory limitations are rather tough: $64$ mb so i can't just keep all the values of totient function. $n$ can be as large as $10^9$ and time given is $2$ s.</p>&#xA;&#xA;<p>My main idea is to somehow estimate ...
number theory
1
Calculating product of totient functions -- (number theory) <p>Suppose that i need to compute product $~\phi(1) \dots \phi(n)~$ modulo prime $500009$ as fast as possible. Memory limitations are rather tough: $64$ mb so i can't just keep all the values of totient function. $n$ can be as large as $10^9$ and time given is...
habedi/stack-exchange-dataset
54,688
UCT1 Algorithm: What does "total number of simulations" mean?
<p>When reading up on the UCT1 algorithm (I'm writing a Monte Carlo tree search), I'm having trouble with the formula.&#xA;$$\frac{w_i}{n_i} + \sqrt{\frac{\ln t}{n_i}}$$&#xA;<a href="https://en.wikipedia.org/wiki/Monte_Carlo_tree_search#Exploration_and_exploitation" rel="noreferrer">Wikipedia</a>, <a href="https://jeff...
algorithms trees search trees monte carlo
1
UCT1 Algorithm: What does "total number of simulations" mean? -- (algorithms trees search trees monte carlo) <p>When reading up on the UCT1 algorithm (I'm writing a Monte Carlo tree search), I'm having trouble with the formula.&#xA;$$\frac{w_i}{n_i} + \sqrt{\frac{\ln t}{n_i}}$$&#xA;<a href="https://en.wikipedia.org/wik...
habedi/stack-exchange-dataset
54,696
What is fastest algorithm for factoring out square from number
<p>I have $n$-digit integer $N=a^2b$, $b$ is square-free. In other words, $a$ is maximal square which divides $N$.</p>&#xA;&#xA;<p>What is fastest known algorithm to find $a$? I can write algorithm of $O(n^2\sqrt{N})$ simply trying all squares that are smaller than $N$ and checking for divisibility.</p>&#xA;&#xA;<p>Is ...
factoring
1
What is fastest algorithm for factoring out square from number -- (factoring) <p>I have $n$-digit integer $N=a^2b$, $b$ is square-free. In other words, $a$ is maximal square which divides $N$.</p>&#xA;&#xA;<p>What is fastest known algorithm to find $a$? I can write algorithm of $O(n^2\sqrt{N})$ simply trying all square...
habedi/stack-exchange-dataset
54,699
The difference between theoretical complexity and practical efficiency
<p>If I have this pseudocode:</p>&#xA;&#xA;<pre><code>for i=0 to n/2 do&#xA; for j=0 to n/2 do &#xA; ... do anything ....&#xA;</code></pre>&#xA;&#xA;<p>The number of iterations is $n^2/4$.</p>&#xA;&#xA;<p>What is the complexity of this program?&#xA;Is it $O(n^2)$?</p>&#xA;&#xA;<p>What is the intuition formal/in...
complexity theory time complexity runtime analysis
1
The difference between theoretical complexity and practical efficiency -- (complexity theory time complexity runtime analysis) <p>If I have this pseudocode:</p>&#xA;&#xA;<pre><code>for i=0 to n/2 do&#xA; for j=0 to n/2 do &#xA; ... do anything ....&#xA;</code></pre>&#xA;&#xA;<p>The number of iterations is $n^2/...
habedi/stack-exchange-dataset
54,700
How many segmentations are possible for a string length N?
<p>I have a string with length N. I would like to know how many segmentations are possible to it. &#xA;Consider the example <code>abcdc</code> the number of N = 5&#xA;All possible segmentations are </p>&#xA;&#xA;<pre><code>['abcdc']&#xA;['abcd', 'c']&#xA;['abc', 'dc']&#xA;['abc', 'd', 'c']&#xA;['ab', 'cdc']&#xA;['ab', ...
combinatorics strings
1
How many segmentations are possible for a string length N? -- (combinatorics strings) <p>I have a string with length N. I would like to know how many segmentations are possible to it. &#xA;Consider the example <code>abcdc</code> the number of N = 5&#xA;All possible segmentations are </p>&#xA;&#xA;<pre><code>['abcdc']&#...
habedi/stack-exchange-dataset
54,709
How to write a closed term with this type?
<p><code>X→Y →(X+Y)×Y</code></p>&#xA;&#xA;<p>I'm confused about how to get the type <code>(X + Y)</code>.&#xA;If I assume <code>m: (X + Y), n: X, k: Y</code>&#xA;then I can get $${m:X+Y \vdash \lambda n:X.\lambda k:Y.&lt;m, k&gt;}$$&#xA;which get the right type. But I can't reduce the context <code>m: X + Y</code>.&#xA...
lambda calculus
1
How to write a closed term with this type? -- (lambda calculus) <p><code>X→Y →(X+Y)×Y</code></p>&#xA;&#xA;<p>I'm confused about how to get the type <code>(X + Y)</code>.&#xA;If I assume <code>m: (X + Y), n: X, k: Y</code>&#xA;then I can get $${m:X+Y \vdash \lambda n:X.\lambda k:Y.&lt;m, k&gt;}$$&#xA;which get the right...
habedi/stack-exchange-dataset
54,712
How to compute Jacobi symbol efficiently?
<p>How do I compute the Jacobi symbol $(N|A)$ efficiently?</p>&#xA;&#xA;<p>In particular, for every odd $N, A$, define the Jacobi symbol $(A|N)$ as $\prod_i Q_{p_i}(A)$ where $p_1, \dots , p_k$ are all the (not necessarily distinct) prime factors of $N$ (i.e., $N =\prod_i p_i$), and where $Q_p(A)$ is defined as below (...
time complexity complexity classes randomized algorithms number theory primes
1
How to compute Jacobi symbol efficiently? -- (time complexity complexity classes randomized algorithms number theory primes) <p>How do I compute the Jacobi symbol $(N|A)$ efficiently?</p>&#xA;&#xA;<p>In particular, for every odd $N, A$, define the Jacobi symbol $(A|N)$ as $\prod_i Q_{p_i}(A)$ where $p_1, \dots , p_k$ a...
habedi/stack-exchange-dataset
54,713
Why does the recurrence equation for QuickSort consider all the elements in the array?
<p>I have been taught that <code>QuickSort</code> has the following recurrence equation in the best case:</p>&#xA;&#xA;<p>$T(n) = \begin{cases} c &amp; \text{if } n=1 \\ 2\ T(\frac{n}{2}) + c \cdot n &amp; \text{if } n&gt;1 \end{cases}$</p>&#xA;&#xA;<p>where $c \in \Theta(1)$ and $c \cdot n \in \Theta(n)$. As well for ...
algorithm analysis recurrence relation recursion quicksort
1
Why does the recurrence equation for QuickSort consider all the elements in the array? -- (algorithm analysis recurrence relation recursion quicksort) <p>I have been taught that <code>QuickSort</code> has the following recurrence equation in the best case:</p>&#xA;&#xA;<p>$T(n) = \begin{cases} c &amp; \text{if } n=1 \\...
habedi/stack-exchange-dataset
54,722
Algorithm for compressing binary data that can efficiently be partially decompressed
<p>So I have been given the following problem and since I have no experience at all in this field, I would really appreciate some advice/guidance.</p>&#xA;&#xA;<p>These are the requirements:</p>&#xA;&#xA;<p>So three times per second a certain amount (fixed per session) of 32-bit values come in. These values have to be ...
algorithms data structures data compression
1
Algorithm for compressing binary data that can efficiently be partially decompressed -- (algorithms data structures data compression) <p>So I have been given the following problem and since I have no experience at all in this field, I would really appreciate some advice/guidance.</p>&#xA;&#xA;<p>These are the requireme...
habedi/stack-exchange-dataset
54,723
Unary notation representation in Turing Machine
<p>What can be a good convention to represent positive and negative integers in unary notation on a Turing machine? I want to design a Turing machine which acts as a subtractor.So should I partition the integer range to represent positive and negative integers in unary notation or is there some other way?</p>&#xA;
turing machines automata
1
Unary notation representation in Turing Machine -- (turing machines automata) <p>What can be a good convention to represent positive and negative integers in unary notation on a Turing machine? I want to design a Turing machine which acts as a subtractor.So should I partition the integer range to represent positive and...
habedi/stack-exchange-dataset
54,732
Falsifying the "Circular Wait" Condition - Deadlock Prevention
<p>In the <em>Circular Wait</em> condition for <code>Deadlock Prevention</code> section of <a href="http://rads.stackoverflow.com/amzn/click/1118063333" rel="nofollow">this</a>, it is described as follows:</p>&#xA;&#xA;<blockquote>&#xA; <p>One&#xA; way to ensure that this condition never holds is to impose a total or...
operating systems deadlocks
1
Falsifying the "Circular Wait" Condition - Deadlock Prevention -- (operating systems deadlocks) <p>In the <em>Circular Wait</em> condition for <code>Deadlock Prevention</code> section of <a href="http://rads.stackoverflow.com/amzn/click/1118063333" rel="nofollow">this</a>, it is described as follows:</p>&#xA;&#xA;<bloc...
habedi/stack-exchange-dataset
54,741
Algorithm to find pronounciation rules
<p>Suppose that you have a large dictionary with spellings and pronounciations of foreign words, and you want to find a set of pronunciation rules. They should have the simplest form: a sequence of letters to a sequence of sounds.</p>&#xA;&#xA;<p>For example, in French, <em>c</em> [k], <em>i</em> [i] and <em>ci</em> [s...
algorithms machine learning data mining computational linguistics
1
Algorithm to find pronounciation rules -- (algorithms machine learning data mining computational linguistics) <p>Suppose that you have a large dictionary with spellings and pronounciations of foreign words, and you want to find a set of pronunciation rules. They should have the simplest form: a sequence of letters to a...
habedi/stack-exchange-dataset
54,747
How to find a perfect matching with this constraint?
<p>I have a positive integer $n$ and two disjoint sets of nodes $V=\{v_1,\ldots,v_n\}$ and $W=\{w_1,\ldots,w_n\}$. I also have a weight function $f:V\times W\to\mathbb{R}_{&gt;0}$ and a positive number $\alpha$. The function $f$ is represented by the matrix $\mathbf{F}=\left[f_{vw}\right]$ as:</p>&#xA;&#xA;<p>$$\mathbf...
algorithms np
1
How to find a perfect matching with this constraint? -- (algorithms np) <p>I have a positive integer $n$ and two disjoint sets of nodes $V=\{v_1,\ldots,v_n\}$ and $W=\{w_1,\ldots,w_n\}$. I also have a weight function $f:V\times W\to\mathbb{R}_{&gt;0}$ and a positive number $\alpha$. The function $f$ is represented by t...
habedi/stack-exchange-dataset
54,748
Why is quiescent consistency compositional, but sequential consistency is not
<p>I'm having trouble in comparing these two memory consistency models.</p>&#xA;&#xA;<p>Essentially for sequential consistency I think of real code like this:</p>&#xA;&#xA;<pre><code>int x, y;&#xA;&#xA;void ThreadA()&#xA;{&#xA; x = 20; //Write&#xA; int a = y; //Read&#xA;}&#xA;&#xA;void ThreadB()&#xA;{&#xA; y = ...
concurrency cpu cache threads shared memory
1
Why is quiescent consistency compositional, but sequential consistency is not -- (concurrency cpu cache threads shared memory) <p>I'm having trouble in comparing these two memory consistency models.</p>&#xA;&#xA;<p>Essentially for sequential consistency I think of real code like this:</p>&#xA;&#xA;<pre><code>int x, y;...
habedi/stack-exchange-dataset
54,749
What is the difference between "deadlock prevention" and "deadlock avoidance"
<p>I have studied about both of these on many places like <a href="https://en.wikipedia.org/wiki/Deadlock#Prevention" rel="nofollow">this</a>, <a href="https://en.wikipedia.org/wiki/Deadlock#Avoidance" rel="nofollow">this</a> and <a href="https://www.quora.com/What-is-the-difference-between-deadlock-prevention-and-dead...
operating systems deadlocks
1
What is the difference between "deadlock prevention" and "deadlock avoidance" -- (operating systems deadlocks) <p>I have studied about both of these on many places like <a href="https://en.wikipedia.org/wiki/Deadlock#Prevention" rel="nofollow">this</a>, <a href="https://en.wikipedia.org/wiki/Deadlock#Avoidance" rel="no...
habedi/stack-exchange-dataset
54,751
Parameterized Dominating Set
<p>What is the best algorithm to compute p-dominating set?</p>&#xA;&#xA;<p>The p-dominating set problem is a parameterized version of minimum dominating set in which the problem takes a parameter $k$ also as an input, and the problem is now whether there exist a dominating set of cardinality at most $k$.</p>&#xA;&#xA;<...
graphs parameterized complexity
1
Parameterized Dominating Set -- (graphs parameterized complexity) <p>What is the best algorithm to compute p-dominating set?</p>&#xA;&#xA;<p>The p-dominating set problem is a parameterized version of minimum dominating set in which the problem takes a parameter $k$ also as an input, and the problem is now whether there...
habedi/stack-exchange-dataset
54,759
Design a grammar for this context-free language
<p>I am doing an exercise from <a href="http://web.engr.illinois.edu/~jeffe/teaching/algorithms/all-models.pdf" rel="nofollow">Models Of Computation - Ch - 5, Q-1(r)</a>.</p>&#xA;&#xA;<p>Design a grammar that generates this context-free language</p>&#xA;&#xA;<p>$\{ x\space\$\space y^R \,|\, x, y \in\{0, 1\}^* \text{ an...
context free formal grammars
1
Design a grammar for this context-free language -- (context free formal grammars) <p>I am doing an exercise from <a href="http://web.engr.illinois.edu/~jeffe/teaching/algorithms/all-models.pdf" rel="nofollow">Models Of Computation - Ch - 5, Q-1(r)</a>.</p>&#xA;&#xA;<p>Design a grammar that generates this context-free l...
habedi/stack-exchange-dataset
54,773
What exactly would stop me from registering a domain from my own nameserver?
<p>Can I just make a nameserver and claim away? Are there implemented measures to stop this from happening?</p>&#xA;
computer networks security
1
What exactly would stop me from registering a domain from my own nameserver? -- (computer networks security) <p>Can I just make a nameserver and claim away? Are there implemented measures to stop this from happening?</p>&#xA;
habedi/stack-exchange-dataset
54,775
Why do grammars in Chomsky Normal Form have derivations of length 2n-1?
<p>I would like to know how they obtained the expression $2n-1$ as said from the excerpt of <a href="http://people.cs.clemson.edu/~goddard/texts/theoryOfComputation/9a.pdf" rel="noreferrer">article</a> (p.3):</p>&#xA;&#xA;<blockquote>&#xA; <p>The key advantage is that in Chomsky Normal Form, every derivation of a stri...
context free formal grammars normal forms
1
Why do grammars in Chomsky Normal Form have derivations of length 2n-1? -- (context free formal grammars normal forms) <p>I would like to know how they obtained the expression $2n-1$ as said from the excerpt of <a href="http://people.cs.clemson.edu/~goddard/texts/theoryOfComputation/9a.pdf" rel="noreferrer">article</a>...
habedi/stack-exchange-dataset
54,778
Constructive version of decidability?
<p>Today at lunch, I brought up <a href="https://cs.stackexchange.com/questions/367/how-can-it-be-decidable-whether-pi-has-some-sequence-of-digits">this issue</a> with my colleagues, and to my surprise, Jeff E.'s argument that the problem is decidable did not convince them (<a href="https://mathoverflow.net/questions/1...
computability undecidability
1
Constructive version of decidability? -- (computability undecidability) <p>Today at lunch, I brought up <a href="https://cs.stackexchange.com/questions/367/how-can-it-be-decidable-whether-pi-has-some-sequence-of-digits">this issue</a> with my colleagues, and to my surprise, Jeff E.'s argument that the problem is decida...
habedi/stack-exchange-dataset
54,780
Tile Problem : Dynamic Programming
<p>Came across the following tile problem :</p>&#xA;&#xA;<pre><code>Given a “2 x n” board and tiles of size “2 x 1″, count the number of ways to tile the given board using the 2 x 1 tiles. A tile can either be placed horizontally i.e., as a 1 x 2 tile or vertically i.e., as 2 x 1 tile.&#xA;</code></pre>&#xA;&#xA;<p>Rec...
algorithms dynamic programming
1
Tile Problem : Dynamic Programming -- (algorithms dynamic programming) <p>Came across the following tile problem :</p>&#xA;&#xA;<pre><code>Given a “2 x n” board and tiles of size “2 x 1″, count the number of ways to tile the given board using the 2 x 1 tiles. A tile can either be placed horizontally i.e., as a 1 x 2 ti...
habedi/stack-exchange-dataset
54,782
Why is ZPP = RP ∩ co-RP?
<p>I am trying to prove the theorem that <a href="https://en.wikipedia.org/wiki/ZPP_(complexity)" rel="nofollow">ZPP</a> = <a href="https://en.wikipedia.org/wiki/RP_(complexity)" rel="nofollow">RP</a> $\; \cap \; co-RP$. If $L \in \; \subseteq RP \; \cap \; co-RP$ then I can see that it belongs to $ZPP$. But I am unabl...
complexity theory time complexity probability theory randomized algorithms probabilistic algorithms
1
Why is ZPP = RP ∩ co-RP? -- (complexity theory time complexity probability theory randomized algorithms probabilistic algorithms) <p>I am trying to prove the theorem that <a href="https://en.wikipedia.org/wiki/ZPP_(complexity)" rel="nofollow">ZPP</a> = <a href="https://en.wikipedia.org/wiki/RP_(complexity)" rel="nofoll...
habedi/stack-exchange-dataset
54,790
Finding a good loop invariant for a powering procedure
<p>Consider the following algorithm for computing integer powers:</p>&#xA;&#xA;<pre><code>Procedure power(integer x, integer n) &#xA; power := 1 &#xA; for i := 1 to n &#xA; power := power * x&#xA; return power&#xA;</code></pre>&#xA;&#xA;<p>Can we say that the loop invariant is $power \leq x^n$ ?<br>&...
algorithms correctness proof loop invariants program correctness
1
Finding a good loop invariant for a powering procedure -- (algorithms correctness proof loop invariants program correctness) <p>Consider the following algorithm for computing integer powers:</p>&#xA;&#xA;<pre><code>Procedure power(integer x, integer n) &#xA; power := 1 &#xA; for i := 1 to n &#xA; power ...
habedi/stack-exchange-dataset
54,800
How to give an upper bound on this bin packing problem?
<p>In the bin packing with fragile objects (BPFO) problem one is given a set of objects $\{1,\ldots,n\}$ where each object $i$ has a weight $w_i$ and a fragility $f_i$ for all $i$ in the set $\{1,\ldots,n\}$. (We assum that $w_i\le f_i$.) Also, we have a set of bins of infinite capacity (each) in which we want to place...
approximation lower bounds
1
How to give an upper bound on this bin packing problem? -- (approximation lower bounds) <p>In the bin packing with fragile objects (BPFO) problem one is given a set of objects $\{1,\ldots,n\}$ where each object $i$ has a weight $w_i$ and a fragility $f_i$ for all $i$ in the set $\{1,\ldots,n\}$. (We assum that $w_i\le ...
habedi/stack-exchange-dataset
54,802
Is the language of strings with an integer ratio of the number of a's to the number of b's context-free?
<p>Consider the language $L \subseteq \{a,b,c\}^*$, where $w \in L$ if and only if the ratio of the number of $a$'s in $w$ to the number of $b$'s in $w$ is an integer. I've been unable to find a counterexample string in $L$ which I can use to disprove (via a contradiction proof using the pumping lemma for CFLs) that $L...
formal languages context free
1
Is the language of strings with an integer ratio of the number of a's to the number of b's context-free? -- (formal languages context free) <p>Consider the language $L \subseteq \{a,b,c\}^*$, where $w \in L$ if and only if the ratio of the number of $a$'s in $w$ to the number of $b$'s in $w$ is an integer. I've been un...
habedi/stack-exchange-dataset
54,803
How would I write an if-statement in continuation passing style without an if-statement?
<p>Using continuation passing style, many common language constructs can be written in a simple language with recursion, such as loops (using trampolining), exceptions, generators and even function returns. I have found numerous examples of other language constructs, but all examples I have seen use if-statements direc...
continuations
1
How would I write an if-statement in continuation passing style without an if-statement? -- (continuations) <p>Using continuation passing style, many common language constructs can be written in a simple language with recursion, such as loops (using trampolining), exceptions, generators and even function returns. I hav...
habedi/stack-exchange-dataset
54,809
Checking whether a node is expandable
<p>I'm making a program to play the board game <a href="https://en.wikipedia.org/wiki/Quoridor" rel="nofollow noreferrer">Quoridor</a>. I build a move tree using Monte Carlo Tree Search (MCTS). MCTS requires me to test whether a node is expandable. A node is said to be <em>expandable</em> if it has a child node that h...
algorithms trees efficiency board games
1
Checking whether a node is expandable -- (algorithms trees efficiency board games) <p>I'm making a program to play the board game <a href="https://en.wikipedia.org/wiki/Quoridor" rel="nofollow noreferrer">Quoridor</a>. I build a move tree using Monte Carlo Tree Search (MCTS). MCTS requires me to test whether a node is ...
habedi/stack-exchange-dataset
54,817
Approximate a float using a minimal fraction
<p>This sounds like it's probably a well-known problem, but I haven't been able to find references to it by searching.</p>&#xA;&#xA;<p>Given a floating point value $x$ and an error range $\varepsilon$, how can I efficiently find a minimal positive integer $q$ such that $\left|x - \frac{p}{q}\right| &lt; \varepsilon$ fo...
algorithms floating point mathematical programming numerical algorithms
1
Approximate a float using a minimal fraction -- (algorithms floating point mathematical programming numerical algorithms) <p>This sounds like it's probably a well-known problem, but I haven't been able to find references to it by searching.</p>&#xA;&#xA;<p>Given a floating point value $x$ and an error range $\varepsilo...
habedi/stack-exchange-dataset
54,827
How do I interpret this divide and conquer algorithm for removing duplicates in a list?
<p>Consider the following divide and conquer algorithm to remove duplicates in a list. The text is in French.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/JA5vw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JA5vw.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>What is the meaning...
algorithms notation divide and conquer lists
1
How do I interpret this divide and conquer algorithm for removing duplicates in a list? -- (algorithms notation divide and conquer lists) <p>Consider the following divide and conquer algorithm to remove duplicates in a list. The text is in French.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/JA5vw.png" rel="nofol...
habedi/stack-exchange-dataset
54,829
Finding the lowest-weight negative cycle in a weighted digraph
<p>Given a weighted digraph with positive and negative edge weights, what is the complexity of finding the negative cycle in the graph whose weight is as small as possible?</p>&#xA;&#xA;<p>I know that I can detect negative weight cycles using Bellman-Ford. Has this variation be studied before? Can you point me to a ref...
algorithms graphs reference request shortest path
1
Finding the lowest-weight negative cycle in a weighted digraph -- (algorithms graphs reference request shortest path) <p>Given a weighted digraph with positive and negative edge weights, what is the complexity of finding the negative cycle in the graph whose weight is as small as possible?</p>&#xA;&#xA;<p>I know that I...
habedi/stack-exchange-dataset
54,836
finding shortest negative cycle
<p>Given a weighted digraph with positive and negative edge weights, what is the complexity of finding the shortest (uses the least number of edges) negative weight cycle in the graph?</p>&#xA;&#xA;<p>I know that I can detect negative weight cycles using Bellman-Ford. Has this variation be studied before? Can you point...
algorithms graphs shortest path
1
finding shortest negative cycle -- (algorithms graphs shortest path) <p>Given a weighted digraph with positive and negative edge weights, what is the complexity of finding the shortest (uses the least number of edges) negative weight cycle in the graph?</p>&#xA;&#xA;<p>I know that I can detect negative weight cycles us...
habedi/stack-exchange-dataset
54,842
Upper bound on the covering radius of a code
<p>Let $C$ be a $[n,k]$ linear code over $\mathbb{F}_q$. </p>&#xA;&#xA;<p>Suppose that $\rho$ is the covering radius .</p>&#xA;&#xA;<p>I want to show that $\rho \leq n-k$.</p>&#xA;&#xA;<p>Could you give me a hint how we could show this?</p>&#xA;&#xA;<p>The covering radius is defined as follows:</p>&#xA;&#xA;<p>$$\rho=\...
coding theory
1
Upper bound on the covering radius of a code -- (coding theory) <p>Let $C$ be a $[n,k]$ linear code over $\mathbb{F}_q$. </p>&#xA;&#xA;<p>Suppose that $\rho$ is the covering radius .</p>&#xA;&#xA;<p>I want to show that $\rho \leq n-k$.</p>&#xA;&#xA;<p>Could you give me a hint how we could show this?</p>&#xA;&#xA;<p>The...
habedi/stack-exchange-dataset
54,844
Undecidability of telling if a program returns true or false
<p>Consider the problem of taking an input Turing machine and determining if the final cell is a $0$ or $1$ after computation halts. On cases where it writes something else or does not halt, you are allowed to give any answer (but you have to halt and give some answer on all inputs).</p>&#xA;&#xA;<p>Is this problem und...
undecidability decision problem halting problem
1
Undecidability of telling if a program returns true or false -- (undecidability decision problem halting problem) <p>Consider the problem of taking an input Turing machine and determining if the final cell is a $0$ or $1$ after computation halts. On cases where it writes something else or does not halt, you are allowed...
habedi/stack-exchange-dataset
54,846
Binary Search Tree Traversal output validity and unique BST construction
<p>I had two specific type of questions involving Binary <strong>Search</strong> Tree (not simple Binary Tree) traversals :</p>&#xA;<ol>&#xA;<li><p>Given x-order traversal output of BST, can we state if it is valid or invalid output?</p>&#xA;<p>(For example, this: <code>[3,2,1,4,6,7,8,5]</code> can be valid postorder t...
data structures trees binary trees binary search trees
1
Binary Search Tree Traversal output validity and unique BST construction -- (data structures trees binary trees binary search trees) <p>I had two specific type of questions involving Binary <strong>Search</strong> Tree (not simple Binary Tree) traversals :</p>&#xA;<ol>&#xA;<li><p>Given x-order traversal output of BST, ...
habedi/stack-exchange-dataset
54,850
Can I use "XORing" in my thesis?
<p>I'm currently writing my bachelor thesis and explain some algorithms where the XOR-operation is used.</p>&#xA;&#xA;<p>Can I use "XORing" or "XORed" in my thesis or is this too informal?</p>&#xA;&#xA;<p>For example: "xoring the plaintext with the stream cipher results in the cypher text" and "the plaintext is XORed w...
xor
1
Can I use "XORing" in my thesis? -- (xor) <p>I'm currently writing my bachelor thesis and explain some algorithms where the XOR-operation is used.</p>&#xA;&#xA;<p>Can I use "XORing" or "XORed" in my thesis or is this too informal?</p>&#xA;&#xA;<p>For example: "xoring the plaintext with the stream cipher results in the ...
habedi/stack-exchange-dataset
54,854
Lower bound on the covering radius of a code
<p>Let $C$ be a $[n,k]$ linear code over $\mathbb{F}_q$. </p>&#xA;&#xA;<p>Suppose that $\rho$ is the covering radius .</p>&#xA;&#xA;<p>I want to show that $\rho \geq \frac{n-k}{1+ \log_q{(n)}}$.</p>&#xA;&#xA;<p>Could you give me a hint how we could show this?</p>&#xA;
coding theory
1
Lower bound on the covering radius of a code -- (coding theory) <p>Let $C$ be a $[n,k]$ linear code over $\mathbb{F}_q$. </p>&#xA;&#xA;<p>Suppose that $\rho$ is the covering radius .</p>&#xA;&#xA;<p>I want to show that $\rho \geq \frac{n-k}{1+ \log_q{(n)}}$.</p>&#xA;&#xA;<p>Could you give me a hint how we could show th...
habedi/stack-exchange-dataset
54,858
Covering radius of code
<p>Let $C$ be a $[n, k]$ linear code over $\mathbb{F}_q$.</p>&#xA;&#xA;<p>I want to calculate the covering radius of the Hamming codes.</p>&#xA;&#xA;<p>I have thought the following:</p>&#xA;&#xA;<p>Since the Hamming distance is $3$, the coverig radius will always be $3$.</p>&#xA;&#xA;<p>Am I right?</p>&#xA;
coding theory
1
Covering radius of code -- (coding theory) <p>Let $C$ be a $[n, k]$ linear code over $\mathbb{F}_q$.</p>&#xA;&#xA;<p>I want to calculate the covering radius of the Hamming codes.</p>&#xA;&#xA;<p>I have thought the following:</p>&#xA;&#xA;<p>Since the Hamming distance is $3$, the coverig radius will always be $3$.</p>&...
habedi/stack-exchange-dataset
54,859
Relation between covering radius and columns of parity check matrix
<p>Let $C$ be a $[n,k]$ linear Code over $\mathbb{F}_q$ .</p>&#xA;&#xA;<p>I want to show that each vector of $\mathbb{F}_q^{n-k} $ is written as a linear combination of $m$ columns of $H$ iff $\rho \leq m$.</p>&#xA;&#xA;<p>I have thought the following:</p>&#xA;&#xA;<p>$$ d(C)=\min \{ d \in \mathbb{N} | \text{ there ar...
coding theory
1
Relation between covering radius and columns of parity check matrix -- (coding theory) <p>Let $C$ be a $[n,k]$ linear Code over $\mathbb{F}_q$ .</p>&#xA;&#xA;<p>I want to show that each vector of $\mathbb{F}_q^{n-k} $ is written as a linear combination of $m$ columns of $H$ iff $\rho \leq m$.</p>&#xA;&#xA;<p>I have th...
habedi/stack-exchange-dataset
54,866
Algorithm for graph with nodes grouped into sets
<p>I have a weighted graph. The nodes of this graph are grouped into sets, and each node has only one corresponding set (no overlapping). Nodes in the same set do not have edges between them. An edge only connects nodes that are in different sets.</p>&#xA;&#xA;<p>I want to select one node from each set, such that the t...
algorithms graphs optimization
1
Algorithm for graph with nodes grouped into sets -- (algorithms graphs optimization) <p>I have a weighted graph. The nodes of this graph are grouped into sets, and each node has only one corresponding set (no overlapping). Nodes in the same set do not have edges between them. An edge only connects nodes that are in dif...
habedi/stack-exchange-dataset
54,867
How did each class of languages receive their name?
<p>If we look at the Chomsky hierarchy, we see that there are four well-known classes of languages: regular languages, context-free languages, context-sensitive languages, and recursively enumerable languages. There's also the class of recursive languages (which fits in between CSL and RE), but Chomsky didn't include t...
formal languages terminology history chomsky hierarchy
1
How did each class of languages receive their name? -- (formal languages terminology history chomsky hierarchy) <p>If we look at the Chomsky hierarchy, we see that there are four well-known classes of languages: regular languages, context-free languages, context-sensitive languages, and recursively enumerable languages...
habedi/stack-exchange-dataset
54,876
Is the set of CFGs that contain all odd and even length words Turing-decidable?
<p>$ALLEVEN_{CFG}$ = {M is a grammar, and L(M) includes all strings of even length in $\Sigma^*$} = {(M): ($\Sigma\Sigma$)* ⊆ L(M)}</p>&#xA;&#xA;<p>$ALLODD_{CFG}$ = {M is a grammar, and L(M) includes all strings of odd length in $\Sigma^*$} = {(M): $\Sigma$($\Sigma\Sigma$)* ⊆ L(M)}</p>&#xA;&#xA;<p>Is $ALLEVEN_{CFG} \ca...
formal languages computability context free formal grammars undecidability
1
Is the set of CFGs that contain all odd and even length words Turing-decidable? -- (formal languages computability context free formal grammars undecidability) <p>$ALLEVEN_{CFG}$ = {M is a grammar, and L(M) includes all strings of even length in $\Sigma^*$} = {(M): ($\Sigma\Sigma$)* ⊆ L(M)}</p>&#xA;&#xA;<p>$ALLODD_{CFG...
habedi/stack-exchange-dataset
54,878
How to come up the number of nodes on a given level in heaps?
<p><a href="https://en.wikipedia.org/wiki/Introduction_to_Algorithms" rel="nofollow">CLRS</a> asked it's readers to prove that there are at most $\lceil n/2^{h+1} \rceil$ nodes of height $h$ in any n-element heap as an exercise. <BR>The principle of Mathematical Induction can be used to prove this as explained <a href=...
algorithm analysis data structures proof techniques heaps
1
How to come up the number of nodes on a given level in heaps? -- (algorithm analysis data structures proof techniques heaps) <p><a href="https://en.wikipedia.org/wiki/Introduction_to_Algorithms" rel="nofollow">CLRS</a> asked it's readers to prove that there are at most $\lceil n/2^{h+1} \rceil$ nodes of height $h$ in a...
habedi/stack-exchange-dataset
54,881
Does JPEG compression use a heuristic model similar to MP3?
<p>I know that MP3 uses a compression heuristic that allows it to exclude storing frequency data outside a certain range due to the limits of human hearing.</p>&#xA;&#xA;<p>Does JPEG employ some sort of non-linear quantization heuristic that accounts for the limitations of humans to perceive small differences in specif...
image processing data compression
1
Does JPEG compression use a heuristic model similar to MP3? -- (image processing data compression) <p>I know that MP3 uses a compression heuristic that allows it to exclude storing frequency data outside a certain range due to the limits of human hearing.</p>&#xA;&#xA;<p>Does JPEG employ some sort of non-linear quantiz...
habedi/stack-exchange-dataset
54,883
A regular expression for an automaton which accepts strings with no more than 3 consecutive zeros
<p>This is the automaton I want to find the regular expression for:<br>&#xA;<a href="https://i.stack.imgur.com/Ws59j.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ws59j.jpg" alt="an automaton with 5 states"></a></p>&#xA;&#xA;<p>As you see, states Q1 to Q4 are accepted and Q5 is a kind of trap. This...
regular languages finite automata regular expressions
1
A regular expression for an automaton which accepts strings with no more than 3 consecutive zeros -- (regular languages finite automata regular expressions) <p>This is the automaton I want to find the regular expression for:<br>&#xA;<a href="https://i.stack.imgur.com/Ws59j.jpg" rel="nofollow noreferrer"><img src="https...
habedi/stack-exchange-dataset
54,892
Counterexample for equality in Quantified Boolean Formula
<p>I'm looking for a counterexample for the following (false) equality. It should exist.</p>&#xA;&#xA;<p>$n$ is an <em>odd</em> integer.</p>&#xA;&#xA;<p>$f(x_1, x_2 .. x_n)$ is a boolean expression in 3 CNF form with boolean variables x.</p>&#xA;&#xA;<p>$A = \exists x_1 \forall x_2 \exists x_3 \forall x_4 ... \forall x...
boolean algebra
1
Counterexample for equality in Quantified Boolean Formula -- (boolean algebra) <p>I'm looking for a counterexample for the following (false) equality. It should exist.</p>&#xA;&#xA;<p>$n$ is an <em>odd</em> integer.</p>&#xA;&#xA;<p>$f(x_1, x_2 .. x_n)$ is a boolean expression in 3 CNF form with boolean variables x.</p>...
habedi/stack-exchange-dataset
54,933
How do computers keep track of time?
<p>How are computers able to tell the correct time and date every time?</p>&#xA;&#xA;<p>Whenever I close the computer (shut it down) all connections and processes inside stop. How is it that when I open the computer again it tells the exact correct time? Does the computer not shut down completely when I shut it down? ...
computer architecture clocks
1
How do computers keep track of time? -- (computer architecture clocks) <p>How are computers able to tell the correct time and date every time?</p>&#xA;&#xA;<p>Whenever I close the computer (shut it down) all connections and processes inside stop. How is it that when I open the computer again it tells the exact correct...
habedi/stack-exchange-dataset
54,936
Why does this statement evaluate to 176?
<pre><code>int y = 10;&#xA;int z;&#xA;z = (++y * (y++ + 5)); // Evaluates to 176&#xA;</code></pre>&#xA;&#xA;<p>According to me this should evaluate to 180. Please provide an explanation as well which relates to precedence and associativity.</p>&#xA;
java
1
Why does this statement evaluate to 176? -- (java) <pre><code>int y = 10;&#xA;int z;&#xA;z = (++y * (y++ + 5)); // Evaluates to 176&#xA;</code></pre>&#xA;&#xA;<p>According to me this should evaluate to 180. Please provide an explanation as well which relates to precedence and associativity.</p>&#xA;
habedi/stack-exchange-dataset
54,941
Why classification represents all computations?
<p>I'm a computer science student taking a theory of computation class. Recently we were taught about what is computable and what is not and about the Turing machine. As I understood (please correct me if I'm wrong) Turing machine could do any computation that is possible to compute. But for all examples in computing,...
computability decision problem computation models
1
Why classification represents all computations? -- (computability decision problem computation models) <p>I'm a computer science student taking a theory of computation class. Recently we were taught about what is computable and what is not and about the Turing machine. As I understood (please correct me if I'm wrong) T...
habedi/stack-exchange-dataset
54,943
Derivation of implicational propositional axioms
<p>Is there a way to subtract and add properties of axioms to generate new axioms?</p>&#xA;&#xA;<p>For example:</p>&#xA;&#xA;<p><strong>{L} = {P S K}</strong> // natural deduction</p>&#xA;&#xA;<p><strong>{P S K} = {P H K I}</strong> // natural deduction</p>&#xA;&#xA;<p><strong>{S K} = {?}</strong> // constructive logic...
propositional logic automated theorem proving
1
Derivation of implicational propositional axioms -- (propositional logic automated theorem proving) <p>Is there a way to subtract and add properties of axioms to generate new axioms?</p>&#xA;&#xA;<p>For example:</p>&#xA;&#xA;<p><strong>{L} = {P S K}</strong> // natural deduction</p>&#xA;&#xA;<p><strong>{P S K} = {P H K...
habedi/stack-exchange-dataset
54,945
Prove that the Kolmogorov complexity function cannot be approached from below
<p>How would one go about proving that Kolmogorov function $K(x)$ cannot be approached from below by any computable function?</p>&#xA;&#xA;<p>After some research it seems I must show the function $K(x)$ is not lower semi-computable.</p>&#xA;&#xA;<p>Instead, I can do this by showing $-K(x)$ is not upper semi-computable<...
computability computation models information theory kolmogorov complexity
1
Prove that the Kolmogorov complexity function cannot be approached from below -- (computability computation models information theory kolmogorov complexity) <p>How would one go about proving that Kolmogorov function $K(x)$ cannot be approached from below by any computable function?</p>&#xA;&#xA;<p>After some research i...
habedi/stack-exchange-dataset
54,951
Multi-threading vs. Interrupt Handlers
<p>In Arduino's architecture, multi-threading is not supported. However, interrupt handlers are being used as "placebo/replacement" if you may. However, I am not quite sure how these interrupt handlers work. For instance:</p>&#xA;&#xA;<pre><code>void functionA()&#xA;{ //x is a global boolean&#xA; x = true; //as s...
multi tasking
1
Multi-threading vs. Interrupt Handlers -- (multi tasking) <p>In Arduino's architecture, multi-threading is not supported. However, interrupt handlers are being used as "placebo/replacement" if you may. However, I am not quite sure how these interrupt handlers work. For instance:</p>&#xA;&#xA;<pre><code>void functionA()...
habedi/stack-exchange-dataset
54,954
How to find loop invariant from weakest precondition?
<p>Consider this code: </p>&#xA;&#xA;<p>Precondition:</p>&#xA;&#xA;<p>Postcondition: <code>rv == i &lt;==&gt; ∃i, 0 ≤ i ≤ a.length-1, a[i] == key</code></p>&#xA;&#xA;<p><code>function Find(Array&lt;int&gt; a, int key) returns (int i) {&#xA; i = a.length -1;&#xA; while i ≥ 0 {&#xA; if a[i] == key {retur...
correctness proof loop invariants hoare logic
1
How to find loop invariant from weakest precondition? -- (correctness proof loop invariants hoare logic) <p>Consider this code: </p>&#xA;&#xA;<p>Precondition:</p>&#xA;&#xA;<p>Postcondition: <code>rv == i &lt;==&gt; ∃i, 0 ≤ i ≤ a.length-1, a[i] == key</code></p>&#xA;&#xA;<p><code>function Find(Array&lt;int&gt; a, int ke...
habedi/stack-exchange-dataset
54,957
Difference between Dependent type , refinement type and Hoare Logic
<p>I know little dependent type theory. From wikipedia :</p>&#xA;&#xA;<blockquote>&#xA; <p>A dependent type is a type whose definition depends on a value.</p>&#xA;</blockquote>&#xA;&#xA;<p>And from my Type theory course i recall that a dependent type is :</p>&#xA;&#xA;<blockquote>&#xA; <p>Family of types indexed by a...
dependent types hoare logic
1
Difference between Dependent type , refinement type and Hoare Logic -- (dependent types hoare logic) <p>I know little dependent type theory. From wikipedia :</p>&#xA;&#xA;<blockquote>&#xA; <p>A dependent type is a type whose definition depends on a value.</p>&#xA;</blockquote>&#xA;&#xA;<p>And from my Type theory cours...
habedi/stack-exchange-dataset
54,958
How is parallel tag checking achieved in associative Mapping?
<p>I originally posted this question on stack overflow and then realised it was better suited to computer science .</p>&#xA;&#xA;<p>In the book on computer organization and architecture by William stallings , in the cache memory chapter and associative mapping topic , the author says that the cache control logic simult...
computer architecture cpu cache
1
How is parallel tag checking achieved in associative Mapping? -- (computer architecture cpu cache) <p>I originally posted this question on stack overflow and then realised it was better suited to computer science .</p>&#xA;&#xA;<p>In the book on computer organization and architecture by William stallings , in the cache...
habedi/stack-exchange-dataset