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
82,559
How to prove the equivalence between Hoare and Floyd assignment axioms?
<p>How to show that these two axioms are equivalent:</p>&#xA;&#xA;<p>1: $\{G[v/e]\} v:=e \{G\}$</p>&#xA;&#xA;<p>2: $\{F\} v:=e \{\exists v' (F[v/v'] \land v=e[v/v'])\}$</p>&#xA;&#xA;<p>I've tried with $G = \exists v' (F[v/v'] \land v=e[v/v']) $and then I get $G[v/e] = F$, but when I try $F = G[v/e]$ then from $\exists ...
hoare logic software verification
1
How to prove the equivalence between Hoare and Floyd assignment axioms? -- (hoare logic software verification) <p>How to show that these two axioms are equivalent:</p>&#xA;&#xA;<p>1: $\{G[v/e]\} v:=e \{G\}$</p>&#xA;&#xA;<p>2: $\{F\} v:=e \{\exists v' (F[v/v'] \land v=e[v/v'])\}$</p>&#xA;&#xA;<p>I've tried with $G = \ex...
habedi/stack-exchange-dataset
82,561
Regular language such that L(r) = L(r₁) L(r) ∪ L(r₂)
<p>Prove or disprove the following statement: for arbitrary regular expressions $r_1$ and $r_2$ over an&#xA;alphabet $\Sigma$ such that $\epsilon$ belongs to $L(r_1)$, there exists a regular expression $r$ over $\Sigma$ such that $r = r_1r + r_2$.</p>&#xA;&#xA;<p>My Solution: Let us consider $\Sigma =\{a\}$. $L_1$ is e...
formal languages regular languages
1
Regular language such that L(r) = L(r₁) L(r) ∪ L(r₂) -- (formal languages regular languages) <p>Prove or disprove the following statement: for arbitrary regular expressions $r_1$ and $r_2$ over an&#xA;alphabet $\Sigma$ such that $\epsilon$ belongs to $L(r_1)$, there exists a regular expression $r$ over $\Sigma$ such th...
habedi/stack-exchange-dataset
82,571
Are all vertices within a strongly connected component with 2 or more vertices part of a cycle?
<p>Within a directed simple graph, are all vertices within a strongly connected component with 2 or more vertices part of a cycle?</p>&#xA;
graphs
1
Are all vertices within a strongly connected component with 2 or more vertices part of a cycle? -- (graphs) <p>Within a directed simple graph, are all vertices within a strongly connected component with 2 or more vertices part of a cycle?</p>&#xA;
habedi/stack-exchange-dataset
82,587
Detecting face like patterns using CNN based face detector
<p>I have a CNN based object detector trained on WIDER Face dataset. It can successfully detect human faces in a given image. </p>&#xA;&#xA;<p>Now, I am trying to detect abstract face and minimalistic face patterns in clouds or houses etc but having no success. </p>&#xA;&#xA;<p>Initially, I thought I could lower the d...
machine learning neural networks
1
Detecting face like patterns using CNN based face detector -- (machine learning neural networks) <p>I have a CNN based object detector trained on WIDER Face dataset. It can successfully detect human faces in a given image. </p>&#xA;&#xA;<p>Now, I am trying to detect abstract face and minimalistic face patterns in clou...
habedi/stack-exchange-dataset
82,598
Computationally 'hard' polynomial-time reduction to other NP-complete problems / Hierarchy of NP-complete problems
<p>As we all know there exist plenty of polynomial-time reductions from one NP-complete problem to another. Are there any NP-complete problems that have a rather large polynomial bound for reductions to other NP-complete problems, like a poly-time sub-hierarchy of NP-complete problems...?</p>&#xA;&#xA;<p>E.g. lets assu...
complexity theory time complexity np complete polynomial time
1
Computationally 'hard' polynomial-time reduction to other NP-complete problems / Hierarchy of NP-complete problems -- (complexity theory time complexity np complete polynomial time) <p>As we all know there exist plenty of polynomial-time reductions from one NP-complete problem to another. Are there any NP-complete prob...
habedi/stack-exchange-dataset
82,603
Given a computable function $f$ and a decidable language $L$, is there a Turing machine $M$ such that $M$ both decides $L$ and computes $f$?
<p>1) (cited from "Introduction to the Theory of Computation" by Michael Sipser)</p>&#xA;&#xA;<blockquote>&#xA; <p>Let $M$ be a Turing machine, we say that $M$ decides a language $L$ if $M$ is a decider which recognizes $L$.</p>&#xA;</blockquote>&#xA;&#xA;<p>2) (cited from "Computational complexity: a modern approach"...
computability turing machines computation models
1
Given a computable function $f$ and a decidable language $L$, is there a Turing machine $M$ such that $M$ both decides $L$ and computes $f$? -- (computability turing machines computation models) <p>1) (cited from "Introduction to the Theory of Computation" by Michael Sipser)</p>&#xA;&#xA;<blockquote>&#xA; <p>Let $M$ b...
habedi/stack-exchange-dataset
82,621
Rearranging strings so that the Hamming distance between them is 1
<p>This is a question from <a href="https://codefights.com/arcade/intro/level-7/PTWhv2oWqd6p4AHB9/description" rel="nofollow noreferrer">CodeFights.com</a>:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given an array of equal-length strings, check if it is possible to rearrange the strings in such a way that after the rearrangem...
np complete traveling salesman hamiltonian path hamming code
1
Rearranging strings so that the Hamming distance between them is 1 -- (np complete traveling salesman hamiltonian path hamming code) <p>This is a question from <a href="https://codefights.com/arcade/intro/level-7/PTWhv2oWqd6p4AHB9/description" rel="nofollow noreferrer">CodeFights.com</a>:</p>&#xA;&#xA;<blockquote>&#xA;...
habedi/stack-exchange-dataset
82,626
Why must a function with polymorphic type `forall t: Type, t->t` be the identity function?
<p>I am new to programming language theory. I was watching some online lectures in which the instructor claimed that a function with polymorphic type <code>forall t: Type, t-&gt;t</code> be the identity, but did not explain why. Can someone explain to me why? Maybe a proof of the claim from first principles. </p>&#xA;
programming languages type theory
1
Why must a function with polymorphic type `forall t: Type, t->t` be the identity function? -- (programming languages type theory) <p>I am new to programming language theory. I was watching some online lectures in which the instructor claimed that a function with polymorphic type <code>forall t: Type, t-&gt;t</code> be ...
habedi/stack-exchange-dataset
82,643
P versus NP and what we are looking for
<p>I was reading the other day about this problem, refreshing it, and on a couple of places over the internet I read somebody explaining something in the line of '..does not matter as long as is polynomial, a N^20 or N^30 will do it, we know that maybe the solution does not make the problem tractable but if we can prod...
complexity theory
1
P versus NP and what we are looking for -- (complexity theory) <p>I was reading the other day about this problem, refreshing it, and on a couple of places over the internet I read somebody explaining something in the line of '..does not matter as long as is polynomial, a N^20 or N^30 will do it, we know that maybe the ...
habedi/stack-exchange-dataset
82,644
Compact mapping from an involuted set
<p>Let <span class="math-container">$S$</span> be a set (say positive integers <span class="math-container">$\leq$</span> N) and <span class="math-container">$f$</span> an involution (<span class="math-container">$f$</span> is bijective, <span class="math-container">$f\cdot f=id$</span>, <em>e.g.</em> xor with a consta...
data structures sets bioinformatics finite sets succinct data structures
1
Compact mapping from an involuted set -- (data structures sets bioinformatics finite sets succinct data structures) <p>Let <span class="math-container">$S$</span> be a set (say positive integers <span class="math-container">$\leq$</span> N) and <span class="math-container">$f$</span> an involution (<span class="math-co...
habedi/stack-exchange-dataset
82,647
What's the theory behind the operator precedences of common operators?
<p>Could for example the precedence ordering of addition, multiplication, exponentiation, boolean and/or and zip/cross product be inferred from a few rules?</p>&#xA;
category theory algebra
1
What's the theory behind the operator precedences of common operators? -- (category theory algebra) <p>Could for example the precedence ordering of addition, multiplication, exponentiation, boolean and/or and zip/cross product be inferred from a few rules?</p>&#xA;
habedi/stack-exchange-dataset
82,658
Taking mod $2$ with LTF gates
<p>Consider the function : $\mathbb{Z}^{\geq 0} \rightarrow \{0,1\}$ given as $n \mapsto n \bmod 2$. Does this have an easy implementation using Linear Threshold Function gates? </p>&#xA;&#xA;<hr>&#xA;&#xA;<p>I do not mean that the input is the infinite set of positive integers. Think of the input as coming on a single...
complexity theory circuits boolean algebra
1
Taking mod $2$ with LTF gates -- (complexity theory circuits boolean algebra) <p>Consider the function : $\mathbb{Z}^{\geq 0} \rightarrow \{0,1\}$ given as $n \mapsto n \bmod 2$. Does this have an easy implementation using Linear Threshold Function gates? </p>&#xA;&#xA;<hr>&#xA;&#xA;<p>I do not mean that the input is t...
habedi/stack-exchange-dataset
82,674
LTF circuits and $AC^0$
<p>Do we know if all of $AC^0$ can be captured by polynomial sized depth $2$ LTF circuits? (with or without polynomially bounded weights). </p>&#xA;&#xA;<hr>&#xA;&#xA;<p>For any vector $w \in \mathbb{R}^n$ and any number $c \in \mathbb{R}$ we define the LTF (x) gate as the function, $\{0,1\}^n \rightarrow \{0,1\}$ such...
complexity theory circuits boolean algebra
1
LTF circuits and $AC^0$ -- (complexity theory circuits boolean algebra) <p>Do we know if all of $AC^0$ can be captured by polynomial sized depth $2$ LTF circuits? (with or without polynomially bounded weights). </p>&#xA;&#xA;<hr>&#xA;&#xA;<p>For any vector $w \in \mathbb{R}^n$ and any number $c \in \mathbb{R}$ we defin...
habedi/stack-exchange-dataset
82,683
Proof of correctness of algorithm
<p>Can someone help me prove the correctness of this algorithm:</p>&#xA;&#xA;<pre><code>MUL(a,b)&#xA; x=a&#xA; y=b&#xA; WHILE x≥b DO&#xA; x=x-b&#xA; y=y+1&#xA; IF x=0 THEN&#xA; RETURN(true)&#xA; ELSE&#xA; RETURN(false)&#xA;</code></pre>&#xA;&#xA;<p>I had to prove that $x_n + b\cdot y_n = a...
algorithm analysis proof techniques correctness proof
1
Proof of correctness of algorithm -- (algorithm analysis proof techniques correctness proof) <p>Can someone help me prove the correctness of this algorithm:</p>&#xA;&#xA;<pre><code>MUL(a,b)&#xA; x=a&#xA; y=b&#xA; WHILE x≥b DO&#xA; x=x-b&#xA; y=y+1&#xA; IF x=0 THEN&#xA; RETURN(true)&#xA; ELSE&#x...
habedi/stack-exchange-dataset
82,689
How to predict the length and offset of the sequence in and array?
<p>I have an input string similar to <code>ABCDEFGHIJK</code> from which a series of sequences has been generated into an array as following:</p>&#xA;&#xA;<pre><code>00: 'ABCD'&#xA;01: 'BCDE'&#xA;02: 'CDEF'&#xA;03: 'DEFG'&#xA;04: 'EFGH'&#xA;05: 'FGHI'&#xA;06: 'GHIJ'&#xA;07: 'HIJK'&#xA;08: 'ABC'&#xA;09: 'BCD'&#xA;10: 'C...
algorithms arrays hash tables
1
How to predict the length and offset of the sequence in and array? -- (algorithms arrays hash tables) <p>I have an input string similar to <code>ABCDEFGHIJK</code> from which a series of sequences has been generated into an array as following:</p>&#xA;&#xA;<pre><code>00: 'ABCD'&#xA;01: 'BCDE'&#xA;02: 'CDEF'&#xA;03: 'DE...
habedi/stack-exchange-dataset
82,694
Comb sort average complexity
<p>The wikipedia page about comb sort claims that the average complexity of comb sort is Omega(n^2/2^p) where p is the number of increments. Take as example an uniform distributed array of 1000 elements, using the standard shrink factor of 1.3 the length of the gaps list is 23. Is this the p mentioned in the wikipedia ...
algorithm analysis runtime analysis sorting average case
1
Comb sort average complexity -- (algorithm analysis runtime analysis sorting average case) <p>The wikipedia page about comb sort claims that the average complexity of comb sort is Omega(n^2/2^p) where p is the number of increments. Take as example an uniform distributed array of 1000 elements, using the standard shrink...
habedi/stack-exchange-dataset
82,695
How do you prove that the set of decimal representation of the 4 divisble natural numbers is regular?
<p>This is from an old exam, the last Task no one could solve correctly and I'm curious how it's done :p</p>&#xA;&#xA;<p>Show that the set of decimal representation (without leading zeroes) of the divisible numbers by <code>4</code> (natural numbers) is regular.</p>&#xA;&#xA;<p>By this thread <a href="https://cs.stacke...
formal languages regular languages automata finite automata proof techniques
1
How do you prove that the set of decimal representation of the 4 divisble natural numbers is regular? -- (formal languages regular languages automata finite automata proof techniques) <p>This is from an old exam, the last Task no one could solve correctly and I'm curious how it's done :p</p>&#xA;&#xA;<p>Show that the s...
habedi/stack-exchange-dataset
82,717
If h(n) is a perfect heuristic (that is, h(n) = h*(n)), then does it imply that A* will always take linear time complexity?
<p>That is, if h(n) = h*(n), then A* only expands nodes that lie on an optimal path to the goal. But does this imply that A* will always take a linear time in the solution length to find an optimal solution?</p>&#xA;&#xA;<p>I suspect I may be overthinking this problem, but if h(n) = h*(n) then we are measuring the exac...
algorithms graphs artificial intelligence search algorithms heuristics
1
If h(n) is a perfect heuristic (that is, h(n) = h*(n)), then does it imply that A* will always take linear time complexity? -- (algorithms graphs artificial intelligence search algorithms heuristics) <p>That is, if h(n) = h*(n), then A* only expands nodes that lie on an optimal path to the goal. But does this imply tha...
habedi/stack-exchange-dataset
82,721
Does a Haskell program count as an inductive proof?
<p>Is the following statement from [1] true?</p>&#xA;&#xA;<p>"Since recursion is the main computational technique, a terminating pure Haskell program counts as an inductive proof of a theorem."</p>&#xA;&#xA;<p>My intuition is that inductive proofs require a base case, assume the hypothesis case for k, prove induction s...
proof techniques functional programming
1
Does a Haskell program count as an inductive proof? -- (proof techniques functional programming) <p>Is the following statement from [1] true?</p>&#xA;&#xA;<p>"Since recursion is the main computational technique, a terminating pure Haskell program counts as an inductive proof of a theorem."</p>&#xA;&#xA;<p>My intuition ...
habedi/stack-exchange-dataset
82,728
In Disjoint Sets, why do we make the smaller tree the subtree of the larger one?
<p>Currently I'm learning about the Disjoint Sets data structure. I understand that, when we create a union of two disjoint sets, we create a kind of "backwards" tree for fast lookup. As Skiena says in his book:</p>&#xA;&#xA;<blockquote>&#xA; <p>To minimize the tree height, it is better to make the smaller tree the su...
data structures
1
In Disjoint Sets, why do we make the smaller tree the subtree of the larger one? -- (data structures) <p>Currently I'm learning about the Disjoint Sets data structure. I understand that, when we create a union of two disjoint sets, we create a kind of "backwards" tree for fast lookup. As Skiena says in his book:</p>&#x...
habedi/stack-exchange-dataset
82,732
Finding a minimum of a noisy function
<p>I have a certain function that calculates numerically, for every $x \in [0,10]$, a value $y\geq 0$. I want to find an approximate minimum point of that function. A possible solution is to calculate $y$ for e.g. 10000 values of $x$ in the range $[0,3]$ and return the $x$ for which $y$ is smallest. I am looking for fa...
optimization numerical algorithms
1
Finding a minimum of a noisy function -- (optimization numerical algorithms) <p>I have a certain function that calculates numerically, for every $x \in [0,10]$, a value $y\geq 0$. I want to find an approximate minimum point of that function. A possible solution is to calculate $y$ for e.g. 10000 values of $x$ in the ra...
habedi/stack-exchange-dataset
82,735
Unknown representation of number as bits
<p>I am self taught in CS and came across this while looking at binary search applied to multiplication. I don't understand this part:&#xA;OK, we have some x that has binary representation $10110010(1*2 + 1*2^4 + 1*2^5 + 1^7$) ...I understand this, but don't know what following means $x = 2^4(1011) + 0010$. What is nam...
algorithms
1
Unknown representation of number as bits -- (algorithms) <p>I am self taught in CS and came across this while looking at binary search applied to multiplication. I don't understand this part:&#xA;OK, we have some x that has binary representation $10110010(1*2 + 1*2^4 + 1*2^5 + 1^7$) ...I understand this, but don't know...
habedi/stack-exchange-dataset
82,738
How to count all contiguous subsequences with positive sum?
<p>I have array $t$ with size $n \leq 10^6$. It has only two kinds of elements inside: $1$ or $-1$.&#xA;I need to count how many contiguous subsequences have positive sum.</p>&#xA;&#xA;<p>This pseudocode demonstrates exactly the behavior I want, but is too slow for large $n$:</p>&#xA;&#xA;<pre><code>c = 0&#xA;for i = 1...
optimization time complexity counting subsequences
1
How to count all contiguous subsequences with positive sum? -- (optimization time complexity counting subsequences) <p>I have array $t$ with size $n \leq 10^6$. It has only two kinds of elements inside: $1$ or $-1$.&#xA;I need to count how many contiguous subsequences have positive sum.</p>&#xA;&#xA;<p>This pseudocode ...
habedi/stack-exchange-dataset
82,741
What is the relationship between the complexity class $L^n$ and $NL^m$?
<p>The <a href="https://en.wikipedia.org/wiki/Space_hierarchy_theorem" rel="nofollow noreferrer">space hierarchy theorem</a> shows that &#xA;$$\mathrm{\mathbf{L}}^{1} \subsetneq \mathrm{\mathbf{L}}^{2} \subsetneq \cdots \subsetneq \mathrm{\mathbf{L}}^{m} \subsetneq \cdots \subsetneq \mathrm{\mathbf{PSPACE}}$$&#xA;and&#...
complexity theory space complexity
1
What is the relationship between the complexity class $L^n$ and $NL^m$? -- (complexity theory space complexity) <p>The <a href="https://en.wikipedia.org/wiki/Space_hierarchy_theorem" rel="nofollow noreferrer">space hierarchy theorem</a> shows that &#xA;$$\mathrm{\mathbf{L}}^{1} \subsetneq \mathrm{\mathbf{L}}^{2} \subse...
habedi/stack-exchange-dataset
82,757
Simultaneous regression of multiple curves in the same dataset or image?
<p><a href="https://i.stack.imgur.com/mvkMl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mvkMl.png" alt="dataset with multiple lines"></a>&#xA;I am getting the pattern shown in the picture from an experiment. To my human brain it is evident that it consists of some 20 straight lines. I need to fin...
pattern recognition
1
Simultaneous regression of multiple curves in the same dataset or image? -- (pattern recognition) <p><a href="https://i.stack.imgur.com/mvkMl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mvkMl.png" alt="dataset with multiple lines"></a>&#xA;I am getting the pattern shown in the picture from an exp...
habedi/stack-exchange-dataset
82,768
NP-hardness of MCSP
<p><a href="http://drops.dagstuhl.de/opus/volltexte/2015/5074/pdf/26.pdf" rel="nofollow noreferrer"><em>Ryan Williams and Cody Murray</em></a> in 2015 proved that MCSP (Minimum Circuit Size Problem) is provably not NP-hard under local reductions. (Local reductions are the ones in which you are allowed time $O(n^{1/2} -...
complexity theory reductions circuits
1
NP-hardness of MCSP -- (complexity theory reductions circuits) <p><a href="http://drops.dagstuhl.de/opus/volltexte/2015/5074/pdf/26.pdf" rel="nofollow noreferrer"><em>Ryan Williams and Cody Murray</em></a> in 2015 proved that MCSP (Minimum Circuit Size Problem) is provably not NP-hard under local reductions. (Local red...
habedi/stack-exchange-dataset
82,770
Are linear languages always unambiguous?
<p>Deterministic Context free languages are always unambiguous. Now DCFL are a subset of linear languages. Are there any linear languages which are inherently ambiguous?</p>&#xA;
formal languages context free ambiguity
1
Are linear languages always unambiguous? -- (formal languages context free ambiguity) <p>Deterministic Context free languages are always unambiguous. Now DCFL are a subset of linear languages. Are there any linear languages which are inherently ambiguous?</p>&#xA;
habedi/stack-exchange-dataset
82,772
Proof of correctness of this algorithm
<p>Assume $A$ is an array that contains sorted integers , ie $\forall\ i,j$ where $1 \le i \le j \le |A|$, $A_i \le A_j$. The numbers do not have to be unique, and the task is to check if there is at least one pair of indices $i$ and $j$ where $A_i + A_j = n$. Simple enough, here's an algorithm that does it:</p>&#xA;&#...
algorithms correctness proof
1
Proof of correctness of this algorithm -- (algorithms correctness proof) <p>Assume $A$ is an array that contains sorted integers , ie $\forall\ i,j$ where $1 \le i \le j \le |A|$, $A_i \le A_j$. The numbers do not have to be unique, and the task is to check if there is at least one pair of indices $i$ and $j$ where $A_...
habedi/stack-exchange-dataset
82,782
maximizing inner product of vectors in an ellipsoid and a given vector
<p>I have been wrestling with this for quite a long time but couldn't convince myself that the following is true:<a href="https://i.stack.imgur.com/Wxyhn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wxyhn.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>What I do understand: $\theta_a$...
machine learning linear algebra statistics
1
maximizing inner product of vectors in an ellipsoid and a given vector -- (machine learning linear algebra statistics) <p>I have been wrestling with this for quite a long time but couldn't convince myself that the following is true:<a href="https://i.stack.imgur.com/Wxyhn.png" rel="nofollow noreferrer"><img src="https:...
habedi/stack-exchange-dataset
82,785
Problem with solving the recurrence $T(n) = 2T(\sqrt n) + \log n$
<p>This question has already been asked before in this site, but the details of none of them is my question and none of them answer my question.&#xA;The following is an example recurrence given in <em>introduction to algorithms</em> book by CLRS . </p>&#xA;&#xA;<p>$$T(n) = 2T(\sqrt n) + \log n$$</p>&#xA;&#xA;<p>It is s...
recurrence relation
1
Problem with solving the recurrence $T(n) = 2T(\sqrt n) + \log n$ -- (recurrence relation) <p>This question has already been asked before in this site, but the details of none of them is my question and none of them answer my question.&#xA;The following is an example recurrence given in <em>introduction to algorithms</...
habedi/stack-exchange-dataset
82,792
Why do modern processors need a runtime stack?
<p>Professor said that modern processor needs runtime stack.</p>&#xA;&#xA;<p>But he didn't explain the reason.</p>&#xA;&#xA;<p>Why is the runtime stack required in the modern processors? </p>&#xA;
computer architecture memory management
1
Why do modern processors need a runtime stack? -- (computer architecture memory management) <p>Professor said that modern processor needs runtime stack.</p>&#xA;&#xA;<p>But he didn't explain the reason.</p>&#xA;&#xA;<p>Why is the runtime stack required in the modern processors? </p>&#xA;
habedi/stack-exchange-dataset
82,793
Merge 2 Binary Heaps
<p>I want to merge $2$ binary heaps. Which is the fastest algorithm to do so. Also would like to know its time complexity.</p>&#xA;&#xA;<p>I know how to do it linear time $O(n)$, I want to know if there is something faster (probably there is). </p>&#xA;
data structures heaps
1
Merge 2 Binary Heaps -- (data structures heaps) <p>I want to merge $2$ binary heaps. Which is the fastest algorithm to do so. Also would like to know its time complexity.</p>&#xA;&#xA;<p>I know how to do it linear time $O(n)$, I want to know if there is something faster (probably there is). </p>&#xA;
habedi/stack-exchange-dataset
82,800
Question on pseudocode for Ford-Fulkerson in Kleinberg-Tardos Text
<p>I am looking at the following pseudocode from the Kleinberg-Tardos text "Algorithm Design".</p>&#xA;&#xA;<pre><code>Max-Flow&#xA;Initially f(e)=0 for all e in G&#xA;While there is an s-t path in the residual graph G_f&#xA; Let P be a simple s-t path in G_f&#xA; f' = augment(f,P)&#xA; Update f to f'&#xA; ...
algorithms graphs network flow ford fulkerson
1
Question on pseudocode for Ford-Fulkerson in Kleinberg-Tardos Text -- (algorithms graphs network flow ford fulkerson) <p>I am looking at the following pseudocode from the Kleinberg-Tardos text "Algorithm Design".</p>&#xA;&#xA;<pre><code>Max-Flow&#xA;Initially f(e)=0 for all e in G&#xA;While there is an s-t path in the ...
habedi/stack-exchange-dataset
82,810
Reducing products in HoTT to church/scott encodings
<p>So I am currently going though the HoTT book with some people. I made the claim that most inductive types we will see can be reduced to types containing only dependent function types and universes by taking the type of the recuror as inspiration for the equivalent type. I started to sketch how I thought this would w...
type theory type checking dependent types homotopy type theory
1
Reducing products in HoTT to church/scott encodings -- (type theory type checking dependent types homotopy type theory) <p>So I am currently going though the HoTT book with some people. I made the claim that most inductive types we will see can be reduced to types containing only dependent function types and universes ...
habedi/stack-exchange-dataset
82,813
Create a DFA and a NFA where the word includes (two) consecutive zeroes
<p>I have chosen an example task to see if I understood DFA and NFA correctly.</p>&#xA;&#xA;<p>So let's say we have that task:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given alphabet $\Sigma = \{0,1\}$ and the language $L = \{w \mid w \text{ includes two consecutive zeroes}\}$. Create a DFA and a NFA for the language with as...
finite automata
1
Create a DFA and a NFA where the word includes (two) consecutive zeroes -- (finite automata) <p>I have chosen an example task to see if I understood DFA and NFA correctly.</p>&#xA;&#xA;<p>So let's say we have that task:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given alphabet $\Sigma = \{0,1\}$ and the language $L = \{w \mid ...
habedi/stack-exchange-dataset
82,816
What operation is the algorithm performing?
<pre><code>unsigned int input = 0xC116D9B5709FED85 unsigned int output = 0 &#xA;while (input &gt; 0 ) &#xA;{ &#xA;if (( input mod 2) == 1) &#xA;{ &#xA;output += 1 &#xA;} &#xA;input = floor(input / 2)&#xA; }&#xA; return output&#xA;</code></pre>&#xA;&#xA;<p>I understand how the algorithm is working and using mod to break...
algorithms c++
1
What operation is the algorithm performing? -- (algorithms c++) <pre><code>unsigned int input = 0xC116D9B5709FED85 unsigned int output = 0 &#xA;while (input &gt; 0 ) &#xA;{ &#xA;if (( input mod 2) == 1) &#xA;{ &#xA;output += 1 &#xA;} &#xA;input = floor(input / 2)&#xA; }&#xA; return output&#xA;</code></pre>&#xA;&#xA;<p>...
habedi/stack-exchange-dataset
82,828
How to calculate Kolmogorov Complexity if we have access to an Oracle for the HALT Problem
<p>I try to solve the following exercise:</p>&#xA;&#xA;<p><strong>We know that K (x), the complexity of Kolmogorov, is incomputable. Show how&#xA;calculate it, if we have an oracle for the membership problem (or for the HALT problem, if it accommodates more).</strong></p>&#xA;&#xA;<p>I have solved it in the following w...
turing machines halting problem oracle machines kolmogorov complexity
1
How to calculate Kolmogorov Complexity if we have access to an Oracle for the HALT Problem -- (turing machines halting problem oracle machines kolmogorov complexity) <p>I try to solve the following exercise:</p>&#xA;&#xA;<p><strong>We know that K (x), the complexity of Kolmogorov, is incomputable. Show how&#xA;calculat...
habedi/stack-exchange-dataset
82,837
Prove that $L_1 = \{\, 0^m 1^k 2^n \,\vert\, \lvert m - n \rvert = k \,\}$ is not regular using Pumping lemma
<p>I have been trying to understand Pumping lemmas for a while now, I am doing this exercise and I <em>think</em> that the pin has finally dropped. However, I am unsure if I am doing it even remotely correctly. I will briefly explain my attempt and thus my solution. Thereafter I would discuss a few points that are not ...
formal languages pumping lemma
1
Prove that $L_1 = \{\, 0^m 1^k 2^n \,\vert\, \lvert m - n \rvert = k \,\}$ is not regular using Pumping lemma -- (formal languages pumping lemma) <p>I have been trying to understand Pumping lemmas for a while now, I am doing this exercise and I <em>think</em> that the pin has finally dropped. However, I am unsure if I ...
habedi/stack-exchange-dataset
82,851
Infix to postfix conversion
<p>I am somewhat stuck in converting an expression with negative numbers from infix to postfix.</p>&#xA;&#xA;<p>Suppose we have a expression like </p>&#xA;&#xA;<p>a = -b - (-c - d) .</p>&#xA;&#xA;<p>At some places I read that you can parathesize the negative numbers to solve the problem. But if I parathesize them as </...
algorithms
1
Infix to postfix conversion -- (algorithms) <p>I am somewhat stuck in converting an expression with negative numbers from infix to postfix.</p>&#xA;&#xA;<p>Suppose we have a expression like </p>&#xA;&#xA;<p>a = -b - (-c - d) .</p>&#xA;&#xA;<p>At some places I read that you can parathesize the negative numbers to solve ...
habedi/stack-exchange-dataset
82,852
How can one tell when will the state of the circuit components change?
<p><p>The system clock is needed to synchronize all components on the motherboard, which means they all do their work only if the clock is high; never when it's low. And because the clock speed is set above the longest time any signal needs to propagate through any circuit on the board, this system is preventing signal...
computer architecture cpu clocks
1
How can one tell when will the state of the circuit components change? -- (computer architecture cpu clocks) <p><p>The system clock is needed to synchronize all components on the motherboard, which means they all do their work only if the clock is high; never when it's low. And because the clock speed is set above the ...
habedi/stack-exchange-dataset
82,854
How does left-factoring prevent backtracking?
<p>I read that deterministic grammar helps in preventing backtracking.</p>&#xA;&#xA;<p>Consider a grammar</p>&#xA;&#xA;<p>$$A \rightarrow ab \mid ac \mid ad$$.</p>&#xA;&#xA;<p>Here if input is "ad" then the compiler needs to check each of ab, ac .. and backtrack until it gets to last production.</p>&#xA;&#xA;<p>To elim...
formal grammars compilers
1
How does left-factoring prevent backtracking? -- (formal grammars compilers) <p>I read that deterministic grammar helps in preventing backtracking.</p>&#xA;&#xA;<p>Consider a grammar</p>&#xA;&#xA;<p>$$A \rightarrow ab \mid ac \mid ad$$.</p>&#xA;&#xA;<p>Here if input is "ad" then the compiler needs to check each of ab, ...
habedi/stack-exchange-dataset
82,862
Expected number of comparisons in a merge step?
<p>I know that merging two sorted arrays takes worst case n comparisons. However, there will often be cases where one array is depleted before the other, letting us just append the remainder of one array to the combined sorted array. I've also read that merging takes the same amount of comparisons (wrt to n) to any inp...
algorithms sorting mergesort
1
Expected number of comparisons in a merge step? -- (algorithms sorting mergesort) <p>I know that merging two sorted arrays takes worst case n comparisons. However, there will often be cases where one array is depleted before the other, letting us just append the remainder of one array to the combined sorted array. I've...
habedi/stack-exchange-dataset
82,865
Is the Tomasi-Kanade factorization still commonly used as a modern computer vision technique?
<p>My understanding is that, in very rough terms, the Tomasi-Kanade algorithm published in 1992 describes a way to reconstruct the 3D structure of an object from multiple images of that object, given that you have a reliable method of identifying important structural features from the 2D images.</p>&#xA;&#xA;<p>A lack ...
algorithms computer vision linear algebra
1
Is the Tomasi-Kanade factorization still commonly used as a modern computer vision technique? -- (algorithms computer vision linear algebra) <p>My understanding is that, in very rough terms, the Tomasi-Kanade algorithm published in 1992 describes a way to reconstruct the 3D structure of an object from multiple images o...
habedi/stack-exchange-dataset
82,869
Exhaustive search algorithms for np-complete problems
<p>Somewhere in the forum (a question about p vs np) I read that no exhaustive search algorithm exists for np-complete problems with better time complexity than $2^N$, however the subset sum problem has an algorithm with worst case complexity $O(2^{N/2}$), this looks much better than $2^N$, what is wrong with this?</p>...
algorithm analysis time complexity
1
Exhaustive search algorithms for np-complete problems -- (algorithm analysis time complexity) <p>Somewhere in the forum (a question about p vs np) I read that no exhaustive search algorithm exists for np-complete problems with better time complexity than $2^N$, however the subset sum problem has an algorithm with worst...
habedi/stack-exchange-dataset
82,873
Bayesian updating for multivariate Gaussian
<p>I am reading <a href="http://www.yisongyue.com/courses/cs159/lectures/LinUCB.pdf" rel="nofollow noreferrer">http://www.yisongyue.com/courses/cs159/lectures/LinUCB.pdf</a> and come across this slide</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/TMzzI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur...
machine learning artificial intelligence reinforcement learning bayesian statistics
1
Bayesian updating for multivariate Gaussian -- (machine learning artificial intelligence reinforcement learning bayesian statistics) <p>I am reading <a href="http://www.yisongyue.com/courses/cs159/lectures/LinUCB.pdf" rel="nofollow noreferrer">http://www.yisongyue.com/courses/cs159/lectures/LinUCB.pdf</a> and come acro...
habedi/stack-exchange-dataset
82,874
Lexical analysis
<p>Will the below statement cause any lexical error ?</p>&#xA;&#xA;<pre><code>int a123c ;&#xA;</code></pre>&#xA;&#xA;<p>According to me, int would be tokenized as a keyword and there would be a lexical error when "a123c" would be encountered as it doesn't fall into any token category.</p>&#xA;&#xA;<p>I read this questi...
compilers
1
Lexical analysis -- (compilers) <p>Will the below statement cause any lexical error ?</p>&#xA;&#xA;<pre><code>int a123c ;&#xA;</code></pre>&#xA;&#xA;<p>According to me, int would be tokenized as a keyword and there would be a lexical error when "a123c" would be encountered as it doesn't fall into any token category.</p...
habedi/stack-exchange-dataset
82,881
Converting Recursion into Into Iteration
<p>While reading <strong>Code Complete</strong> second edition, I came across this line:</p>&#xA;&#xA;<blockquote>&#xA; <p>You can do anything with stacks and iteration that you can do with&#xA; recursion.</p>&#xA;</blockquote>&#xA;&#xA;<p>Is this true? or there are functions, that must be implemented recursively, an...
recursion
1
Converting Recursion into Into Iteration -- (recursion) <p>While reading <strong>Code Complete</strong> second edition, I came across this line:</p>&#xA;&#xA;<blockquote>&#xA; <p>You can do anything with stacks and iteration that you can do with&#xA; recursion.</p>&#xA;</blockquote>&#xA;&#xA;<p>Is this true? or there...
habedi/stack-exchange-dataset
82,895
Closure property of recursively enumerable language
<p>I read that recursively enumerable languages are closed under intersection but not under set difference.</p>&#xA;&#xA;<p>We know that, $A \cap B = A - ( A - B)$.</p>&#xA;&#xA;<p>Now for LHS (left-hand side) to be closed under intersection, RHS(right-hand side) should be closed under set difference . </p>&#xA;&#xA;<p...
computability closure properties
1
Closure property of recursively enumerable language -- (computability closure properties) <p>I read that recursively enumerable languages are closed under intersection but not under set difference.</p>&#xA;&#xA;<p>We know that, $A \cap B = A - ( A - B)$.</p>&#xA;&#xA;<p>Now for LHS (left-hand side) to be closed under i...
habedi/stack-exchange-dataset
82,897
Does Bloom filter with false positive rate greater than 0.5 make sense?
<p>If the false positive error rate is greater than 0.5 then a Bloom filter is no different from coin flip, right? </p>&#xA;&#xA;<p>Still, if one does implement this data structure with, say, P=0.55 then it would still work.</p>&#xA;&#xA;<p>Should the constructor method of a Bloom filter implementation forbid values of...
data structures bloom filters
1
Does Bloom filter with false positive rate greater than 0.5 make sense? -- (data structures bloom filters) <p>If the false positive error rate is greater than 0.5 then a Bloom filter is no different from coin flip, right? </p>&#xA;&#xA;<p>Still, if one does implement this data structure with, say, P=0.55 then it would ...
habedi/stack-exchange-dataset
82,901
Splitting the array in the median-of-median solution for $k$th smallest element problem
<p>Regarding the <a href="https://en.wikipedia.org/wiki/Median_of_medians" rel="nofollow noreferrer">median of medians</a> solution to the $k$th smallest element in an array, why does the algorithm split the array into subarrays of length $n/5$, where $n$ is the length of the initial array? Why not $n/7$ or $n/3$? Why ...
algorithms algorithm analysis divide and conquer
1
Splitting the array in the median-of-median solution for $k$th smallest element problem -- (algorithms algorithm analysis divide and conquer) <p>Regarding the <a href="https://en.wikipedia.org/wiki/Median_of_medians" rel="nofollow noreferrer">median of medians</a> solution to the $k$th smallest element in an array, why...
habedi/stack-exchange-dataset
82,906
Deterministic finite automata that accepts the only the string "aabb"
<p>Lets construct a DFA over{a,b} That accepts only the string "aabb" in it.&#xA;My problem with this video is that the tutor has &#xA;moved arrow from state D to B why didn't he set a self loop on D .Im really helpless .</p>&#xA;&#xA;<p><a href="https://www.youtube.com/watch?v=_2cKtLkdwnc&amp;list=PLBlnK6fEyqRgp46KUv4...
turing machines automata finite automata
1
Deterministic finite automata that accepts the only the string "aabb" -- (turing machines automata finite automata) <p>Lets construct a DFA over{a,b} That accepts only the string "aabb" in it.&#xA;My problem with this video is that the tutor has &#xA;moved arrow from state D to B why didn't he set a self loop on D .Im ...
habedi/stack-exchange-dataset
82,916
Complement of DPDA
<p>I read that we can find complement of DPDA by just complementing(toggling) the states of DPDA. </p>&#xA;&#xA;<p>Why can't we do the same with NPDA ?</p>&#xA;&#xA;<p>Also is DCFL closed under complement just because we can toggle the states of DPDA ?</p>&#xA;
closure properties pushdown automata
1
Complement of DPDA -- (closure properties pushdown automata) <p>I read that we can find complement of DPDA by just complementing(toggling) the states of DPDA. </p>&#xA;&#xA;<p>Why can't we do the same with NPDA ?</p>&#xA;&#xA;<p>Also is DCFL closed under complement just because we can toggle the states of DPDA ?</p>&#x...
habedi/stack-exchange-dataset
82,934
Pumping lemma for context-free languages - Am I doing it right?
<p>I have an exam coming up in three days, and there's a thing that I really need to be able to completely understand - that is, of-course, pumping lemmas for CFL. I know how to do prove that a regular language is not regular using PL, but for CFL it's a bit more variables, and I am not entirely sure how to split a str...
formal languages context free pumping lemma
1
Pumping lemma for context-free languages - Am I doing it right? -- (formal languages context free pumping lemma) <p>I have an exam coming up in three days, and there's a thing that I really need to be able to completely understand - that is, of-course, pumping lemmas for CFL. I know how to do prove that a regular langu...
habedi/stack-exchange-dataset
82,938
Is the difference between two regular expressions a new regular expression?
<p>Let say the following:</p>&#xA;&#xA;<p>Given <code>Ax</code> and <code>Bx</code> two literals which represent <code>POSIX</code> regular expressions.</p>&#xA;&#xA;<p>Let def A as the set of literals that match <code>Ax</code>. The same def for B.</p>&#xA;&#xA;<p>Using <a href="https://en.wikipedia.org/wiki/Complemen...
regular expressions
1
Is the difference between two regular expressions a new regular expression? -- (regular expressions) <p>Let say the following:</p>&#xA;&#xA;<p>Given <code>Ax</code> and <code>Bx</code> two literals which represent <code>POSIX</code> regular expressions.</p>&#xA;&#xA;<p>Let def A as the set of literals that match <code>...
habedi/stack-exchange-dataset
82,944
Dynamic Programming formulation for hotel problem
<p>There are <code>n hotels</code> given at a<sub>0</sub>, a<sub>1</sub>, ..., a<sub>n</sub> such that 0 &lt; a<sub>0</sub> &lt; a<sub>1</sub> &lt; ... &lt; a<sub>n</sub>. The only places you are allowed to stop are at these hotels, but you can choose which of the hotels you stop at. You must stop at the final hotel (a...
algorithms dynamic programming
1
Dynamic Programming formulation for hotel problem -- (algorithms dynamic programming) <p>There are <code>n hotels</code> given at a<sub>0</sub>, a<sub>1</sub>, ..., a<sub>n</sub> such that 0 &lt; a<sub>0</sub> &lt; a<sub>1</sub> &lt; ... &lt; a<sub>n</sub>. The only places you are allowed to stop are at these hotels, b...
habedi/stack-exchange-dataset
82,947
What is the relationship between oracle Turing machine $M^O$ and Turing machine $M$ (given $O$)?
<p>An <a href="https://en.wikipedia.org/wiki/Oracle_machine" rel="nofollow noreferrer">oracle Turing machine</a> (OTM) $\bar{M}$ can be denoted $M^{O}$ if it is a <a href="https://en.wikipedia.org/wiki/Turing_machine" rel="nofollow noreferrer">Turing machine</a> (TM) $M$ with an oracle $O$. Given the oracle $O$, there ...
turing machines nondeterminism oracle machines
1
What is the relationship between oracle Turing machine $M^O$ and Turing machine $M$ (given $O$)? -- (turing machines nondeterminism oracle machines) <p>An <a href="https://en.wikipedia.org/wiki/Oracle_machine" rel="nofollow noreferrer">oracle Turing machine</a> (OTM) $\bar{M}$ can be denoted $M^{O}$ if it is a <a href=...
habedi/stack-exchange-dataset
82,953
Is there an approximation algorithm for Minimum Test Collection Problem?
<p>The problem is defined as follows:</p>&#xA;&#xA;<p><strong>Instance:</strong> A finite set $A$ of "possible diagnoses," a collection $C$ of subsets of $A$, representing binary "tests," and a positive integer $J≤|C|$.</p>&#xA;&#xA;<p><strong>Question:</strong> Is there a subcollection $C′⊆ C$ with $|C′|≤ J$ such that...
complexity theory np complete approximation
1
Is there an approximation algorithm for Minimum Test Collection Problem? -- (complexity theory np complete approximation) <p>The problem is defined as follows:</p>&#xA;&#xA;<p><strong>Instance:</strong> A finite set $A$ of "possible diagnoses," a collection $C$ of subsets of $A$, representing binary "tests," and a posi...
habedi/stack-exchange-dataset
82,961
Knapsack with an even number of items.
<p>I was asked in an interview to create a knapsack of only even items in n*C time, c being the capacity, n being the number of items to choose from. I tried approaching it with a third dimension, where it would be of height n and signify at each ij whether the knapsack with these maxes contains even numbers or not, bu...
dynamic programming
1
Knapsack with an even number of items. -- (dynamic programming) <p>I was asked in an interview to create a knapsack of only even items in n*C time, c being the capacity, n being the number of items to choose from. I tried approaching it with a third dimension, where it would be of height n and signify at each ij whethe...
habedi/stack-exchange-dataset
82,967
Complexity analysis of recurrence with multiple variables
<p>To give background, there's two ways to multiply two complex numbers:</p>&#xA;&#xA;<ul>&#xA;<li>Method A: requires 3 multiplications and 5 additions</li>&#xA;<li>Method B: requires 4 multiplications and 2 additions</li>&#xA;</ul>&#xA;&#xA;<p>And it's given that multiplying two $m$ bit numbers is $O(m^2)$ and that ad...
algorithm analysis runtime analysis recurrence relation
1
Complexity analysis of recurrence with multiple variables -- (algorithm analysis runtime analysis recurrence relation) <p>To give background, there's two ways to multiply two complex numbers:</p>&#xA;&#xA;<ul>&#xA;<li>Method A: requires 3 multiplications and 5 additions</li>&#xA;<li>Method B: requires 4 multiplications...
habedi/stack-exchange-dataset
82,993
How logic programming (especially ASP) is related to the reasoning in (first-order) logic?
<p>How logic programming (<a href="https://en.wikipedia.org/wiki/Logic_programming" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Logic_programming</a>, especially answer set programming) is related to the reasoning in the (first-order) logic? Maybe logic programming can be expressed using lambda calculus and...
logic lambda calculus first order logic curry howard answer set programming
1
How logic programming (especially ASP) is related to the reasoning in (first-order) logic? -- (logic lambda calculus first order logic curry howard answer set programming) <p>How logic programming (<a href="https://en.wikipedia.org/wiki/Logic_programming" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Logic_pr...
habedi/stack-exchange-dataset
82,994
Monadic Second Order Logic for Dummies
<p>I am programmer with a grip on automata, but not on logic.</p>&#xA;&#xA;<p>I read in papers that the two are very tightly related.&#xA;Deterministic Finite Automata (DFA), Tree Automata and Visibly Pushdown Automata are all related to Monadic Second Order Logic (MSO).&#xA;Although, I understand the automata and peop...
automata finite automata logic coq automated theorem proving
1
Monadic Second Order Logic for Dummies -- (automata finite automata logic coq automated theorem proving) <p>I am programmer with a grip on automata, but not on logic.</p>&#xA;&#xA;<p>I read in papers that the two are very tightly related.&#xA;Deterministic Finite Automata (DFA), Tree Automata and Visibly Pushdown Autom...
habedi/stack-exchange-dataset
83,019
$m/p$-equivalence holds after union with an arbitrary finite language
<p><strong>Problem 1:</strong> Let $A,B$ be languages over some alphabet $\Sigma$, if $A \equiv_m B$, then for every finite language $C$, $A \cup C \equiv_m B \cup C$.</p>&#xA;&#xA;<p><strong>Problem 2:</strong> Problem 1 but using polynomial time reductions.</p>&#xA;&#xA;<p><strong>Note:</strong> $A \equiv_m B$ means ...
complexity theory formal languages turing machines reductions polynomial time
1
$m/p$-equivalence holds after union with an arbitrary finite language -- (complexity theory formal languages turing machines reductions polynomial time) <p><strong>Problem 1:</strong> Let $A,B$ be languages over some alphabet $\Sigma$, if $A \equiv_m B$, then for every finite language $C$, $A \cup C \equiv_m B \cup C$....
habedi/stack-exchange-dataset
83,021
Cannot find paper: All k nearest neighbors search in N*log(N) using distance indices for log(N) support points
<p>I remember reading a paper about finding k nearest neighbors for all N multi-dimensional objects in the set.</p>&#xA;&#xA;<p>I've tries to find it again many times, but have failed so far.</p>&#xA;&#xA;<p>The algorithm was as follows:</p>&#xA;&#xA;<ol>&#xA;<li>Each object is assigned a sorted queue of nears neighbor...
nearest neighbour
1
Cannot find paper: All k nearest neighbors search in N*log(N) using distance indices for log(N) support points -- (nearest neighbour) <p>I remember reading a paper about finding k nearest neighbors for all N multi-dimensional objects in the set.</p>&#xA;&#xA;<p>I've tries to find it again many times, but have failed so...
habedi/stack-exchange-dataset
83,023
Why does the effectiveness of my reinforcement based neural network recede after a while?
<p>I have a reinforcement based neural network training on the OpenAI gym CartPole-v1 environment. For the structure and training algorithm, assume it is the same as the one in <a href="https://github.com/awjuliani/DeepRL-Agents/blob/master/Vanilla-Policy.ipynb" rel="noreferrer">this article</a>.</p>&#xA;&#xA;<p>Typica...
machine learning neural networks reinforcement learning
1
Why does the effectiveness of my reinforcement based neural network recede after a while? -- (machine learning neural networks reinforcement learning) <p>I have a reinforcement based neural network training on the OpenAI gym CartPole-v1 environment. For the structure and training algorithm, assume it is the same as the...
habedi/stack-exchange-dataset
83,031
How one epoch completes in Perceptron?
<p>I am confusing on completing one epoch, I am using Single Layer Feed Forward neural Network approach. Lets suppose i have a data of OR Gate:</p>&#xA;&#xA;<pre><code>X1 X2 Target&#xA;0 0 0&#xA;0 1 1&#xA;1 0 1&#xA;1 1 1&#xA;</code></pre>&#xA;&#xA;<p>Now we initialize weights (w1 and w2 with 0) a...
optimization machine learning neural networks
1
How one epoch completes in Perceptron? -- (optimization machine learning neural networks) <p>I am confusing on completing one epoch, I am using Single Layer Feed Forward neural Network approach. Lets suppose i have a data of OR Gate:</p>&#xA;&#xA;<pre><code>X1 X2 Target&#xA;0 0 0&#xA;0 1 1&#xA;1 0 1&#...
habedi/stack-exchange-dataset
83,034
When does a type generalise another type?
<p>In languages like Haskell, with a Hindley-Milner type system, when does a type $t$ generalise a type $u$? I use the definition: $t$ generalises $u$ iff $\forall\ v: v \text{ unifies with } u \rightarrow v \text{ unifies with } t$.</p>&#xA;&#xA;<p>I have an algorithm that given these types returns a unifier if one ex...
type theory functional programming haskell
1
When does a type generalise another type? -- (type theory functional programming haskell) <p>In languages like Haskell, with a Hindley-Milner type system, when does a type $t$ generalise a type $u$? I use the definition: $t$ generalises $u$ iff $\forall\ v: v \text{ unifies with } u \rightarrow v \text{ unifies with } ...
habedi/stack-exchange-dataset
83,060
What does it mean to add up O-terms with different variables?
<p>Is this true? O(n) + O(k) =O(n+k).I have searched for it ,the answers were quite ambiguous and I couldn't find a good explanation.</p>&#xA;
asymptotics landau notation
1
What does it mean to add up O-terms with different variables? -- (asymptotics landau notation) <p>Is this true? O(n) + O(k) =O(n+k).I have searched for it ,the answers were quite ambiguous and I couldn't find a good explanation.</p>&#xA;
habedi/stack-exchange-dataset
83,062
Prove key of leaf is larger or smaller than key of parent if leaf is largest key in smaller tree or smallest in larger tree with respect to parent
<p>Show that for any leaf v in a binary search tree, if u is the parent of v, then either key[v] is the largest key in the tree smaller than key[u], or key[v] is the smallest key in the tree larger than key[u].</p>&#xA;&#xA;<p>I don't understand "key[v] is the largest key in the tree smaller than key[u]" and "key[v] is...
trees binary trees
1
Prove key of leaf is larger or smaller than key of parent if leaf is largest key in smaller tree or smallest in larger tree with respect to parent -- (trees binary trees) <p>Show that for any leaf v in a binary search tree, if u is the parent of v, then either key[v] is the largest key in the tree smaller than key[u], ...
habedi/stack-exchange-dataset
83,066
Sub-exponential for Subset Sum on the total bit length of the input
<p>Was crawling the internet, and found this in a paper (1)</p>&#xA;&#xA;<p><em>"[...], a variant of dynamic programming called&#xA;dynamic dynamic programming has been shown to have a worst-case sub-exponential time complexity of $2^{O(\sqrt x)}$ when the total bit length $x$ of the input set is used as the complexity...
time complexity np complete runtime analysis
1
Sub-exponential for Subset Sum on the total bit length of the input -- (time complexity np complete runtime analysis) <p>Was crawling the internet, and found this in a paper (1)</p>&#xA;&#xA;<p><em>"[...], a variant of dynamic programming called&#xA;dynamic dynamic programming has been shown to have a worst-case sub-ex...
habedi/stack-exchange-dataset
83,078
Is there a polynomial algorithm for optimal sorting on trees?
<p>There's the classical problem of sorting numbers in a list with the restriction that you can only swap two neighbouring numbers. It's easy to see that getting an optimal number of needed swaps can be achieved by insertion sort or bubble sort.</p>&#xA;&#xA;<p>We can generalize this problem by changing the underlying ...
algorithms graphs sorting trees
1
Is there a polynomial algorithm for optimal sorting on trees? -- (algorithms graphs sorting trees) <p>There's the classical problem of sorting numbers in a list with the restriction that you can only swap two neighbouring numbers. It's easy to see that getting an optimal number of needed swaps can be achieved by insert...
habedi/stack-exchange-dataset
83,093
Enumerate all maximal subset of a weighted knapsack
<p>Given a knapsack $A$ composed of $(u_i, v_i)$-item where $u_i$ is the item identifier and $v_i$ is the weight of the item.</p>&#xA;&#xA;<p>I call a <em>maximal</em> subset when you consider a subset $S$ of $A$ where the sum $R(S)$ over $v_i$ in this subset is less or equal than $P_{max}$ <em>and</em> if you try addi...
enumeration
1
Enumerate all maximal subset of a weighted knapsack -- (enumeration) <p>Given a knapsack $A$ composed of $(u_i, v_i)$-item where $u_i$ is the item identifier and $v_i$ is the weight of the item.</p>&#xA;&#xA;<p>I call a <em>maximal</em> subset when you consider a subset $S$ of $A$ where the sum $R(S)$ over $v_i$ in thi...
habedi/stack-exchange-dataset
83,118
Advantages of segmented paging over pure paging
<p>As we know segmented paging is an improvement over segmentation and paging but I am having some doubts regarding the memory overhead of these three system.It is clear that segmentation need less memory overhead.But about other two system please confirm these two points. </p>&#xA;&#xA;<blockquote>&#xA; <p>number of...
memory management
1
Advantages of segmented paging over pure paging -- (memory management) <p>As we know segmented paging is an improvement over segmentation and paging but I am having some doubts regarding the memory overhead of these three system.It is clear that segmentation need less memory overhead.But about other two system please c...
habedi/stack-exchange-dataset
83,124
What is the $4k$ kernelization algorithm for Planar Independent Set?
<p><a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.117.1808&amp;rep=rep1&amp;type=pdf" rel="nofollow noreferrer">Chen et al.</a> say that</p>&#xA;&#xA;<blockquote>&#xA; <p>The four-color theorem implies a $4k$-kernelization for Planar Independent Det, which is the dual problem of Planar Vertex Cover....
parameterized complexity
1
What is the $4k$ kernelization algorithm for Planar Independent Set? -- (parameterized complexity) <p><a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.117.1808&amp;rep=rep1&amp;type=pdf" rel="nofollow noreferrer">Chen et al.</a> say that</p>&#xA;&#xA;<blockquote>&#xA; <p>The four-color theorem implies...
habedi/stack-exchange-dataset
83,128
Calculating this sum in $O(n)$ time
<p>Assume that $\forall 1 \leq i \leq n : a&gt;0, c_i &gt; 0 $ where $n \in \mathbb{N}$. I need to show that it is possible to compute this sum in $O(n)$ time:</p>&#xA;&#xA;<p>$$I = \sum_{(\epsilon_1,...,\epsilon_n) \in \{0,1\}^n}a^{c_1 \epsilon_1 + ... + c_n \epsilon_n}$$</p>&#xA;&#xA;<p>(a sum over all binary vectors...
algorithms numerical algorithms
1
Calculating this sum in $O(n)$ time -- (algorithms numerical algorithms) <p>Assume that $\forall 1 \leq i \leq n : a&gt;0, c_i &gt; 0 $ where $n \in \mathbb{N}$. I need to show that it is possible to compute this sum in $O(n)$ time:</p>&#xA;&#xA;<p>$$I = \sum_{(\epsilon_1,...,\epsilon_n) \in \{0,1\}^n}a^{c_1 \epsilon_1...
habedi/stack-exchange-dataset
83,163
Why are Oracle call instances bounded in the definition of FPT Turing reductions?
<p>Let's take the following definition of a FPT Turing reduction from Flum &amp; Grohe's book.</p>&#xA;&#xA;<p>Let $F$ and $G$ be parameterised problems. For any instance $x$ of $F$, write $k(x)$ for the parameter of $F$ and $|x|$ for the size of $x$. For any instance $y$ of $G$, write $l(y)$ for the&#xA;parameter of $...
algorithms complexity theory graphs computability parameterized complexity
1
Why are Oracle call instances bounded in the definition of FPT Turing reductions? -- (algorithms complexity theory graphs computability parameterized complexity) <p>Let's take the following definition of a FPT Turing reduction from Flum &amp; Grohe's book.</p>&#xA;&#xA;<p>Let $F$ and $G$ be parameterised problems. For ...
habedi/stack-exchange-dataset
83,166
Proving a factor 2 performance guarantee for a greedy minimum cardinality vertex cover algorithm (Exercise)
<p>Exercise 1.3 from Vijay Vazirani - 'Approximation Algorithms' asks:</p>&#xA;&#xA;<p>Consider the following factor $2$ approximation algorithm&#xA;for the cardinality vertex cover problem. Find a depth first search tree&#xA;in the given graph, $G$, and output the set, say S, of all the nonleaf vertices&#xA;of this tr...
graphs combinatorics approximation
1
Proving a factor 2 performance guarantee for a greedy minimum cardinality vertex cover algorithm (Exercise) -- (graphs combinatorics approximation) <p>Exercise 1.3 from Vijay Vazirani - 'Approximation Algorithms' asks:</p>&#xA;&#xA;<p>Consider the following factor $2$ approximation algorithm&#xA;for the cardinality ver...
habedi/stack-exchange-dataset
83,175
When is the empty word part of $A^+$?
<p>My professor mentioned the below statement in class but without a proof. I am trying to prove it for myself as I don't understand 100% why this is always the case. &#xA;Given is A, a subset of {0,1}$^*$.</p>&#xA;&#xA;<p>ε $\in\ A^+$ &lt;-> ε $\in\ A$, where ε is the empty word.&#xA;I thought of doing a proof by cont...
formal languages proof techniques kleene star
1
When is the empty word part of $A^+$? -- (formal languages proof techniques kleene star) <p>My professor mentioned the below statement in class but without a proof. I am trying to prove it for myself as I don't understand 100% why this is always the case. &#xA;Given is A, a subset of {0,1}$^*$.</p>&#xA;&#xA;<p>ε $\in\ ...
habedi/stack-exchange-dataset
83,178
How does the Y combinator exemplify "Lambda calculus inconsistency"?
<p>On the Wikipedia page for <a href="https://en.wikipedia.org/wiki/Fixed-point_combinator#Usage" rel="noreferrer">Fixed Point Combinators</a> is written the rather mysterious text</p>&#xA;&#xA;<blockquote>&#xA; <p>The Y combinator is an example of what makes the Lambda calculus inconsistent. So it should be regarded ...
lambda calculus combinatory logic
1
How does the Y combinator exemplify "Lambda calculus inconsistency"? -- (lambda calculus combinatory logic) <p>On the Wikipedia page for <a href="https://en.wikipedia.org/wiki/Fixed-point_combinator#Usage" rel="noreferrer">Fixed Point Combinators</a> is written the rather mysterious text</p>&#xA;&#xA;<blockquote>&#xA; ...
habedi/stack-exchange-dataset
83,179
Greedy algorithm: Minimizing the maximum of a list
<blockquote>&#xA; <p>Given a list $L$ of positive integers, assuming you can only modify the list by "splitting" its numbers a finite number $n$ of times. Write an algorithm which minimize the maximum of the last generated list.</p>&#xA;</blockquote>&#xA;&#xA;<p>By "splitting" a number $x$ I mean deleting $x$ from $L$...
algorithms optimization greedy algorithms
1
Greedy algorithm: Minimizing the maximum of a list -- (algorithms optimization greedy algorithms) <blockquote>&#xA; <p>Given a list $L$ of positive integers, assuming you can only modify the list by "splitting" its numbers a finite number $n$ of times. Write an algorithm which minimize the maximum of the last generate...
habedi/stack-exchange-dataset
83,207
Is there any standard for comparing runtimes experimentally?
<h3>My situation</h3>&#xA;&#xA;<p>I am writing a paper presenting a software module I developed and I want to compare its runtime to other modules for the same task.&#xA;I am aware of <a href="https://cs.stackexchange.com/q/3126/24535">the drawbacks of runtime experiments</a>, but please assume as given that there is n...
algorithm analysis reference request runtime analysis experimental analysis
1
Is there any standard for comparing runtimes experimentally? -- (algorithm analysis reference request runtime analysis experimental analysis) <h3>My situation</h3>&#xA;&#xA;<p>I am writing a paper presenting a software module I developed and I want to compare its runtime to other modules for the same task.&#xA;I am awa...
habedi/stack-exchange-dataset
83,217
Are all finite strings over some infinite alphabet countable?
<p>Over some infinite alphabet $\Sigma$, can we state that the set of all possible finite strings is countable?</p>&#xA;
strings uncountability
1
Are all finite strings over some infinite alphabet countable? -- (strings uncountability) <p>Over some infinite alphabet $\Sigma$, can we state that the set of all possible finite strings is countable?</p>&#xA;
habedi/stack-exchange-dataset
83,229
Context-free string that satisfies constraint?
<p>I'm not sure on how to come up with a string that is in terms of $p$ for</p>&#xA;&#xA;<p>$ a^ib^jc^k$ where $ i+j = k^2$</p>&#xA;&#xA;<p>Where $p$ is the pumping length. I can't seem to find anything in terms of $p$ that satisifies the constraint. Any ideas or sugeestions are appreciated!</p>&#xA;
context free pumping lemma
1
Context-free string that satisfies constraint? -- (context free pumping lemma) <p>I'm not sure on how to come up with a string that is in terms of $p$ for</p>&#xA;&#xA;<p>$ a^ib^jc^k$ where $ i+j = k^2$</p>&#xA;&#xA;<p>Where $p$ is the pumping length. I can't seem to find anything in terms of $p$ that satisifies the c...
habedi/stack-exchange-dataset
83,236
How can a spinlock progress when it's busy-waiting?
<p>I read that in spinlock, process keeps on waiting for the lock continuously in a loop until it receives <code>signal(lock)</code> or <code>release(lock)</code> from other processes. This causes busy waiting and hence CPU cycles are wasted.</p>&#xA;&#xA;<p>My doubt is, if CPU is continuously checking the value of loc...
operating systems concurrency process scheduling mutual exclusion
1
How can a spinlock progress when it's busy-waiting? -- (operating systems concurrency process scheduling mutual exclusion) <p>I read that in spinlock, process keeps on waiting for the lock continuously in a loop until it receives <code>signal(lock)</code> or <code>release(lock)</code> from other processes. This causes ...
habedi/stack-exchange-dataset
83,244
Incorrect proof of closure under the star operation using NFA results in the NFA recognizing undesired strings?
<p>I'm currently reading the book <em>Introduction to the Theory of Computation (2nd or 3rd Ed.)</em> by <em>Michael Sipser</em>, and have stumbled upon a question in <em>Chapter 1 - Regular Languages</em>, namely when the author is presenting the proof idea of <em>Theorem 1.49</em> - <strong>"The class of regular lang...
regular languages automata finite automata nondeterminism
1
Incorrect proof of closure under the star operation using NFA results in the NFA recognizing undesired strings? -- (regular languages automata finite automata nondeterminism) <p>I'm currently reading the book <em>Introduction to the Theory of Computation (2nd or 3rd Ed.)</em> by <em>Michael Sipser</em>, and have stumbl...
habedi/stack-exchange-dataset
83,246
Do system calls always means a context switch?
<p>When a system call takes place some kernel code must be executed. If some kernel code is being executed it means it can alter register values. So before this code gets executed the old process state must be saved. This is called context switch.&#xA;Now Wikipedia says that not all system calls need context switch. Ho...
operating systems
1
Do system calls always means a context switch? -- (operating systems) <p>When a system call takes place some kernel code must be executed. If some kernel code is being executed it means it can alter register values. So before this code gets executed the old process state must be saved. This is called context switch.&#x...
habedi/stack-exchange-dataset
83,247
How to use stable matching algorithm in order to determine optimal schedule?
<p>This is a problem 1.6 from the book Algorithm Design by Kleinberg/Tardos:</p>&#xA;<blockquote>&#xA;<p>There's a company that manages ships that do various tasks when in port. There're <span class="math-container">$n$</span> ships, <span class="math-container">$n$</span> ports, <span class="math-container">$m$</span>...
algorithms matching
1
How to use stable matching algorithm in order to determine optimal schedule? -- (algorithms matching) <p>This is a problem 1.6 from the book Algorithm Design by Kleinberg/Tardos:</p>&#xA;<blockquote>&#xA;<p>There's a company that manages ships that do various tasks when in port. There're <span class="math-container">$n...
habedi/stack-exchange-dataset
83,254
Is the problem of deciding whether a Context free grammar generates exactly K strings is decidable?
<p>I am reading "Introduction to Theory of Computation" by Michael Sipser. One of the exercise problems asks to verify whether the problem of deciding whether a Context free grammar generates exactly K strings is decidable?</p>&#xA;&#xA;<p>This problem has two parts</p>&#xA;&#xA;<ol>&#xA;<li>K can be infinite (I know ...
formal languages
1
Is the problem of deciding whether a Context free grammar generates exactly K strings is decidable? -- (formal languages) <p>I am reading "Introduction to Theory of Computation" by Michael Sipser. One of the exercise problems asks to verify whether the problem of deciding whether a Context free grammar generates exact...
habedi/stack-exchange-dataset
83,280
Solving SAT correctly on all but $poly(m)$ formulas
<p>The question is to show that there is no deterministic polynomial time algorithm that solves SAT correctly on all but $poly(m)$ formulas of size $m$, for every $m \geq 0$ unless $P \ne NP$.</p>&#xA;&#xA;<p>I know that if $P = NP$, a polynomial time algorithm exists that, given a Boolean formula φ, actually produces...
np complete np hard satisfiability decision problem
1
Solving SAT correctly on all but $poly(m)$ formulas -- (np complete np hard satisfiability decision problem) <p>The question is to show that there is no deterministic polynomial time algorithm that solves SAT correctly on all but $poly(m)$ formulas of size $m$, for every $m \geq 0$ unless $P \ne NP$.</p>&#xA;&#xA;<p>I ...
habedi/stack-exchange-dataset
83,282
f(n) and g(n) are monotonically increasing functions. h(n) = max(f,g) => h = O(f) or h = O(g)?
<p>All functions are from naturals to naturals.</p>&#xA;&#xA;<p>Let f(n) and g(n) be monotonically increasing functions. prove or disprove &#xA;h(n) = max(f(n),g(n)) => h = O(f) or h = O(g)</p>&#xA;&#xA;<p>I've found close questions regarding max(f,g) being O(f+g) but I couldn't derive anything from them regarding my...
asymptotics landau notation
1
f(n) and g(n) are monotonically increasing functions. h(n) = max(f,g) => h = O(f) or h = O(g)? -- (asymptotics landau notation) <p>All functions are from naturals to naturals.</p>&#xA;&#xA;<p>Let f(n) and g(n) be monotonically increasing functions. prove or disprove &#xA;h(n) = max(f(n),g(n)) => h = O(f) or h = O(g)<...
habedi/stack-exchange-dataset
83,286
2:1 Mutual exclusion with semaphores
<p>I'm stuck on this semaphore exercise (it's a exam question of a previous exam and I'm studying for that exam):</p>&#xA;&#xA;<p>There are three processes: A, B and C. Process A wants to execute method a(); Process B wants to execute b(); and Process C c();. The Processes are each started once.</p>&#xA;&#xA;<p>The exe...
concurrency synchronization
1
2:1 Mutual exclusion with semaphores -- (concurrency synchronization) <p>I'm stuck on this semaphore exercise (it's a exam question of a previous exam and I'm studying for that exam):</p>&#xA;&#xA;<p>There are three processes: A, B and C. Process A wants to execute method a(); Process B wants to execute b(); and Proces...
habedi/stack-exchange-dataset
83,289
Fastest algorithm for matrix inversion
<p>What is the fastest way to compute the inverse of the matrix, whose entries are from file $\mathbb{R}$ (set of real numbers)?</p>&#xA;&#xA;<p>One way to calculate the inverse is using the gaussian elimination method. In this method append more columns(double the number of columns ) to the input matrix and then we tr...
algorithms matrices
1
Fastest algorithm for matrix inversion -- (algorithms matrices) <p>What is the fastest way to compute the inverse of the matrix, whose entries are from file $\mathbb{R}$ (set of real numbers)?</p>&#xA;&#xA;<p>One way to calculate the inverse is using the gaussian elimination method. In this method append more columns(d...
habedi/stack-exchange-dataset
83,291
Make n-bit adder
<p>I understand how 1-bit adders work, but I don't see how to make a 4-bit adder using those 1-bit adders...</p>&#xA;&#xA;<p>This is my 1-bit adder:</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/buRX7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/buRX7.png" alt="enter image description here"><...
computer architecture
1
Make n-bit adder -- (computer architecture) <p>I understand how 1-bit adders work, but I don't see how to make a 4-bit adder using those 1-bit adders...</p>&#xA;&#xA;<p>This is my 1-bit adder:</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/buRX7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/buR...
habedi/stack-exchange-dataset
83,300
How many tapes would Turing Machine require to find the sum of 2 integers (expressed in base2)?
<p>Suppose I wished to devise an algorithm (to be run on a turing machine) which could find the sum of 2 integers (expressed in base2). How many tapes would this require?</p>&#xA;&#xA;<p>My intuition tells me that 4 tapes would be required: 1 for each of the two numbers being added together, 1 to store the 'carry over'...
turing machines
1
How many tapes would Turing Machine require to find the sum of 2 integers (expressed in base2)? -- (turing machines) <p>Suppose I wished to devise an algorithm (to be run on a turing machine) which could find the sum of 2 integers (expressed in base2). How many tapes would this require?</p>&#xA;&#xA;<p>My intuition tel...
habedi/stack-exchange-dataset
83,302
Is a powerful two-way hash function provably impossible?
<p>A two-way hash function that could hash complex strings to a fixed length would change the world.</p>&#xA;&#xA;<p>Imagine the decreased load on wires around the world if, for example, HTML pages could be hashed, then decoded by clients. Power (electricity) savings would be enormous.</p>&#xA;&#xA;<p>Is it absolutely,...
hash
1
Is a powerful two-way hash function provably impossible? -- (hash) <p>A two-way hash function that could hash complex strings to a fixed length would change the world.</p>&#xA;&#xA;<p>Imagine the decreased load on wires around the world if, for example, HTML pages could be hashed, then decoded by clients. Power (electr...
habedi/stack-exchange-dataset
83,312
Count substrings with same first and last characters
<p>We are given a string S, we need to find count of all contiguous substrings starting and ending with same character.<br></p>&#xA;&#xA;<p>Examples :<br></p>&#xA;&#xA;<p>Input : S = "abcab"<br>&#xA;Output : 7<br>&#xA;There are 15 substrings of "abcab"<br>&#xA;a, ab, abc, abca, abcab, b, bc, bca<br>&#xA;bcab, c, ca, c...
algorithms strings
1
Count substrings with same first and last characters -- (algorithms strings) <p>We are given a string S, we need to find count of all contiguous substrings starting and ending with same character.<br></p>&#xA;&#xA;<p>Examples :<br></p>&#xA;&#xA;<p>Input : S = "abcab"<br>&#xA;Output : 7<br>&#xA;There are 15 substrings ...
habedi/stack-exchange-dataset
83,320
Why does Banded Needleman-Wunsch give alignments with no more than d base pairs of indels?
<p>A common modification to the Needleman-Wunsch to reduce running time is to only fill in the cells along a diagonal band of the matrix (<a href="https://www.comp.nus.edu.sg/~wongls/courses/cs2220/2013/Lect5-2220-seqcomparison.pdf" rel="nofollow noreferrer">slides 27/28</a>). Let 2d + 1 represent the width of the band...
algorithms dynamic programming subsequences bioinformatics
1
Why does Banded Needleman-Wunsch give alignments with no more than d base pairs of indels? -- (algorithms dynamic programming subsequences bioinformatics) <p>A common modification to the Needleman-Wunsch to reduce running time is to only fill in the cells along a diagonal band of the matrix (<a href="https://www.comp.n...
habedi/stack-exchange-dataset
83,328
The constant in the merge sort recurrence
<p>Assuming that the worst case running time of merge sort can be described with this recurrence:</p>&#xA;&#xA;<p>$\ &#xA;T(n) = &#xA;\begin{cases}&#xA; \theta(1) &amp; \text{if }n = 1\\ &#xA; 2T(\frac{n}{2}) + \theta(n) &amp; \text{if } n\gt 1 &#xA;\end{cases}&#xA;$</p>&#xA;&#xA;<p><em>Introduction to Algorithm...
algorithm analysis runtime analysis sorting recurrence relation mergesort
1
The constant in the merge sort recurrence -- (algorithm analysis runtime analysis sorting recurrence relation mergesort) <p>Assuming that the worst case running time of merge sort can be described with this recurrence:</p>&#xA;&#xA;<p>$\ &#xA;T(n) = &#xA;\begin{cases}&#xA; \theta(1) &amp; \text{if }n = 1\\ &#xA; 2...
habedi/stack-exchange-dataset
83,336
Is what the all-zeroes instruction does considered in machine instruction design?
<p>I remember using a simulated machine with with a minimal instruction set in university. In particular I remember that the instruction that consisted of all zeroes loaded was a <code>LOAD</code> instruction. So, if you made a mistake and began executing empty memory then it would simply keep executing until it ran ou...
computer architecture programming languages history user interface
1
Is what the all-zeroes instruction does considered in machine instruction design? -- (computer architecture programming languages history user interface) <p>I remember using a simulated machine with with a minimal instruction set in university. In particular I remember that the instruction that consisted of all zeroes ...
habedi/stack-exchange-dataset
83,337
Is Mersenne primality testing necessarily EXPTIME?
<p>The computational complexity of primality testing is usually specified in relation to the bit length of the number being tested.</p>&#xA;&#xA;<p>However, Mersenne numbers have the special property that the characterizing instance exponent <span class="math-container">$p$</span> is exponentially more succinct than th...
algorithms complexity theory time complexity primes
1
Is Mersenne primality testing necessarily EXPTIME? -- (algorithms complexity theory time complexity primes) <p>The computational complexity of primality testing is usually specified in relation to the bit length of the number being tested.</p>&#xA;&#xA;<p>However, Mersenne numbers have the special property that the cha...
habedi/stack-exchange-dataset
83,341
What's the language of the NFA?
<p>Given is the NFA <code>N</code>:</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/DFZsE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DFZsE.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>What's the language of this NFA? What's its complement?</p>&#xA;&#xA;<hr>&#xA;&#xA;<p>I'm lea...
formal languages regular languages automata finite automata
1
What's the language of the NFA? -- (formal languages regular languages automata finite automata) <p>Given is the NFA <code>N</code>:</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/DFZsE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DFZsE.png" alt="enter image description here"></a></p>&#xA;&#xA...
habedi/stack-exchange-dataset