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
40,864
Is it possible to make N-way Controlled-NOTs out of Toffoli gates, without extra work bits?
<p>I'm working on exercise 4.29 of <a href="http://rads.stackoverflow.com/amzn/click/1107002176" rel="nofollow">Nielsen and Chuang</a>:</p>&#xA;&#xA;<blockquote>&#xA; <p>Find a circuit containing <em>O(n^2)</em> Toffoli, CNOT, and single qubit gates which implements a $C^n(X)$ gate (for n >3), using no work qubits.</p...
circuits reversible computing
1
Is it possible to make N-way Controlled-NOTs out of Toffoli gates, without extra work bits? -- (circuits reversible computing) <p>I'm working on exercise 4.29 of <a href="http://rads.stackoverflow.com/amzn/click/1107002176" rel="nofollow">Nielsen and Chuang</a>:</p>&#xA;&#xA;<blockquote>&#xA; <p>Find a circuit contain...
habedi/stack-exchange-dataset
40,866
How to make a "Secure by Design" client-server communication?
<p>Is there a way to have a secure by design client-server communication in a sense that the server can check if the client is not a modified version?</p>&#xA;&#xA;<p>What I'd like to do is give the user access to both the client's and the server's source code, but keep him from communicating with a modified version.</...
distributed systems security
1
How to make a "Secure by Design" client-server communication? -- (distributed systems security) <p>Is there a way to have a secure by design client-server communication in a sense that the server can check if the client is not a modified version?</p>&#xA;&#xA;<p>What I'd like to do is give the user access to both the c...
habedi/stack-exchange-dataset
40,872
Proof of Karp-Lipton theorem
<p>I am trying to understand the proof of the Karp-Lipton theorem as stated in the book &quot;Computational Complexity: A modern approach&quot; (2009).</p>&#xA;<p>In particular, this book states the following:</p>&#xA;<blockquote>&#xA;<p><em>Karp-Lipton theorem</em></p>&#xA;<p>If <strong>NP</strong> <span class="math-c...
complexity theory complexity classes
1
Proof of Karp-Lipton theorem -- (complexity theory complexity classes) <p>I am trying to understand the proof of the Karp-Lipton theorem as stated in the book &quot;Computational Complexity: A modern approach&quot; (2009).</p>&#xA;<p>In particular, this book states the following:</p>&#xA;<blockquote>&#xA;<p><em>Karp-Li...
habedi/stack-exchange-dataset
40,883
Does NP-completeness require to find the solution?
<p>In the paper "Computing Equilibria:A Computational Complexity Perspective" by Tim Roughgarden, they consider the problem:</p>&#xA;&#xA;<p><strong>Problem 2.1</strong> (Clique). Given a graph $G = (V, E)$ and an integer $k$:</p>&#xA;&#xA;<ol>&#xA;<li>if there is a set $K ⊆ V$ with $|K| = k$ and with $(i, j) ∈ E$ for...
complexity theory decision problem np search problem
1
Does NP-completeness require to find the solution? -- (complexity theory decision problem np search problem) <p>In the paper "Computing Equilibria:A Computational Complexity Perspective" by Tim Roughgarden, they consider the problem:</p>&#xA;&#xA;<p><strong>Problem 2.1</strong> (Clique). Given a graph $G = (V, E)$ and...
habedi/stack-exchange-dataset
40,884
Is there any other way of getting a function from this piece of code?
<p>I have this pseudocode</p>&#xA;&#xA;<pre><code>function mysterious(N):&#xA; count = 0&#xA; for i = 0 to N:&#xA; if (i mod 3 == 0):&#xA; count = count + i&#xA; return count&#xA;</code></pre>&#xA;&#xA;<p>The problem ask for the expression that returns this function using N or in terms of N</...
algorithms algorithm analysis
1
Is there any other way of getting a function from this piece of code? -- (algorithms algorithm analysis) <p>I have this pseudocode</p>&#xA;&#xA;<pre><code>function mysterious(N):&#xA; count = 0&#xA; for i = 0 to N:&#xA; if (i mod 3 == 0):&#xA; count = count + i&#xA; return count&#xA;</code></...
habedi/stack-exchange-dataset
40,890
Algorithm - Wine Bottle Filling
<p>You have two friends, call them A and B. They each are given two wine bottles: one bottle holds <code>k_1</code> litres and the other <code>k_2</code> litres. Both A and B can perform these operations: &#xA;- completely fill a wine bottle with wine&#xA;- completely empty a wine bottle&#xA;- pour the wine of one bott...
algorithms decision problem
1
Algorithm - Wine Bottle Filling -- (algorithms decision problem) <p>You have two friends, call them A and B. They each are given two wine bottles: one bottle holds <code>k_1</code> litres and the other <code>k_2</code> litres. Both A and B can perform these operations: &#xA;- completely fill a wine bottle with wine&#xA...
habedi/stack-exchange-dataset
40,891
Infinite sequence of regular languages over fixed finite alphabet
<p>Construct an infinite sequence of regular languages $L_1, L_2 , \ldots$, over the same fixed finite alphabet, such that for every $i ≥ 1$, $L_i ⊇ L_{i+1}$ and $|L_i \setminus L_{i+1} | = ∞$.</p>&#xA;
formal languages regular languages
1
Infinite sequence of regular languages over fixed finite alphabet -- (formal languages regular languages) <p>Construct an infinite sequence of regular languages $L_1, L_2 , \ldots$, over the same fixed finite alphabet, such that for every $i ≥ 1$, $L_i ⊇ L_{i+1}$ and $|L_i \setminus L_{i+1} | = ∞$.</p>&#xA;
habedi/stack-exchange-dataset
40,902
Different weight sets for same problem?
<p>Considering the case that we have a fixed set of training examples and a fixed ANN (i.e same number of input,output and intermediate layers). Is it possible that there exists more than one set of weights that all produce same desired results when applied to test examples. Basically can different weight matrix lead t...
machine learning neural networks
1
Different weight sets for same problem? -- (machine learning neural networks) <p>Considering the case that we have a fixed set of training examples and a fixed ANN (i.e same number of input,output and intermediate layers). Is it possible that there exists more than one set of weights that all produce same desired resul...
habedi/stack-exchange-dataset
40,903
Application of set theory subjects as ordinals, forcing, generic filters in software engineering
<p>I am going to teach a course in set theory for software engineering students.&#xA;I am going to talk in this course about: ordinal numbers, partial orders, well ordering, generic filters and maybe some <a href="http://en.wikipedia.org/wiki/Cardinal_characteristic_of_the_continuum" rel="nofollow">cardinal invariants<...
discrete mathematics type theory sets software engineering applied theory
1
Application of set theory subjects as ordinals, forcing, generic filters in software engineering -- (discrete mathematics type theory sets software engineering applied theory) <p>I am going to teach a course in set theory for software engineering students.&#xA;I am going to talk in this course about: ordinal numbers, p...
habedi/stack-exchange-dataset
40,911
What is the relationship between Turing Machines with a finite tape and Finite State Automata?
<p>I seem to recall from an undergraduate class that for a Turing Machine with a finite tape there will always exist a corresponding Finite State Automata, but I've been unable to find this confirmed anywhere on the internet. Is this actually the case or am I misremembering? </p>&#xA;
turing machines finite automata
1
What is the relationship between Turing Machines with a finite tape and Finite State Automata? -- (turing machines finite automata) <p>I seem to recall from an undergraduate class that for a Turing Machine with a finite tape there will always exist a corresponding Finite State Automata, but I've been unable to find thi...
habedi/stack-exchange-dataset
40,913
Is there a term for "delegate" function in CS?
<p><em>This question is all about terminology (names).</em></p>&#xA;&#xA;<p>When you consider "list", this term is well defined in CS -- despite the fact programming languages use and misuse this term (for example C# <code>List</code> is not a list).</p>&#xA;&#xA;<p>I am looking for term in Computer Science domain that...
terminology programming languages
1
Is there a term for "delegate" function in CS? -- (terminology programming languages) <p><em>This question is all about terminology (names).</em></p>&#xA;&#xA;<p>When you consider "list", this term is well defined in CS -- despite the fact programming languages use and misuse this term (for example C# <code>List</code>...
habedi/stack-exchange-dataset
40,914
How do you search a graph?
<p>An interview question I was asked. I was first asked how to traverse a graph and next I was asked how to search one. Got the first one but not the second. </p>&#xA;&#xA;<p>What is the modern standard way to search a graph (assume undirected) given no other context? I've a notion that it might have something to do w...
algorithms graphs graph traversal
1
How do you search a graph? -- (algorithms graphs graph traversal) <p>An interview question I was asked. I was first asked how to traverse a graph and next I was asked how to search one. Got the first one but not the second. </p>&#xA;&#xA;<p>What is the modern standard way to search a graph (assume undirected) given no...
habedi/stack-exchange-dataset
40,919
Algorithm to extract the subgraph of all nodes with degree at least four
<p>I have an undirected graph represented by a list of nodes and a list of edges. What I need to produce from this is a list of nodes and edges representing a new graph containing only the nodes which have degree of at least 4. I think I've developed an algorithm. It uses an object called Node, which can store an integ...
algorithms graphs
1
Algorithm to extract the subgraph of all nodes with degree at least four -- (algorithms graphs) <p>I have an undirected graph represented by a list of nodes and a list of edges. What I need to produce from this is a list of nodes and edges representing a new graph containing only the nodes which have degree of at least...
habedi/stack-exchange-dataset
40,926
Constructing solution to 3SAT formulas using oracle queries
<p>I'm interested in 3SAT and querying an oracle. Suppose we had an oracle that can decide, on an input boolean formula $\phi$, whether there exists any assignment to the variables that makes the formula true. Note: this does not say what the assignment to the variables is, just that there exists one.</p>&#xA;&#xA;<p>M...
complexity theory satisfiability oracle machines
1
Constructing solution to 3SAT formulas using oracle queries -- (complexity theory satisfiability oracle machines) <p>I'm interested in 3SAT and querying an oracle. Suppose we had an oracle that can decide, on an input boolean formula $\phi$, whether there exists any assignment to the variables that makes the formula tr...
habedi/stack-exchange-dataset
40,931
Enumerating all n-tuples over a finite domain
<p>I would like to create an algorithm which takes in an integer n and returns an array whose entries give all n-tuples of nonnegative integers each of which is at most n, so like </p>&#xA;&#xA;<ul>&#xA;<li><code>A[n][0] = [0,0,0,...,0]</code>, </li>&#xA;<li><code>A[n][1] = [1,0,0,...,0]</code>, ..., </li>&#xA;<li><cod...
algorithms enumeration
1
Enumerating all n-tuples over a finite domain -- (algorithms enumeration) <p>I would like to create an algorithm which takes in an integer n and returns an array whose entries give all n-tuples of nonnegative integers each of which is at most n, so like </p>&#xA;&#xA;<ul>&#xA;<li><code>A[n][0] = [0,0,0,...,0]</code>, <...
habedi/stack-exchange-dataset
40,933
Creating bigger controlled nots from single qubit, Toffoli, and CNOT gates, without workspace
<p>Exercise 4.29 from <a href="http://rads.stackoverflow.com/amzn/click/1107002176" rel="nofollow noreferrer">Quantum Computation and Quantum Information by Nielsen and Chuang</a> has me stumped.</p>&#xA;&#xA;<blockquote>&#xA; <p>Find a circuit containing $O(n^2)$ Toffoli, CNOT and single qubit gates which implements ...
quantum computing circuits
1
Creating bigger controlled nots from single qubit, Toffoli, and CNOT gates, without workspace -- (quantum computing circuits) <p>Exercise 4.29 from <a href="http://rads.stackoverflow.com/amzn/click/1107002176" rel="nofollow noreferrer">Quantum Computation and Quantum Information by Nielsen and Chuang</a> has me stumped...
habedi/stack-exchange-dataset
40,935
Reduction from Vertex Cover to Polygon Cover
<p><strong>Polygon Cover</strong>:</p>&#xA;&#xA;<p><strong>Input</strong>: A set of points $P$, a set of polygons $S$ in a 2D plane, and a positive integer $k \in \mathbb{N}$. </p>&#xA;&#xA;<p><strong>Output</strong>: True if and only if there exists a subset in $S$ of at most $k$ (not necessarily convex) polygons such...
complexity theory graphs np complete reductions computational geometry
1
Reduction from Vertex Cover to Polygon Cover -- (complexity theory graphs np complete reductions computational geometry) <p><strong>Polygon Cover</strong>:</p>&#xA;&#xA;<p><strong>Input</strong>: A set of points $P$, a set of polygons $S$ in a 2D plane, and a positive integer $k \in \mathbb{N}$. </p>&#xA;&#xA;<p><stron...
habedi/stack-exchange-dataset
40,939
RSA Decryption from Simple Public Key Values
<p>I'm a little stuck trying to figure out how to decrypt some messages and could use some hints as to what I may be doing wrong.</p>&#xA;&#xA;<p>I was given a series of integer values that make up my cipher text. Here are just a few of them:</p>&#xA;&#xA;<p>6584 15650 16198 11003</p>&#xA;&#xA;<p>I was given the follow...
cryptography encryption
1
RSA Decryption from Simple Public Key Values -- (cryptography encryption) <p>I'm a little stuck trying to figure out how to decrypt some messages and could use some hints as to what I may be doing wrong.</p>&#xA;&#xA;<p>I was given a series of integer values that make up my cipher text. Here are just a few of them:</p>...
habedi/stack-exchange-dataset
40,951
Converting regular (Type-3) grammar to a deterministic finite state automaton
<p>I would like to create a deterministic finite state automaton (DFA) M=(Q, Σ, δ, q0, F) that is accepting the language generated by the following regular grammar (RG) G=(N, Σ, P, S). In short I want to <strong>convert RG to DFA</strong>.</p>&#xA;&#xA;<pre><code>G = ({S,A,B},{a,b},P,S)&#xA;P = { &#xA;S -&gt; aA | bB,&...
automata formal grammars finite automata
1
Converting regular (Type-3) grammar to a deterministic finite state automaton -- (automata formal grammars finite automata) <p>I would like to create a deterministic finite state automaton (DFA) M=(Q, Σ, δ, q0, F) that is accepting the language generated by the following regular grammar (RG) G=(N, Σ, P, S). In short I ...
habedi/stack-exchange-dataset
40,957
Paxos: Accepting Proposals With Different Values and Consensus in Paxos
<p>I have a number of questions about Paxos which I can't answer in full confidence from reading the paper (Paxos Made Simple).</p>&#xA;&#xA;<p>My questions are loosely based around the following quote:</p>&#xA;&#xA;<blockquote>&#xA; <p>In Paxos, a value is chosen when a single proposal with that value has been accept...
distributed systems
1
Paxos: Accepting Proposals With Different Values and Consensus in Paxos -- (distributed systems) <p>I have a number of questions about Paxos which I can't answer in full confidence from reading the paper (Paxos Made Simple).</p>&#xA;&#xA;<p>My questions are loosely based around the following quote:</p>&#xA;&#xA;<blockq...
habedi/stack-exchange-dataset
40,961
Are hardware specs relevant in software performance comparisons?
<p>I notice occasionally in blogs or articles comparing different languages, algorithms, etc. that the author will divulge info about the processor used in the testing. Is this meaningful? </p>&#xA;&#xA;<p>Shouldn't the relative performance differences be hardware-agnostic? That is, if Language A executes in twice the ...
algorithm analysis memory hardware
1
Are hardware specs relevant in software performance comparisons? -- (algorithm analysis memory hardware) <p>I notice occasionally in blogs or articles comparing different languages, algorithms, etc. that the author will divulge info about the processor used in the testing. Is this meaningful? </p>&#xA;&#xA;<p>Shouldn't...
habedi/stack-exchange-dataset
40,962
Huffman code optimal substructure property
<p>I am learning about Greedy Algorithms and we did an example on Huffman codes. To prove the correctness of our algorithm, we had to have the greedy choice property and the optimal substructure property.</p>&#xA;&#xA;<p>Here is what my professor said about the optimal substructure property:</p>&#xA;&#xA;<p>Let C be an...
greedy algorithms
1
Huffman code optimal substructure property -- (greedy algorithms) <p>I am learning about Greedy Algorithms and we did an example on Huffman codes. To prove the correctness of our algorithm, we had to have the greedy choice property and the optimal substructure property.</p>&#xA;&#xA;<p>Here is what my professor said ab...
habedi/stack-exchange-dataset
40,963
Number of path with given length within an unrooted Tree
<p>Given a Tree (without a root) function w : v -> N and a number C - How can we count the number of verticies with distance between them equal to C.</p>&#xA;&#xA;<p>I was thinking about some smart vertice numbering so we could use dynamic programing to do it but after some thinking it is no good.</p>&#xA;&#xA;<p>I wou...
graphs trees
1
Number of path with given length within an unrooted Tree -- (graphs trees) <p>Given a Tree (without a root) function w : v -> N and a number C - How can we count the number of verticies with distance between them equal to C.</p>&#xA;&#xA;<p>I was thinking about some smart vertice numbering so we could use dynamic progr...
habedi/stack-exchange-dataset
40,965
CFGs: detecting infinitely many derivations of a single string
<p>Some particularly degenerate CFGs can produce a single string in infinitely many ways: for a dumb example, $S \to SS \mid \epsilon$ can produce the empty string as $S \to \epsilon$ or $S \to SS \to S \to \epsilon$, etc.</p>&#xA;&#xA;<p>I'm writing a general CFG parser which can produce all the different parses for a...
context free parsers
1
CFGs: detecting infinitely many derivations of a single string -- (context free parsers) <p>Some particularly degenerate CFGs can produce a single string in infinitely many ways: for a dumb example, $S \to SS \mid \epsilon$ can produce the empty string as $S \to \epsilon$ or $S \to SS \to S \to \epsilon$, etc.</p>&#xA;...
habedi/stack-exchange-dataset
40,966
Finding the interior of a connected graph
<p>I'm designing software that produces images such as the following:</p>&#xA;&#xA;<p><a href="https://imgur.com/NB4TGqo" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fhJbr.png" alt="snippet"></a></p>&#xA;&#xA;<p>Regions of interest are circumscribed by red pixels. I am interested in extracting the ful...
algorithms graphs
1
Finding the interior of a connected graph -- (algorithms graphs) <p>I'm designing software that produces images such as the following:</p>&#xA;&#xA;<p><a href="https://imgur.com/NB4TGqo" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fhJbr.png" alt="snippet"></a></p>&#xA;&#xA;<p>Regions of interest are c...
habedi/stack-exchange-dataset
40,976
Consequences of $NP=coNP=BPP=RP$
<p>What is complexity theoretic implication of following possibilities - $NP=coNP=BPP=RP$ or $coNP\neq NP=BPP=RP$ (consensus is these seem impossible)?</p>&#xA;
complexity theory
1
Consequences of $NP=coNP=BPP=RP$ -- (complexity theory) <p>What is complexity theoretic implication of following possibilities - $NP=coNP=BPP=RP$ or $coNP\neq NP=BPP=RP$ (consensus is these seem impossible)?</p>&#xA;
habedi/stack-exchange-dataset
40,986
Which fingerprinting/hashing algorithms support compounding?
<p>The definition of fingerprinting algorithms in Wikipedia describe a property called compounding <a href="http://en.wikipedia.org/wiki/Fingerprint_%28computing%29" rel="nofollow">as you can see here</a> as:</p>&#xA;&#xA;<blockquote>&#xA; <p>Some fingerprinting algorithms allow the fingerprint of a composite file to ...
algorithms information theory hash
1
Which fingerprinting/hashing algorithms support compounding? -- (algorithms information theory hash) <p>The definition of fingerprinting algorithms in Wikipedia describe a property called compounding <a href="http://en.wikipedia.org/wiki/Fingerprint_%28computing%29" rel="nofollow">as you can see here</a> as:</p>&#xA;&#...
habedi/stack-exchange-dataset
40,993
DFA Minimization
<p>I am currently in a class that deals with DFA's and their minimization. However I believe I have reached a DFA where the method of minimization we were taught doesn't work.</p>&#xA;&#xA;<p>I have the following DFA (in JFLAP)</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/EOiUh.png" alt="enter image description ...
finite automata
1
DFA Minimization -- (finite automata) <p>I am currently in a class that deals with DFA's and their minimization. However I believe I have reached a DFA where the method of minimization we were taught doesn't work.</p>&#xA;&#xA;<p>I have the following DFA (in JFLAP)</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/EO...
habedi/stack-exchange-dataset
41,014
Does "contains only" imply "contains"?
<p>Written in English, does "the set S contains <em>only</em> members of set T" imply that S does contain some member of set T?</p>&#xA;&#xA;<p>How would this relationship be written formally?</p>&#xA;
terminology computability sets
1
Does "contains only" imply "contains"? -- (terminology computability sets) <p>Written in English, does "the set S contains <em>only</em> members of set T" imply that S does contain some member of set T?</p>&#xA;&#xA;<p>How would this relationship be written formally?</p>&#xA;
habedi/stack-exchange-dataset
41,022
Modelling a basic sequential circuit as a transition system?
<p>I'm going through Dr Joost-Pieter Katoen's slides and stumbled upon this:</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/jBb6Z.png" alt="enter image description here"></p>&#xA;&#xA;<p>For some reason I can't quite make out how the transition system relates to the sequential circuit. If I had a question for inst...
model checking software verification transition systems
1
Modelling a basic sequential circuit as a transition system? -- (model checking software verification transition systems) <p>I'm going through Dr Joost-Pieter Katoen's slides and stumbled upon this:</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/jBb6Z.png" alt="enter image description here"></p>&#xA;&#xA;<p>For so...
habedi/stack-exchange-dataset
41,024
About Control Unit in CPU and Clock Cycle
<p>I've been studying about CPU and I am trying to implement a small CPU, like <em>MU0</em>.</p>&#xA;<p>Control unit gets instruction and generates and gives several control signals to other parts of CPU, such as ALU, PC, ACC, etc. And I know that these works in one clock cycle.</p>&#xA;<p>But I have some quetions.</p>...
computer architecture
1
About Control Unit in CPU and Clock Cycle -- (computer architecture) <p>I've been studying about CPU and I am trying to implement a small CPU, like <em>MU0</em>.</p>&#xA;<p>Control unit gets instruction and generates and gives several control signals to other parts of CPU, such as ALU, PC, ACC, etc. And I know that the...
habedi/stack-exchange-dataset
41,031
How to cover maximum points with a fixed length line segment?
<p>The problem is defined as:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a set of $N$ points $(x_1, x_2, x_3, \ldots, x_n)$ and $L$ the <strong>fixed</strong> length of a segment.</p>&#xA; &#xA; <p>Find the number of maximum points which you can cover with a segment line of length $L$.</p>&#xA; &#xA; <h1>Ranges</h1>&...
algorithms
1
How to cover maximum points with a fixed length line segment? -- (algorithms) <p>The problem is defined as:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a set of $N$ points $(x_1, x_2, x_3, \ldots, x_n)$ and $L$ the <strong>fixed</strong> length of a segment.</p>&#xA; &#xA; <p>Find the number of maximum points which you ...
habedi/stack-exchange-dataset
41,033
About codes over $\mathbb{F}_2$
<p>I was looking through these <a href="http://people.csail.mit.edu/madhu/FT02/" rel="nofollow noreferrer">notes</a> but I am not sure I can locate the answer to these questions of mine - it would be great if someone can just even point out what to look for!</p>&#xA;<ul>&#xA;<li><p>So any set of binary vectors can be s...
complexity theory coding theory error correcting codes code generation
1
About codes over $\mathbb{F}_2$ -- (complexity theory coding theory error correcting codes code generation) <p>I was looking through these <a href="http://people.csail.mit.edu/madhu/FT02/" rel="nofollow noreferrer">notes</a> but I am not sure I can locate the answer to these questions of mine - it would be great if som...
habedi/stack-exchange-dataset
41,041
Running time of recursive algorithm with geometric series
<p>What is the complexity of the recurrence $T(n) = 3T(\frac n2) + O(n)$?</p>&#xA;&#xA;<p>So far I have:</p>&#xA;&#xA;<p>$ O(n) \le cn$ for some constant $c$</p>&#xA;&#xA;<p>Hence: </p>&#xA;&#xA;<p>$$T(n) \le 3T(\frac{n}{2}) + cn$$</p>&#xA;&#xA;<p>After a recursion:</p>&#xA;&#xA;<p>$$T(n) \le 3(3T(\frac{n}{4}) + \frac{...
algorithms algorithm analysis time complexity recurrence relation
1
Running time of recursive algorithm with geometric series -- (algorithms algorithm analysis time complexity recurrence relation) <p>What is the complexity of the recurrence $T(n) = 3T(\frac n2) + O(n)$?</p>&#xA;&#xA;<p>So far I have:</p>&#xA;&#xA;<p>$ O(n) \le cn$ for some constant $c$</p>&#xA;&#xA;<p>Hence: </p>&#xA;&...
habedi/stack-exchange-dataset
41,051
What does it mean to be "closed" under beta reduction?
<p>I am reading the paper <a href="http://research.microsoft.com/en-us/um/people/akenn/sml/CompilingWithContinuationsContinued.pdf" rel="nofollow"><em>Compiling with Continuations, Continued</em></a>, and in section 2.4, <em>Comparison with ANF</em>, the author draws attention to the fact that ANF is not closed under b...
compilers lambda calculus continuations
1
What does it mean to be "closed" under beta reduction? -- (compilers lambda calculus continuations) <p>I am reading the paper <a href="http://research.microsoft.com/en-us/um/people/akenn/sml/CompilingWithContinuationsContinued.pdf" rel="nofollow"><em>Compiling with Continuations, Continued</em></a>, and in section 2.4,...
habedi/stack-exchange-dataset
41,053
What is the complexity of multiplying a matrix by a scalar?
<p>I would like to know the complexity of multiplying a matrix of $n\times m$ size by a scalar $\alpha$?</p>&#xA;&#xA;<p>In fact, I have a directed graph $G=(V,E)$ represented by an incidence matrix $M$. I would like to calculate the transpose of this graph, i.e., inverse the directions of the edges. I think that if I ...
algorithms matrices
1
What is the complexity of multiplying a matrix by a scalar? -- (algorithms matrices) <p>I would like to know the complexity of multiplying a matrix of $n\times m$ size by a scalar $\alpha$?</p>&#xA;&#xA;<p>In fact, I have a directed graph $G=(V,E)$ represented by an incidence matrix $M$. I would like to calculate the t...
habedi/stack-exchange-dataset
41,054
How many zeros should be in front of two's complement model?
<p><strong>The Problem</strong>&#xA;Convert 256 to its 2's complement representation.</p>&#xA;&#xA;<p><strong>My Work</strong></p>&#xA;&#xA;<p>&nbsp;&nbsp; I know that 256's representation in unsigned binary is 100000000. What I know from working with two's complement model is that the most significant digit represents...
arithmetic
1
How many zeros should be in front of two's complement model? -- (arithmetic) <p><strong>The Problem</strong>&#xA;Convert 256 to its 2's complement representation.</p>&#xA;&#xA;<p><strong>My Work</strong></p>&#xA;&#xA;<p>&nbsp;&nbsp; I know that 256's representation in unsigned binary is 100000000. What I know from work...
habedi/stack-exchange-dataset
41,065
Why doesn't the binary fraction representation match the decimal fraction representation?
<p><strong>The Problem:</strong> What value does the hexadecimal number x55544552 represent in data type IEEE floating point?</p>&#xA;&#xA;<p><strong>My Work</strong>: <BR>&#xA;&nbsp; &nbsp; I first wrote out that hexadecimal number in binary and got </p>&#xA;&#xA;<pre><code>0101 0101 0101 0100 0100 0101 0101 0010&#xA...
arithmetic floating point
1
Why doesn't the binary fraction representation match the decimal fraction representation? -- (arithmetic floating point) <p><strong>The Problem:</strong> What value does the hexadecimal number x55544552 represent in data type IEEE floating point?</p>&#xA;&#xA;<p><strong>My Work</strong>: <BR>&#xA;&nbsp; &nbsp; I first...
habedi/stack-exchange-dataset
41,070
DNF to CNF conversion: Easy or Hard
<p>In relation to the thread <a href="https://cs.stackexchange.com/questions/3513/cnf-to-dnf-conversion-is-np-hard">Proving that the conversion from CNF to DNF is NP-Hard</a> (and a related <a href="https://math.stackexchange.com/questions/159591/solving-sat-by-converting-to-disjunctive-normal-form">Math thread</a>):</...
complexity theory logic satisfiability normal forms
1
DNF to CNF conversion: Easy or Hard -- (complexity theory logic satisfiability normal forms) <p>In relation to the thread <a href="https://cs.stackexchange.com/questions/3513/cnf-to-dnf-conversion-is-np-hard">Proving that the conversion from CNF to DNF is NP-Hard</a> (and a related <a href="https://math.stackexchange.c...
habedi/stack-exchange-dataset
41,072
Lower bound for finding majority element in a sorted array
<p>Suppose $A$ is a sorted array with $n$ elements. I want to know whether we can determine if there are majority elements in $A$ with time complexity $O(1)$.</p>&#xA;&#xA;<p>Recall that a majority element of $A$ is an element which appears over $n/2$ times in $A$.</p>&#xA;&#xA;<p>I can find a $O(\log(n))$ algorithm t...
algorithms complexity theory lower bounds constant time
1
Lower bound for finding majority element in a sorted array -- (algorithms complexity theory lower bounds constant time) <p>Suppose $A$ is a sorted array with $n$ elements. I want to know whether we can determine if there are majority elements in $A$ with time complexity $O(1)$.</p>&#xA;&#xA;<p>Recall that a majority e...
habedi/stack-exchange-dataset
41,078
Online supervised learning algorithm
<p>I have labeled examples coming in on the fly, thus I need to create a classifier from sequential data instead of a static example set. Incoming data is fully labeled, there are no unlabeled examples. Each incoming example has a number of features.</p>&#xA;&#xA;<p>E.g. let X by an incoming example with 3 features</p>...
machine learning classification online algorithms
1
Online supervised learning algorithm -- (machine learning classification online algorithms) <p>I have labeled examples coming in on the fly, thus I need to create a classifier from sequential data instead of a static example set. Incoming data is fully labeled, there are no unlabeled examples. Each incoming example has...
habedi/stack-exchange-dataset
41,080
Weighted closest-pair-of-points problem
<p>I want to solve the following optimisation problem (an approximation or heuristic would be helpful as well).</p>&#xA;&#xA;<p>I have two sets of points in the plane:<br>&#xA; $P=\left\{ p_{1},p_{2},\dots,p_{N}\right\} $ and $Q=\left\{ q_{1},q_{2},\dots,q_{M}\right\} $.</p>&#xA;&#xA;<p>Each point has a value/weight, i...
algorithms time complexity optimization computational geometry search problem
1
Weighted closest-pair-of-points problem -- (algorithms time complexity optimization computational geometry search problem) <p>I want to solve the following optimisation problem (an approximation or heuristic would be helpful as well).</p>&#xA;&#xA;<p>I have two sets of points in the plane:<br>&#xA; $P=\left\{ p_{1},p_{...
habedi/stack-exchange-dataset
41,081
Guessing the structure of a finger tree from the number of elements
<p>I'm writing a data structure library, and I want to write an efficient algorithm for adding many elements to a finger tree (from an iterable sequence). I'm going to do this by constructing a finger tree from the sequence efficiently, as described below, and then concat it to the original finger tree. Concat is a ver...
data structures trees functional programming persistent data structure
1
Guessing the structure of a finger tree from the number of elements -- (data structures trees functional programming persistent data structure) <p>I'm writing a data structure library, and I want to write an efficient algorithm for adding many elements to a finger tree (from an iterable sequence). I'm going to do this ...
habedi/stack-exchange-dataset
41,088
LCA from children using bottom up approach?
<p>I'm interested in finding the LCA of two distinct Nodes in a (not necessarily binary) tree from the bottom up without using depth.</p>&#xA;&#xA;<p>How would I go about traversing the tree, starting from any 2 arbitrary nodes, each of which points to a previous node as shown without a depth variable? </p>&#xA;
algorithms graphs trees graph traversal
1
LCA from children using bottom up approach? -- (algorithms graphs trees graph traversal) <p>I'm interested in finding the LCA of two distinct Nodes in a (not necessarily binary) tree from the bottom up without using depth.</p>&#xA;&#xA;<p>How would I go about traversing the tree, starting from any 2 arbitrary nodes, ea...
habedi/stack-exchange-dataset
41,097
How to solve a Simple Linear Equation using a binary tree data structure
<p>i am currently working on a school project that takes in a simple linear equation and has to return the value of x, the code i have transforms x + 3 = 3x - 2 into a binary tree format like so:</p>&#xA;&#xA;<pre><code> =&#xA; / \&#xA; + -&#xA; / \ / \&#xA; x 3 * 2&#xA; / \...
binary trees linear algebra
1
How to solve a Simple Linear Equation using a binary tree data structure -- (binary trees linear algebra) <p>i am currently working on a school project that takes in a simple linear equation and has to return the value of x, the code i have transforms x + 3 = 3x - 2 into a binary tree format like so:</p>&#xA;&#xA;<pre>...
habedi/stack-exchange-dataset
41,117
Why are there $(2kn+1)^{kn}$ Turing Machines with $k$ symbols and $n$ states?
<p>I've seen a few references <a href="http://sodfather.blogspot.com/2006/08/super-simple-turing-machines-and-busy.html" rel="nofollow">[1]</a>, <a href="http://www.logique.jussieu.fr/~michel/tmi.html" rel="nofollow">[2]</a>, <a href="http://arxiv.org/pdf/0906.3749.pdf" rel="nofollow">[3]</a> that say that for a Turing...
turing machines combinatorics
1
Why are there $(2kn+1)^{kn}$ Turing Machines with $k$ symbols and $n$ states? -- (turing machines combinatorics) <p>I've seen a few references <a href="http://sodfather.blogspot.com/2006/08/super-simple-turing-machines-and-busy.html" rel="nofollow">[1]</a>, <a href="http://www.logique.jussieu.fr/~michel/tmi.html" rel="...
habedi/stack-exchange-dataset
41,120
Similarity of two monochromatic shapes
<p>I need to find out to what extent two shapes are similar. I mean I've got two vectors of points - and just that, no shadows, color or whatever - simplest case. Two triangles are the perfect example. Of course this has to work regardless of what the angle shift is and regardless of their scale (only aspect ratio matt...
matching
1
Similarity of two monochromatic shapes -- (matching) <p>I need to find out to what extent two shapes are similar. I mean I've got two vectors of points - and just that, no shadows, color or whatever - simplest case. Two triangles are the perfect example. Of course this has to work regardless of what the angle shift is ...
habedi/stack-exchange-dataset
41,124
What are the examples of the easily computable "wild" permutations?
<p>I am looking for the function $y=f(x)$ that would map the integer interval $[0,n)$ into itself $[0,n)$. The function must be bijective, so it is a permutation of n elements. It should "randomize" the input variable, ie.</p>&#xA;&#xA;<ul>&#xA;<li>for every $x_1$ and $x_2$ that are close $|x_1 - x_2| &lt; 100$ the out...
cryptography hash one way functions
1
What are the examples of the easily computable "wild" permutations? -- (cryptography hash one way functions) <p>I am looking for the function $y=f(x)$ that would map the integer interval $[0,n)$ into itself $[0,n)$. The function must be bijective, so it is a permutation of n elements. It should "randomize" the input va...
habedi/stack-exchange-dataset
41,147
Description and semantics of program graphs
<p>I'm working on a question which gives me a program graph and tells me to give a mathematical description of it. I'm aware that a program graph PG is a tuple </p>&#xA;&#xA;<p>$(Loc, Act, Effect, \rightarrow, Loc_0, g_0)$</p>&#xA;&#xA;<p>This is the question I'm trying to answer:</p>&#xA;&#xA;<p><img src="https://i.st...
semantics model checking software verification
1
Description and semantics of program graphs -- (semantics model checking software verification) <p>I'm working on a question which gives me a program graph and tells me to give a mathematical description of it. I'm aware that a program graph PG is a tuple </p>&#xA;&#xA;<p>$(Loc, Act, Effect, \rightarrow, Loc_0, g_0)$</...
habedi/stack-exchange-dataset
41,153
MAP estimation (for stationary iid gaussian environment)
<p>This is my first post, and have been self studying Haykin's Neural Networks and Learning Machines book. I'm not sure if this is a typo or if I'm doing something wrong, but I've been stuck on a statement on page 75. </p>&#xA;&#xA;<p>The context was the process of finding a Maximum likelihood estimate for a parameter...
machine learning mathematical foundations
1
MAP estimation (for stationary iid gaussian environment) -- (machine learning mathematical foundations) <p>This is my first post, and have been self studying Haykin's Neural Networks and Learning Machines book. I'm not sure if this is a typo or if I'm doing something wrong, but I've been stuck on a statement on page 7...
habedi/stack-exchange-dataset
41,154
Can a probabilistic Turing Machine compute an uncomputable number?
<p>Can a probabilistic Turing Machine compute an uncomputable number?</p>&#xA;&#xA;<p>My question probably does not make sense, but, that being the case, is&#xA;there a reasonably simple formal explanation for it. I should add that&#xA;I am pretty much ignorant of probabilistic TM and randomized algorithms.&#xA;I looke...
computability turing machines randomness probabilistic algorithms real numbers
1
Can a probabilistic Turing Machine compute an uncomputable number? -- (computability turing machines randomness probabilistic algorithms real numbers) <p>Can a probabilistic Turing Machine compute an uncomputable number?</p>&#xA;&#xA;<p>My question probably does not make sense, but, that being the case, is&#xA;there a ...
habedi/stack-exchange-dataset
41,169
MST with half the edges the maximum weight
<p>I have been cracking my head over the following question -</p>&#xA;&#xA;<blockquote>&#xA; <p>You are given an undirected connected graph with an even number of&#xA; edges. Half of the edges have weight less than C (possibly with&#xA; repetitions), and the other half of edges all have weight C. Is it&#xA; true th...
algorithms trees minimum spanning tree
1
MST with half the edges the maximum weight -- (algorithms trees minimum spanning tree) <p>I have been cracking my head over the following question -</p>&#xA;&#xA;<blockquote>&#xA; <p>You are given an undirected connected graph with an even number of&#xA; edges. Half of the edges have weight less than C (possibly with...
habedi/stack-exchange-dataset
41,170
Route planning for a car driver picking up people using public transport
<p>We just had an interesting though for a routing algorithm for people carpooling. Imagine the following situation:</p>&#xA;&#xA;<p>Person 1 is driving with his car from the south of city A to city B far in the north. He is picking up person 2 who is starting in the west of city A and person 3 who is starting in the e...
algorithms graphs routing
1
Route planning for a car driver picking up people using public transport -- (algorithms graphs routing) <p>We just had an interesting though for a routing algorithm for people carpooling. Imagine the following situation:</p>&#xA;&#xA;<p>Person 1 is driving with his car from the south of city A to city B far in the nort...
habedi/stack-exchange-dataset
41,180
Why does this mergesort variant not do Θ(n) comparisons on average?
<p>A comparison sort cannot require fewer than $\Theta (n\log n)$ comparisons on average. However, consider this sorting algorithm:</p>&#xA;&#xA;<pre><code>sort(array):&#xA; if length(array) &lt; 2:&#xA; return array&#xA; unsorted ← empty_array&#xA; i ← 0&#xA; while i &lt; length(array) - 1:&#xA; ...
algorithm analysis runtime analysis sorting average case
1
Why does this mergesort variant not do Θ(n) comparisons on average? -- (algorithm analysis runtime analysis sorting average case) <p>A comparison sort cannot require fewer than $\Theta (n\log n)$ comparisons on average. However, consider this sorting algorithm:</p>&#xA;&#xA;<pre><code>sort(array):&#xA; if length(arr...
habedi/stack-exchange-dataset
41,185
Shortest paths in weighted graphs, and minimum spanning trees
<p>I stuck in one challenging question, I read on my notes. </p>&#xA;&#xA;<blockquote>&#xA; <p>An undirected, weighted, connected graph $G$, (with no negative&#xA; weights and with all weights distinct) is given. We know that, in this graph,&#xA; the shortest path between any two vertices is on the minimum spanning ...
graphs trees shortest path minimum spanning tree
1
Shortest paths in weighted graphs, and minimum spanning trees -- (graphs trees shortest path minimum spanning tree) <p>I stuck in one challenging question, I read on my notes. </p>&#xA;&#xA;<blockquote>&#xA; <p>An undirected, weighted, connected graph $G$, (with no negative&#xA; weights and with all weights distinct)...
habedi/stack-exchange-dataset
41,186
Number and probability of random allocations of n processes to n servers
<p>I've been using the Stanford Algorithms (1) Coursera course, and in a description of a problem, the lecturer said that in the problem of allocating n processes to n servers at random, the sample space of allocations is n^n, and each has equal probability.</p>&#xA;&#xA;<p>Intuitively this seems unlikely to me: if you...
combinatorics
1
Number and probability of random allocations of n processes to n servers -- (combinatorics) <p>I've been using the Stanford Algorithms (1) Coursera course, and in a description of a problem, the lecturer said that in the problem of allocating n processes to n servers at random, the sample space of allocations is n^n, a...
habedi/stack-exchange-dataset
41,192
Algorithmic type checking for Calculus of Inductive Constructions
<p>So from reading "Advanced Topics in Types and Programming Languages" (ATTPL) I know of the calculus of constructions (CoC). It also presents the "algorithmic" type checking rules. Reading Coq's <a href="https://coq.inria.fr/refman/Reference-Manual006.html#sec167" rel="noreferrer">documentation</a> on the Calculus of...
reference request lambda calculus type theory type checking coq
1
Algorithmic type checking for Calculus of Inductive Constructions -- (reference request lambda calculus type theory type checking coq) <p>So from reading "Advanced Topics in Types and Programming Languages" (ATTPL) I know of the calculus of constructions (CoC). It also presents the "algorithmic" type checking rules. Re...
habedi/stack-exchange-dataset
41,201
Proof for variation of Prim's and Kruskal's to find maximum-weight acyclic subgraph
<p>I have been scratching my head to find good counter examples to the following problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>Suppose we are given a directed graph G=(V,E) in which every edge has&#xA; a distinct positive edge weight. A directed graph is acyclic if it has&#xA; no directed cycle. Suppose that we want to...
graphs weighted graphs minimum spanning tree
1
Proof for variation of Prim's and Kruskal's to find maximum-weight acyclic subgraph -- (graphs weighted graphs minimum spanning tree) <p>I have been scratching my head to find good counter examples to the following problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>Suppose we are given a directed graph G=(V,E) in which every ...
habedi/stack-exchange-dataset
41,206
Amplifying the correctness of $\mathsf{RP}$ algorithms using expander graphs
<p>A graph $G = (V, E)$ is called an $(n, d, \varepsilon)$-<em>expander</em> if the graph has $n$ vertices, maximum degree $d$, and satisfies the following <em>expansion property</em>:</p>&#xA;&#xA;<ul>&#xA;<li>for every subset $W\subset V$ such that $|W|\leq n/2$, $|W\cup N(W)|\ge (1+\varepsilon)|W|$</li>&#xA;</ul>&#x...
algorithms graphs randomized algorithms expanders
1
Amplifying the correctness of $\mathsf{RP}$ algorithms using expander graphs -- (algorithms graphs randomized algorithms expanders) <p>A graph $G = (V, E)$ is called an $(n, d, \varepsilon)$-<em>expander</em> if the graph has $n$ vertices, maximum degree $d$, and satisfies the following <em>expansion property</em>:</p>...
habedi/stack-exchange-dataset
41,208
Practical applications of Weighted Independent Set in path graph?
<p>Consider Weighted Independent Set in a <a href="https://en.wikipedia.org/wiki/Path_graph" rel="nofollow">path graph</a>, i.e., a graph where all the vertices are in a single path.</p>&#xA;&#xA;<p>Does this problem have practical applications? What are some? This problem is used in many CS courses as an intro to th...
algorithms graphs dynamic programming
1
Practical applications of Weighted Independent Set in path graph? -- (algorithms graphs dynamic programming) <p>Consider Weighted Independent Set in a <a href="https://en.wikipedia.org/wiki/Path_graph" rel="nofollow">path graph</a>, i.e., a graph where all the vertices are in a single path.</p>&#xA;&#xA;<p>Does this pr...
habedi/stack-exchange-dataset
41,211
Language is recursive, hence recursively enumerable
<p>I was going through a book of proof and I read:</p>&#xA;&#xA;<blockquote>&#xA; <p>If L is recursive, L is r.e.</p>&#xA;</blockquote>&#xA;&#xA;<p>And the proof goes:</p>&#xA;&#xA;<ul>&#xA;<li>Let L be recursive, hence there is a TM that decides it</li>&#xA;<li>Convert an halt state to a normal state</li>&#xA;<li>Add...
computability turing machines semi decidability
1
Language is recursive, hence recursively enumerable -- (computability turing machines semi decidability) <p>I was going through a book of proof and I read:</p>&#xA;&#xA;<blockquote>&#xA; <p>If L is recursive, L is r.e.</p>&#xA;</blockquote>&#xA;&#xA;<p>And the proof goes:</p>&#xA;&#xA;<ul>&#xA;<li>Let L be recursive, ...
habedi/stack-exchange-dataset
41,214
Halting Problem and Turing Degree and Reduction?
<p>This is a Local Olympiad question on computation and computer science on 2013. How can explain it and says some hint for understanding such an example question.</p>&#xA;&#xA;<blockquote>&#xA; <p>for $ A \subseteq \mathbb{N}$ we have $a=deg_T(A)=\{B | B \equiv_T A \} $ and $D=\{deg_T(A)| A \subseteq \mathbb{N} \}$....
computability turing machines computation models halting problem lattices
1
Halting Problem and Turing Degree and Reduction? -- (computability turing machines computation models halting problem lattices) <p>This is a Local Olympiad question on computation and computer science on 2013. How can explain it and says some hint for understanding such an example question.</p>&#xA;&#xA;<blockquote>&#x...
habedi/stack-exchange-dataset
41,217
Feynman finite state machine
<p>In his lectures on computer science, Feynman talks about finite state machines:</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/1Zsyo.png" alt="enter image description here"></p>&#xA;&#xA;<p>he present a simple delay finite state machine</p>&#xA;&#xA;<blockquote>&#xA; <p>Let me now give a specific example of an...
automata finite automata computation models
1
Feynman finite state machine -- (automata finite automata computation models) <p>In his lectures on computer science, Feynman talks about finite state machines:</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/1Zsyo.png" alt="enter image description here"></p>&#xA;&#xA;<p>he present a simple delay finite state machi...
habedi/stack-exchange-dataset
41,222
Searching the space of permutations
<p>I'm given n objects, and a set of n permutations of these n objects (out of n! total permutations). There is a true underlying permutation, which I know is one among the set of n permutations, but I don't know which one. An oracle however knows the true permutation. To find the true permutation, I'm allowed to query...
complexity theory lower bounds search problem permutations
1
Searching the space of permutations -- (complexity theory lower bounds search problem permutations) <p>I'm given n objects, and a set of n permutations of these n objects (out of n! total permutations). There is a true underlying permutation, which I know is one among the set of n permutations, but I don't know which o...
habedi/stack-exchange-dataset
41,231
Gray Code Generation
<p>I am trying to generate a $n$-bit gray code where I can specify two strings $s$ and $t$ that must be consecutive in that gray code. I know that there are ways to generate specific codes (such has the Binary Reflected Gray Code and the Recursive Partition Gray Code), but I need to be able to construct one given any t...
graphs data structures
1
Gray Code Generation -- (graphs data structures) <p>I am trying to generate a $n$-bit gray code where I can specify two strings $s$ and $t$ that must be consecutive in that gray code. I know that there are ways to generate specific codes (such has the Binary Reflected Gray Code and the Recursive Partition Gray Code), b...
habedi/stack-exchange-dataset
41,239
Halting problem reducing to the blank tape halting problem
<p>I was going through my book of proof and I find very confusing its definition, so I would like someone to help me in understanding this.</p>&#xA;&#xA;<ul>&#xA;<li>The blank tape problem takes a machine and an empty tape and tells if this machine halts or not</li>&#xA;<li>We prove it is unsolvable by proving it reduc...
turing machines halting problem
1
Halting problem reducing to the blank tape halting problem -- (turing machines halting problem) <p>I was going through my book of proof and I find very confusing its definition, so I would like someone to help me in understanding this.</p>&#xA;&#xA;<ul>&#xA;<li>The blank tape problem takes a machine and an empty tape a...
habedi/stack-exchange-dataset
41,243
Halting problem reduction to Halting for all inputs
<p>I was going through my book of revision and I would like someone hints on this.</p>&#xA;&#xA;<ul>&#xA;<li>The Halt for All Input problem (HAI) takes a machine and tell if this machine halts or not for any input</li>&#xA;<li>We prove it is unsolvable by proving it reduces to the halting problem</li>&#xA;</ul>&#xA;&#x...
turing machines halting problem
1
Halting problem reduction to Halting for all inputs -- (turing machines halting problem) <p>I was going through my book of revision and I would like someone hints on this.</p>&#xA;&#xA;<ul>&#xA;<li>The Halt for All Input problem (HAI) takes a machine and tell if this machine halts or not for any input</li>&#xA;<li>We p...
habedi/stack-exchange-dataset
41,246
Is a stack machine with a forward read iterator Turing complete?
<p>It is well known that a machine with a single stack as only unlimited storage is not Turing complete, if it can only read from the top of the stack. I want a machine which is (slightly) more powerful than a stack machine, but still not Turing complete. (I wonder whether there exists a non-Turing complete machine, wh...
computation models turing completeness linked lists stacks
1
Is a stack machine with a forward read iterator Turing complete? -- (computation models turing completeness linked lists stacks) <p>It is well known that a machine with a single stack as only unlimited storage is not Turing complete, if it can only read from the top of the stack. I want a machine which is (slightly) mo...
habedi/stack-exchange-dataset
41,250
What is the case 2 in master theorem?
<p>I am confused about the statement of the Master theorem in CLRS book.</p>&#xA;&#xA;<p>Here is the link of the book <a href="http://syedwaqarahmad.webs.com/documents/t._cormen_-_introduction_to_algorithms_3rd_edition.pdf" rel="nofollow">CLRS</a>.</p>&#xA;&#xA;<p>In page 94, the theorem, in case 2, states that:</p>&#x...
algorithms master theorem
1
What is the case 2 in master theorem? -- (algorithms master theorem) <p>I am confused about the statement of the Master theorem in CLRS book.</p>&#xA;&#xA;<p>Here is the link of the book <a href="http://syedwaqarahmad.webs.com/documents/t._cormen_-_introduction_to_algorithms_3rd_edition.pdf" rel="nofollow">CLRS</a>.</p...
habedi/stack-exchange-dataset
41,254
Average case lower bound for sorting
<p>The $\Omega(n\lg{n})$ lower bound for sorting in the comparison model is well known. Is there a similar average case lower bound for sorting in the comparison model and if so, which random distributions does it apply to?</p>&#xA;
complexity theory sorting lower bounds
1
Average case lower bound for sorting -- (complexity theory sorting lower bounds) <p>The $\Omega(n\lg{n})$ lower bound for sorting in the comparison model is well known. Is there a similar average case lower bound for sorting in the comparison model and if so, which random distributions does it apply to?</p>&#xA;
habedi/stack-exchange-dataset
41,259
Subset Sum algorithm, why not split by 3+?
<p>A classic algorithm for Subset Sum is to first split the input into two sets (A and B), evaluate the sums of the subsets of each, sort those sums for each A and B, then cleverly filter whole ranges of combinations by comparing the highest and lowest sums from each A and B.</p>&#xA;&#xA;<p>Do we know (or does someone...
combinatorics
1
Subset Sum algorithm, why not split by 3+? -- (combinatorics) <p>A classic algorithm for Subset Sum is to first split the input into two sets (A and B), evaluate the sums of the subsets of each, sort those sums for each A and B, then cleverly filter whole ranges of combinations by comparing the highest and lowest sums ...
habedi/stack-exchange-dataset
41,262
Algorithm for fastest division below threshold
<p>Take a number <code>i</code>. You need to split it in two pieces as many times as necessary so that all splits are less than or equal to <code>j</code>. How does one obtain this with the minimum number of splits? Examples:</p>&#xA;&#xA;<p>Splitting it in half is optimal here:</p>&#xA;&#xA;<pre><code>i = 4, j = 2&#xA...
algorithms
1
Algorithm for fastest division below threshold -- (algorithms) <p>Take a number <code>i</code>. You need to split it in two pieces as many times as necessary so that all splits are less than or equal to <code>j</code>. How does one obtain this with the minimum number of splits? Examples:</p>&#xA;&#xA;<p>Splitting it in...
habedi/stack-exchange-dataset
41,268
Product of a Transition System and a Finite Automaton
<p>Dealing with a question that asks me to compute the product of the following transition system and finite automaton.<br>&#xA;Compute the product between the transition system <em>TS</em> and the finite-word automaton <em>A</em> depicted below.</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/Ectyv.png" alt="Task ...
automata finite automata model checking
1
Product of a Transition System and a Finite Automaton -- (automata finite automata model checking) <p>Dealing with a question that asks me to compute the product of the following transition system and finite automaton.<br>&#xA;Compute the product between the transition system <em>TS</em> and the finite-word automaton <...
habedi/stack-exchange-dataset
41,271
Is automatic multicore support at the hardware or compiler level possible?
<p>Due to technical constraints, single thread performance has been increasing more slowly and adding cores has been adopted to offer greater potential increase in performance.</p>&#xA;&#xA;<p>However, multicore support currently appears to require the programmer to manually divide the work, control communication/synch...
parallel computing
1
Is automatic multicore support at the hardware or compiler level possible? -- (parallel computing) <p>Due to technical constraints, single thread performance has been increasing more slowly and adding cores has been adopted to offer greater potential increase in performance.</p>&#xA;&#xA;<p>However, multicore support c...
habedi/stack-exchange-dataset
41,274
Trying to understand the proof of the halting problem presented in Sipser textbook
<p>I'm having some problems to understand the classic proof of the halting problem.</p>&#xA;&#xA;<p>The Proof:</p>&#xA;&#xA;<p>$A_{tm} = ${$&lt;M,w&gt;$ | $M$ is a $TM$ and $M$ accepts $w$}.</p>&#xA;&#xA;<p>We assume that $A_{tm}$ is decidable and obtain a contradiction.</p>&#xA;&#xA;<blockquote>&#xA; <p>I have no pro...
computability halting problem
1
Trying to understand the proof of the halting problem presented in Sipser textbook -- (computability halting problem) <p>I'm having some problems to understand the classic proof of the halting problem.</p>&#xA;&#xA;<p>The Proof:</p>&#xA;&#xA;<p>$A_{tm} = ${$&lt;M,w&gt;$ | $M$ is a $TM$ and $M$ accepts $w$}.</p>&#xA;&#x...
habedi/stack-exchange-dataset
41,282
NFA not accepting a certain string
<p>I am trying to make a non-deterministic NFA that does not contain a string "101".</p>&#xA;&#xA;<p>How do I make my NFA so that it does not have this string?</p>&#xA;&#xA;<p>My attempt: </p>&#xA;&#xA;<p><img src="https://puu.sh/haCdI/b39bca43e7.png" alt="enter image description here"></p>&#xA;
automata finite automata
1
NFA not accepting a certain string -- (automata finite automata) <p>I am trying to make a non-deterministic NFA that does not contain a string "101".</p>&#xA;&#xA;<p>How do I make my NFA so that it does not have this string?</p>&#xA;&#xA;<p>My attempt: </p>&#xA;&#xA;<p><img src="https://puu.sh/haCdI/b39bca43e7.png" alt...
habedi/stack-exchange-dataset
41,293
Transforming NFA into DFA
<p>In the examples I was given I have the following NFA diagram:&#xA;<img src="https://i.stack.imgur.com/wxzQY.png" alt="enter image description here"></p>&#xA;&#xA;<p>Then it gives the conversion process<img src="https://i.stack.imgur.com/qLlDG.png" alt="enter image description here"></p>&#xA;&#xA;<p>Could someone exp...
formal languages automata
1
Transforming NFA into DFA -- (formal languages automata) <p>In the examples I was given I have the following NFA diagram:&#xA;<img src="https://i.stack.imgur.com/wxzQY.png" alt="enter image description here"></p>&#xA;&#xA;<p>Then it gives the conversion process<img src="https://i.stack.imgur.com/qLlDG.png" alt="enter i...
habedi/stack-exchange-dataset
41,314
Why does my answer sheet say the set of computable functions is uncountable?
<p>I'm trying to understand why I can't find room for the set of computable functions in the hotel of the Hilbert's Hotel Paradox.</p>&#xA;&#xA;<p>I was thinking that, because Gödel numbering, I could consider the set of computable functions as numerable (and with cardinality equal to $\mathrm{card}(\mathbb N)$). Howev...
computability enumeration
1
Why does my answer sheet say the set of computable functions is uncountable? -- (computability enumeration) <p>I'm trying to understand why I can't find room for the set of computable functions in the hotel of the Hilbert's Hotel Paradox.</p>&#xA;&#xA;<p>I was thinking that, because Gödel numbering, I could consider th...
habedi/stack-exchange-dataset
41,315
Maximizing the minimum of $k$ submodular functions
<p>Let $f(X)$ be a monotone submodular function from $2^{\{1, \ldots, n\}}$ to $\mathbb{N}$ and consider the problem of maximizing it subject to a cardinality constraint $|X| \leq m$. By using the greedy algorithm, it is possible to obtain a $1-1/e$ approximation (see, for example, <a href="http://theory.stanford.edu/~...
algorithms approximation
1
Maximizing the minimum of $k$ submodular functions -- (algorithms approximation) <p>Let $f(X)$ be a monotone submodular function from $2^{\{1, \ldots, n\}}$ to $\mathbb{N}$ and consider the problem of maximizing it subject to a cardinality constraint $|X| \leq m$. By using the greedy algorithm, it is possible to obtain...
habedi/stack-exchange-dataset
41,318
Research regarding algorithm generation/discovery/heuristics
<p>Say I have a specification of preconditions and postconditions for a function. Is there a field of computer science that studies the automated generation of functions that satisfy those specifications?</p>&#xA;&#xA;<p>For example:&#xA;Preconditions:</p>&#xA;&#xA;<ul>&#xA;<li>I is a list</li>&#xA;<li>Q is a binary re...
algorithms reference request
1
Research regarding algorithm generation/discovery/heuristics -- (algorithms reference request) <p>Say I have a specification of preconditions and postconditions for a function. Is there a field of computer science that studies the automated generation of functions that satisfy those specifications?</p>&#xA;&#xA;<p>For ...
habedi/stack-exchange-dataset
41,320
Terminology for a graph with ports on its nodes
<p>A Graph is a well-defined concept in mathematics, computer science and engineering disciplines that depend on them. However, oftentimes a practical implementation of a (directed) graph in a certain domain or application requires that edges don't merely connect vertices, but instead connect ports that exist on these ...
graphs terminology
1
Terminology for a graph with ports on its nodes -- (graphs terminology) <p>A Graph is a well-defined concept in mathematics, computer science and engineering disciplines that depend on them. However, oftentimes a practical implementation of a (directed) graph in a certain domain or application requires that edges don't...
habedi/stack-exchange-dataset
41,326
Regular Expressions with at least 2 0's and at most 1
<p>I think the answer should be:</p>&#xA;&#xA;<p>$(1+ \epsilon)000^* + 0^*0(1+\epsilon)00^* + 000^*(1+\epsilon)$</p>&#xA;&#xA;<p>But I am not sure if this is the right answer. Can someone explain the correct answer?&#xA;And if it is correct how can I shorten this up?</p>&#xA;&#xA;<p>Also what is the nfa for the regular...
regular expressions formal methods
1
Regular Expressions with at least 2 0's and at most 1 -- (regular expressions formal methods) <p>I think the answer should be:</p>&#xA;&#xA;<p>$(1+ \epsilon)000^* + 0^*0(1+\epsilon)00^* + 000^*(1+\epsilon)$</p>&#xA;&#xA;<p>But I am not sure if this is the right answer. Can someone explain the correct answer?&#xA;And if...
habedi/stack-exchange-dataset
41,327
What is the difference between the fundamental matrix and the essential matrix?
<p>Could someone, in plain english, explain the distinction between the fundamental matrix and the essential matrix in multi-view computer vision?</p>&#xA;&#xA;<p>How are they different, and how can each be used in computing the 3D position of a point imaged from multiple views?</p>&#xA;
algorithms image processing computer vision
1
What is the difference between the fundamental matrix and the essential matrix? -- (algorithms image processing computer vision) <p>Could someone, in plain english, explain the distinction between the fundamental matrix and the essential matrix in multi-view computer vision?</p>&#xA;&#xA;<p>How are they different, and ...
habedi/stack-exchange-dataset
41,330
Partitioning planar graph cycles based on chords
<p>Given a cycle of length > 3 in a planar graph, I'm looking to partition it into 4 sublists of length 2 or more such that:</p>&#xA;&#xA;<ol>&#xA;<li>No sublist contains two vertices with a chord between them</li>&#xA;<li>The last element in each sublist is the first element in the next </li>&#xA;<li>Every element in ...
algorithms graphs
1
Partitioning planar graph cycles based on chords -- (algorithms graphs) <p>Given a cycle of length > 3 in a planar graph, I'm looking to partition it into 4 sublists of length 2 or more such that:</p>&#xA;&#xA;<ol>&#xA;<li>No sublist contains two vertices with a chord between them</li>&#xA;<li>The last element in each ...
habedi/stack-exchange-dataset
41,335
Prove that this language is not context-free
<p>I'm not very comfortable with pumping lemma for context-free grammar. I understand the sufficient conditions that must hold but proving it gets me everytime. For example, I need to prove whether $L=\{0^{2^n}∣n \geq 0\}$ is not context-free.</p>&#xA;&#xA;<p>There is no pattern of 0's that can be recreated by a pushdo...
complexity theory context free automata
1
Prove that this language is not context-free -- (complexity theory context free automata) <p>I'm not very comfortable with pumping lemma for context-free grammar. I understand the sufficient conditions that must hold but proving it gets me everytime. For example, I need to prove whether $L=\{0^{2^n}∣n \geq 0\}$ is not ...
habedi/stack-exchange-dataset
41,344
What is the relation between NC and P/poly?
<p>I am unable to see a clear explanation of how the classes NC and P/poly intersect or not. (and if they do intersect then how and where? and if not then what is the proof?) </p>&#xA;
complexity theory complexity classes nc
1
What is the relation between NC and P/poly? -- (complexity theory complexity classes nc) <p>I am unable to see a clear explanation of how the classes NC and P/poly intersect or not. (and if they do intersect then how and where? and if not then what is the proof?) </p>&#xA;
habedi/stack-exchange-dataset
41,347
What sorting algorithm should be used for this array?
<p>I am given an array <code>{1, 2, 3, 5, 4, 6}</code> and I am asked </p>&#xA;&#xA;<blockquote>&#xA; <p>What sorting algorithm might you want to use to sort the given list, and why?</p>&#xA;</blockquote>&#xA;&#xA;<p>Initially I think using <a href="https://en.wikipedia.org/wiki/Bubble_sort" rel="nofollow">Bubble sort...
algorithms sorting efficiency
1
What sorting algorithm should be used for this array? -- (algorithms sorting efficiency) <p>I am given an array <code>{1, 2, 3, 5, 4, 6}</code> and I am asked </p>&#xA;&#xA;<blockquote>&#xA; <p>What sorting algorithm might you want to use to sort the given list, and why?</p>&#xA;</blockquote>&#xA;&#xA;<p>Initially I t...
habedi/stack-exchange-dataset
41,349
How to explain a language with modulo conditions is regular?
<p>I don't want to create a duplicate question of <a href="https://cs.stackexchange.com/questions/1331/how-to-prove-a-language-is-regular">How to prove a language is regular?</a>, I only want to know what is a good and simple way to explain why a language like</p>&#xA;&#xA;<p>$\qquad \displaystyle L = \{w \in \{a,b,c\}...
regular languages
1
How to explain a language with modulo conditions is regular? -- (regular languages) <p>I don't want to create a duplicate question of <a href="https://cs.stackexchange.com/questions/1331/how-to-prove-a-language-is-regular">How to prove a language is regular?</a>, I only want to know what is a good and simple way to exp...
habedi/stack-exchange-dataset
41,355
Calculating the Transfer Time for a Hard Disk
<p>I know that transfer rate is data size over transfer speed - but according to the information given, I don't know what the data size is to calculate the transfer rate. Am I missing something or was I really not given it?</p>&#xA;&#xA;<p>The information given is as follows:</p>&#xA;&#xA;<blockquote>&#xA; <p>A numbe...
computer architecture
1
Calculating the Transfer Time for a Hard Disk -- (computer architecture) <p>I know that transfer rate is data size over transfer speed - but according to the information given, I don't know what the data size is to calculate the transfer rate. Am I missing something or was I really not given it?</p>&#xA;&#xA;<p>The in...
habedi/stack-exchange-dataset
41,360
If A is decidable and B is decidable, then A is Turing Reducible to B
<p>The statement seems intuitively true but is it? If so, how can I prove this?</p>&#xA;
computability turing machines
1
If A is decidable and B is decidable, then A is Turing Reducible to B -- (computability turing machines) <p>The statement seems intuitively true but is it? If so, how can I prove this?</p>&#xA;
habedi/stack-exchange-dataset
41,361
Simplifying a nested sum
<p>I'm trying to analyze an algorithm of a function, I can express the function in term of summation, but I have no clues on how I could simplify this summation down to get the run-time in tern of big $O$ or $\Theta$. I have this pseudo-code below:</p>&#xA;&#xA;<pre><code>f(n)&#xA; for int i = 1 to n&#xA; for...
algorithm analysis runtime analysis loops
1
Simplifying a nested sum -- (algorithm analysis runtime analysis loops) <p>I'm trying to analyze an algorithm of a function, I can express the function in term of summation, but I have no clues on how I could simplify this summation down to get the run-time in tern of big $O$ or $\Theta$. I have this pseudo-code below:...
habedi/stack-exchange-dataset
41,370
How do I manage flow control with no ELSE statement? (on Turing machine)
<p>I have been given the problem of writing a turing machine with the commands: </p>&#xA;&#xA;<pre><code>if, while, whileNot, read X, write X, goLeft, goRight, HALT&#xA;</code></pre>&#xA;&#xA;<p>The problem was simply "calculate a two's complement number, from number with \$ on the left and # on the right, ex: $1011010...
turing machines simulation
1
How do I manage flow control with no ELSE statement? (on Turing machine) -- (turing machines simulation) <p>I have been given the problem of writing a turing machine with the commands: </p>&#xA;&#xA;<pre><code>if, while, whileNot, read X, write X, goLeft, goRight, HALT&#xA;</code></pre>&#xA;&#xA;<p>The problem was simp...
habedi/stack-exchange-dataset
41,377
How to compress a bit string?
<p>I'm aware of some techniques to compress a string of characters such as Huffman coding. I need to know whether there is any technique to compress a long string of arbitrary bits? (ideally with high compression ratio).</p>&#xA;
computer networks data compression
1
How to compress a bit string? -- (computer networks data compression) <p>I'm aware of some techniques to compress a string of characters such as Huffman coding. I need to know whether there is any technique to compress a long string of arbitrary bits? (ideally with high compression ratio).</p>&#xA;
habedi/stack-exchange-dataset
41,382
What are some interesting applications of the skyline problem?
<p><em>You are given a set of $n$ rectangles in no particular order. They have varying widths and heights, but their bottom edges are collinear, so that they look like buildings on a skyline. For each rectangle, you’re given the $x$ position of the left edge, the $x$ position of the right edge, and the height. Your tas...
reference request computational geometry graphics applied theory
1
What are some interesting applications of the skyline problem? -- (reference request computational geometry graphics applied theory) <p><em>You are given a set of $n$ rectangles in no particular order. They have varying widths and heights, but their bottom edges are collinear, so that they look like buildings on a skyl...
habedi/stack-exchange-dataset
41,395
Understanding an upper bound in the analysis of Karger's algorithm
<p>I'm reading the <a href="http://en.wikipedia.org/wiki/Karger%27s_algorithm" rel="nofollow">wiki page of Karger's algorithm</a> for a self-study of CLRS to get some and I'm confused by one of the bounds they have. </p>&#xA;&#xA;<p>Here, under the section about finding all min cuts, they have this line $$(1-P(n))^{O(\...
algorithm analysis asymptotics
1
Understanding an upper bound in the analysis of Karger's algorithm -- (algorithm analysis asymptotics) <p>I'm reading the <a href="http://en.wikipedia.org/wiki/Karger%27s_algorithm" rel="nofollow">wiki page of Karger's algorithm</a> for a self-study of CLRS to get some and I'm confused by one of the bounds they have. <...
habedi/stack-exchange-dataset
41,403
Why does SAT not reduce to QBF?
<p>So, I remember the professor saying that SAT does not reduce to QBF (Quantifier Boolean Formula)</p>&#xA;&#xA;<p>$QBF ::= prop|-QBF|(QBFoQBF)|\exists pQBF |\forall pQBF$</p>&#xA;&#xA;<p>So, I guess this is not NP, since solving a QBF could grow exponentially.</p>&#xA;&#xA;<p>However, $P \subseteq NP \subseteq PSPACE...
complexity theory decision problem
1
Why does SAT not reduce to QBF? -- (complexity theory decision problem) <p>So, I remember the professor saying that SAT does not reduce to QBF (Quantifier Boolean Formula)</p>&#xA;&#xA;<p>$QBF ::= prop|-QBF|(QBFoQBF)|\exists pQBF |\forall pQBF$</p>&#xA;&#xA;<p>So, I guess this is not NP, since solving a QBF could grow ...
habedi/stack-exchange-dataset
41,404
Do we need recursion in programming language to solve any problem?
<p>My question is simple: If we want to be able to solve <strong>every problem, that we can solve using recursions</strong>, do we need programming language to allow us use recursions?</p>&#xA;&#xA;<p>Assuming we are allowed to use: conditional evaluation of blocks (if/else), cycles(for,while), dynamic allocation of me...
computability programming languages computation models turing completeness
1
Do we need recursion in programming language to solve any problem? -- (computability programming languages computation models turing completeness) <p>My question is simple: If we want to be able to solve <strong>every problem, that we can solve using recursions</strong>, do we need programming language to allow us use ...
habedi/stack-exchange-dataset
41,412
Differences between linear/nonlinear vs. deterministic/nondeterministic neural nets
<p>When speaking of neural networks, I don't get the difference between nonlinear and non-deterministic. Basically, both say that the output of something is not directly correlated to the input?</p>&#xA;&#xA;<p>Hope someone can illuminate me.</p>&#xA;
terminology artificial intelligence neural networks
1
Differences between linear/nonlinear vs. deterministic/nondeterministic neural nets -- (terminology artificial intelligence neural networks) <p>When speaking of neural networks, I don't get the difference between nonlinear and non-deterministic. Basically, both say that the output of something is not directly correlate...
habedi/stack-exchange-dataset
41,418
n closest points in a set of lat/long coordinates
<p>Here's my problem:</p>&#xA;&#xA;<p>I have a website where people can search based on their location (which is converted to lat/long coordinates). I have many products stored in a database with their lat/long coordinates. I also have a function to calculate the distance between two points based on their coordinates.<...
sorting databases nearest neighbour
1
n closest points in a set of lat/long coordinates -- (sorting databases nearest neighbour) <p>Here's my problem:</p>&#xA;&#xA;<p>I have a website where people can search based on their location (which is converted to lat/long coordinates). I have many products stored in a database with their lat/long coordinates. I als...
habedi/stack-exchange-dataset
41,423
Non-deterministic Turing machine to solve graph colouring
<p>Consider the <em>graph coloring problem</em>: given an undirected graph $G$ and a natural number $n$ return yes if we can color the graph with n different colors and no otherwise.</p>&#xA;&#xA;<p>I am able to design a deterministic Turing machine that would solve it with a greedy approach trying the different combin...
complexity theory turing machines
1
Non-deterministic Turing machine to solve graph colouring -- (complexity theory turing machines) <p>Consider the <em>graph coloring problem</em>: given an undirected graph $G$ and a natural number $n$ return yes if we can color the graph with n different colors and no otherwise.</p>&#xA;&#xA;<p>I am able to design a de...
habedi/stack-exchange-dataset