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 |
|---|---|---|---|---|---|---|
14,344 | Big Theta Proof on polynomial function | <p>This is not homework. I have the solution but it's not what I'm getting. I know there are multiple solutions to the problem but I want to make sure that I'm not missing anything. </p>

<p>The question is as follows:</p>

<blockquote>
 <p>Prove that 2$n^2$
 - 4n + 7 = Θ ($n^2$). give the va... | asymptotics | 1 | Big Theta Proof on polynomial function -- (asymptotics)
<p>This is not homework. I have the solution but it's not what I'm getting. I know there are multiple solutions to the problem but I want to make sure that I'm not missing anything. </p>

<p>The question is as follows:</p>

<blockquote>
 <p>Pr... | habedi/stack-exchange-dataset |
14,347 | Solving recurrences using substitution method | <p>I already have a solution for this problem but it's just not making sense to me. </p>

<p>Here is the problem (It's from Introduction to Algorithms by CLRS found in CH.4): </p>

<blockquote>
 <p>Show $T(n) = 2T(\lfloor n/2 \rfloor +17)+n$ is $O(n \log n)$</p>
</blockquote>

<p>This ... | asymptotics proof techniques recurrence relation | 1 | Solving recurrences using substitution method -- (asymptotics proof techniques recurrence relation)
<p>I already have a solution for this problem but it's just not making sense to me. </p>

<p>Here is the problem (It's from Introduction to Algorithms by CLRS found in CH.4): </p>

<blockquote>
 <p>S... | habedi/stack-exchange-dataset |
14,351 | Rational agent question from Russell and Norvig | <p>Question from <em>Artificial Intelligenge: A Modern Approach</em> by Russell and Norvig (Exercise 2.1).</p>

<blockquote>
 <p>Suppose that the performance measure is concerned with just the first
 $T$ time steps of the environment and ignores everything thereafter.
 Show that a rational agent'... | artificial intelligence | 1 | Rational agent question from Russell and Norvig -- (artificial intelligence)
<p>Question from <em>Artificial Intelligenge: A Modern Approach</em> by Russell and Norvig (Exercise 2.1).</p>

<blockquote>
 <p>Suppose that the performance measure is concerned with just the first
 $T$ time steps of the env... | habedi/stack-exchange-dataset |
14,354 | Simple graph canonization algorithm | <p>I'm looking for an algorithm that provides a <a href="http://en.wikipedia.org/wiki/Graph_canonization" rel="noreferrer">canonical string</a> for a given colored graph. Ie. an algorithm that returns a string for a graph, such that two graphs get the same string if and only if they are isomorphic. </p>

<p>In ... | algorithms graphs combinatorics | 1 | Simple graph canonization algorithm -- (algorithms graphs combinatorics)
<p>I'm looking for an algorithm that provides a <a href="http://en.wikipedia.org/wiki/Graph_canonization" rel="noreferrer">canonical string</a> for a given colored graph. Ie. an algorithm that returns a string for a graph, such that two graphs get... | habedi/stack-exchange-dataset |
14,356 | Is it possible to prove thread safety? | <p>Given a program consisting of variables and instructions which modify these variables, and a synchronization primitive (a monitor, mutex, java's synchronized or C#'s lock), is it possible to prove that such a program is thread safe? </p>

<p>Is there even a formal model for describing things like thread safe... | proof techniques correctness proof concurrency threads | 1 | Is it possible to prove thread safety? -- (proof techniques correctness proof concurrency threads)
<p>Given a program consisting of variables and instructions which modify these variables, and a synchronization primitive (a monitor, mutex, java's synchronized or C#'s lock), is it possible to prove that such a program i... | habedi/stack-exchange-dataset |
14,359 | Are there problems that are polynomial-time equivalent to factoring composites? | <p>It seems that factoring a number known to be composite is in its own interesting little complexity class, e.g. polynomial time using quantum computing even though no one has proved $\mathsf{P} = \mathsf{NP}$ for quantum computing. </p>

<p>Are there interesting, non-obvious examples of problems with polynomi... | complexity theory complexity classes factoring | 1 | Are there problems that are polynomial-time equivalent to factoring composites? -- (complexity theory complexity classes factoring)
<p>It seems that factoring a number known to be composite is in its own interesting little complexity class, e.g. polynomial time using quantum computing even though no one has proved $\ma... | habedi/stack-exchange-dataset |
14,360 | Pros and cons of representing strings as lists of characters | <p>I am writing a compiler for my programming language (both almost complete), but they are stuck in the, I would call, "String vs List-of-Char dilemma".
Maybe some more experienced compiler programmer could help.</p>

<p>It is a functional, strongly typed (with inference) and almost pure (immutable vars) l... | programming languages compilers functional programming | 1 | Pros and cons of representing strings as lists of characters -- (programming languages compilers functional programming)
<p>I am writing a compiler for my programming language (both almost complete), but they are stuck in the, I would call, "String vs List-of-Char dilemma".
Maybe some more experienced compiler prog... | habedi/stack-exchange-dataset |
14,361 | Help with recurrence solutions | <p>We started learning recurrences and I am having trouble with some of the problems. Our professor is having us substitute in $n=2^m$ and $S(m)=T(2^m)$ then writing down equations and summing them all up. I understand the substitution part, but not how to simplify the end result.</p>

<p>One of the problems I ... | proof techniques recurrence relation | 1 | Help with recurrence solutions -- (proof techniques recurrence relation)
<p>We started learning recurrences and I am having trouble with some of the problems. Our professor is having us substitute in $n=2^m$ and $S(m)=T(2^m)$ then writing down equations and summing them all up. I understand the substitution part, but n... | habedi/stack-exchange-dataset |
14,364 | Post-selection and complexity theory | <p>I read about post-selection and didn't understand the meaning behind this thing. I didn't understand the Wikipedia article well, so what is a simple but understandable explanation of post-selection and how to use it in complexity? </p>
 | complexity theory terminology probability theory | 1 | Post-selection and complexity theory -- (complexity theory terminology probability theory)
<p>I read about post-selection and didn't understand the meaning behind this thing. I didn't understand the Wikipedia article well, so what is a simple but understandable explanation of post-selection and how to use it in complex... | habedi/stack-exchange-dataset |
14,369 | Confused by Floating Point Spacing | <p>I'm currently taking a numerical analysis class in college and we're covering floating point systems. For the most part, I have a good grasp on it. However, something I can't seem to visualize, and haven't seen any totally lucid explanations about after searching extensively, is spacing between floating point number... | computer architecture floating point number formats | 1 | Confused by Floating Point Spacing -- (computer architecture floating point number formats)
<p>I'm currently taking a numerical analysis class in college and we're covering floating point systems. For the most part, I have a good grasp on it. However, something I can't seem to visualize, and haven't seen any totally lu... | habedi/stack-exchange-dataset |
14,379 | Modulo operation in monotone complexity | <p>Given $x\in\Bbb N$, I would like to find $x\bmod N$, where $N$ is composite. For example $N=35$, $x=53$ and $x\bmod N=18$. Is this operation considered monotone in circuit/algebraic complexity language? I also want to have consider $x_1+x_2\bmod N = x_1\bmod N+x_2\bmod N$ and $x_1x_2\bmod N = (x_1\bmod N)(x_2\bmod N... | complexity theory circuits | 1 | Modulo operation in monotone complexity -- (complexity theory circuits)
<p>Given $x\in\Bbb N$, I would like to find $x\bmod N$, where $N$ is composite. For example $N=35$, $x=53$ and $x\bmod N=18$. Is this operation considered monotone in circuit/algebraic complexity language? I also want to have consider $x_1+x_2\bmod... | habedi/stack-exchange-dataset |
14,398 | Bridge theorems for group theory and formal languages | <blockquote>
 <p>Is there some natural or notable way to relate or link math <a href="http://en.wikipedia.org/wiki/Group_theory" rel="nofollow noreferrer">groups</a> and CS <a href="http://en.wikipedia.org/wiki/Formal_language" rel="nofollow noreferrer">formal languages</a> or some other core CS concept e.g. Turin... | formal languages reference request automata discrete mathematics group theory | 1 | Bridge theorems for group theory and formal languages -- (formal languages reference request automata discrete mathematics group theory)
<blockquote>
 <p>Is there some natural or notable way to relate or link math <a href="http://en.wikipedia.org/wiki/Group_theory" rel="nofollow noreferrer">groups</a> and CS <a hr... | habedi/stack-exchange-dataset |
14,402 | Compute 'permutation' like problem with modulo | <p>Say, I have some permutation or combination formula like this,<br>
$$\frac{n!}{(n-r)!r!},$$
and I want to $\bmod$ the result with some big prime ($10^9+7$ for example). </p>

<p>I already tried with modular operation and multiplicative inverse but failed (I don't quite understand them). Can someone g... | arithmetic | 1 | Compute 'permutation' like problem with modulo -- (arithmetic)
<p>Say, I have some permutation or combination formula like this,<br>
$$\frac{n!}{(n-r)!r!},$$
and I want to $\bmod$ the result with some big prime ($10^9+7$ for example). </p>

<p>I already tried with modular operation and multiplicative in... | habedi/stack-exchange-dataset |
14,408 | How to include calls to an $O(n)$ subroutine on finite-sized inputs in an analysis? | <p>I am trying to calculate the runtime complexity of a function that does not have fixed size input, but uses several helper methods that do have fixed size input. I was unsure of how to include the helper methods in my calculations. </p>

<p>If I have an array with a fixed size of 32 indices, and I have a fun... | terminology algorithm analysis runtime analysis | 1 | How to include calls to an $O(n)$ subroutine on finite-sized inputs in an analysis? -- (terminology algorithm analysis runtime analysis)
<p>I am trying to calculate the runtime complexity of a function that does not have fixed size input, but uses several helper methods that do have fixed size input. I was unsure of ho... | habedi/stack-exchange-dataset |
14,410 | Approximation algorithm for Feedback Arc Set | <p>Given a directed graph $G = (V,A)$, a feedback arc set is a set of arcs whose removal leaves an acyclic graph. The problem is to find the minimum cardinality such set.</p>

<p>I want to find out about is there some approximation algorithm around this problem.</p>
 | algorithms graphs approximation | 1 | Approximation algorithm for Feedback Arc Set -- (algorithms graphs approximation)
<p>Given a directed graph $G = (V,A)$, a feedback arc set is a set of arcs whose removal leaves an acyclic graph. The problem is to find the minimum cardinality such set.</p>

<p>I want to find out about is there some approximati... | habedi/stack-exchange-dataset |
14,419 | Running time and stack depth of a lisp recurrence | <p>Consider the following sequence $a_n$:</p>

<p>\begin{align*}
 a_0 &= \alpha \\
 a_k &= \beta a_{k-1} + \kappa
\end{align*}</p>

<p>Now consider the implementation of this sequence via lisp:</p>

<pre><code>(defun an (k)
 (if (= k 0) alpha
 (+ (* beta (an (- ... | algorithm analysis programming languages recurrence relation | 1 | Running time and stack depth of a lisp recurrence -- (algorithm analysis programming languages recurrence relation)
<p>Consider the following sequence $a_n$:</p>

<p>\begin{align*}
 a_0 &= \alpha \\
 a_k &= \beta a_{k-1} + \kappa
\end{align*}</p>

<p>Now consider the implementation... | habedi/stack-exchange-dataset |
14,420 | Enumerating all set covers when knowing one set at least | <p>I have an index taking as keys values from the power set $P(S)$ of a set $S$, except for $\emptyset$ and $S$.</p>

<p>Then I have a query $Q=(s, k)$, where $s \in P(S) - \{\emptyset \cup S\}$ and $ 1 < k \le |S|$.</p>

<p>The result of the query is the set of covers $R$ of $S$; $\forall r \in R, ... | sets set cover | 1 | Enumerating all set covers when knowing one set at least -- (sets set cover)
<p>I have an index taking as keys values from the power set $P(S)$ of a set $S$, except for $\emptyset$ and $S$.</p>

<p>Then I have a query $Q=(s, k)$, where $s \in P(S) - \{\emptyset \cup S\}$ and $ 1 < k \le |S|$.</p>

<p... | habedi/stack-exchange-dataset |
14,433 | Recover the path to a goal state in A* search algorithm | <p>In the <a href="http://en.wikipedia.org/wiki/A%2a_search_algorithm" rel="nofollow">A* search algorithm</a>, we use a priority queue with heuristic function to find optimum result with minimum cost. But, how do we get the path after reaching goal?</p>
 | algorithms search algorithms | 1 | Recover the path to a goal state in A* search algorithm -- (algorithms search algorithms)
<p>In the <a href="http://en.wikipedia.org/wiki/A%2a_search_algorithm" rel="nofollow">A* search algorithm</a>, we use a priority queue with heuristic function to find optimum result with minimum cost. But, how do we get the path a... | habedi/stack-exchange-dataset |
14,442 | How does Grover's Quantum Sorting avoid reading the list? | <p>It is well known now that <a href="http://en.wikipedia.org/wiki/Grover%27s_algorithm" rel="nofollow">Grover's quantum algorithm</a> can <strong>SORT</strong> a database of $N$ entries in $O(\sqrt{N})$ time. How can an algorithm work without reading through the list of entries which needs $O(N)$ operation. How does G... | algorithms sorting quantum computing | 1 | How does Grover's Quantum Sorting avoid reading the list? -- (algorithms sorting quantum computing)
<p>It is well known now that <a href="http://en.wikipedia.org/wiki/Grover%27s_algorithm" rel="nofollow">Grover's quantum algorithm</a> can <strong>SORT</strong> a database of $N$ entries in $O(\sqrt{N})$ time. How can an... | habedi/stack-exchange-dataset |
14,453 | Proving the language $L= \{0^n 1^m \space | \space m \equiv 0 \space mod \space n, \space n \geq 2 \}$ is not regular using the pumping lemma | <p>I am trying to learn about applying the pumping lemma and I'm not really sure how to go about proving this language isn't regular with the pumping lemma:</p>

<p>$L= \{0^n 1^m \space | \space m \equiv 0 \space mod \space n, \space n \geq 2 \}$</p>

<p>Now I realize that the condition $m \equiv 0 \spa... | regular languages proof techniques pumping lemma | 1 | Proving the language $L= \{0^n 1^m \space | \space m \equiv 0 \space mod \space n, \space n \geq 2 \}$ is not regular using the pumping lemma -- (regular languages proof techniques pumping lemma)
<p>I am trying to learn about applying the pumping lemma and I'm not really sure how to go about proving this language isn't... | habedi/stack-exchange-dataset |
14,456 | Factorial algorithm more efficient than naive multiplication | <p>I know how to code for factorials using both iterative and recursive (e.g. <code>n * factorial(n-1)</code> for e.g.). I read in a textbook (without been given any further explanations) that there is an even more efficient way of coding for factorials by dividing them in half recursively. </p>

<p>I understan... | algorithms efficiency arithmetic | 1 | Factorial algorithm more efficient than naive multiplication -- (algorithms efficiency arithmetic)
<p>I know how to code for factorials using both iterative and recursive (e.g. <code>n * factorial(n-1)</code> for e.g.). I read in a textbook (without been given any further explanations) that there is an even more effici... | habedi/stack-exchange-dataset |
14,458 | Converting NFA to DFA | <p>I've converted an NFA to a DFA. But even after checking over it a few times, it still doesn't feel right. I'm sure this is trivial, but I'd like someone to give me an idea where I went totally wrong on this.</p>

<p>NFA:</p>

<p><img src="https://i.stack.imgur.com/JpLX5.jpg" alt="NFA"></p>

... | automata finite automata | 1 | Converting NFA to DFA -- (automata finite automata)
<p>I've converted an NFA to a DFA. But even after checking over it a few times, it still doesn't feel right. I'm sure this is trivial, but I'd like someone to give me an idea where I went totally wrong on this.</p>

<p>NFA:</p>

<p><img src="https://... | habedi/stack-exchange-dataset |
14,467 | Perfectly Secure Ciphers known other than the OTP | <p>By Information-Theoretic definitions, the <a href="http://en.wikipedia.org/wiki/One-time_pad" rel="nofollow">One Time Pad (OTP)</a> is called/was proved to be a Perfectly Secure Cipher. For the sake of completeness, we define</p>

<ul>
<li>OTP: An enc/dec function, $f:\mathcal{P} \times \mathcal{K} \righ... | cryptography | 1 | Perfectly Secure Ciphers known other than the OTP -- (cryptography)
<p>By Information-Theoretic definitions, the <a href="http://en.wikipedia.org/wiki/One-time_pad" rel="nofollow">One Time Pad (OTP)</a> is called/was proved to be a Perfectly Secure Cipher. For the sake of completeness, we define</p>

<ul>
<... | habedi/stack-exchange-dataset |
14,480 | Fundamental algorithms in formal language-automata theory | <p>I'm willing to take a course in formal languages and automata theory , where we will explore side by side a functional programming language to implement the different algorithms we will encounter ,despite i am new to the language , i am assuming i've learned what's nessecary to move to the theoretical part , so i'm ... | algorithms formal languages automata | 1 | Fundamental algorithms in formal language-automata theory -- (algorithms formal languages automata)
<p>I'm willing to take a course in formal languages and automata theory , where we will explore side by side a functional programming language to implement the different algorithms we will encounter ,despite i am new to ... | habedi/stack-exchange-dataset |
14,487 | Why do most scientists believe that P≠NP? | <p>I read that most scientists don't believe that P=NP. It might be subjective but can you simplify why not? I'm not informed enough to have an opinion but I'd like to know the definitions and some "pretty simple" explanation why to believe one or the other case, for instance why even believe that it can be proved?</p>... | nondeterminism polynomial time | 1 | Why do most scientists believe that P≠NP? -- (nondeterminism polynomial time)
<p>I read that most scientists don't believe that P=NP. It might be subjective but can you simplify why not? I'm not informed enough to have an opinion but I'd like to know the definitions and some "pretty simple" explanation why to believe o... | habedi/stack-exchange-dataset |
14,493 | Regex for all odd length string that contains exactly 2 0's with language {0,1} | <p>I just started learning about formal lang and automata theory, and recently learned about regex, so I don't know any complicated symbols, so please stick with basic symbols.</p>

<p>The question is: Write a regex for the following language over {0,1} that is a set of all odd length strings that contain exact... | automata regular expressions | 1 | Regex for all odd length string that contains exactly 2 0's with language {0,1} -- (automata regular expressions)
<p>I just started learning about formal lang and automata theory, and recently learned about regex, so I don't know any complicated symbols, so please stick with basic symbols.</p>

<p>The question ... | habedi/stack-exchange-dataset |
14,498 | Undecidable among these for turing machine | <p>Below are two questions I found in Theory of Computation book but couldn't find its correct answers, can anyone please give correct answers with explanation?</p>

<ol>
<li>It is undecidable, whether
<ol>
<li>an arbitrary Turing machine(TM) has 15 states</li>
<li>an arbitrary TM halts after 10... | formal languages turing machines undecidability | 1 | Undecidable among these for turing machine -- (formal languages turing machines undecidability)
<p>Below are two questions I found in Theory of Computation book but couldn't find its correct answers, can anyone please give correct answers with explanation?</p>

<ol>
<li>It is undecidable, whether
<ol>&#... | habedi/stack-exchange-dataset |
14,499 | Can a method be written if the language is undecidable? | <p>If a language is decidable, we can write a method that always halts and returns <code>true</code> for each string that is an element of the language and <code>false</code> otherwise.</p>

<p>If a language is undecidable, what does that mean? Does it mean:</p>

<p>a.) We cannot write a method; we cann... | formal grammars undecidability decision problem halting problem turing completeness | 1 | Can a method be written if the language is undecidable? -- (formal grammars undecidability decision problem halting problem turing completeness)
<p>If a language is decidable, we can write a method that always halts and returns <code>true</code> for each string that is an element of the language and <code>false</code> ... | habedi/stack-exchange-dataset |
14,509 | FFT for expanded form of equation multiplication | <p>I know how to use the FFT for multiplying two equations in $O(n\,log\,n)$ time, but is there a way to use FFT to compute the expanded equation before simplifying?</p>

<p>For example, if you are multiplying $A(x) = 1 + 2x + 6x^2$ and $B(x) = 4 + 5x + 3x^2$ such that you get $C(x) = A(x) \cdot B(x) = 4 + 5x +... | algorithms algorithm analysis randomized algorithms fourier transform | 1 | FFT for expanded form of equation multiplication -- (algorithms algorithm analysis randomized algorithms fourier transform)
<p>I know how to use the FFT for multiplying two equations in $O(n\,log\,n)$ time, but is there a way to use FFT to compute the expanded equation before simplifying?</p>

<p>For example, i... | habedi/stack-exchange-dataset |
14,527 | Determine whether two languages are context free | <p>(1) $L_1 = \{a^ib^{i+j}c^j|i,j\geq 0\} $</p>

<p>(2) $L_2 = \{xy | x,y \in \{0,1\}^*, x \neq y, |x| = |y| \}$</p>

<p>I doubt that $L_1$ is CFL. I've been trying to go with the string $s$ = $a^pb^{2p}c^p$. Thus, we can write $s$ as $uvxyz$. Now I'm trying to show $uv^2xy^2z$ is not in $L_1$. </p>
... | context free pushdown automata | 1 | Determine whether two languages are context free -- (context free pushdown automata)
<p>(1) $L_1 = \{a^ib^{i+j}c^j|i,j\geq 0\} $</p>

<p>(2) $L_2 = \{xy | x,y \in \{0,1\}^*, x \neq y, |x| = |y| \}$</p>

<p>I doubt that $L_1$ is CFL. I've been trying to go with the string $s$ = $a^pb^{2p}c^p$. Thus, we c... | habedi/stack-exchange-dataset |
14,528 | What kind of reductions are usually used in order to prove PP-completeness? | <p>I've read that MAJSAT is PP-complete. Under what type of reduction is this true? What kind of reductions are usually used in order to prove PP-completeness? </p>
 | complexity theory | 1 | What kind of reductions are usually used in order to prove PP-completeness? -- (complexity theory)
<p>I've read that MAJSAT is PP-complete. Under what type of reduction is this true? What kind of reductions are usually used in order to prove PP-completeness? </p>
 | habedi/stack-exchange-dataset |
14,532 | Big O and program calls with varied input sizes | <p>Suppose I have a program p that has time complexity $O(n)$ and a second program q that calls program p $m$ times. If we know the input size of p will be the same every one of those times (n), we can say that the complexity of q is $O(m \times n)$. This case sounds pretty simple to me.</p>

<p>However, suppos... | algorithm analysis asymptotics runtime analysis | 1 | Big O and program calls with varied input sizes -- (algorithm analysis asymptotics runtime analysis)
<p>Suppose I have a program p that has time complexity $O(n)$ and a second program q that calls program p $m$ times. If we know the input size of p will be the same every one of those times (n), we can say that the comp... | habedi/stack-exchange-dataset |
14,537 | Prove that $|P(X)| = 2^{|X|}$ | <p>Prove that for any finite set $X$, $|P(X)| = 2^{|X|}$. The solution should use induction.</p>
 | sets | 1 | Prove that $|P(X)| = 2^{|X|}$ -- (sets)
<p>Prove that for any finite set $X$, $|P(X)| = 2^{|X|}$. The solution should use induction.</p>
 | habedi/stack-exchange-dataset |
14,543 | How to solve for recurrence with substitution or other methods? | <p>Forgive me if I am new, I am trying to learn how to solve recurrences.</p>

<p>I have the following recurrence:</p>

<p>$$T(n) = 2 T(\lfloor\frac{n}{3}\rfloor) + \frac{1}{2} T(\lfloor\frac{2n}{3}\rfloor) + n^2 \text{ if } n>0$$</p>

<p>Now from my understanding is that I am not able to use... | asymptotics recurrence relation | 1 | How to solve for recurrence with substitution or other methods? -- (asymptotics recurrence relation)
<p>Forgive me if I am new, I am trying to learn how to solve recurrences.</p>

<p>I have the following recurrence:</p>

<p>$$T(n) = 2 T(\lfloor\frac{n}{3}\rfloor) + \frac{1}{2} T(\lfloor\frac{2n}{3}\rflo... | habedi/stack-exchange-dataset |
14,545 | Characterising $(aa)^*$ in first order logic | <p>In my descriptive complexity class, we've been asked to find a formula that characterises the language $(aa)^*$ (over the alphabet $\{a\}$) with a first order formula over the language $\{<, P_a\}$.</p>

<p>This was the first class, so I will recall what we've learned to be sure that I understood. To a $L... | formal languages regular languages logic first order logic | 1 | Characterising $(aa)^*$ in first order logic -- (formal languages regular languages logic first order logic)
<p>In my descriptive complexity class, we've been asked to find a formula that characterises the language $(aa)^*$ (over the alphabet $\{a\}$) with a first order formula over the language $\{<, P_a\}$.</p>&#x... | habedi/stack-exchange-dataset |
14,552 | Minimal size of contracting a DAG into a new DAG | <p>We have a DAG. We have a function on the nodes $F\colon V\to \mathbb N$ (loosely speaking, we number the nodes). We would like to create a new directed graph with these rules: </p>

<ol>
<li>Only nodes with the same number can be contracted into the same new node. $F(x) \neq F(y) \Rightarrow x' \neq y'$.... | algorithms graphs np complete reductions | 1 | Minimal size of contracting a DAG into a new DAG -- (algorithms graphs np complete reductions)
<p>We have a DAG. We have a function on the nodes $F\colon V\to \mathbb N$ (loosely speaking, we number the nodes). We would like to create a new directed graph with these rules: </p>

<ol>
<li>Only nodes with the... | habedi/stack-exchange-dataset |
14,559 | Prove L to not context free using pumping lemma on language L | <p>$L = \{0^i1^j0^i1^j|i,j \geq 0\}$</p>

<p>I've tried letting $s = 0^p1^p0^p1^p$. But not sure where to go from here. Help would be appreciated.</p>
 | context free pumping lemma | 1 | Prove L to not context free using pumping lemma on language L -- (context free pumping lemma)
<p>$L = \{0^i1^j0^i1^j|i,j \geq 0\}$</p>

<p>I've tried letting $s = 0^p1^p0^p1^p$. But not sure where to go from here. Help would be appreciated.</p>
 | habedi/stack-exchange-dataset |
14,568 | Constructing regular expressions with given substring requirments | <p>I'm having trouble with this question about regular expressions:</p>

<blockquote>
 <p>Let $L_1$ be the language of passwords containing at least one
 lowercase letter, at least one uppercase letter, and at least one
 number. Write down a regular expression that describes $L_1$.</p>
</bloc... | formal languages regular expressions | 1 | Constructing regular expressions with given substring requirments -- (formal languages regular expressions)
<p>I'm having trouble with this question about regular expressions:</p>

<blockquote>
 <p>Let $L_1$ be the language of passwords containing at least one
 lowercase letter, at least one uppercase... | habedi/stack-exchange-dataset |
14,583 | How is non-ambuiguity different from determinism? | <p>I am trying to understand what is meant by "deterministic" in expressions such as "deterministic context-free grammar". (There are more deterministic "things" in this field). I would appreciate an example more then the most elaborate explanation! If possible.</p>

<p>My primary source of confusion is from no... | context free formal grammars parsers | 1 | How is non-ambuiguity different from determinism? -- (context free formal grammars parsers)
<p>I am trying to understand what is meant by "deterministic" in expressions such as "deterministic context-free grammar". (There are more deterministic "things" in this field). I would appreciate an example more then the most e... | habedi/stack-exchange-dataset |
14,591 | Problem with storing an existing triangulation in a DCEL | <p>I am trying to store an existing 2D triangulation (of which I have all of the vertices and edges) in a DCEL data structure. </p>

<p>Using the algorithm described <a href="https://cs.stackexchange.com/a/2516/20691">in this answer</a>, I was able to store a part of the triangulation, but not the "half-edge" r... | algorithms data structures computational geometry doubly connected edge list | 1 | Problem with storing an existing triangulation in a DCEL -- (algorithms data structures computational geometry doubly connected edge list)
<p>I am trying to store an existing 2D triangulation (of which I have all of the vertices and edges) in a DCEL data structure. </p>

<p>Using the algorithm described <a href... | habedi/stack-exchange-dataset |
14,592 | Abduction in ASP | <p>Well, forgive my ignorance about the matter as I have been playing with <a href="http://en.wikipedia.org/wiki/Answer_set_programming" rel="nofollow">ASP</a> for the last couple of days.</p>

<p>Consider this simple example</p>

<pre><code>p.
s :- p.
</code></pre>

<p>And the correspon... | logic logic programming answer set programming | 1 | Abduction in ASP -- (logic logic programming answer set programming)
<p>Well, forgive my ignorance about the matter as I have been playing with <a href="http://en.wikipedia.org/wiki/Answer_set_programming" rel="nofollow">ASP</a> for the last couple of days.</p>

<p>Consider this simple example</p>

<pre... | habedi/stack-exchange-dataset |
14,596 | SAT not reducible to 2SAT | <p>Why is the reduction $\textbf{SAT} \leq_P \textbf{3SAT}$ possible, but $\textbf{SAT} \leq_P \textbf{2SAT}$ not possible, given, that $\textbf{SAT}$ is $\textbf{NP}$-complete, $\textbf{2SAT} \in \textbf{NP}$ and $\textbf{3SAT} \in \textbf{NP}$?</p>
 | reductions | 1 | SAT not reducible to 2SAT -- (reductions)
<p>Why is the reduction $\textbf{SAT} \leq_P \textbf{3SAT}$ possible, but $\textbf{SAT} \leq_P \textbf{2SAT}$ not possible, given, that $\textbf{SAT}$ is $\textbf{NP}$-complete, $\textbf{2SAT} \in \textbf{NP}$ and $\textbf{3SAT} \in \textbf{NP}$?</p>
 | habedi/stack-exchange-dataset |
14,601 | why not just use a random number generator as a hash function? | <p>I guess at the heart of this is that I don't really understand hash functions.
<img src="https://upload.wikimedia.org/wikipedia/commons/5/58/Hash_table_4_1_1_0_0_1_0_LL.svg" alt=""></p>

<p>One article says any function mapping objects to an object of fixed size:</p>

<blockquote>
 <p>A hash... | hash probabilistic algorithms | 1 | why not just use a random number generator as a hash function? -- (hash probabilistic algorithms)
<p>I guess at the heart of this is that I don't really understand hash functions.
<img src="https://upload.wikimedia.org/wikipedia/commons/5/58/Hash_table_4_1_1_0_0_1_0_LL.svg" alt=""></p>

<p>One article says ... | habedi/stack-exchange-dataset |
14,614 | What is "polynomial delay?" | <p>I am reading a paper and it uses the expression "polynomial delay" which I don't understand. It is used in conjonction with the big O notation, which I'm familiar with. </p>

<p>Here is a example sentence showing how it is used:</p>

<blockquote>
 <p>The loop is executed in time $O(n^2(e+n))$, w... | algorithm analysis terminology landau notation | 1 | What is "polynomial delay?" -- (algorithm analysis terminology landau notation)
<p>I am reading a paper and it uses the expression "polynomial delay" which I don't understand. It is used in conjonction with the big O notation, which I'm familiar with. </p>

<p>Here is a example sentence showing how it is used:<... | habedi/stack-exchange-dataset |
14,618 | How to calculate or estimate how long it takes to solve a recurrence relation? | <p>I am trying to understand how to solve complex recurrence relations and whether there is a general method or technique to help me. That being said I am not talking about recurrence relations that can be solved using the (generalized) <em>Master Theorem</em> or the <em>Akra–Bazzi</em> method.</p>

<p>This is ... | recurrence relation | 1 | How to calculate or estimate how long it takes to solve a recurrence relation? -- (recurrence relation)
<p>I am trying to understand how to solve complex recurrence relations and whether there is a general method or technique to help me. That being said I am not talking about recurrence relations that can be solved usi... | habedi/stack-exchange-dataset |
14,619 | How to map the tapes of a "k-tape" Turing Machine into the single tape of a "1-tape" Turing Machine | <p>I'm reading <a href="https://en.wikipedia.org/wiki/Michael_Sipser" rel="noreferrer">Sipser</a> and I'm finding it hard to understand what the process is such that if you give me k Turing machines with k tapes, I can spit out an equivalent Turing machine with only one tape. An example would be nice. Actually, a worke... | turing machines simulation | 1 | How to map the tapes of a "k-tape" Turing Machine into the single tape of a "1-tape" Turing Machine -- (turing machines simulation)
<p>I'm reading <a href="https://en.wikipedia.org/wiki/Michael_Sipser" rel="noreferrer">Sipser</a> and I'm finding it hard to understand what the process is such that if you give me k Turin... | habedi/stack-exchange-dataset |
14,626 | Math term for Associative arrays/Maps/Dictionaries | <p>What would be the equivalent math concept for associative arrays/maps/dictionaries?</p>

<p>EDIT: Disregard mutability. FYI,off topic, the reason why I ask this question, is that I want to calculate the distance(or similarity) between two maps given that I have a distance function for each entity(or key) in ... | discrete mathematics | 1 | Math term for Associative arrays/Maps/Dictionaries -- (discrete mathematics)
<p>What would be the equivalent math concept for associative arrays/maps/dictionaries?</p>

<p>EDIT: Disregard mutability. FYI,off topic, the reason why I ask this question, is that I want to calculate the distance(or similarity) betwe... | habedi/stack-exchange-dataset |
14,629 | Solving a recurrence | <p>Can anyone give me some hint on solving $T(n) = T(\frac{n}{2} + \sqrt{n}) + n$, with any method, master method, substitution....
I have came up with this : $T(n) = T(\frac{(\sqrt{n} + 1)^{2} - 1}{2}) + n$ and then substituting $n = 2^{m}$ but things gets really messy !</p>

<p>any idea?</p>
 | algorithm analysis | 1 | Solving a recurrence -- (algorithm analysis)
<p>Can anyone give me some hint on solving $T(n) = T(\frac{n}{2} + \sqrt{n}) + n$, with any method, master method, substitution....
I have came up with this : $T(n) = T(\frac{(\sqrt{n} + 1)^{2} - 1}{2}) + n$ and then substituting $n = 2^{m}$ but things gets really messy ... | habedi/stack-exchange-dataset |
14,634 | How to encode date as input in neural network? | <p>I am using neural networks to predict a time series.
The question I'm facing now is how do I encode date/time/serial no. of each input set as an input to the neural network?</p>

<p>Should I use 1 of C encoding (used for encoding categories) as described <a href="ftp://ftp.sas.com/pub/neural/FAQ2.html#A_... | machine learning artificial intelligence neural networks | 1 | How to encode date as input in neural network? -- (machine learning artificial intelligence neural networks)
<p>I am using neural networks to predict a time series.
The question I'm facing now is how do I encode date/time/serial no. of each input set as an input to the neural network?</p>

<p>Should I use 1... | habedi/stack-exchange-dataset |
14,636 | NP-COMPLETE:Why say "reduction algorithm computes reduction function"? | <p>In Chap 34.3 <em>NP-completeness and reducibility</em> of the book, <em>Introduction to Algorithm(3rd Edition)</em>, the author states(the original text):</p>

<p>We call the function <em>f</em> the <strong><em>reduction function</em></strong>, and a polynomial-time algorithm <em>F</em> that computes <em>f<... | np complete complexity classes | 1 | NP-COMPLETE:Why say "reduction algorithm computes reduction function"? -- (np complete complexity classes)
<p>In Chap 34.3 <em>NP-completeness and reducibility</em> of the book, <em>Introduction to Algorithm(3rd Edition)</em>, the author states(the original text):</p>

<p>We call the function <em>f</em> the <s... | habedi/stack-exchange-dataset |
14,640 | Convert $\sum x_i = y$ to 3-sat | <p>I have a simple looking question. What is the most efficient conversion of $\sum_{i=1}^n x_i = y$ to 3-sat? Here $x_i$ is either $1$ or $0$ and $y$ is some positive integer.</p>

<p>Can you do better than making a SATISFIABILITY instance with $\binom{n}{y}$ clauses, each of which is the conjunction of $y$ ... | satisfiability sat solvers | 1 | Convert $\sum x_i = y$ to 3-sat -- (satisfiability sat solvers)
<p>I have a simple looking question. What is the most efficient conversion of $\sum_{i=1}^n x_i = y$ to 3-sat? Here $x_i$ is either $1$ or $0$ and $y$ is some positive integer.</p>

<p>Can you do better than making a SATISFIABILITY instance with ... | habedi/stack-exchange-dataset |
14,646 | A containment result in complexity | <p>A question on the interesting result in <a href="http://arxiv.org/pdf/1110.6126v1.pdf">http://arxiv.org/pdf/1110.6126v1.pdf</a></p>

<p>It is shown $\Pi_2^P \not\subset P^{NP}$. But <a href="http://en.wikipedia.org/wiki/Polynomial_hierarchy">http://en.wikipedia.org/wiki/Polynomial_hierarchy</a> says $\Pi_2^P... | complexity theory | 1 | A containment result in complexity -- (complexity theory)
<p>A question on the interesting result in <a href="http://arxiv.org/pdf/1110.6126v1.pdf">http://arxiv.org/pdf/1110.6126v1.pdf</a></p>

<p>It is shown $\Pi_2^P \not\subset P^{NP}$. But <a href="http://en.wikipedia.org/wiki/Polynomial_hierarchy">http://en... | habedi/stack-exchange-dataset |
14,649 | A simple question on #P | <p>Wiki (<a href="http://en.wikipedia.org/wiki/Sharp-P" rel="nofollow">http://en.wikipedia.org/wiki/Sharp-P</a>) says 'In computational complexity theory, the complexity class #P (pronounced "number P" or, sometimes "sharp P" or "hash P") is the set of the counting problems associated with the decision problems in the ... | complexity theory | 1 | A simple question on #P -- (complexity theory)
<p>Wiki (<a href="http://en.wikipedia.org/wiki/Sharp-P" rel="nofollow">http://en.wikipedia.org/wiki/Sharp-P</a>) says 'In computational complexity theory, the complexity class #P (pronounced "number P" or, sometimes "sharp P" or "hash P") is the set of the counting problem... | habedi/stack-exchange-dataset |
14,655 | Solving a complicated recurrence relation | <p>How to solve the recurrence relation below?</p>

<p>$$T(n) = \begin{cases}
 2T(\sqrt{n}) + \log n/\log\log n & \text{if } n > 4\\
 1 & \text{if } n \leq 4.
 \end{cases}$$</p>

<p>Preferably by the master theorem; otherwise by any method. I know ... | recurrence relation | 1 | Solving a complicated recurrence relation -- (recurrence relation)
<p>How to solve the recurrence relation below?</p>

<p>$$T(n) = \begin{cases}
 2T(\sqrt{n}) + \log n/\log\log n & \text{if } n > 4\\
 1 & \text{if } n \leq 4.
 \end{cases}$$</p>

<p... | habedi/stack-exchange-dataset |
14,661 | Complexity of keeping track of $K$ smallest integers in a stream | <p>I need to analyze the time complexity of an online algorithm to keep track of minimum $K$ numbers from a stream of $R$ numbers. The algorithm is </p>

<ul>
<li>Suppose the $i$th number in the stream is $S_i$.</li>
<li>Keep a max heap of size $K$.</li>
<li>If the heap contains fewer than $K$ eleme... | algorithms algorithm analysis runtime analysis average case | 1 | Complexity of keeping track of $K$ smallest integers in a stream -- (algorithms algorithm analysis runtime analysis average case)
<p>I need to analyze the time complexity of an online algorithm to keep track of minimum $K$ numbers from a stream of $R$ numbers. The algorithm is </p>

<ul>
<li>Suppose the $i$... | habedi/stack-exchange-dataset |
14,665 | create divide and conquer algorithm | <p>I have to create an algorithm for homework, but cant figure out where to start. </p>

<p>The divide and conquer algorithm muse be O(nlgn) and returns a pair of numbers <em>p</em> and <em>q</em> in an array <em>A</em>. <em>p</em> must appear before <em>q</em> in the array, and <em>q-p</em> must be the highest... | algorithms divide and conquer | 1 | create divide and conquer algorithm -- (algorithms divide and conquer)
<p>I have to create an algorithm for homework, but cant figure out where to start. </p>

<p>The divide and conquer algorithm muse be O(nlgn) and returns a pair of numbers <em>p</em> and <em>q</em> in an array <em>A</em>. <em>p</em> must appe... | habedi/stack-exchange-dataset |
14,670 | proving the error bound for a hypothesis | <p>Given a hypothesis $h:X\rightarrow Y$ ($h$ is returned by an Empirical Risk Minimization (ERM) strategy with realizable case i.e. $h$ is consistent with the sample examples) over $X=[0,1]\subseteq R$ where $Y=\{0,1\}$ and $D$ is the uniform distribution over $X$. How can I prove that for the accuracy parameter $0\le... | machine learning learning theory | 1 | proving the error bound for a hypothesis -- (machine learning learning theory)
<p>Given a hypothesis $h:X\rightarrow Y$ ($h$ is returned by an Empirical Risk Minimization (ERM) strategy with realizable case i.e. $h$ is consistent with the sample examples) over $X=[0,1]\subseteq R$ where $Y=\{0,1\}$ and $D$ is the unifo... | habedi/stack-exchange-dataset |
14,674 | Intro to Martin-Löf type theory | <p>What would be the best introduction to Per Martin-Löfs ideas about type theory? I've looked at some lectures from the Oregon PL summer school, but I'm still sort of puzzled by the following question:</p>

<p><em>What is a type?</em></p>

<p>I know what a set is, since you can define them by the usual... | logic type theory | 1 | Intro to Martin-Löf type theory -- (logic type theory)
<p>What would be the best introduction to Per Martin-Löfs ideas about type theory? I've looked at some lectures from the Oregon PL summer school, but I'm still sort of puzzled by the following question:</p>

<p><em>What is a type?</em></p>

<p>I kno... | habedi/stack-exchange-dataset |
14,680 | Show a TM-recognizable language of TMs can be expressed by TM-description language of equivalent TMs | <p>I am studying "An Introduction to the Theory of Computation" by Sipser -- there is a problem *3.17 (p.161) which I can not solve. 
Any <em>hints</em> (not <em>answers</em>) from which side to attack it?</p>

<blockquote>
 <p>Let $B=\{M_1, M_2, ...\}$ be a Turing-recognizable language consisting of T... | turing machines computability decision problem | 1 | Show a TM-recognizable language of TMs can be expressed by TM-description language of equivalent TMs -- (turing machines computability decision problem)
<p>I am studying "An Introduction to the Theory of Computation" by Sipser -- there is a problem *3.17 (p.161) which I can not solve. 
Any <em>hints</em> (not <em>a... | habedi/stack-exchange-dataset |
14,685 | Complexity of a recursive bignum multiplication algorithm | <p>We have started learning about analysis of recursive algorithms and I got the gist of it. However there are some questions, like the one I'm going to post, that confuse me a little.</p>
<h3>The exercise</h3>
<blockquote>
<p>Consider the problem of multiplying two big integers, i.e. integers represented b... | algorithms time complexity recursion | 1 | Complexity of a recursive bignum multiplication algorithm -- (algorithms time complexity recursion)
<p>We have started learning about analysis of recursive algorithms and I got the gist of it. However there are some questions, like the one I'm going to post, that confuse me a little.</p>
<h3>The exercise</h3>
<... | habedi/stack-exchange-dataset |
14,691 | Does a Universal Turing Machine have more computational power than a non-universal one? | <p>I'm a bit confused about these concepts. As far as I understand, something is Turing complete when it can simulate a Turing machine. And there is this thing called a Universal Turing machine which is universal because it can simulate a Turing machine. Which to me, implies there are Turing machines that are not unive... | turing completeness | 1 | Does a Universal Turing Machine have more computational power than a non-universal one? -- (turing completeness)
<p>I'm a bit confused about these concepts. As far as I understand, something is Turing complete when it can simulate a Turing machine. And there is this thing called a Universal Turing machine which is univ... | habedi/stack-exchange-dataset |
14,694 | Smallest set of features that would make relational algebra Turing complete | <p>I'm thinking this should be just one or two things, since lambda calculus is so tiny and still Turing complete.</p>

<p>Probably just recursion (something like "MY_QUERY(param) = select * from param UNION MY_QUERY(DO_SOMETHING_WITH(param))"). But I don't see how I could define aggregate functions with this.<... | computation models turing completeness relational algebra | 1 | Smallest set of features that would make relational algebra Turing complete -- (computation models turing completeness relational algebra)
<p>I'm thinking this should be just one or two things, since lambda calculus is so tiny and still Turing complete.</p>

<p>Probably just recursion (something like "MY_QUERY(... | habedi/stack-exchange-dataset |
14,701 | Proving a Language is Irregular using Myhill-Nerode | <p>I'm trying to prove that the language: \begin{equation*}
L = \{ w \in \{ 0, 1 \}^* : w \text{ contains more 0's than 1's} \}
\end{equation*} is irregular using the Myhill-Nerode theorem. I've been through all the basic examples in the book, and thought I understood them, but I'm having trouble with this one... | formal languages | 1 | Proving a Language is Irregular using Myhill-Nerode -- (formal languages)
<p>I'm trying to prove that the language: \begin{equation*}
L = \{ w \in \{ 0, 1 \}^* : w \text{ contains more 0's than 1's} \}
\end{equation*} is irregular using the Myhill-Nerode theorem. I've been through all the basic examples in the... | habedi/stack-exchange-dataset |
14,708 | Maintaining an efficient ordering where you can insert elements "in between" any two other elements in the ordering? | <p>Imagine I have an ordering on a bunch of elements like so:</p>

<p><img src="https://i.imgur.com/Sl2kUC0.png" alt="enter image description here"></p>

<p>Where an arrow $X \leftarrow Y$ means $X < Y$. It is also transitive: $\left(X < Y\right) \wedge \left(Y < Z\right) \implies \left(X < ... | data structures graphs linked lists partial order order theory | 1 | Maintaining an efficient ordering where you can insert elements "in between" any two other elements in the ordering? -- (data structures graphs linked lists partial order order theory)
<p>Imagine I have an ordering on a bunch of elements like so:</p>

<p><img src="https://i.imgur.com/Sl2kUC0.png" alt="enter ima... | habedi/stack-exchange-dataset |
14,712 | a jigsaw problem: recreating a subgraph from a limited number of fragments on an original graph | <p>Suppose I have a set of small subgraphs $A=\{G_i\}$ of an original directed acyclic graph $G$, typically $|G_i| \ll |G|$, which together span the original graph</p>

<p>$$
G= \bigcup_i G_i
$$
My question is if I take a arbitrary subset of these graphs $A′ \subset A$, and a single subgraph from th... | graphs | 1 | a jigsaw problem: recreating a subgraph from a limited number of fragments on an original graph -- (graphs)
<p>Suppose I have a set of small subgraphs $A=\{G_i\}$ of an original directed acyclic graph $G$, typically $|G_i| \ll |G|$, which together span the original graph</p>

<p>$$
G= \bigcup_i G_i
$$&#... | habedi/stack-exchange-dataset |
14,713 | Algorithm for splitting array into subarrays with sums close to the target value | <p>I have an array of positive integers, $A = (a_1, a_2, ..., a_n)$.
Let $s(A)$ denote the sum of elements of array $A$.
I also have an integer $t$, such that $1 < t \le s(A)$.</p>

<p>I want to split the array $A$ into $m$ contiguous subarrays $(A_1, ..., A_m)$, for which I'll get a minimum of funct... | algorithms dynamic programming | 1 | Algorithm for splitting array into subarrays with sums close to the target value -- (algorithms dynamic programming)
<p>I have an array of positive integers, $A = (a_1, a_2, ..., a_n)$.
Let $s(A)$ denote the sum of elements of array $A$.
I also have an integer $t$, such that $1 < t \le s(A)$.</p>

<p... | habedi/stack-exchange-dataset |
14,717 | Object recognition - given an image, does it contain a particular 3D object of interest? | <p>I have in mind a particular 3D object. Given an image taken by a camera, I want to check whether that image contains an instance of my object.</p>

<p>For instance, let's say that the object is a bathroom sink. There are many kinds of bathroom sinks, but they tend to share some common elements (e.g., shape... | machine learning image processing computer vision pattern recognition | 1 | Object recognition - given an image, does it contain a particular 3D object of interest? -- (machine learning image processing computer vision pattern recognition)
<p>I have in mind a particular 3D object. Given an image taken by a camera, I want to check whether that image contains an instance of my object.</p>
&... | habedi/stack-exchange-dataset |
14,733 | Complexity of recursive Fibonacci algorithm | <p>Using the following recursive Fibonacci algorithm:</p>

<pre><code>def fib(n):
 if n==0:
 return 0
 elif n==1
 return 1
 return (fib(n-1)+fib(n-2))
</code></pre>

<p>If I input the number 5 to find fib(5), I know this will output 5 but how do I examine the comp... | algorithms time complexity recursion | 1 | Complexity of recursive Fibonacci algorithm -- (algorithms time complexity recursion)
<p>Using the following recursive Fibonacci algorithm:</p>

<pre><code>def fib(n):
 if n==0:
 return 0
 elif n==1
 return 1
 return (fib(n-1)+fib(n-2))
</code></pre>

<p>If I inpu... | habedi/stack-exchange-dataset |
14,741 | On approximations and reductions | <p>This may be a naive question but I am a bit clueless. I was under the opinion that given two NP complete problems, $P1$ and $P2$, if $P2 \in APX$ and $P1 \notin APX$, then we cannot have a direct reduction $P2\leq P1$ but we can have a reduction $P1\leq P2$.</p>

<p>In this paper on page 165 <a href="http://... | complexity theory reductions | 1 | On approximations and reductions -- (complexity theory reductions)
<p>This may be a naive question but I am a bit clueless. I was under the opinion that given two NP complete problems, $P1$ and $P2$, if $P2 \in APX$ and $P1 \notin APX$, then we cannot have a direct reduction $P2\leq P1$ but we can have a reduction $P1\... | habedi/stack-exchange-dataset |
14,749 | Why do compilers produce assembly code? | <p>Assembly language is converted in to machine language by assembler. Why would a compiler convert high-level language to assembly? Can't it directly convert from the high-level language to machine code?</p>
 | compilers code generation assembly | 1 | Why do compilers produce assembly code? -- (compilers code generation assembly)
<p>Assembly language is converted in to machine language by assembler. Why would a compiler convert high-level language to assembly? Can't it directly convert from the high-level language to machine code?</p>
 | habedi/stack-exchange-dataset |
14,754 | Type inference of pair (product) types | <p>I am looking into Hindler-Milney type system and I am trying to add support for
the pair type. In Pierces book, he introduces special language constructs for creation of pairs and getting their elements.</p>

<p>What I am interested in is the following. What if I don't introduce new constructs, yet use s... | type theory type inference unification | 1 | Type inference of pair (product) types -- (type theory type inference unification)
<p>I am looking into Hindler-Milney type system and I am trying to add support for
the pair type. In Pierces book, he introduces special language constructs for creation of pairs and getting their elements.</p>

<p>What I am ... | habedi/stack-exchange-dataset |
14,768 | Number of Independent Sets in a tree | <p>(I've been stuck on this homework assignment for far too long)</p>

<p>I need to find the number of independent sets in a tree. </p>

<p>For example, say the set of nodes in a tree is {A, B, C, D, E}. B and C are children of A and D, E are children of B. This tree has 14 independent sets. </p>
&#... | algorithms trees | 1 | Number of Independent Sets in a tree -- (algorithms trees)
<p>(I've been stuck on this homework assignment for far too long)</p>

<p>I need to find the number of independent sets in a tree. </p>

<p>For example, say the set of nodes in a tree is {A, B, C, D, E}. B and C are children of A and D, E are ch... | habedi/stack-exchange-dataset |
14,775 | Recursive equation for complexity: T(n) = log(n) * T(log(n)) + n | <p>For analyzing the running time of an algorithm , I'm stuck with this recursive equation :
$$
T(n) = \log(n) \cdot T(\log n) + n
$$
Obviously this can't be handled with the use of the Master Theorem, so I was wondering if anybody has any ideas for solving this recursive equation.</p>

<p>I'm p... | asymptotics runtime analysis recursion master theorem | 1 | Recursive equation for complexity: T(n) = log(n) * T(log(n)) + n -- (asymptotics runtime analysis recursion master theorem)
<p>For analyzing the running time of an algorithm , I'm stuck with this recursive equation :
$$
T(n) = \log(n) \cdot T(\log n) + n
$$
Obviously this can't be handled with the use o... | habedi/stack-exchange-dataset |
14,780 | Is an Event Counter essentially an integer version of Barrier? | <p>Just like there exists binary and integer Semaphores, does the <strong>Event Counter</strong> play an integer version of a <strong>Barrier</strong>?</p>

<p>Event Counters are described in the paper</p>

<blockquote>
 <p>Reed, DP; Kanodia, RK: Synchronization with eventcounts and sequencers. <em... | terminology operating systems | 1 | Is an Event Counter essentially an integer version of Barrier? -- (terminology operating systems)
<p>Just like there exists binary and integer Semaphores, does the <strong>Event Counter</strong> play an integer version of a <strong>Barrier</strong>?</p>

<p>Event Counters are described in the paper</p>

... | habedi/stack-exchange-dataset |
14,799 | does godel's incompleteness theorem shed any light on dynamic vs typed languages? | <p>I'm clojure user myself. I'm trying really hard to learn haskell and to better understand the type system. However, I feel that trying to 'type' everything is quite restrictive when the problem or the data is less defined.</p>

<p>I intuitively feel that godel's incompleteness theorem offers some insight int... | type theory | 1 | does godel's incompleteness theorem shed any light on dynamic vs typed languages? -- (type theory)
<p>I'm clojure user myself. I'm trying really hard to learn haskell and to better understand the type system. However, I feel that trying to 'type' everything is quite restrictive when the problem or the data is less defi... | habedi/stack-exchange-dataset |
14,810 | One $O(n^k)$ algorithm requiring only one $O(2^n)$ computation (for all n instances) is P or NP | <p>Let $a$ one decision problem and $A$ one algorithm solving it in $O(n^k)$.</p>

<p>But, to construct $A_n$ we need to compute certain thing (strategy path, magic numbers, ...), we can compute that using certain general algorithm $R$ in $O(2^n)$.</p>

<p>Obiously, $A$ is polynomial (then, all $A_n$ ar... | complexity theory decision problem np | 1 | One $O(n^k)$ algorithm requiring only one $O(2^n)$ computation (for all n instances) is P or NP -- (complexity theory decision problem np)
<p>Let $a$ one decision problem and $A$ one algorithm solving it in $O(n^k)$.</p>

<p>But, to construct $A_n$ we need to compute certain thing (strategy path, magic numbers,... | habedi/stack-exchange-dataset |
14,814 | How do you say when a language is Turing-complete only in a trivial way? | <p>I didn't know how to ask this question before but now that I'm reading about typed lambda calculus I think I've got a better idea. </p>

<p>There is <a href="https://stackoverflow.com/a/5239256/1219414">this answer</a> to a question asking whether CSS is Turing complete or not (note that this question is NOT... | lambda calculus turing completeness | 1 | How do you say when a language is Turing-complete only in a trivial way? -- (lambda calculus turing completeness)
<p>I didn't know how to ask this question before but now that I'm reading about typed lambda calculus I think I've got a better idea. </p>

<p>There is <a href="https://stackoverflow.com/a/5239256/1... | habedi/stack-exchange-dataset |
14,817 | Number of 1 child nodes in a binary tree | <p>Does anybody know how would I approach calculating the maximum number of 1 child nodes (nodes that have exactly 1 child) in a binary tree with n nodes. Please don't give me the actual answer as this is one of the homework problems, I would like to solve it by myself, but I simply don't know where to start. Any help ... | binary trees | 1 | Number of 1 child nodes in a binary tree -- (binary trees)
<p>Does anybody know how would I approach calculating the maximum number of 1 child nodes (nodes that have exactly 1 child) in a binary tree with n nodes. Please don't give me the actual answer as this is one of the homework problems, I would like to solve it b... | habedi/stack-exchange-dataset |
14,826 | Performance of row- vs. column-wise matrix traversal | <p>Scott Meyers describes <a href="http://www.aristeia.com/TalkNotes/ACCU2011_CPUCaches.pdf" rel="nofollow">here</a> that traversing a symmetric matrix row-wise performes significantly better over traversing it column-wise - which is also significantly counter-intuitive. </p>

<p>The reasoning is connected with... | cpu cache performance | 1 | Performance of row- vs. column-wise matrix traversal -- (cpu cache performance)
<p>Scott Meyers describes <a href="http://www.aristeia.com/TalkNotes/ACCU2011_CPUCaches.pdf" rel="nofollow">here</a> that traversing a symmetric matrix row-wise performes significantly better over traversing it column-wise - which is also s... | habedi/stack-exchange-dataset |
14,833 | Is there a graph product that is multiplicative in independence number? | <p>I know that Stable set cannot be approximated to constant factor. I saw a simple proof using OR product sometime back. I am unable to recall it. If anyone here knows what I am talking about could help fill my memory, that will be helpful.</p>

<p>Is there a graph product $\cdot$ such that $\alpha(G\cdot G)=\... | complexity theory graphs | 1 | Is there a graph product that is multiplicative in independence number? -- (complexity theory graphs)
<p>I know that Stable set cannot be approximated to constant factor. I saw a simple proof using OR product sometime back. I am unable to recall it. If anyone here knows what I am talking about could help fill my memory... | habedi/stack-exchange-dataset |
14,837 | Regular expression for a string not containing a set of substrings | <p>I'm trying to figure out how to build a regular expression for a language that doesn't contain strings that contain $101$ or $001$. The alphabet is defined as $\{0, 1\}$. I'm stuck on trying to figure out the DFA. Any help would be appreciated.</p>
 | regular languages regular expressions | 1 | Regular expression for a string not containing a set of substrings -- (regular languages regular expressions)
<p>I'm trying to figure out how to build a regular expression for a language that doesn't contain strings that contain $101$ or $001$. The alphabet is defined as $\{0, 1\}$. I'm stuck on trying to figure out th... | habedi/stack-exchange-dataset |
14,839 | Running Floyd-Warshall algorithm on graph with negative cost cycle | <p>I am trying to find the answer to the following question for the Floyd-Warshall algorithm. Suppose Floyd-Warshall algorithm is run on a directed graph G in which every edge's length is either -1, 0, or 1. Suppose that G is strongly connected, with at least one u-v path for every pair u,v of vertices, and that G may ... | algorithms graphs shortest path | 1 | Running Floyd-Warshall algorithm on graph with negative cost cycle -- (algorithms graphs shortest path)
<p>I am trying to find the answer to the following question for the Floyd-Warshall algorithm. Suppose Floyd-Warshall algorithm is run on a directed graph G in which every edge's length is either -1, 0, or 1. Suppose ... | habedi/stack-exchange-dataset |
14,843 | Deriving the exact number of execution times | <p>So I'm studying for my data structures midterm and my professor gave out a sample midterm with the answers, but I'm having a hard time understanding one of the questions. </p>

<p>Here's a screen cap:</p>

<p><img src="https://i.stack.imgur.com/EPFBo.png" alt="enter image description here"></p>
&... | time complexity runtime analysis | 1 | Deriving the exact number of execution times -- (time complexity runtime analysis)
<p>So I'm studying for my data structures midterm and my professor gave out a sample midterm with the answers, but I'm having a hard time understanding one of the questions. </p>

<p>Here's a screen cap:</p>

<p><img src=... | habedi/stack-exchange-dataset |
14,845 | Finding asymptotic time complexity | <p>So I'm studying for a midterm and my professor put out a sample exam with the answers, and I'm stuck on one of the questions.</p>

<p><img src="https://i.stack.imgur.com/lexzm.png" alt="enter image description here"></p>

<p>The answer is <code>Big-O(n^2 log n)</code></p>

<p>Could someone sh... | time complexity asymptotics | 1 | Finding asymptotic time complexity -- (time complexity asymptotics)
<p>So I'm studying for a midterm and my professor put out a sample exam with the answers, and I'm stuck on one of the questions.</p>

<p><img src="https://i.stack.imgur.com/lexzm.png" alt="enter image description here"></p>

<p>The answ... | habedi/stack-exchange-dataset |
14,847 | CoNP and NPhard intersection | <p>Can a problem be both <em>NP-Hard</em> and <em>CoNP</em>?</p>

<p>Can a problem be both <em>NP</em> and <em>CoNP-Hard</em>?</p>
 | complexity theory | 1 | CoNP and NPhard intersection -- (complexity theory)
<p>Can a problem be both <em>NP-Hard</em> and <em>CoNP</em>?</p>

<p>Can a problem be both <em>NP</em> and <em>CoNP-Hard</em>?</p>
 | habedi/stack-exchange-dataset |
14,849 | Regular Expression as basis for creating this grammar | <p>I made a right-linear grammar from a regular expression:</p>

<p>The alphabet is:</p>

<p>$Σ = \{a, b, c\} $</p>

<p>Regular expression:</p>

<p>$r = cc^{*}(ba)^{*}bb$</p>

<p>My solution, it seems a little too short like I'm leaving something out. Maybe someone can see where ... | formal languages automata formal grammars regular expressions | 1 | Regular Expression as basis for creating this grammar -- (formal languages automata formal grammars regular expressions)
<p>I made a right-linear grammar from a regular expression:</p>

<p>The alphabet is:</p>

<p>$Σ = \{a, b, c\} $</p>

<p>Regular expression:</p>

<p>$r = cc^{*}(ba)^{*}... | habedi/stack-exchange-dataset |
14,852 | Reducing states of a GTG | <p>I used this generalized transition graph with 3 states and got an equivalent generalized
transition graph with 2 states:</p>

<p>GTG:</p>

<p><img src="https://i.stack.imgur.com/LSUfs.jpg" alt="enter image description here"></p>

<p>Equivalent with 2 states:</p>

<p><img src="http... | formal languages graphs automata formal grammars | 1 | Reducing states of a GTG -- (formal languages graphs automata formal grammars)
<p>I used this generalized transition graph with 3 states and got an equivalent generalized
transition graph with 2 states:</p>

<p>GTG:</p>

<p><img src="https://i.stack.imgur.com/LSUfs.jpg" alt="enter image description ... | habedi/stack-exchange-dataset |
14,853 | Writing a program to find polynomial $f(x)$ from $f(1)$ and $f(f(1))$ | <p>Let $f(x)=a_0+a_1x+a_2x^2+\dots+a_nx^n$, where $a_i\ge0$ and $a_i$ is integer.</p>

<p>Given $f(1)=p$ and $f(f(1))=q$, we have to find $a_0$, $a_1$, $a_2$, $a_3$, $\dots$, $a_n$, where such $f(x)$ exists. Or we have to confirm if such $f(x)$ exists or if the polynomial is ambiguous e.g. for $p=1$ and $q=2$, ... | mathematical programming polynomials | 1 | Writing a program to find polynomial $f(x)$ from $f(1)$ and $f(f(1))$ -- (mathematical programming polynomials)
<p>Let $f(x)=a_0+a_1x+a_2x^2+\dots+a_nx^n$, where $a_i\ge0$ and $a_i$ is integer.</p>

<p>Given $f(1)=p$ and $f(f(1))=q$, we have to find $a_0$, $a_1$, $a_2$, $a_3$, $\dots$, $a_n$, where such $f(x)$ ... | habedi/stack-exchange-dataset |
14,863 | Is this $\beta$-reduction well defined? | <p>Would it be possible to apply $(\lambda x.\lambda y. x)$ to the argument $y$? It seems to me that this must not be possible as it would give a different answer if applied to a constant, call it $\alpha$ and $y$. Namely:</p>

<p>$(\lambda x.\lambda y. x) \alpha = \alpha$</p>

<p>but </p>

<p>$... | programming languages lambda calculus term rewriting variable binding | 1 | Is this $\beta$-reduction well defined? -- (programming languages lambda calculus term rewriting variable binding)
<p>Would it be possible to apply $(\lambda x.\lambda y. x)$ to the argument $y$? It seems to me that this must not be possible as it would give a different answer if applied to a constant, call it $\alpha$... | habedi/stack-exchange-dataset |
14,864 | Big O Notation of $n^{0.999999}\log(n)$ | <p>I'm taking the MIT Open Courseware for Introduction to Algorithms and I'm having trouble understanding the first homework problem/solution.</p>

<p>We are supposed to compare the asymptotic complexity (big-O) for different functions:</p>

<p>$f_1(n) = n^{0.999999}\log(n)$<br>
$f_2(n) = 10000000n$... | algorithms asymptotics | 1 | Big O Notation of $n^{0.999999}\log(n)$ -- (algorithms asymptotics)
<p>I'm taking the MIT Open Courseware for Introduction to Algorithms and I'm having trouble understanding the first homework problem/solution.</p>

<p>We are supposed to compare the asymptotic complexity (big-O) for different functions:</p>
... | habedi/stack-exchange-dataset |
14,866 | Finding Statistical Signifigance for a Classifier | <p>I recently did work in the area of machine learning for one of my jobs and was able to build a classifier which evaluated to an F score of 85%. I also have access to correctly and incorrectly classified instances. My boss would like to make sure my classifier is good and and test it for statistical significance. I'm... | machine learning statistics classification | 1 | Finding Statistical Signifigance for a Classifier -- (machine learning statistics classification)
<p>I recently did work in the area of machine learning for one of my jobs and was able to build a classifier which evaluated to an F score of 85%. I also have access to correctly and incorrectly classified instances. My bo... | habedi/stack-exchange-dataset |
14,869 | Ternary Search Recurrence Relation | <p>I am trying to work out the recurrence relation for Ternary Search. This is what I came up with:</p>

<pre><code>C(n) = C(n/3) + 2
</code></pre>

<p>However, I talked to my professor and he said it's not correct. He says that we need to take all of their cases into account. This part confuses me ... | algorithms recurrence relation | 1 | Ternary Search Recurrence Relation -- (algorithms recurrence relation)
<p>I am trying to work out the recurrence relation for Ternary Search. This is what I came up with:</p>

<pre><code>C(n) = C(n/3) + 2
</code></pre>

<p>However, I talked to my professor and he said it's not correct. He says that ... | habedi/stack-exchange-dataset |
14,880 | What is the asymptotic runtime of this nested loop? | <p>I am trying to analyse the runtime of this algorithm:</p>



<pre><code>for(i=1; i < n; i++){
 for(j=1; j <= i; j++){
 statement1;
 } 
}
</code></pre>

<p>Expanding the above loop into.</p>

<ul>
<li><p>First : </p>

 

... | algorithm analysis runtime analysis loops | 1 | What is the asymptotic runtime of this nested loop? -- (algorithm analysis runtime analysis loops)
<p>I am trying to analyse the runtime of this algorithm:</p>



<pre><code>for(i=1; i < n; i++){
 for(j=1; j <= i; j++){
 statement1;
 } 
}
</code></pre>
&#x... | habedi/stack-exchange-dataset |
14,882 | result after applying on delete cascade | <p>In this table B is foreign key referring to the primary key A with on delete cascade option.What will be the result after deleting (4,3) and how
A:1 4 2 9 3 5
B:3 3 4 2 9 4</p>
 | databases | 1 | result after applying on delete cascade -- (databases)
<p>In this table B is foreign key referring to the primary key A with on delete cascade option.What will be the result after deleting (4,3) and how
A:1 4 2 9 3 5
B:3 3 4 2 9 4</p>
 | habedi/stack-exchange-dataset |
14,900 | Derive a Context Free Grammar from a language | <p>I am having challenges (in two phases) with creating a CFG.</p>

<ol>
<li>Derive the CFG for the following language </li>
<li>Show parse trees for the strings <em>cacab</em> and <em>aacabbb</em> obtained from the grammar designed above.</li>
</ol>

<p>I am getting a bit mixed up by the ex... | context free formal grammars tree grammars | 1 | Derive a Context Free Grammar from a language -- (context free formal grammars tree grammars)
<p>I am having challenges (in two phases) with creating a CFG.</p>

<ol>
<li>Derive the CFG for the following language </li>
<li>Show parse trees for the strings <em>cacab</em> and <em>aacabbb</em> obtained fro... | habedi/stack-exchange-dataset |
14,901 | How to reduce the number of crossing edges in a diagram? | <p>I am working on a diagram editor.
Diagrams display 2D shapes (<em>nodes</em>) connected with connectors (<em>edges</em>).</p>

<p>I'd like to add an operation that, given a selection of nodes, <em>"disentangles"</em> them: it repositions them to reduce the number of crossing edges, if possible
(and i... | algorithms graphs graph algorithms crossing number | 1 | How to reduce the number of crossing edges in a diagram? -- (algorithms graphs graph algorithms crossing number)
<p>I am working on a diagram editor.
Diagrams display 2D shapes (<em>nodes</em>) connected with connectors (<em>edges</em>).</p>

<p>I'd like to add an operation that, given a selection of nodes,... | habedi/stack-exchange-dataset |
14,905 | Is it possible to do Dependent Types in Typed Racket? | <p>Is it possible to use <a href="http://en.wikipedia.org/wiki/Dependent_type" rel="noreferrer">Dependent Types</a> in the existing <a href="http://docs.racket-lang.org/ts-guide/" rel="noreferrer">Typed Racket</a> implementation? (ie do they exist in it?)</p>

<p>Is it reasonably possible to implement a Depende... | programming languages typing type checking dependent types lisp | 1 | Is it possible to do Dependent Types in Typed Racket? -- (programming languages typing type checking dependent types lisp)
<p>Is it possible to use <a href="http://en.wikipedia.org/wiki/Dependent_type" rel="noreferrer">Dependent Types</a> in the existing <a href="http://docs.racket-lang.org/ts-guide/" rel="noreferrer">... | habedi/stack-exchange-dataset |
14,908 | DFA/NFA/ε-NFA: subsetting each other or different sets? | <p>I know that an ε-NFA (NFA with epsilon transitions) is not an NFA or a DFA and an NFA is not a DFA.</p>

<p>HOWEVER, say you have a complete DFA. Isn't that theoretically an NFA and an ε-NFA? Just because it doesn't have ε transitions, does it mean it is not ε-NFA? If a question asks you to turn a DFA into a... | formal languages automata finite automata | 1 | DFA/NFA/ε-NFA: subsetting each other or different sets? -- (formal languages automata finite automata)
<p>I know that an ε-NFA (NFA with epsilon transitions) is not an NFA or a DFA and an NFA is not a DFA.</p>

<p>HOWEVER, say you have a complete DFA. Isn't that theoretically an NFA and an ε-NFA? Just because i... | habedi/stack-exchange-dataset |
14,918 | Maximizing length of subsequence | <p>Given a sequence $(a)$ of lenght $n$, such $a_1 = a_n = 1$ and $a_i \in \left \{ -1, 1 \right\}$. </p>

<p>We want to find a subsequence $(b) \subset (a)$ which statisfies the following conditions: </p>

<ul>
<li>The length of $(b)$, (let's call it $k$) is the largest possible</li>
<li>$b_k... | algorithms algorithm analysis | 1 | Maximizing length of subsequence -- (algorithms algorithm analysis)
<p>Given a sequence $(a)$ of lenght $n$, such $a_1 = a_n = 1$ and $a_i \in \left \{ -1, 1 \right\}$. </p>

<p>We want to find a subsequence $(b) \subset (a)$ which statisfies the following conditions: </p>

<ul>
<li>The length of ... | habedi/stack-exchange-dataset |
14,927 | Proving a PDA with CFG Transitions recognizes Context Free Languages | <p>I'm working on a proof that deals with a modified PDA, which is identitical to a PDA, but with transitions: \begin{equation*}
a,b \to c
\end{equation*} where $a$ is a context free grammar, instead of just a symbol. The modified PDA then reads a prefix $w'$ of $w$, the suffix of the input stream, where $w' \i... | formal languages automata | 1 | Proving a PDA with CFG Transitions recognizes Context Free Languages -- (formal languages automata)
<p>I'm working on a proof that deals with a modified PDA, which is identitical to a PDA, but with transitions: \begin{equation*}
a,b \to c
\end{equation*} where $a$ is a context free grammar, instead of just a sy... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.