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 |
|---|---|---|---|---|---|---|
80,016 | Proof for "It is my contention that these operations include all those which are used in the computation of a number" | <p>In <a href="https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf" rel="nofollow noreferrer">his famous paper</a>, Turing briefly describes his machine and then states (p. 232) (emphasis mine): </p>

<blockquote>
 <p><strong>It is my contention that these operations include all those which are
... | turing machines | 1 | Proof for "It is my contention that these operations include all those which are used in the computation of a number" -- (turing machines)
<p>In <a href="https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf" rel="nofollow noreferrer">his famous paper</a>, Turing briefly describes his machine and then states (p. 23... | habedi/stack-exchange-dataset |
80,038 | How are binary trees represented on disk | <p>Assume I have a word document, the contents in it are stored on the disk as bits. Nothing so complex here. When the word processor reads those bits, it just knows how to display on screen.</p>

<p>But what about binary trees. They are just not data, they have route node, child nodes. How are they actually re... | data structures binary trees | 1 | How are binary trees represented on disk -- (data structures binary trees)
<p>Assume I have a word document, the contents in it are stored on the disk as bits. Nothing so complex here. When the word processor reads those bits, it just knows how to display on screen.</p>

<p>But what about binary trees. They are... | habedi/stack-exchange-dataset |
80,042 | Complexity of determining spanning bipartite graph | <p>A procedure by induction to get maximum spanning bipartite graph (same vertex set as <span class="math-container">$G$</span> and the maximum possible number of edges) from given graph <span class="math-container">$G$</span>:</p>

<p>Given a planar graph <span class="math-container">$G$</span>, we need two di... | algorithms graphs algorithm analysis | 1 | Complexity of determining spanning bipartite graph -- (algorithms graphs algorithm analysis)
<p>A procedure by induction to get maximum spanning bipartite graph (same vertex set as <span class="math-container">$G$</span> and the maximum possible number of edges) from given graph <span class="math-container">$G$</span>:... | habedi/stack-exchange-dataset |
80,044 | Why is the inapproximability $2^{n^\epsilon}$? | <p>Many inapproximability factors are $2^{n^\epsilon}$. I don't know why this is <strong>2</strong> instead of 3, 4, ..., etc. </p>

<p>To be precise, given a problem,</p>

<p>theorem 1 says: It's NP-hard to approximate the problem to $2^{n^\epsilon}$ for any $0 \leq \epsilon < 1$;</p>

<p>th... | complexity theory asymptotics np hard approximation | 1 | Why is the inapproximability $2^{n^\epsilon}$? -- (complexity theory asymptotics np hard approximation)
<p>Many inapproximability factors are $2^{n^\epsilon}$. I don't know why this is <strong>2</strong> instead of 3, 4, ..., etc. </p>

<p>To be precise, given a problem,</p>

<p>theorem 1 says: It's NP-... | habedi/stack-exchange-dataset |
80,058 | How many bytes of memory is used just to "acknowledge" that a certain file is a .jpg? | <p>I'm rather new to computers and how they work in the microscopic scale, but here's the little bit that I know.</p>

<blockquote>
 <p>Computers have lots of transistors in them, both in memory and processor, and each transistor has two states, on and off. They are translated to binary equivalents 0 and 1... | memory hardware | 1 | How many bytes of memory is used just to "acknowledge" that a certain file is a .jpg? -- (memory hardware)
<p>I'm rather new to computers and how they work in the microscopic scale, but here's the little bit that I know.</p>

<blockquote>
 <p>Computers have lots of transistors in them, both in memory and p... | habedi/stack-exchange-dataset |
80,061 | Find isomorphism of graph with maximal number $x$ such that $f(x)\neq x$ - assuming $NP=P$ | <blockquote>
 <p>For $f : V → V$ which is authomorphism of directed graph $G = (V, E)$,
 $$\#f = |\{v : f(v) \neq v\}|$$ For graph $G$ we denote: $$\#G =
 \max\{\#f : \text{$f$ is isomorphism $G$} \}$$</p>
 
 <p>Prove that if $P = NP$ then function $G\to\#G$ is polynomially
 computable.<... | complexity theory graphs time complexity np graph isomorphism | 1 | Find isomorphism of graph with maximal number $x$ such that $f(x)\neq x$ - assuming $NP=P$ -- (complexity theory graphs time complexity np graph isomorphism)
<blockquote>
 <p>For $f : V → V$ which is authomorphism of directed graph $G = (V, E)$,
 $$\#f = |\{v : f(v) \neq v\}|$$ For graph $G$ we denote: $$\... | habedi/stack-exchange-dataset |
80,067 | How do I calculate the speedup properly? | <p>I am trying to calculate the speedup of this, but I am getting the wrong answer:</p>

<blockquote>
 <p>Assuming that we have a program where we have two execution phases. One phase takes 1 time unit to execute and can only execute sequentially. The other phase takes 3 times units to execute sequentially... | parallel computing performance program optimization | 1 | How do I calculate the speedup properly? -- (parallel computing performance program optimization)
<p>I am trying to calculate the speedup of this, but I am getting the wrong answer:</p>

<blockquote>
 <p>Assuming that we have a program where we have two execution phases. One phase takes 1 time unit to exec... | habedi/stack-exchange-dataset |
80,071 | Minimum Spanning Tree with Kruskal - bounds on size | <p>I am using Kruskal's algorithm to build minimum-spanning-trees. I would like to know, given that my total set of edges has size <code>N</code>, if there is a bounding number of edges in the resulting MST, i.e. a size <code>M</code> smaller than <code>N</code> that determines the maximum number of edges in the MST. O... | algorithms graphs minimum spanning tree | 1 | Minimum Spanning Tree with Kruskal - bounds on size -- (algorithms graphs minimum spanning tree)
<p>I am using Kruskal's algorithm to build minimum-spanning-trees. I would like to know, given that my total set of edges has size <code>N</code>, if there is a bounding number of edges in the resulting MST, i.e. a size <co... | habedi/stack-exchange-dataset |
80,076 | Solving recurrence relation with square root | <p>I am trying to solve the following recurrence relation :-</p>

<p><span class="math-container">$T(n) = T(\sqrt{n}) + n$</span> using masters theorem.</p>

<p>We can substitute <span class="math-container">$n = 2 ^ m$</span></p>

<p><span class="math-container">$T(2^m) = T(2 ^ {\frac{m}{2}}) +... | asymptotics recurrence relation master theorem | 1 | Solving recurrence relation with square root -- (asymptotics recurrence relation master theorem)
<p>I am trying to solve the following recurrence relation :-</p>

<p><span class="math-container">$T(n) = T(\sqrt{n}) + n$</span> using masters theorem.</p>

<p>We can substitute <span class="math-container"... | habedi/stack-exchange-dataset |
80,079 | Minimum frame size in ethernet | <p>Suppose the round trip propagation delay for a 10 Mbps Ethernet having 48-bit jamming signal is 46.4 μs. The minimum frame size is:</p>

<p>a) 94</p>

<p>b) 416</p>

<p>c) 464</p>

<p>d) 512</p>

<p>My approach:- I have read in the book that minimum frame transmission time is ... | computer networks | 1 | Minimum frame size in ethernet -- (computer networks)
<p>Suppose the round trip propagation delay for a 10 Mbps Ethernet having 48-bit jamming signal is 46.4 μs. The minimum frame size is:</p>

<p>a) 94</p>

<p>b) 416</p>

<p>c) 464</p>

<p>d) 512</p>

<p>My approach:- I have rea... | habedi/stack-exchange-dataset |
80,082 | Proving if a function is an upper bound | <p>Let $f(n) = (\log n)^n$
 and $g(n) = n^2$</p>

<p>By taking a large value, I could make out that $f(n) > g(n)$ .</p>

<p>I want to know if $f(n) \in \Theta(n^2)$ . For proving this, I need to find out the value of $c$ such that
$f(n) \le c \cdot g(n)$ .</p>

<p>How do I find th... | algorithms time complexity | 1 | Proving if a function is an upper bound -- (algorithms time complexity)
<p>Let $f(n) = (\log n)^n$
 and $g(n) = n^2$</p>

<p>By taking a large value, I could make out that $f(n) > g(n)$ .</p>

<p>I want to know if $f(n) \in \Theta(n^2)$ . For proving this, I need to find out the value of $c$ ... | habedi/stack-exchange-dataset |
80,086 | What is the utility of proving P=NP if we can't find an algorithm that can solve any NP problem in polynomial time? | <p>Here we see a <a href="https://arxiv.org/abs/1708.03486" rel="nofollow noreferrer">very interesting attempt</a> to show that $\mathrm{P} \ne \mathrm{NP}$ by <a href="http://theory.cs.uni-bonn.de/blum/" rel="nofollow noreferrer">Norbert Blum</a>. </p>

<p>Here we see <a href="http://www.win.tue.nl/~gwoegi/P-v... | complexity theory polynomial time p vs np | 1 | What is the utility of proving P=NP if we can't find an algorithm that can solve any NP problem in polynomial time? -- (complexity theory polynomial time p vs np)
<p>Here we see a <a href="https://arxiv.org/abs/1708.03486" rel="nofollow noreferrer">very interesting attempt</a> to show that $\mathrm{P} \ne \mathrm{NP}$ ... | habedi/stack-exchange-dataset |
80,091 | The C3 linearization algorithm for method resolution in multiple inheritance OO languages: Looking for a justification for some implementation detail | <p>According to <a href="https://www.python.org/download/releases/2.3/mro/" rel="nofollow noreferrer">this</a> description of Python's method resolution order (mro), a.k.a. <a href="https://en.wikipedia.org/wiki/C3_linearization" rel="nofollow noreferrer">C3 linearization</a>, the algorithm can be described recursively... | algorithms programming languages type theory object oriented | 1 | The C3 linearization algorithm for method resolution in multiple inheritance OO languages: Looking for a justification for some implementation detail -- (algorithms programming languages type theory object oriented)
<p>According to <a href="https://www.python.org/download/releases/2.3/mro/" rel="nofollow noreferrer">th... | habedi/stack-exchange-dataset |
80,094 | Boolean Logic Equation | <p>How can I prove this. what is the way? im up to the second last line. and i dont actually know how can x * (1 + y) then the y just disappears into x * 1. </p>

<pre><code>x + x * y = x
x + x * y = (x * 1) + (x * y)
 = x * (1 + y)
 = x * 1 [THIS LINE]
 = x
</code... | logic boolean algebra | 1 | Boolean Logic Equation -- (logic boolean algebra)
<p>How can I prove this. what is the way? im up to the second last line. and i dont actually know how can x * (1 + y) then the y just disappears into x * 1. </p>

<pre><code>x + x * y = x
x + x * y = (x * 1) + (x * y)
 = x * (1 + y)
 ... | habedi/stack-exchange-dataset |
80,095 | Is selection in genetic algorithm considered to be a genetic operator? | <p>It is listed as such in wiki, however my literature never refers to it as such.
My gut tells me to follow papers and monographs on the matter, but my concern is that I will make an easily avoidable mistake, or that I simply misunderstood the text.</p>
 | genetic algorithms | 1 | Is selection in genetic algorithm considered to be a genetic operator? -- (genetic algorithms)
<p>It is listed as such in wiki, however my literature never refers to it as such.
My gut tells me to follow papers and monographs on the matter, but my concern is that I will make an easily avoidable mistake, or that I s... | habedi/stack-exchange-dataset |
80,106 | Equivalence of machine $M$ in $BPP$ and $EXP$ | <p><a href="https://i.stack.imgur.com/3bgOD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3bgOD.png" alt="http://i.imgur.com/sRhSngb.png"></a></p>

<p>Ok, the proof is clear. But, if we prove that $BPP \subseteq EXP$ we should show that for every machin in $BPP$ there exists <strong>equival... | complexity theory complexity classes probability theory | 1 | Equivalence of machine $M$ in $BPP$ and $EXP$ -- (complexity theory complexity classes probability theory)
<p><a href="https://i.stack.imgur.com/3bgOD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3bgOD.png" alt="http://i.imgur.com/sRhSngb.png"></a></p>

<p>Ok, the proof is clear. But, if w... | habedi/stack-exchange-dataset |
80,108 | Shuffling a list while keeping order relative to related elements | <p>I'm looking to shuffle a list of the elements $a_1,\dots, a_6, \dots, e_1, \dots, e_6$</p>

<p>while keeping two rules:</p>

<p>if I loop though the list and filter out a specific letter or number it should be in order:</p>

<p>$a_1, a_2, a_3 \dots$ or $a_1, b_1, c_1 \dots$</p>

<p>Ho... | algorithms randomness | 1 | Shuffling a list while keeping order relative to related elements -- (algorithms randomness)
<p>I'm looking to shuffle a list of the elements $a_1,\dots, a_6, \dots, e_1, \dots, e_6$</p>

<p>while keeping two rules:</p>

<p>if I loop though the list and filter out a specific letter or number it should b... | habedi/stack-exchange-dataset |
80,126 | Given a low resolution video, is it possible to create a higher resolution image | <p>This question is purely theoretical as I've not been able to find anyone who's done such a thing, so my question is - is it possible, and if not why?</p>

<p>Say you have a short video (CCTV) of a face, or number (car licence) plate, and that video is of too poor quality to discern who that person is or what... | image processing computer vision | 1 | Given a low resolution video, is it possible to create a higher resolution image -- (image processing computer vision)
<p>This question is purely theoretical as I've not been able to find anyone who's done such a thing, so my question is - is it possible, and if not why?</p>

<p>Say you have a short video (CCTV... | habedi/stack-exchange-dataset |
80,128 | Reference/book recommendations for search data structure | <p>I am interested in data structures that support efficient searching of various kinds. </p>

<p>When I read the Wikipedia page of "search data structure", it says "Useful search data structures allow faster retrieval; however, they are limited to queries of some specific kind". So, obviously, there exists a c... | data structures reference request searching | 1 | Reference/book recommendations for search data structure -- (data structures reference request searching)
<p>I am interested in data structures that support efficient searching of various kinds. </p>

<p>When I read the Wikipedia page of "search data structure", it says "Useful search data structures allow fast... | habedi/stack-exchange-dataset |
80,135 | Prove that $L$ is closed under Kleene star iff $L=NL$ | <blockquote>
 <p>Prove that $L$ is closed under Kleene star iff $L=NL$</p>
</blockquote>

<p>Hi,<br>
I am trying to solve this exercise, but it is quiet difficult.<br>
Of course first part is very easy:<br>
Let assume that $L=NL$. Lets consider language $A\in L$. We show that also $A^*\in ... | complexity theory space complexity nondeterminism kleene star | 1 | Prove that $L$ is closed under Kleene star iff $L=NL$ -- (complexity theory space complexity nondeterminism kleene star)
<blockquote>
 <p>Prove that $L$ is closed under Kleene star iff $L=NL$</p>
</blockquote>

<p>Hi,<br>
I am trying to solve this exercise, but it is quiet difficult.<br>
Of cou... | habedi/stack-exchange-dataset |
80,141 | What is responsible for the 1-1 correspondence between characters and binary? | <p>Could someone explain to me what component(s) are responsible for translating binary into ASCII/UNICODE? For example, is it an assembly program that sets up a 1-1 correspondence between characters and their binary equivalents, which is then loaded into ROM during manufacturing?</p>
 | computer architecture encoding scheme | 1 | What is responsible for the 1-1 correspondence between characters and binary? -- (computer architecture encoding scheme)
<p>Could someone explain to me what component(s) are responsible for translating binary into ASCII/UNICODE? For example, is it an assembly program that sets up a 1-1 correspondence between characters... | habedi/stack-exchange-dataset |
80,145 | How to prove that average complexity is N/2 for linear search in the unsorted array | <p>All tutorials on algorithms show the complexity for the linear search in the unsorted array in the average case as <code>N/2</code>. I understand that the average case means the items in the list are randomly distributed. </p>

<p>Can anyone show how I would arrive at <code>N/2</code> if I have items randoml... | algorithm analysis runtime analysis arrays average case searching | 1 | How to prove that average complexity is N/2 for linear search in the unsorted array -- (algorithm analysis runtime analysis arrays average case searching)
<p>All tutorials on algorithms show the complexity for the linear search in the unsorted array in the average case as <code>N/2</code>. I understand that the average... | habedi/stack-exchange-dataset |
80,149 | Equivalance of NFAs, understanding the solution | <p>This solution comes from <a href="https://people.eecs.berkeley.edu/~luca/cs172-07/solutions/practicefinal-sol.pdf" rel="nofollow noreferrer">https://people.eecs.berkeley.edu/~luca/cs172-07/solutions/practicefinal-sol.pdf</a></p>

<blockquote>
 <p>Consider the language</p>
 
 <p>$$ EQ_{NFA} = \... | complexity theory finite automata | 1 | Equivalance of NFAs, understanding the solution -- (complexity theory finite automata)
<p>This solution comes from <a href="https://people.eecs.berkeley.edu/~luca/cs172-07/solutions/practicefinal-sol.pdf" rel="nofollow noreferrer">https://people.eecs.berkeley.edu/~luca/cs172-07/solutions/practicefinal-sol.pdf</a></p>&#... | habedi/stack-exchange-dataset |
80,158 | Show that checking if there exists word not containg patterns from list is in $PSPACE$ | <blockquote>
<p>There are given:</p>
<ul>
<li>alphabet <span class="math-container">$Σ$</span> with some symbols <span class="math-container">$a,b$</span>.</li>
<li>list of forbidden patterns</li>
</ul>
<p>Result: Is there exists word of form <span class="math-container">$a\Sigma^*b$</span> su... | complexity theory space complexity nondeterminism | 1 | Show that checking if there exists word not containg patterns from list is in $PSPACE$ -- (complexity theory space complexity nondeterminism)
<blockquote>
<p>There are given:</p>
<ul>
<li>alphabet <span class="math-container">$Σ$</span> with some symbols <span class="math-container">$a,b$</span>.</li>
<... | habedi/stack-exchange-dataset |
80,160 | Algorithm for arranging elements into different sized buckets | <p>I have a set of items. For each item, there is a list of buyers I can sell it to and a corresponding price they will pay me. For example:</p>

<pre><code>item1: item2: item3: item4:
 john: 17 john: 19 bob: 42 ...
 bob: 23 mick: 22 mick: 44
 sue: 1... | algorithms optimization assignment problem | 1 | Algorithm for arranging elements into different sized buckets -- (algorithms optimization assignment problem)
<p>I have a set of items. For each item, there is a list of buyers I can sell it to and a corresponding price they will pay me. For example:</p>

<pre><code>item1: item2: item3: item4... | habedi/stack-exchange-dataset |
80,168 | Why does this not prove $P\neq NP$? | <p>Fiorini, Massar, Pokutta, Tiwary and De Wolf (<em>Exponential Lower Bounds for Polytopes in Combinatorial
Optimization</em>, <em>Journal of the ACM</em> 62(2):article 17, 2015; <a href="http://dl.acm.org/citation.cfm?id=2716307" rel="noreferrer">PDF</a>, <a href="https://arxiv.org/pdf/1111.0837.pdf" rel="norefer... | complexity theory proof techniques linear programming p vs np traveling salesman | 1 | Why does this not prove $P\neq NP$? -- (complexity theory proof techniques linear programming p vs np traveling salesman)
<p>Fiorini, Massar, Pokutta, Tiwary and De Wolf (<em>Exponential Lower Bounds for Polytopes in Combinatorial
Optimization</em>, <em>Journal of the ACM</em> 62(2):article 17, 2015; <a href="http:... | habedi/stack-exchange-dataset |
80,169 | Verifying execution of code in trustless environment | <p>Let us assume I have a Program P running on remote computer generating output O. Without trusting the remote environment and not having to verify the output O, is there is a way to validate that Program P has indeed been executed and resulted in output O ?</p>

<p>Let me know if the question is too vague. I ... | computation models distributed systems logical validity | 1 | Verifying execution of code in trustless environment -- (computation models distributed systems logical validity)
<p>Let us assume I have a Program P running on remote computer generating output O. Without trusting the remote environment and not having to verify the output O, is there is a way to validate that Program ... | habedi/stack-exchange-dataset |
80,170 | Big O proving for increasing functions | <p>Please help me to prove:</p>

<p>If $f, g ∶ \mathbb{N} \rightarrow \mathbb{N}$ and $f$ and $g$ are increasing $(f(n+1)>f(n),g(n+1)>g(n)$).</p>

<p>Need to prove $g=O(f)$ or $f=O(g)$.</p>

<p>Thanks</p>
 | asymptotics | 1 | Big O proving for increasing functions -- (asymptotics)
<p>Please help me to prove:</p>

<p>If $f, g ∶ \mathbb{N} \rightarrow \mathbb{N}$ and $f$ and $g$ are increasing $(f(n+1)>f(n),g(n+1)>g(n)$).</p>

<p>Need to prove $g=O(f)$ or $f=O(g)$.</p>

<p>Thanks</p>
 | habedi/stack-exchange-dataset |
80,178 | Find all disconnected directed (cyclic) subgraphs and transform them into stars | <p>I have a graph $G=(V,E)$ that consists of many disconnected directed subgraphs, some of them may be cyclic. (Basically a "forest" consisting of directed trees and some directed disconnected cyclic graphs added into it). </p>

<p>I want to find all of these disconnected subgraphs and turn them into stars give... | algorithms graphs | 1 | Find all disconnected directed (cyclic) subgraphs and transform them into stars -- (algorithms graphs)
<p>I have a graph $G=(V,E)$ that consists of many disconnected directed subgraphs, some of them may be cyclic. (Basically a "forest" consisting of directed trees and some directed disconnected cyclic graphs added into... | habedi/stack-exchange-dataset |
80,179 | SAT to knapsack vs. ETH | <p>Theorem states that every problem in $\mathsf{NP}$ can be reduced to another $\mathsf{NP}$-complete problem in polynomial time. Also you can only make a problem polynomially longer using polynomial time.</p>

<p>Thus SAT of length $n$ can be reduced to knapsack with length $n^k$ for some fixed $k\in\mathbb{R... | np complete satisfiability knapsack problems | 1 | SAT to knapsack vs. ETH -- (np complete satisfiability knapsack problems)
<p>Theorem states that every problem in $\mathsf{NP}$ can be reduced to another $\mathsf{NP}$-complete problem in polynomial time. Also you can only make a problem polynomially longer using polynomial time.</p>

<p>Thus SAT of length $n$ ... | habedi/stack-exchange-dataset |
80,181 | Does every 3CNF propositional formula has an equivalent 2CNF propositional formula? | <p>Does every 3CNF propositional formula has an <strong>equivalent</strong> 2CNF propositional formula?</p>

<p>Definitions:</p>

<p>3CNF propositional formula is conjunctive normal form propositional formula, which is just conjunction $\land$ of clauses, where each clause is disjunction $\lor$ of at mo... | logic first order logic propositional logic | 1 | Does every 3CNF propositional formula has an equivalent 2CNF propositional formula? -- (logic first order logic propositional logic)
<p>Does every 3CNF propositional formula has an <strong>equivalent</strong> 2CNF propositional formula?</p>

<p>Definitions:</p>

<p>3CNF propositional formula is conjunct... | habedi/stack-exchange-dataset |
80,186 | Is there a programming language that is not a formal language | <p>Are out there, any programming languages that are not defined algorithmically so that we can call them "constructed languages" but not "formal languages"? Are there any discussions or papers on that topic? It seems pretty hard to develop a compiler for this kind of languages.</p>
 | formal languages programming languages compilers | 1 | Is there a programming language that is not a formal language -- (formal languages programming languages compilers)
<p>Are out there, any programming languages that are not defined algorithmically so that we can call them "constructed languages" but not "formal languages"? Are there any discussions or papers on that to... | habedi/stack-exchange-dataset |
80,188 | Graph isomorphism in BPP implies it is also in RP | <p>$$L=\{\langle G\rangle \#\langle H\rangle : H, G \text{ are directed isomorphic graphs }\}$$<br>
$\langle G\rangle$ is adjacency matrix written row by row.
Show that if $L\in BPP$ then also $L\in RP$.<br>
Can you help me ?<br>
I have no idea how to do it. </p>
 | complexity theory probabilistic algorithms | 1 | Graph isomorphism in BPP implies it is also in RP -- (complexity theory probabilistic algorithms)
<p>$$L=\{\langle G\rangle \#\langle H\rangle : H, G \text{ are directed isomorphic graphs }\}$$<br>
$\langle G\rangle$ is adjacency matrix written row by row.
Show that if $L\in BPP$ then also $L\in RP$.<br>
Ca... | habedi/stack-exchange-dataset |
80,193 | create new data from trained ANN | <p>I use a very simple neural network to make classification between classes. Once my ANN is trained I'm able to present new and unknown data, and get a good classification. </p>

<p>Is there a simple way to reverse the process and create an artificial data, knowing at which class it should belong ? </p>
&#... | neural networks | 1 | create new data from trained ANN -- (neural networks)
<p>I use a very simple neural network to make classification between classes. Once my ANN is trained I'm able to present new and unknown data, and get a good classification. </p>

<p>Is there a simple way to reverse the process and create an artificial data,... | habedi/stack-exchange-dataset |
80,194 | Does this behavior have a formal name, and if so, what is it? | <p>This is related to the issue asked about in <a href="https://stackoverflow.com/questions/26337003/why-non-equality-check-of-one-variable-against-many-values-always-returns-true">this other question</a>.</p>

<p>For the sake of this question, let's assume that we have a variable v that can have any value from... | terminology programming languages | 1 | Does this behavior have a formal name, and if so, what is it? -- (terminology programming languages)
<p>This is related to the issue asked about in <a href="https://stackoverflow.com/questions/26337003/why-non-equality-check-of-one-variable-against-many-values-always-returns-true">this other question</a>.</p>

... | habedi/stack-exchange-dataset |
80,200 | Does every 3CNF propositional formula has an equisatisfiable 2CNF propositional formula | <p>Does every 3CNF propositional formula has an <strong>equisatisfiable</strong> 2CNF propositional formula?</p>
 | logic first order logic propositional logic | 1 | Does every 3CNF propositional formula has an equisatisfiable 2CNF propositional formula -- (logic first order logic propositional logic)
<p>Does every 3CNF propositional formula has an <strong>equisatisfiable</strong> 2CNF propositional formula?</p>
 | habedi/stack-exchange-dataset |
80,211 | Why is $\Sigma^*$ concatenated with some language regular? | <p>Let $\Sigma=\{a,b\}$. Why is the concatenation of any language with $\Sigma^*$ always regular? I found a problem where $(a+b)^*$concatenated with $a^nb^n$ was regular? </p>
 | formal languages regular languages | 1 | Why is $\Sigma^*$ concatenated with some language regular? -- (formal languages regular languages)
<p>Let $\Sigma=\{a,b\}$. Why is the concatenation of any language with $\Sigma^*$ always regular? I found a problem where $(a+b)^*$concatenated with $a^nb^n$ was regular? </p>
 | habedi/stack-exchange-dataset |
80,219 | The use of binary search when determining whether a point lies inside a given convex hull | <p>In <a href="https://cs.stackexchange.com/a/39985/76261">an answer to the problem of determining whether or not a point lies inside a given convex hull</a>, a thesis is mentioned, which says :</p>

<blockquote>
 <p>For repeated queries with preprocessing allowed, we develop a special
 method that re... | algorithms binary search convex hull | 1 | The use of binary search when determining whether a point lies inside a given convex hull -- (algorithms binary search convex hull)
<p>In <a href="https://cs.stackexchange.com/a/39985/76261">an answer to the problem of determining whether or not a point lies inside a given convex hull</a>, a thesis is mentioned, which ... | habedi/stack-exchange-dataset |
80,220 | Randomized linear search -- Why does reducing the sample size make the running time constant? | <p>I have two search algorithms (for determining if an element $x$ is in a list $A$ of length $n$):</p>

<p>(1) Pick a random index $i$ from $L = [1, \ldots n]$. If $A[i] = x$, terminate. Otherwise, pick a new random index $i$, still in the list $L = [1, \ldots , n]$. Repeat until we've either found a $j$ such ... | randomized algorithms | 1 | Randomized linear search -- Why does reducing the sample size make the running time constant? -- (randomized algorithms)
<p>I have two search algorithms (for determining if an element $x$ is in a list $A$ of length $n$):</p>

<p>(1) Pick a random index $i$ from $L = [1, \ldots n]$. If $A[i] = x$, terminate. Oth... | habedi/stack-exchange-dataset |
80,221 | Is this case of weighted 2SAT NP-complete? | <p><a href="https://en.wikipedia.org/wiki/2-satisfiability#Weighted-2-satisfiability" rel="nofollow noreferrer">Weighted 2SAT</a> asks if it is possible to satisfy the formula with at most $k$ variables set as positive/negative. Trivially, every instance must be in 2CNF. It is known to be $\mathsf{NP}$-complete.</p>&#x... | np complete 2 sat | 1 | Is this case of weighted 2SAT NP-complete? -- (np complete 2 sat)
<p><a href="https://en.wikipedia.org/wiki/2-satisfiability#Weighted-2-satisfiability" rel="nofollow noreferrer">Weighted 2SAT</a> asks if it is possible to satisfy the formula with at most $k$ variables set as positive/negative. Trivially, every instance... | habedi/stack-exchange-dataset |
80,223 | Using backtracking to find all possible permutations in a string | <p>I came across this algorithm in a book, and have been struggling to understand the basic idea. The books says it uses backtracking to print all possible permutations of the characters in a string. In Python, the algorithm is given as:</p>

<pre><code>def bitStr(n, s):
 if n == 1: return s
 retu... | algorithms permutations backtracking | 1 | Using backtracking to find all possible permutations in a string -- (algorithms permutations backtracking)
<p>I came across this algorithm in a book, and have been struggling to understand the basic idea. The books says it uses backtracking to print all possible permutations of the characters in a string. In Python, th... | habedi/stack-exchange-dataset |
80,225 | Examples of problems for each class in $L \subseteq NL \subseteq P \subseteq NP \subseteq PSPACE$ | <p>Given that $L \subseteq NL \subseteq P \subseteq NP \subseteq PSPACE$ and that it is commonly believed that all these inclusions are strict can you provide examples of problems that are believed to be in each class and not in the preceding ones?</p>

<p>To try to narrow the scope of the question, could you p... | complexity theory complexity classes | 1 | Examples of problems for each class in $L \subseteq NL \subseteq P \subseteq NP \subseteq PSPACE$ -- (complexity theory complexity classes)
<p>Given that $L \subseteq NL \subseteq P \subseteq NP \subseteq PSPACE$ and that it is commonly believed that all these inclusions are strict can you provide examples of problems ... | habedi/stack-exchange-dataset |
80,232 | Is this possible to find the maximum of differentiable and analytic function on finite and fixed interval in O(1) time using quantum computer? | <p>$f$ is differentiable (continous) and analytic function.</p>

<p>If $x\in\mathbb{R} \land 0\le x\le1$ then $f(x)$ is <strong>computable</strong>, $f(x)\in\mathbb{R}$ and $0\le f(x)\le1$.</p>

<p>I have a conjecture that it is possible in O(1) constant time to find the maximum of $f$ in the interval [... | complexity theory time complexity quantum computing | 1 | Is this possible to find the maximum of differentiable and analytic function on finite and fixed interval in O(1) time using quantum computer? -- (complexity theory time complexity quantum computing)
<p>$f$ is differentiable (continous) and analytic function.</p>

<p>If $x\in\mathbb{R} \land 0\le x\le1$ then $f... | habedi/stack-exchange-dataset |
80,255 | Why page size = size of one cache way? | <p>Why is that the page size equals the size of one cache way?</p>

<p>My book states "A direct-mapped cache cannot be bigger than a page".</p>
 | computer architecture cpu cache memory hardware paging | 1 | Why page size = size of one cache way? -- (computer architecture cpu cache memory hardware paging)
<p>Why is that the page size equals the size of one cache way?</p>

<p>My book states "A direct-mapped cache cannot be bigger than a page".</p>
 | habedi/stack-exchange-dataset |
80,256 | Why do functions containing `await` need to be `async`? | <p>From what I understand, <code>async</code>/<code>await</code> enables to avoid the "callback pyramid of doom".<br>
Let's say that I have <code>funcA()</code>, <code>funcB()</code> and <code>funcC()</code> that are <code>async</code> functions, now if I do something like that: </p>

<pre><code>func someF... | programming languages concurrency | 1 | Why do functions containing `await` need to be `async`? -- (programming languages concurrency)
<p>From what I understand, <code>async</code>/<code>await</code> enables to avoid the "callback pyramid of doom".<br>
Let's say that I have <code>funcA()</code>, <code>funcB()</code> and <code>funcC()</code> that are <cod... | habedi/stack-exchange-dataset |
80,270 | Identifying set of longest time periods excluding overlapping time ranages | <p>Suppose I have set of time records as follows</p>

<pre><code>08:00 - 12:00
10:00 - 12:00
08:00 - 13:00
13:00 - 19:00
12:00 - 17:00
</code></pre>

<p>Now I want to select set of time records that are not overlapping and has the largest sum.</p>

<pre><code> 08:00 - 13:00 +... | optimization dynamic programming greedy algorithms | 1 | Identifying set of longest time periods excluding overlapping time ranages -- (optimization dynamic programming greedy algorithms)
<p>Suppose I have set of time records as follows</p>

<pre><code>08:00 - 12:00
10:00 - 12:00
08:00 - 13:00
13:00 - 19:00
12:00 - 17:00
</code></pre>

<p>... | habedi/stack-exchange-dataset |
80,274 | Splitting a set of points in the plane evenly and sorting it | <p>Input: A set of points P(x,y). There are two versions of it - Px, sorted by x and Py, sorted by y.</p>

<p>Output: The two even halves of Px, sorted by y.</p>

<p>The trick here is that it has to work in linear time, otherwise, it's rather useless. What I've come up with so far is finding the midpoin... | algorithms euclidean distance | 1 | Splitting a set of points in the plane evenly and sorting it -- (algorithms euclidean distance)
<p>Input: A set of points P(x,y). There are two versions of it - Px, sorted by x and Py, sorted by y.</p>

<p>Output: The two even halves of Px, sorted by y.</p>

<p>The trick here is that it has to work in l... | habedi/stack-exchange-dataset |
80,276 | How to understand the analysis of expected running time of randomized quick-sort in this paper? | <p>I'm learning the book named Data Structures & Algorithms in Python.</p>

<p>On Page 557-558, there is a proof of the expected running time of randomized qucick-sort. I have some problems confusing me some days. I will note them in bold form.</p>

<p>Here's orginal text:</p>

<blockquote>&... | algorithm analysis runtime analysis sorting randomness quicksort | 1 | How to understand the analysis of expected running time of randomized quick-sort in this paper? -- (algorithm analysis runtime analysis sorting randomness quicksort)
<p>I'm learning the book named Data Structures & Algorithms in Python.</p>

<p>On Page 557-558, there is a proof of the expected running time ... | habedi/stack-exchange-dataset |
80,289 | A 2D Layout Algorithm for Small, Sparse, and Undirected Graphs with a Specific Edge Length | <p>I would like to to draw a graph where every edge $e_m$ has a predefined length of $l$. Given that the graph is small and sparse, it should be feasable. However, I did not manage to find an algorithm which does this (or one that is suitable to modify) yet I'm sure that this is a solved problem. Does anyone know of su... | graphs reference request graph drawing | 1 | A 2D Layout Algorithm for Small, Sparse, and Undirected Graphs with a Specific Edge Length -- (graphs reference request graph drawing)
<p>I would like to to draw a graph where every edge $e_m$ has a predefined length of $l$. Given that the graph is small and sparse, it should be feasable. However, I did not manage to f... | habedi/stack-exchange-dataset |
80,297 | Knight on a chessboard | <p>This is a <a href="https://www.hackerrank.com/challenges/knightl-on-chessboard?h_r=next-challenge&h_v=zen" rel="nofollow noreferrer">Hackerrank challenge</a></p>

<p>$Knight$ is a chess piece that moves in an L shape. We define the possible moves of $Knight(a,b)$ as any movement from some position $(x_1,... | algorithms optimization board games | 1 | Knight on a chessboard -- (algorithms optimization board games)
<p>This is a <a href="https://www.hackerrank.com/challenges/knightl-on-chessboard?h_r=next-challenge&h_v=zen" rel="nofollow noreferrer">Hackerrank challenge</a></p>

<p>$Knight$ is a chess piece that moves in an L shape. We define the possible ... | habedi/stack-exchange-dataset |
80,298 | Number of rooted labelled trees | <p>According to Cayley's formula, we have number of spanning trees on a complete graph as n^n-2 and number of labelled trees with n vertices as n^n-2</p>

<p>If the tree is rooted then in each tree we can choose a root in n ways so total number of rooted labelled trees is n^n-1.</p>

<p>Here when comput... | graphs trees combinatorics spanning trees | 1 | Number of rooted labelled trees -- (graphs trees combinatorics spanning trees)
<p>According to Cayley's formula, we have number of spanning trees on a complete graph as n^n-2 and number of labelled trees with n vertices as n^n-2</p>

<p>If the tree is rooted then in each tree we can choose a root in n ways so t... | habedi/stack-exchange-dataset |
80,305 | Composition of polynomial and logaritmic function | <p>Let $f$ be a computable function in $PSPACE$ It is true that Turing machine that computes $f$ can produce only $EXP$-size output at most. I see that $\log 2^n = n$ we can "control" the output. But, it doesn't convince me. </p>

<p>Please explain</p>
 | complexity theory | 1 | Composition of polynomial and logaritmic function -- (complexity theory)
<p>Let $f$ be a computable function in $PSPACE$ It is true that Turing machine that computes $f$ can produce only $EXP$-size output at most. I see that $\log 2^n = n$ we can "control" the output. But, it doesn't convince me. </p>

<p>Pleas... | habedi/stack-exchange-dataset |
80,311 | How many recursively enumerable sets are there? | <p>I'm trying to get some notion of how "many" recursively enumerable sets there are.</p>

<p>Here's one way of formalizing the question: consider $S =\{q: q\in Q\cap [0,1]\}$ and $R\subset S$ the set of recursively innumerable subsets of $S$.</p>

<p>What is the measure of $R$? My intuition is that it ... | computability | 1 | How many recursively enumerable sets are there? -- (computability)
<p>I'm trying to get some notion of how "many" recursively enumerable sets there are.</p>

<p>Here's one way of formalizing the question: consider $S =\{q: q\in Q\cap [0,1]\}$ and $R\subset S$ the set of recursively innumerable subsets of $S$.</... | habedi/stack-exchange-dataset |
80,326 | Lower the frechet distance between two curves | <p>Fréchet distance tells how similar two curves are. Now let's say I have two curves A and B, both represented in several discrete coordinate x, y points. And the fréchet distance between A and B is d. What technique can I employ to find another curve that has d/2 fréchet distance from both curves and has a total eucl... | computational geometry | 1 | Lower the frechet distance between two curves -- (computational geometry)
<p>Fréchet distance tells how similar two curves are. Now let's say I have two curves A and B, both represented in several discrete coordinate x, y points. And the fréchet distance between A and B is d. What technique can I employ to find another... | habedi/stack-exchange-dataset |
80,329 | Matching with One-sided Preferences | <p>I'm dealing with a slight variation on a classic matching problem on sets $A$ and $B$), where:</p>

<ul>
<li>Set $A$ has an incomplete set of preferences (not all of $B$ is included)</li>
<li>Set $B$ has no preferences whatsoever.</li>
</ul>

<p>I want to find an $A$-optimal matching (e.g... | algorithms matching assignment problem | 1 | Matching with One-sided Preferences -- (algorithms matching assignment problem)
<p>I'm dealing with a slight variation on a classic matching problem on sets $A$ and $B$), where:</p>

<ul>
<li>Set $A$ has an incomplete set of preferences (not all of $B$ is included)</li>
<li>Set $B$ has no preferences wh... | habedi/stack-exchange-dataset |
80,334 | Size of Circular Queue | <p>I am Implementing a Queue using circular arrays in C language .The Implementation uses one empty position to indicate that the queue is full.That is if the rear is two position behind front. The condition is we cant use a variable to count the entries in the queue as we insert or delete . I have created this functio... | algorithm analysis data structures queues | 1 | Size of Circular Queue -- (algorithm analysis data structures queues)
<p>I am Implementing a Queue using circular arrays in C language .The Implementation uses one empty position to indicate that the queue is full.That is if the rear is two position behind front. The condition is we cant use a variable to count the ent... | habedi/stack-exchange-dataset |
80,342 | Proving that converting min-heaps to max-heaps requires time Ω(n) | <p>Suppose I have a min-heap SH stored inside an array. I can perform the operations:</p>

<ul>
<li>view-min(SH) in $O(1)$</li>
<li>extract-min(SH) in $O(\log n)$</li>
<li>insert(SH) in $O(\log n)$</li>
<li>is-empty(SH) in $O(1)$</li>
</ul>

<p>If I want to build a max-heap BH from t... | complexity theory algorithm analysis data structures lower bounds heaps | 1 | Proving that converting min-heaps to max-heaps requires time Ω(n) -- (complexity theory algorithm analysis data structures lower bounds heaps)
<p>Suppose I have a min-heap SH stored inside an array. I can perform the operations:</p>

<ul>
<li>view-min(SH) in $O(1)$</li>
<li>extract-min(SH) in $O(\log n)... | habedi/stack-exchange-dataset |
80,343 | If problem is coNL-complete, is it NL-complete | <p>We know from Immerman-Szelepcsényi theorem that $coNL=NL$. But, what about:
If problem is $coNL\text{-}complete$, is it $NL\text{-}complete$? And why?</p>
 | complexity theory space complexity | 1 | If problem is coNL-complete, is it NL-complete -- (complexity theory space complexity)
<p>We know from Immerman-Szelepcsényi theorem that $coNL=NL$. But, what about:
If problem is $coNL\text{-}complete$, is it $NL\text{-}complete$? And why?</p>
 | habedi/stack-exchange-dataset |
80,349 | Maximizing number of selected squares in a grid | <p>We have an $n\times n$ grid of squares, each square has a non-negative integer. Two distinct squares are neighbours if they share a row or column. A selection of squares is good if every selected square has a number of selected neighbours less than or equal to its number.</p>

<p>Is there a known way to find... | algorithms graphs optimization square grid | 1 | Maximizing number of selected squares in a grid -- (algorithms graphs optimization square grid)
<p>We have an $n\times n$ grid of squares, each square has a non-negative integer. Two distinct squares are neighbours if they share a row or column. A selection of squares is good if every selected square has a number of se... | habedi/stack-exchange-dataset |
80,368 | Locate all locations in a sorted array where arr[i]<arr[i+1] | <p>Suppose you are given an array of $n$ integers with duplicates in non-decreasing order. The goal is to find the locations where a value is different from its neighbor.
For example, given the array $arr={3,3,5,5,5,200,200,200,200,209}$, the output would be: ${2,5,9}$.
Obviously, this can be done in linear tim... | algorithm analysis runtime analysis binary search searching | 1 | Locate all locations in a sorted array where arr[i]<arr[i+1] -- (algorithm analysis runtime analysis binary search searching)
<p>Suppose you are given an array of $n$ integers with duplicates in non-decreasing order. The goal is to find the locations where a value is different from its neighbor.
For example, given ... | habedi/stack-exchange-dataset |
80,380 | Periodic Pattern recognition In a Sales Log | <p>I'm pretty new in this field and I need some advice for my first professional challenge.</p>

<p>I'm trying to create a sort of <em>client segmentation</em> from a my company's sales log which has the peculiarity that the clients has a pretty long-term relationship and a periodic behavior.</p>

<ol>&... | machine learning pattern recognition | 1 | Periodic Pattern recognition In a Sales Log -- (machine learning pattern recognition)
<p>I'm pretty new in this field and I need some advice for my first professional challenge.</p>

<p>I'm trying to create a sort of <em>client segmentation</em> from a my company's sales log which has the peculiarity that the c... | habedi/stack-exchange-dataset |
80,388 | The upper bound on a Nondeterministic Finite Automata's configurations number | <p>In <strong>"Engineering: A Compiler"</strong> 2nd ed. by Cooper and Torczon,
in <strong>2.4.1 "Nondeterministic Finite Automata"</strong> of Chapter 2,<br/>
section <strong>"Equivalence of NFAs and DFAs"</strong></p>

<p>discusses the upper bound of a NFA's configurations number.</p>

<p>Here... | finite automata parsers upper bound | 1 | The upper bound on a Nondeterministic Finite Automata's configurations number -- (finite automata parsers upper bound)
<p>In <strong>"Engineering: A Compiler"</strong> 2nd ed. by Cooper and Torczon,
in <strong>2.4.1 "Nondeterministic Finite Automata"</strong> of Chapter 2,<br/>
section <strong>"Equivalence of N... | habedi/stack-exchange-dataset |
80,394 | The border between P and NP for some problems | <p>A problem is defined to be in <strong>NP</strong> when it can be reduced to another <strong>NP</strong> problem in polynomial time.</p>

<p>In <a href="https://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems" rel="nofollow noreferrer">Karp's 21 NP-complete problems</a>, the most famous ones are presen... | complexity theory np complete np | 1 | The border between P and NP for some problems -- (complexity theory np complete np)
<p>A problem is defined to be in <strong>NP</strong> when it can be reduced to another <strong>NP</strong> problem in polynomial time.</p>

<p>In <a href="https://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems" rel="nofo... | habedi/stack-exchange-dataset |
80,396 | function in big O but not in little o? | <p>Give two functions that is in O(n^2) but not in o(n^2).</p>

<p>The answer is nlogn and n,But I think a lot but can't understand why answer are them.I doubt answers is wrong.</p>

<p>And this question,Give two functions that is in big-omega(n^2) not in 
little-omega(n^2)?</p>

<p>The answ... | asymptotics | 1 | function in big O but not in little o? -- (asymptotics)
<p>Give two functions that is in O(n^2) but not in o(n^2).</p>

<p>The answer is nlogn and n,But I think a lot but can't understand why answer are them.I doubt answers is wrong.</p>

<p>And this question,Give two functions that is in big-omega(n^2)... | habedi/stack-exchange-dataset |
80,399 | Understanding of self-information | <p>I am trying to fully understand the meaning behind the self-information of events. While I totally understood how to calculate it, all explanations I find online lack of an explanation <em>why</em> less likely events have more self-information. </p>

<p>I can't figure out what consequences this has and can't... | information theory | 1 | Understanding of self-information -- (information theory)
<p>I am trying to fully understand the meaning behind the self-information of events. While I totally understood how to calculate it, all explanations I find online lack of an explanation <em>why</em> less likely events have more self-information. </p>

... | habedi/stack-exchange-dataset |
80,402 | How does it possible that $ZPP=RP\cap coRP$? | <p>How does it possible that $ZPP=RP\cap coRP$ ?<br>
After all, it must be that $RP\cap coRP = \emptyset$<br>
Where Am I wrong ?</p>
 | complexity theory | 1 | How does it possible that $ZPP=RP\cap coRP$? -- (complexity theory)
<p>How does it possible that $ZPP=RP\cap coRP$ ?<br>
After all, it must be that $RP\cap coRP = \emptyset$<br>
Where Am I wrong ?</p>
 | habedi/stack-exchange-dataset |
80,403 | Understanding kQBF: changing order of quantification? | <p>2QBF is a problem of determining whether formula $\exists X~\forall Y:\varphi(X,Y)$ is valid. $X$ and $Y$ here are sets of variables. Next, 3QBF asks if formula $\exists X~\forall Y~\exists Z:\varphi(X,Y,Z)$ is valid. But what I can't understand is following:</p>

<ol>
<li>Can't we change order of quanti... | np hard boolean algebra propositional logic | 1 | Understanding kQBF: changing order of quantification? -- (np hard boolean algebra propositional logic)
<p>2QBF is a problem of determining whether formula $\exists X~\forall Y:\varphi(X,Y)$ is valid. $X$ and $Y$ here are sets of variables. Next, 3QBF asks if formula $\exists X~\forall Y~\exists Z:\varphi(X,Y,Z)$ is val... | habedi/stack-exchange-dataset |
80,409 | Should we assume both processes are getting same CPU clock while we solve SYNCHRONIZATION problems in uniprocessor system? | <p>In synchronization, when one process is in a critical section & another is busy waiting, both are using CPU. But in a uni processor system, in the same clock both cant get the CPU. So there must be a scheduling algorithm for them. Should we consider these while solving synchronization problem or should we think... | operating systems process scheduling synchronization | 1 | Should we assume both processes are getting same CPU clock while we solve SYNCHRONIZATION problems in uniprocessor system? -- (operating systems process scheduling synchronization)
<p>In synchronization, when one process is in a critical section & another is busy waiting, both are using CPU. But in a uni processor... | habedi/stack-exchange-dataset |
80,412 | What makes a pseudorandom generator, a high quality one? | <p>Reading this answer to this SO question: <a href="https://cs.stackexchange.com/a/57650">Why do we not combine random number generators?</a>, it talks about </p>

<blockquote>
 <p>very high-quality PRNG (Pseudo Random Number Generator)</p>
</blockquote>

<p>so it makes me wonder what constitu... | randomness pseudo random generators random number generator | 1 | What makes a pseudorandom generator, a high quality one? -- (randomness pseudo random generators random number generator)
<p>Reading this answer to this SO question: <a href="https://cs.stackexchange.com/a/57650">Why do we not combine random number generators?</a>, it talks about </p>

<blockquote>
 <p>ver... | habedi/stack-exchange-dataset |
80,415 | Why is binary search using this weird thing to calculate middle? | <p>I noticed that in many books calculation of midpoint for binary search uses this: </p>

<pre><code>int mid = left + (right - left) / 2;
</code></pre>

<p>Why not use </p>

<pre><code>int mid = (left + right) / 2;
</code></pre>

<p>instead?</p>
 | algorithms binary search | 1 | Why is binary search using this weird thing to calculate middle? -- (algorithms binary search)
<p>I noticed that in many books calculation of midpoint for binary search uses this: </p>

<pre><code>int mid = left + (right - left) / 2;
</code></pre>

<p>Why not use </p>

<pre><code>int mid ... | habedi/stack-exchange-dataset |
80,418 | find number in array divided into k parts | <p>I was wondering what is the most efficient way to find the a number in an array with the following conditions:</p>

<blockquote>
 <p>Array $A$ of size $n$ divided into even parts in the size of $k$</p>
 
 <ul>
 <li>every element in each part is bigger than all the elements in the part
... | algorithms sorting efficiency | 1 | find number in array divided into k parts -- (algorithms sorting efficiency)
<p>I was wondering what is the most efficient way to find the a number in an array with the following conditions:</p>

<blockquote>
 <p>Array $A$ of size $n$ divided into even parts in the size of $k$</p>
 
 <ul>
 <... | habedi/stack-exchange-dataset |
80,424 | Optional prefix code for the naturals | <p>The naturals $\mathbb{N}$ can be encoded with a binary unary code such as</p>

<p>$$
\begin{align}
 1&=0_b\\
 2&=10_b\\
 3&=110_b\\
 &...
\end{align}
$$
The length this the encoding grows linearly with the natural number it represents. For example t... | algorithms data compression encoding scheme | 1 | Optional prefix code for the naturals -- (algorithms data compression encoding scheme)
<p>The naturals $\mathbb{N}$ can be encoded with a binary unary code such as</p>

<p>$$
\begin{align}
 1&=0_b\\
 2&=10_b\\
 3&=110_b\\
 &...
\end{align}
$$
The lengt... | habedi/stack-exchange-dataset |
80,432 | Compress 32 bit integer into a normalized float | <p>and sorry if this is a duplicate of some sort, my poor technical vocabulary doesn't get me very far with google.</p>

<p>I am trying to implement some well-known PRNG algorithms. For the time, the algorithm in themselves do their job very well (generating 16/32/64/128 random bits). I am now trying to create ... | integers floating point | 1 | Compress 32 bit integer into a normalized float -- (integers floating point)
<p>and sorry if this is a duplicate of some sort, my poor technical vocabulary doesn't get me very far with google.</p>

<p>I am trying to implement some well-known PRNG algorithms. For the time, the algorithm in themselves do their jo... | habedi/stack-exchange-dataset |
80,436 | AVL tree partition | <p>The statement sais the following</p>

<blockquote>
 <p>Design a function to partition an AVL tree such that, given an AVL tree and a key $x$, it returns two AVL trees, one containing the keys lower or equal than $x$, and the other containing the remaining keys. The complexity must be better than $\mathc... | algorithms data structures search trees balanced search trees | 1 | AVL tree partition -- (algorithms data structures search trees balanced search trees)
<p>The statement sais the following</p>

<blockquote>
 <p>Design a function to partition an AVL tree such that, given an AVL tree and a key $x$, it returns two AVL trees, one containing the keys lower or equal than $x$, a... | habedi/stack-exchange-dataset |
80,437 | What was the first Turing-Complete programming language? | <p>What was the first turing-complete language? Know about the first machines
and computers, but not the programming language.</p>
 | programming languages turing completeness history | 1 | What was the first Turing-Complete programming language? -- (programming languages turing completeness history)
<p>What was the first turing-complete language? Know about the first machines
and computers, but not the programming language.</p>
 | habedi/stack-exchange-dataset |
80,447 | Can the formalisms of category theory replace those of type theory? | <p>The subtleties of the correspondence between type theory and category theory are outside my ken. However, by my naive understanding of the relationship between the two historically convergent disciplines, the latter entirely subsumes the former. If this is so, can the language and formal/graphical descriptions used ... | type theory category theory | 1 | Can the formalisms of category theory replace those of type theory? -- (type theory category theory)
<p>The subtleties of the correspondence between type theory and category theory are outside my ken. However, by my naive understanding of the relationship between the two historically convergent disciplines, the latter ... | habedi/stack-exchange-dataset |
80,453 | What is the meaning of 'moderately exponential' running time? | <p>I was reading some <a href="https://people.cs.uchicago.edu/~laci/papers/hypergraphiso.pdf" rel="nofollow noreferrer">research paper</a> where for hypergraph of bounded rank $k$ they have given moderately exponential algorithm. The runtime of the algorithm is $e^{ \mathcal {O}(k^2\sqrt n) \cdot poly(n)}$. Here $k$ i... | algorithms terminology time complexity | 1 | What is the meaning of 'moderately exponential' running time? -- (algorithms terminology time complexity)
<p>I was reading some <a href="https://people.cs.uchicago.edu/~laci/papers/hypergraphiso.pdf" rel="nofollow noreferrer">research paper</a> where for hypergraph of bounded rank $k$ they have given moderately exponen... | habedi/stack-exchange-dataset |
80,458 | Can we create faster sort algorithm than O(N log N) | <p>I was thinking that we can create algorithm for sorting that will work faster than $O(N\log N)$</p>

<p>Let's say we have given array $A$ consisting of $N$ integers, where $N = 10^6$. Our task is to sort this given array. The clear solution is to sort the array using the classic merge sort algorithm, which w... | optimization time complexity sorting | 1 | Can we create faster sort algorithm than O(N log N) -- (optimization time complexity sorting)
<p>I was thinking that we can create algorithm for sorting that will work faster than $O(N\log N)$</p>

<p>Let's say we have given array $A$ consisting of $N$ integers, where $N = 10^6$. Our task is to sort this given ... | habedi/stack-exchange-dataset |
80,460 | Show that boring boolean circuit belongs to NP-complete class | <blockquote>
 <p>We say that a boolean circuit is boring if it returns the same
 result for $>\frac34$ possible input, where we have $n$ input gates.
 Hence, boring circuit returns the same output ($0$ or $1$) for
 $>\frac34 2^n$ inputs. Prove that checking if boolean circuit is boring is NP... | complexity theory np complete circuits | 1 | Show that boring boolean circuit belongs to NP-complete class -- (complexity theory np complete circuits)
<blockquote>
 <p>We say that a boolean circuit is boring if it returns the same
 result for $>\frac34$ possible input, where we have $n$ input gates.
 Hence, boring circuit returns the same output... | habedi/stack-exchange-dataset |
80,462 | Does there exist a language which is PSPACE-complete and regular? | <blockquote>
 <p>Does there exist a language which is PSPACE-complete and regular? (reduction is polynomial with regard to time).</p>
</blockquote>

<p>Correct answer here is "unknown". I can't prove it. Can you help me?</p>
 | complexity theory | 1 | Does there exist a language which is PSPACE-complete and regular? -- (complexity theory)
<blockquote>
 <p>Does there exist a language which is PSPACE-complete and regular? (reduction is polynomial with regard to time).</p>
</blockquote>

<p>Correct answer here is "unknown". I can't prove it. Can you ... | habedi/stack-exchange-dataset |
80,476 | Finding all additive orders | <p>Suppose there are $m$ items, and each item has a price. We order the subsets of items according to their price. For example, if the price of $x$ is 1 and the price of $y$ is 2, then the order is:</p>

<p>$$
\emptyset < x < y < xy
$$</p>

<p>What is an algorithm for enumerating all or... | combinatorics | 1 | Finding all additive orders -- (combinatorics)
<p>Suppose there are $m$ items, and each item has a price. We order the subsets of items according to their price. For example, if the price of $x$ is 1 and the price of $y$ is 2, then the order is:</p>

<p>$$
\emptyset < x < y < xy
$$</p>

... | habedi/stack-exchange-dataset |
80,477 | Optimizing electoral votes in a political simulation... 200,000+ possibilities, how to run through them? | <p>So basically, in my government class, we are simulating a presidential election. Our grade comes from the presentation of our candidate, but as an added challenge our teacher has a running count of electoral votes garnered. How it works is like this: </p>

<ol>
<li><p>there are only 18 states amounting t... | algorithms data structures | 1 | Optimizing electoral votes in a political simulation... 200,000+ possibilities, how to run through them? -- (algorithms data structures)
<p>So basically, in my government class, we are simulating a presidential election. Our grade comes from the presentation of our candidate, but as an added challenge our teacher has a... | habedi/stack-exchange-dataset |
80,478 | Graphs: Dectect a sink in $\mathcal{O}(V)$ | <blockquote>
 <p>Given a directed conected graph which representation is its adjacency matrix $A$, design an algorithm to detect a sink in $\mathcal{O}(V)$ time, being $V$ the number of vertices.</p>
</blockquote>

<p>As definitions can vary, in this context, a sink is defined as a vertex with $0$ exit... | algorithms graphs searching | 1 | Graphs: Dectect a sink in $\mathcal{O}(V)$ -- (algorithms graphs searching)
<blockquote>
 <p>Given a directed conected graph which representation is its adjacency matrix $A$, design an algorithm to detect a sink in $\mathcal{O}(V)$ time, being $V$ the number of vertices.</p>
</blockquote>

<p>As defini... | habedi/stack-exchange-dataset |
80,483 | Is P decidable? | <ol>
<li><p>It seems correct that any single given algorithm must either have polynomial runtime or not. Is there a specific algorithm that (does or does not actually lie in $P$, but) can neither be proven nor disproven to do so?</p></li>
<li><p>Is there a decision procedure for "$\in P$"?</p></li>
<li><p>D... | complexity theory computability undecidability | 1 | Is P decidable? -- (complexity theory computability undecidability)
<ol>
<li><p>It seems correct that any single given algorithm must either have polynomial runtime or not. Is there a specific algorithm that (does or does not actually lie in $P$, but) can neither be proven nor disproven to do so?</p></li>
<li><... | habedi/stack-exchange-dataset |
80,491 | How to find minimum number of k-input LUTs needed to express a n variable boolean function? | <p>An k-input LUT (look up table) takes in atmost k-inputs and gives 1 output (which is a function of the k inputs). I need to devise an algorithm to find the minimum number of k-input LUT's required to express a n variable boolean function.</p>

<p>For example : - n=8 and k=4 8 input variables are a0,a1...a7</... | algorithms optimization boolean algebra | 1 | How to find minimum number of k-input LUTs needed to express a n variable boolean function? -- (algorithms optimization boolean algebra)
<p>An k-input LUT (look up table) takes in atmost k-inputs and gives 1 output (which is a function of the k inputs). I need to devise an algorithm to find the minimum number of k-inpu... | habedi/stack-exchange-dataset |
80,492 | How to prove T Z = Z for binary representation of natural numbers in Coq | <p>I have defined an Inductive in Coq for binary representation of natural numbers as follows:</p>

<pre><code>Inductive bin : Type :=
 | Z : bin
 | T : bin -> bin
 | M : bin -> bin.
</code></pre>

<p>and two recursive functions to convert between nat and bin types as:</p>
&... | coq | 1 | How to prove T Z = Z for binary representation of natural numbers in Coq -- (coq)
<p>I have defined an Inductive in Coq for binary representation of natural numbers as follows:</p>

<pre><code>Inductive bin : Type :=
 | Z : bin
 | T : bin -> bin
 | M : bin -> bin.
</code></pre>

... | habedi/stack-exchange-dataset |
80,493 | Open question regarding the DFS | <p>It is an <strong>open question</strong> that whether $\mathsf{DFS\text{}}$ can be done in $O(m+n)$ time and $O(n)$ bits of space, where $n,m$ represent the number of vertices and edges in a <strong>undirected graph</strong>. <a href="https://en.wikipedia.org/wiki/Depth-first_search" rel="nofollow noreferrer">see thi... | algorithms complexity theory graphs graph traversal searching | 1 | Open question regarding the DFS -- (algorithms complexity theory graphs graph traversal searching)
<p>It is an <strong>open question</strong> that whether $\mathsf{DFS\text{}}$ can be done in $O(m+n)$ time and $O(n)$ bits of space, where $n,m$ represent the number of vertices and edges in a <strong>undirected graph</st... | habedi/stack-exchange-dataset |
80,496 | Thompson's construction, The empty-expression | <p>Why this case exists in Thompson's construction algorithm?
<a href="https://i.stack.imgur.com/YDJFW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YDJFW.png" alt="enter image description here"></a></p>

<p>Isn't just a special case of:<br>
<a href="https://i.stack.imgur.com/LVuTj.... | finite automata compilers | 1 | Thompson's construction, The empty-expression -- (finite automata compilers)
<p>Why this case exists in Thompson's construction algorithm?
<a href="https://i.stack.imgur.com/YDJFW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YDJFW.png" alt="enter image description here"></a></p>

<p>Is... | habedi/stack-exchange-dataset |
80,505 | A problem is NP-hard iff its complement is coNP-complete | <p>$A$ is NP-hard iff $\overline{A}$ is $coNP$-hard, where $\overline{A}$ does mean complement of $A$. </p>

<p>I can't figure out why it is true. Let $A\in NP-hard$. I know that each problem in $NP$ is polynomially reducible to $A$. So, let's "negate" $A$, then by definition: $\overline{A}\in coNP$. However... | complexity theory complexity classes | 1 | A problem is NP-hard iff its complement is coNP-complete -- (complexity theory complexity classes)
<p>$A$ is NP-hard iff $\overline{A}$ is $coNP$-hard, where $\overline{A}$ does mean complement of $A$. </p>

<p>I can't figure out why it is true. Let $A\in NP-hard$. I know that each problem in $NP$ is polynomia... | habedi/stack-exchange-dataset |
80,509 | Show that if $NP\subseteq BPP$ then also $NP=RP$ - considerations about solution | <blockquote>
 <p>Show that if $$NP ⊆ BPP$$ then $$NP = RP$$</p>
 
 <p><strong>Solution:</strong> It is enough to show that if $NP ⊆ BPP$ then $3SAT∈ RP$.
 Let $A$ be a $BPP$ algorithm for $3SAT$. Given a formula $ϕ$ with n variables,
 we first run $A$ on $ϕ$. If $A$ rejects, we reject. Otherwis... | complexity theory | 1 | Show that if $NP\subseteq BPP$ then also $NP=RP$ - considerations about solution -- (complexity theory)
<blockquote>
 <p>Show that if $$NP ⊆ BPP$$ then $$NP = RP$$</p>
 
 <p><strong>Solution:</strong> It is enough to show that if $NP ⊆ BPP$ then $3SAT∈ RP$.
 Let $A$ be a $BPP$ algorithm for $3SAT$. ... | habedi/stack-exchange-dataset |
80,516 | Given $g(n) = \omega(f(n))$, then $g(n) + f(n) = \Omega(g(n))$? | <p>I have a proof but I don't know if the assumptions I did are correct. </p>

<p>I know that $g(n)$ dominates $f(n)$, since $g(n) = \omega(f(n))$ and I did the assumption that $g(n) + f(n) = g(n)$. So, by reflexivity, $g(n) = \Omega (g(n))$.</p>

<p>Is this correct?</p>
 | asymptotics | 1 | Given $g(n) = \omega(f(n))$, then $g(n) + f(n) = \Omega(g(n))$? -- (asymptotics)
<p>I have a proof but I don't know if the assumptions I did are correct. </p>

<p>I know that $g(n)$ dominates $f(n)$, since $g(n) = \omega(f(n))$ and I did the assumption that $g(n) + f(n) = g(n)$. So, by reflexivity, $g(n) = \Ome... | habedi/stack-exchange-dataset |
80,524 | Proof of bucket sort worst case being all elements in one bucket | <p>By bucket sort I mean on dividing numbers between 0 and 1 into $n$ buckets and performing insertion sort on all the buckets.</p>

<pre><code>1| n ← length [A]
2| For i = 1 to n do
3| Insert A[i] into list B[nA[i]]
4| For i = 0 to n-1 do
5| Sort list B with Insertion sort
6| Concat... | algorithm analysis runtime analysis sorting | 1 | Proof of bucket sort worst case being all elements in one bucket -- (algorithm analysis runtime analysis sorting)
<p>By bucket sort I mean on dividing numbers between 0 and 1 into $n$ buckets and performing insertion sort on all the buckets.</p>

<pre><code>1| n ← length [A]
2| For i = 1 to n do
3| ... | habedi/stack-exchange-dataset |
80,529 | Generating many graphs satisfying some properties | <p>Suppose I want to generate all graphs satisfying some properties (specifically 2-connected graphs on 30 vertices with degree sequence $(4, 4, 3, 3,3, \dotsc, 3)$). Unfortunately, there are an enormous number of such graphs. Probably the fastest way to find all of them would to use nauty, but it is too slow.</p>
... | graphs | 1 | Generating many graphs satisfying some properties -- (graphs)
<p>Suppose I want to generate all graphs satisfying some properties (specifically 2-connected graphs on 30 vertices with degree sequence $(4, 4, 3, 3,3, \dotsc, 3)$). Unfortunately, there are an enormous number of such graphs. Probably the fastest way to fin... | habedi/stack-exchange-dataset |
80,531 | Probabilistic analysis of finding 2nd largest value in vector | <p>Given the following algorithm for finding the second largest element in a vector:</p>

<p><code>
2ndMAX(v):
 n = length of v
 largest = 0
 second_largest = 0
 for i in 1 to n:
 if v[i] > largest:
 second_largest = largest
 largest = v[i]:
 else if v[... | algorithm analysis probability theory | 1 | Probabilistic analysis of finding 2nd largest value in vector -- (algorithm analysis probability theory)
<p>Given the following algorithm for finding the second largest element in a vector:</p>

<p><code>
2ndMAX(v):
 n = length of v
 largest = 0
 second_largest = 0
 for i in 1 to n:
... | habedi/stack-exchange-dataset |
80,535 | How many bits needed to describe completely random function? | <p>I read this sentence on mit.ocw and don't understand why this completely random function would need $|U|\log n$ bits to be described?</p>

<blockquote>
 <p>Unfortunately, if we choose a hash function h that happens to be a
 completely random function from U to [n], we would actually need $|U|\log n... | random number generator | 1 | How many bits needed to describe completely random function? -- (random number generator)
<p>I read this sentence on mit.ocw and don't understand why this completely random function would need $|U|\log n$ bits to be described?</p>

<blockquote>
 <p>Unfortunately, if we choose a hash function h that happens... | habedi/stack-exchange-dataset |
80,557 | Composing $L$ and $NL$ | <p>Let $A$ be a problem. I would like to solve $A$ in $NL$. So, I am trying to construct Turing machine working in $NL$:</p>

<p>Let $w$ be a input of length $n$. Firstly, we run machine $M_1$ that working in $LOGSPACE$. It produces a output $o$ of length $P(n)$ where $P$ is a polynomial.
Secondly, a machin... | complexity theory | 1 | Composing $L$ and $NL$ -- (complexity theory)
<p>Let $A$ be a problem. I would like to solve $A$ in $NL$. So, I am trying to construct Turing machine working in $NL$:</p>

<p>Let $w$ be a input of length $n$. Firstly, we run machine $M_1$ that working in $LOGSPACE$. It produces a output $o$ of length $P(n)$ whe... | habedi/stack-exchange-dataset |
80,568 | Monte Carlo algorithm: Element in array | <blockquote>
 <p>Design a Monte Carlo algorithm that checks in constant time if a given element $x$ is in a $n$-dimensional vector $V$. Calculate the probability for a correct answer. Then suppose $n=10$, how many times the algorithm must be executed so the probability for a correct answer is greater than $0.9$?</... | monte carlo | 1 | Monte Carlo algorithm: Element in array -- (monte carlo)
<blockquote>
 <p>Design a Monte Carlo algorithm that checks in constant time if a given element $x$ is in a $n$-dimensional vector $V$. Calculate the probability for a correct answer. Then suppose $n=10$, how many times the algorithm must be executed so the ... | habedi/stack-exchange-dataset |
80,570 | Do most bitstrings expand if they halt when executed by a Universal Turing machine? | <p>According to the counting argument, most bitstrings are incompressible or only slightly compressible. However, the counting argument does not work in the opposite direction, since there are an infinite number of bitstrings that are longer. So, the counting argument does not tell us whether most bitstrings will or ... | turing machines combinatorics information theory | 1 | Do most bitstrings expand if they halt when executed by a Universal Turing machine? -- (turing machines combinatorics information theory)
<p>According to the counting argument, most bitstrings are incompressible or only slightly compressible. However, the counting argument does not work in the opposite direction, sinc... | habedi/stack-exchange-dataset |
80,571 | Does the existence of the universe mean Chaitin's number is more than half? | <p>This may be too philosophical for this stackexchange.</p>

<p>Chaitin's constant $\Omega$ is the probability that a bitstring will halt when run on a universal Turing machine. It is uncomputable due to the halting problem.</p>

<p>My thought is that if $\Omega<\frac{1}{2}$ then most likely nothin... | halting problem | 1 | Does the existence of the universe mean Chaitin's number is more than half? -- (halting problem)
<p>This may be too philosophical for this stackexchange.</p>

<p>Chaitin's constant $\Omega$ is the probability that a bitstring will halt when run on a universal Turing machine. It is uncomputable due to the halti... | habedi/stack-exchange-dataset |
80,574 | Maximal expansion of a convex polygon | <p>There is a convex polygon $X$ contained in another polygon $Z$ (which can be non-convex and even have holes). I would like to expand $X$ to a larger convex polygon $Y$ such that:</p>

<ul>
<li>$X\subseteq Y\subseteq Z$</li>
<li>$Y$ is <em>maximal</em>, i.e, there is no other convex polygon $Y'$ such ... | computational geometry | 1 | Maximal expansion of a convex polygon -- (computational geometry)
<p>There is a convex polygon $X$ contained in another polygon $Z$ (which can be non-convex and even have holes). I would like to expand $X$ to a larger convex polygon $Y$ such that:</p>

<ul>
<li>$X\subseteq Y\subseteq Z$</li>
<li>$Y$ is ... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.