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 |
|---|---|---|---|---|---|---|
87,894 | Bin packing with item weight constraint | <p>In the bin packing problem, we are given a set of items I={a1,...,an}, each item with weight w_a1,...,w_an, and a set of n bins with B={b1,..., bn} all bins with capacity C. I want to restrict the weights of the items to be polynomial in n. Is the problem still being NP-hard (restricting the weight of the items)?</p... | np hard packing | 1 | Bin packing with item weight constraint -- (np hard packing)
<p>In the bin packing problem, we are given a set of items I={a1,...,an}, each item with weight w_a1,...,w_an, and a set of n bins with B={b1,..., bn} all bins with capacity C. I want to restrict the weights of the items to be polynomial in n. Is the problem ... | habedi/stack-exchange-dataset |
87,895 | What is a logical approach to developing an algorithm which can find the optimal parameters for a function which make it best fit a given data set? | <p>Consider the highlighted columns in the following table:</p>

<p><a href="https://i.stack.imgur.com/dHd9D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dHd9D.png" alt="life table"></a></p>

<p>Starting with 100,000 newborns, $l_{x+2}$ denotes the number of individuals in the samp... | optimization modelling numerical analysis | 1 | What is a logical approach to developing an algorithm which can find the optimal parameters for a function which make it best fit a given data set? -- (optimization modelling numerical analysis)
<p>Consider the highlighted columns in the following table:</p>

<p><a href="https://i.stack.imgur.com/dHd9D.png" rel... | habedi/stack-exchange-dataset |
87,900 | Is this problem about picking optimal entries of a matrix NP-complete? | <p>I am trying to solve a real-world problem that I was able to reduce to the problem described below. I would like to know the following things:</p>

<ol>
<li>Is there literature about this problem?</li>
<li>Is the corresponding decision problem NP-complete?</li>
<li>Do you know an efficient algori... | optimization np complete | 1 | Is this problem about picking optimal entries of a matrix NP-complete? -- (optimization np complete)
<p>I am trying to solve a real-world problem that I was able to reduce to the problem described below. I would like to know the following things:</p>

<ol>
<li>Is there literature about this problem?</li>&#x... | habedi/stack-exchange-dataset |
87,902 | Efficient way to get integral points of segment from two points in grid | <p>I have two lattice (grid) end points of the line, how can I generate intermediate points of the line segment between them?<br>
One way is iterate through all the x points or y points and check (solve line equation) if the coordinates we get each time are integral solution or not.</p>
 | algorithms computational geometry | 1 | Efficient way to get integral points of segment from two points in grid -- (algorithms computational geometry)
<p>I have two lattice (grid) end points of the line, how can I generate intermediate points of the line segment between them?<br>
One way is iterate through all the x points or y points and check (solve li... | habedi/stack-exchange-dataset |
87,906 | Computational Complexity of Promise Monotone 1 in 3 SAT | <p>Given a 3SAT problem where each clause is a Monotone Clause (i.e. each clause with all positive or negative literals).</p>

<p>Moreover, we are promised that each solution for the above SAT problem (if any exists at all) will be of the form 1 in 3 SAT. </p>

<p>Monotone 1 in 3 SAT is NP Complete, but... | complexity theory np complete | 1 | Computational Complexity of Promise Monotone 1 in 3 SAT -- (complexity theory np complete)
<p>Given a 3SAT problem where each clause is a Monotone Clause (i.e. each clause with all positive or negative literals).</p>

<p>Moreover, we are promised that each solution for the above SAT problem (if any exists at al... | habedi/stack-exchange-dataset |
87,921 | How to find kth largest element in (max) priority queue in O(m) time? | <p>Here is my exercise.</p>

<blockquote>
 <p>FINDLARGEST(k): return the elements in the heap with key >=k" ... "expand the priority queue (max-heap) so that it supports FINDLARGEST(k) in O(m) time, where m is the number of elements with key>=k.</p>
</blockquote>

<p>Can anyone elaborate on thi... | asymptotics heaps selection problem | 1 | How to find kth largest element in (max) priority queue in O(m) time? -- (asymptotics heaps selection problem)
<p>Here is my exercise.</p>

<blockquote>
 <p>FINDLARGEST(k): return the elements in the heap with key >=k" ... "expand the priority queue (max-heap) so that it supports FINDLARGEST(k) in O(m) tim... | habedi/stack-exchange-dataset |
87,925 | Bottom-up algorithm to build subset of maximum weight | <p>I have this problem of obtaining a subset of maximum weight from a given array of size n (the i-th element is the weigth of the item i) - lets call it P. The only restriction is defined by an array R of size n: for each j in R[i] we have that the subset can not contain both P[i] and P[j].
How do I build a DP bo... | dynamic programming | 1 | Bottom-up algorithm to build subset of maximum weight -- (dynamic programming)
<p>I have this problem of obtaining a subset of maximum weight from a given array of size n (the i-th element is the weigth of the item i) - lets call it P. The only restriction is defined by an array R of size n: for each j in R[i] we have ... | habedi/stack-exchange-dataset |
87,928 | Implementation/translation of the $s^1_1$ | <p>This is the Lisp code (from <a href="https://en.wikipedia.org/wiki/Smn_theorem" rel="nofollow noreferrer">wikipedia</a>) that implements the $s^1_1$ form of the $s^m_n$ theorem</p>

<pre><code>(defun s11 (f x)
 (let ((y (gensym)))
 (list 'lambda (list y) (list f x y))))
</code></pre>
&#... | computability | 1 | Implementation/translation of the $s^1_1$ -- (computability)
<p>This is the Lisp code (from <a href="https://en.wikipedia.org/wiki/Smn_theorem" rel="nofollow noreferrer">wikipedia</a>) that implements the $s^1_1$ form of the $s^m_n$ theorem</p>

<pre><code>(defun s11 (f x)
 (let ((y (gensym)))
 (l... | habedi/stack-exchange-dataset |
87,931 | Why are the control statements[if-else, while, for] commonly used in programming? | <p>One simple question I've never been able to answer is, "why use 'for', 'while', and 'if' as control statements?"</p>

<p>Could someone please elucidate the rationale behind using the above mentioned control statements, that have been embraced by most, if not all, high-level languages. I believe this has some... | programming languages | 1 | Why are the control statements[if-else, while, for] commonly used in programming? -- (programming languages)
<p>One simple question I've never been able to answer is, "why use 'for', 'while', and 'if' as control statements?"</p>

<p>Could someone please elucidate the rationale behind using the above mentioned c... | habedi/stack-exchange-dataset |
87,943 | What is the difference between Simulated Annealing and Monte-Carlo Simulations? | <p>What is the difference between Simulated Annealing and Monte-Carlo Simulations? Is Simulated Annealing a specific type of Monte-Carlo simulation, or are they completely separate techniques?</p>
 | randomized algorithms simulation monte carlo | 1 | What is the difference between Simulated Annealing and Monte-Carlo Simulations? -- (randomized algorithms simulation monte carlo)
<p>What is the difference between Simulated Annealing and Monte-Carlo Simulations? Is Simulated Annealing a specific type of Monte-Carlo simulation, or are they completely separate technique... | habedi/stack-exchange-dataset |
87,944 | How can I detect carry and overflow | <p>What is the diffrence between a <strong>carry</strong> bit and <em>overflow</em></p>
 | computer architecture | 1 | How can I detect carry and overflow -- (computer architecture)
<p>What is the diffrence between a <strong>carry</strong> bit and <em>overflow</em></p>
 | habedi/stack-exchange-dataset |
87,947 | Does PDA epsilon transition only transition when there's no more input? | <p>For the Pushdown Automata episilon transition $\epsilon$ which is shorthand for $\epsilon; \epsilon / \epsilon$, does this mean that at any point, regargless of if there is input or not, you can transition to the next state? Or does it only transition to the next state when there is no more input?</p>
 | finite automata pushdown automata | 1 | Does PDA epsilon transition only transition when there's no more input? -- (finite automata pushdown automata)
<p>For the Pushdown Automata episilon transition $\epsilon$ which is shorthand for $\epsilon; \epsilon / \epsilon$, does this mean that at any point, regargless of if there is input or not, you can transition ... | habedi/stack-exchange-dataset |
87,970 | Master theorem with $T(n) = 6T(n/10) + \lg^2 n$ | <p>So I think this falls under case 1...but I am not sure how to formally prove that $n^{lg_{10} 6}$ is asymptotically greater than $\lg^2 n$. I tried using L'hopitals but kinda reached a dead end. Here's what i have so far</p>

<p>$$\lim_{n \rightarrow \infty} \frac{d(\lg^2 n)}{d(n^{\lg_{10}6})} = \frac{2 \lg ... | recurrence relation master theorem | 1 | Master theorem with $T(n) = 6T(n/10) + \lg^2 n$ -- (recurrence relation master theorem)
<p>So I think this falls under case 1...but I am not sure how to formally prove that $n^{lg_{10} 6}$ is asymptotically greater than $\lg^2 n$. I tried using L'hopitals but kinda reached a dead end. Here's what i have so far</p>
... | habedi/stack-exchange-dataset |
87,971 | A general question on NP class problem | <p>I read the paper <a href="http://ieeexplore.ieee.org/document/6121421/" rel="nofollow noreferrer"><em>Certification-Cognizant Time-Triggered Scheduling of Mixed-Criticality Systems</em></a> (Baruah and Fohler, in <em>Proceedings of 32nd IEEE Real Time Systems Symposium</em>, 2011; see Section 6) which proves a ... | algorithms algorithm analysis np complete | 1 | A general question on NP class problem -- (algorithms algorithm analysis np complete)
<p>I read the paper <a href="http://ieeexplore.ieee.org/document/6121421/" rel="nofollow noreferrer"><em>Certification-Cognizant Time-Triggered Scheduling of Mixed-Criticality Systems</em></a> (Baruah and Fohler, in <em>Proceedings of... | habedi/stack-exchange-dataset |
87,977 | Implementing mathematical theory of arithmetic in Haskell via Curry-Howard correspondence | <p>I have to ask for forgiveness in advance if the whole question doesn't
make a lot of sense, but unfortunately, I have no better intuition as
of right now and this seems like the best starting point I could come
up with.</p>

<p>I'm reading Tarski's book "Introduction to Logic: and to the
Meth... | logic propositional logic curry howard haskell | 1 | Implementing mathematical theory of arithmetic in Haskell via Curry-Howard correspondence -- (logic propositional logic curry howard haskell)
<p>I have to ask for forgiveness in advance if the whole question doesn't
make a lot of sense, but unfortunately, I have no better intuition as
of right now and this seem... | habedi/stack-exchange-dataset |
87,989 | Prove that Big-O is transitive by relation. What does it mean by 'by relation'? | <p>Prove $f(n) = O(g(n))$ and $g(n) = O(h(n))$, then $f(n) = O(h(n))$.</p>

<p>The question is </p>

<blockquote>
 <p>Prove that Big-O is transitive <strong>by relation.</strong> </p>
</blockquote>

<p>What does it mean by <code>by relation</code>??</p>
 | algorithms proof techniques | 1 | Prove that Big-O is transitive by relation. What does it mean by 'by relation'? -- (algorithms proof techniques)
<p>Prove $f(n) = O(g(n))$ and $g(n) = O(h(n))$, then $f(n) = O(h(n))$.</p>

<p>The question is </p>

<blockquote>
 <p>Prove that Big-O is transitive <strong>by relation.</strong> </p>&#x... | habedi/stack-exchange-dataset |
87,992 | Median of Medians Recurrence Relation for 3-grouping | <p>So I am trying to figure out the recurrence relation for the median of medians algorithm using groups of 3 instead of groups of 5. Per CLRS's method, my recurrence relation looks like </p>

<p>$$
T(n) = T(\lceil \frac{n}{3} \rceil) + T(\frac{2n}{3} + 4) + c_1n
$$</p>

<p>And I want to show $T... | algorithms recurrence relation selection problem | 1 | Median of Medians Recurrence Relation for 3-grouping -- (algorithms recurrence relation selection problem)
<p>So I am trying to figure out the recurrence relation for the median of medians algorithm using groups of 3 instead of groups of 5. Per CLRS's method, my recurrence relation looks like </p>

<p>$$
T(... | habedi/stack-exchange-dataset |
87,993 | Example of non extensible functions ( $f(x) \notin EXT $) for reduction | <p>This is the definition of $EXT = \{x\ | \varphi_x\ can\ be\ extended\ to\ a\ total\ computable\ function \}$. I'm trying to proof that $\overline{K} \le_{rec} EXP$ and I can't think of an example of a function that can't be extended</p>
 | computability reductions | 1 | Example of non extensible functions ( $f(x) \notin EXT $) for reduction -- (computability reductions)
<p>This is the definition of $EXT = \{x\ | \varphi_x\ can\ be\ extended\ to\ a\ total\ computable\ function \}$. I'm trying to proof that $\overline{K} \le_{rec} EXP$ and I can't think of an example of a function that ... | habedi/stack-exchange-dataset |
87,994 | Implementing SUM(i,j) and CHANGE(i,j) in O(log(n)) using a datastructure with O(n) space complexity | <p>I have two operations:</p>

<p>$Sum(i,j)$ : Calculate $A[i]+A[i+1]+....+A[j]$</p>

<p>$Change(i,x)$: Set $A[i]=x$</p>

<p>I need to implement these operations in an appropriate data structure using $O(n)$ space ($n$ is the length of the input array $A$).</p>

<p>The $Sum(i,j)$ procedu... | data structures time complexity heaps subsequences | 1 | Implementing SUM(i,j) and CHANGE(i,j) in O(log(n)) using a datastructure with O(n) space complexity -- (data structures time complexity heaps subsequences)
<p>I have two operations:</p>

<p>$Sum(i,j)$ : Calculate $A[i]+A[i+1]+....+A[j]$</p>

<p>$Change(i,x)$: Set $A[i]=x$</p>

<p>I need to imple... | habedi/stack-exchange-dataset |
87,997 | Online Set Filling | <p>Suppose we have 3 sets $A, B, C$ which can can hold a maximum of <strong>two</strong> elements, each. So the total number of elements that the sets can hold together i.e. total capacity (TC) is $ 3*2 = 6$.</p>

<p>Now, elements arrive serially (one-by-one) with some properties that impose the following const... | algorithms combinatorics online algorithms | 1 | Online Set Filling -- (algorithms combinatorics online algorithms)
<p>Suppose we have 3 sets $A, B, C$ which can can hold a maximum of <strong>two</strong> elements, each. So the total number of elements that the sets can hold together i.e. total capacity (TC) is $ 3*2 = 6$.</p>

<p>Now, elements arrive seriall... | habedi/stack-exchange-dataset |
88,003 | Avoiding loops in Bellman-Ford algorithm | <p>If you apply standard Bellman-Ford algorithm to a graph containing negative loop it can only report its existence. Are there approaches to modify it to find shortest path containing any vertex not more than once so effectively avoiding loops? I would appreciate if an answer will contain a link to a paper.</p>
 | algorithms graphs shortest path weighted graphs | 1 | Avoiding loops in Bellman-Ford algorithm -- (algorithms graphs shortest path weighted graphs)
<p>If you apply standard Bellman-Ford algorithm to a graph containing negative loop it can only report its existence. Are there approaches to modify it to find shortest path containing any vertex not more than once so effectiv... | habedi/stack-exchange-dataset |
88,009 | Computation of discrete logarithm | <p>I know that an equation 
$$a^x \equiv b \pmod{p}$$ 
can be solved for $x$ in $O(\sqrt{p} \ log(p) )$ time using meet-in-the-middle technique, which relies on fact that we can rewrite the equation as follows: 
$$a^{nk} \equiv ba^{h} \pmod{p},$$ where $nk - h = x$. </p>

<p>I want to know whether o... | algorithms cryptography number theory | 1 | Computation of discrete logarithm -- (algorithms cryptography number theory)
<p>I know that an equation 
$$a^x \equiv b \pmod{p}$$ 
can be solved for $x$ in $O(\sqrt{p} \ log(p) )$ time using meet-in-the-middle technique, which relies on fact that we can rewrite the equation as follows: 
$$a^{nk} \equiv ba^... | habedi/stack-exchange-dataset |
88,020 | Is the intersection of infinitely many recursive sets recursive? | <p>Is the intersection of infinitely many recursive sets $\bigcap_{i}U_{i}$ (where each set is different ) recursive? Recursively enumerable? 
I know the union need not be recursive, because deciding if an element is in the set $U_i$ is the same as deciding the Halting Problem since you for each element you'll have... | computability sets | 1 | Is the intersection of infinitely many recursive sets recursive? -- (computability sets)
<p>Is the intersection of infinitely many recursive sets $\bigcap_{i}U_{i}$ (where each set is different ) recursive? Recursively enumerable? 
I know the union need not be recursive, because deciding if an element is in the set... | habedi/stack-exchange-dataset |
88,022 | Remove parallel edges in a directed graph in linear time | <p>Is there a $O(|V|+|E|)$ algorithm to find and remove all parallel edges in a directed graph? I'm stuck because each idea I've thought of boils down to $deg(v)^2$ comparisons per $v$ which is of course not linear.</p>

<p>Thanks.</p>
 | algorithms graphs | 1 | Remove parallel edges in a directed graph in linear time -- (algorithms graphs)
<p>Is there a $O(|V|+|E|)$ algorithm to find and remove all parallel edges in a directed graph? I'm stuck because each idea I've thought of boils down to $deg(v)^2$ comparisons per $v$ which is of course not linear.</p>

<p>Thanks.<... | habedi/stack-exchange-dataset |
88,031 | Could a scientist make money off of the P vs. NP solution? | <p>If someone solved the P vs. NP problem, would they be able to keep it a secret and make money off of it by, say, starting a software or security company? Or would they only be able to publish it for everyone to know? </p>

<p>Also, would that person (realistically) be at risk of being kidnapped, tortured, ... | complexity theory p vs np | 1 | Could a scientist make money off of the P vs. NP solution? -- (complexity theory p vs np)
<p>If someone solved the P vs. NP problem, would they be able to keep it a secret and make money off of it by, say, starting a software or security company? Or would they only be able to publish it for everyone to know? </p>
... | habedi/stack-exchange-dataset |
88,036 | L = { <M>, M is a DFA accepting all strings except finitely many | <p>Is the $L$ = { $<M>$, $M$ is a DFA accepting all strings except finitely many. }
decidable ?<br><br> I am sort of confused about the question - what exactly does $M$ accept. How are those finitely many strings look like for a particular $DFA$? It is known that $DFA$ accepts infinite number of strings if it... | turing machines undecidability | 1 | L = { <M>, M is a DFA accepting all strings except finitely many -- (turing machines undecidability)
<p>Is the $L$ = { $<M>$, $M$ is a DFA accepting all strings except finitely many. }
decidable ?<br><br> I am sort of confused about the question - what exactly does $M$ accept. How are those finitely many stri... | habedi/stack-exchange-dataset |
88,044 | How to do compare-and-increment different locations with in memory MVCC? | <p>I'm reading the paper <a href="https://www.cs.cmu.edu/~jarulraj/papers/2017.mvcc.vldb.pdf" rel="nofollow noreferrer">An Empirical Evaluation of
In-Memory Multi-Version Concurrency Control</a> which is about implementations of MVCC for in-memory databases. <strong>Section 3.3</strong> on <strong>Two-phase Locking... | concurrency database theory databases | 1 | How to do compare-and-increment different locations with in memory MVCC? -- (concurrency database theory databases)
<p>I'm reading the paper <a href="https://www.cs.cmu.edu/~jarulraj/papers/2017.mvcc.vldb.pdf" rel="nofollow noreferrer">An Empirical Evaluation of
In-Memory Multi-Version Concurrency Control</a> which... | habedi/stack-exchange-dataset |
88,057 | Why is the unit of image size not Pixel²? | <p>If you calculate the area of a rectangle, you just multiply the height and the width and get back the unit squared.
Example:
5cm * 10cm = 50cm²</p>

<p>In contrast, if you calculate the size of an image, you also multiply the height and the width, but you get back the unit - Pixel - just as it was th... | terminology | 1 | Why is the unit of image size not Pixel²? -- (terminology)
<p>If you calculate the area of a rectangle, you just multiply the height and the width and get back the unit squared.
Example:
5cm * 10cm = 50cm²</p>

<p>In contrast, if you calculate the size of an image, you also multiply the height and the w... | habedi/stack-exchange-dataset |
88,077 | Agda: Which part does this type introduce universe inconsistency? | <p>I was trying to prove following lemma,</p>

<pre><code> my_thm : ¬ (∀ {M : Set} (P Q : M → M → Set) →
 (∀ x → ∃ M , λ y → P x y ∨ Q x y) →
 (∀ x → ∃ M , P x) ∨ (∀ x → ∃ M , Q x))
 my_thm = ?
</code></pre>

<p>while Agda gives following mistake:</p>

<pre><code>Set₁ != ... | type theory proof assistants | 1 | Agda: Which part does this type introduce universe inconsistency? -- (type theory proof assistants)
<p>I was trying to prove following lemma,</p>

<pre><code> my_thm : ¬ (∀ {M : Set} (P Q : M → M → Set) →
 (∀ x → ∃ M , λ y → P x y ∨ Q x y) →
 (∀ x → ∃ M , P x) ∨ (∀ x → ∃ M , Q x))
 my_thm = ... | habedi/stack-exchange-dataset |
88,080 | Find all the cumulative sums in a DAG | <p>Let's call G a DAG (directed acyclic graph) with N nodes labeled with a natural value.</p>

<p>We define the cumulative sum of a node v as the sum of the value of all the ancestor nodes of v (including v).</p>

<p>For example, the cumulative sum of d in the following DAG is 7:</p>

<pre><code... | algorithms graphs time complexity dynamic programming | 1 | Find all the cumulative sums in a DAG -- (algorithms graphs time complexity dynamic programming)
<p>Let's call G a DAG (directed acyclic graph) with N nodes labeled with a natural value.</p>

<p>We define the cumulative sum of a node v as the sum of the value of all the ancestor nodes of v (including v).</p>&#x... | habedi/stack-exchange-dataset |
88,083 | How is ReLU used in machine learning functions | <p>I've seen how sigmoid would be used in machine learning</p>

<pre><code>sigmoid(dot(activations, weights)-bias)
</code></pre>

<p>like this ^</p>

<p>but sigmoid makes sure your values are between 0 and 1.
So how would ReLU ( max(0,x) ) be swapped out for sigmoid, if it doesn't clamp ... | machine learning python c++ | 1 | How is ReLU used in machine learning functions -- (machine learning python c++)
<p>I've seen how sigmoid would be used in machine learning</p>

<pre><code>sigmoid(dot(activations, weights)-bias)
</code></pre>

<p>like this ^</p>

<p>but sigmoid makes sure your values are between 0 and 1.
... | habedi/stack-exchange-dataset |
88,088 | DFAs that must reach a certain state at least once | <p>I was given this question:</p>

<blockquote>
 <p>Let M = (Q,Σ, δ, q0, F) be a deterministic finite automaton. Assume that r∈Q is a state of M that is different from the start state q0. </p>
 
 <p>Define the language A⊆Σ* to be the language consisting of all strings that are accepted by M and c... | automata finite automata regular expressions | 1 | DFAs that must reach a certain state at least once -- (automata finite automata regular expressions)
<p>I was given this question:</p>

<blockquote>
 <p>Let M = (Q,Σ, δ, q0, F) be a deterministic finite automaton. Assume that r∈Q is a state of M that is different from the start state q0. </p>
 
 ... | habedi/stack-exchange-dataset |
88,096 | Control of the combinatorial aspects of a dynamic programming solution | <p>I am exploring how a Dynamic Programming design approach relates to the underlying combinatorial properties of problems.</p>

<p>For this, I am looking at the canonical instance of the <strong>coin exchange problem</strong>: Let <code>S = [d_1, d_2, ..., d_m]</code> and <code>n > 0</code> be a requested a... | combinatorics dynamic programming python memoization | 1 | Control of the combinatorial aspects of a dynamic programming solution -- (combinatorics dynamic programming python memoization)
<p>I am exploring how a Dynamic Programming design approach relates to the underlying combinatorial properties of problems.</p>

<p>For this, I am looking at the canonical instance of... | habedi/stack-exchange-dataset |
88,097 | What is the maximum possible degrees of a vertex of an MST | <p>What is the number that a minimum spanning tree can have a vertex with degree at most? Is there any rule? Is it related to the number of vertex or edge? Or not?</p>
 | graphs minimum spanning tree | 1 | What is the maximum possible degrees of a vertex of an MST -- (graphs minimum spanning tree)
<p>What is the number that a minimum spanning tree can have a vertex with degree at most? Is there any rule? Is it related to the number of vertex or edge? Or not?</p>
 | habedi/stack-exchange-dataset |
88,115 | Analysis of the Banana Game | <p>My computer science professor introduced an interesting game in order to get us (his students) more familiar with the Stack and Queue ADTs.</p>

<h2>Game Description</h2>

<p>The banana game is played with a container -- e.g., a queue or a stack. The object of the game is to find a sequence of steps ... | algorithms game theory stacks queues towers of hanoi | 1 | Analysis of the Banana Game -- (algorithms game theory stacks queues towers of hanoi)
<p>My computer science professor introduced an interesting game in order to get us (his students) more familiar with the Stack and Queue ADTs.</p>

<h2>Game Description</h2>

<p>The banana game is played with a contain... | habedi/stack-exchange-dataset |
88,116 | context free grammar not closed under relative complement using product construction of pda and dfa | <p>Hello friends need a bit of help,</p>

<p>I Know that </p>

<p>given: $$L_1 \in L_{cfg}, L_2 \in L_{reg}$$ $$L_2/L_1\notin L_{cfg}$$ 
because if it was contex free it would imply that $L_{cfg} $ is closed under complement and this is not true.
But at another glance I can build a product const... | automata finite automata pushdown automata closure properties | 1 | context free grammar not closed under relative complement using product construction of pda and dfa -- (automata finite automata pushdown automata closure properties)
<p>Hello friends need a bit of help,</p>

<p>I Know that </p>

<p>given: $$L_1 \in L_{cfg}, L_2 \in L_{reg}$$ $$L_2/L_1\notin L_{cfg}$$ &... | habedi/stack-exchange-dataset |
88,127 | Can the following O(...) expression be simplified? | <p>I have an algorithm with three variables affecting the time complexity: $k$, $L$, and $n$. I have come up with the following that expresses the complexity:</p>

<p>$O(kn + k^2L + k^2nL + knL)$</p>

<p>I think I should be able to simplify this to:</p>

<p>$O(k^2nL)$</p>

<p>Am I correc... | asymptotics landau notation | 1 | Can the following O(...) expression be simplified? -- (asymptotics landau notation)
<p>I have an algorithm with three variables affecting the time complexity: $k$, $L$, and $n$. I have come up with the following that expresses the complexity:</p>

<p>$O(kn + k^2L + k^2nL + knL)$</p>

<p>I think I should... | habedi/stack-exchange-dataset |
88,145 | Proving correctness of an iterative Fibonacci algorithm | <p>One of the questions in the problem sets that I'm struggling in is this specific number that asks me to prove an iterative Fibonacci algorithm. The algorithm is written below:</p>

<pre><code>function fib(n)
 if n = 0 then
 return(0)
 else
 a = 0; b = 1; i = 2;
 ... | algorithms algorithm analysis proof techniques correctness proof loop invariants | 1 | Proving correctness of an iterative Fibonacci algorithm -- (algorithms algorithm analysis proof techniques correctness proof loop invariants)
<p>One of the questions in the problem sets that I'm struggling in is this specific number that asks me to prove an iterative Fibonacci algorithm. The algorithm is written below:... | habedi/stack-exchange-dataset |
88,155 | Bipartite Perfect Matching "Assignment Problem" - finding an assignment of a particular weight | <p>The <a href="https://en.wikipedia.org/wiki/Assignment_problem" rel="nofollow noreferrer">assignment problem</a> is to find the minimum weight perfect matching in a weighted bipartite graph. This problem can be solved using the <a href="https://en.wikipedia.org/wiki/Hungarian_algorithm" rel="nofollow noreferrer">Hung... | graphs linear programming enumeration bipartite matching assignment problem | 1 | Bipartite Perfect Matching "Assignment Problem" - finding an assignment of a particular weight -- (graphs linear programming enumeration bipartite matching assignment problem)
<p>The <a href="https://en.wikipedia.org/wiki/Assignment_problem" rel="nofollow noreferrer">assignment problem</a> is to find the minimum weight... | habedi/stack-exchange-dataset |
88,156 | Prove by reduction EVEN TM is undecidable | <pre><code>Reduction from ATM.
Assume that EVEN TM is decidable with decider MT.
We now show how to build, given a ⟨M, w⟩ a machine description ⟨M'⟩ that satisfies the following faithfulness condition.
If M accepts w then M' accepts every even-length string
If M does not accept w then M' does not accept... | turing machines computability undecidability | 1 | Prove by reduction EVEN TM is undecidable -- (turing machines computability undecidability)
<pre><code>Reduction from ATM.
Assume that EVEN TM is decidable with decider MT.
We now show how to build, given a ⟨M, w⟩ a machine description ⟨M'⟩ that satisfies the following faithfulness condition.
If M accepts w... | habedi/stack-exchange-dataset |
88,170 | Deterministic algorithm to find number of collisions | <p>Let $h:U \to[m]=\{0,1,\dots,m\}$ be hash function, which can calculate $h(u), \forall u\in U$ in $O(1).$</p>

<p>Let $D \subseteq U$ be a subset of size $n.$</p>

<p>I'm looking for a deterministic algorithm, efficient as possible, to find the number of collisions of $h$ on $D$</p>

<p>I thou... | algorithms data structures hash | 1 | Deterministic algorithm to find number of collisions -- (algorithms data structures hash)
<p>Let $h:U \to[m]=\{0,1,\dots,m\}$ be hash function, which can calculate $h(u), \forall u\in U$ in $O(1).$</p>

<p>Let $D \subseteq U$ be a subset of size $n.$</p>

<p>I'm looking for a deterministic algorithm, ef... | habedi/stack-exchange-dataset |
88,176 | Can three regular languages be concatenated? | <p>I can't seem to find anything about this and I wonder if I'm asking a silly question.</p>

<blockquote>
 <p>If you have three languages $L_1=\{a,b\}, L_2=\{c,d\}, L_3 =\{e,f\}$, can they be concatenated?</p>
</blockquote>

<p>If yes, would you concatenate the first two and concatenate the re... | formal languages regular languages regular expressions | 1 | Can three regular languages be concatenated? -- (formal languages regular languages regular expressions)
<p>I can't seem to find anything about this and I wonder if I'm asking a silly question.</p>

<blockquote>
 <p>If you have three languages $L_1=\{a,b\}, L_2=\{c,d\}, L_3 =\{e,f\}$, can they be concatena... | habedi/stack-exchange-dataset |
88,181 | Efficiently compute parallel matrix-vector product for block vectors? | <p>I have $P$ processors, each having a different vector $v_p$ of size $N$, $p=1, ..., P$. I now want to compute the matrix-vector product
$$w = (E\otimes I_N)v$$
in parallel, where $\otimes$ is the <a href="https://en.wikipedia.org/wiki/Kronecker_product" rel="nofollow noreferrer">Kronecker product</a>, $v = (... | algorithms parallel computing matrices numerical algorithms multiplication | 1 | Efficiently compute parallel matrix-vector product for block vectors? -- (algorithms parallel computing matrices numerical algorithms multiplication)
<p>I have $P$ processors, each having a different vector $v_p$ of size $N$, $p=1, ..., P$. I now want to compute the matrix-vector product
$$w = (E\otimes I_N)v$$
... | habedi/stack-exchange-dataset |
88,185 | NFA string acceptance with loop of epsilon transitions | <p>I am writing an algorithm to test whether a NFA accepts or not a string, and there is a case in which I don't know how the algorithm should behave namely: 
<a href="https://i.stack.imgur.com/TRhiz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TRhiz.png" alt="enter image description here"></a... | automata finite automata | 1 | NFA string acceptance with loop of epsilon transitions -- (automata finite automata)
<p>I am writing an algorithm to test whether a NFA accepts or not a string, and there is a case in which I don't know how the algorithm should behave namely: 
<a href="https://i.stack.imgur.com/TRhiz.png" rel="nofollow noreferrer">... | habedi/stack-exchange-dataset |
88,193 | What does it mean "given a NFA and its accepted language L build the DFA that accepts L*"? | <p>Supposing we have either a NFA or a DFA with accepted language $L$, what is $L^*$? And how can I build an automaton that accepts it?</p>
 | automata finite automata | 1 | What does it mean "given a NFA and its accepted language L build the DFA that accepts L*"? -- (automata finite automata)
<p>Supposing we have either a NFA or a DFA with accepted language $L$, what is $L^*$? And how can I build an automaton that accepts it?</p>
 | habedi/stack-exchange-dataset |
88,196 | Lower bounds on regret | <p>In "regret" styled analysis over $T$ steps of an iterative algorithm $\{x_i \in F \}_{i=1}^T$ (where $F$ is some feasible set) being given the sequence of loss functions $\{ f_i\}_{i=1}^T$ one defines the regret $R_T = \sum_{i=1}^Tf_t(x_i) - \min_{x \in F} \sum_{i=1}^T f_t(x)$ Most typical analyses assume that the $... | optimization online algorithms | 1 | Lower bounds on regret -- (optimization online algorithms)
<p>In "regret" styled analysis over $T$ steps of an iterative algorithm $\{x_i \in F \}_{i=1}^T$ (where $F$ is some feasible set) being given the sequence of loss functions $\{ f_i\}_{i=1}^T$ one defines the regret $R_T = \sum_{i=1}^Tf_t(x_i) - \min_{x \in F} \... | habedi/stack-exchange-dataset |
88,198 | Number of binary search trees with maximum possible height for n nodes | <p>I'm using the definition of the height of a tree as the longest possible path from the root to a leaf by its number of edges, e.g. a tree of 2 nodes has a height of 1. With that in mind, what would be the number of binary search trees (don't have to be balanced) that have the maximum possible height for n-nodes? <... | data structures binary trees binary search trees | 1 | Number of binary search trees with maximum possible height for n nodes -- (data structures binary trees binary search trees)
<p>I'm using the definition of the height of a tree as the longest possible path from the root to a leaf by its number of edges, e.g. a tree of 2 nodes has a height of 1. With that in mind, what... | habedi/stack-exchange-dataset |
88,199 | Edge removal to convert a non-planar DAG to a planar DAG while maintaining reachability? | <p>Is there an algorithm that removes edges to convert a non-planar DAG to a planar DAG while maintaining reachability? For example, the graph $G$ below is non-planar:</p>

<p><a href="https://i.stack.imgur.com/3V6S9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3V6S9.jpg" alt="enter image ... | graphs planar graphs | 1 | Edge removal to convert a non-planar DAG to a planar DAG while maintaining reachability? -- (graphs planar graphs)
<p>Is there an algorithm that removes edges to convert a non-planar DAG to a planar DAG while maintaining reachability? For example, the graph $G$ below is non-planar:</p>

<p><a href="https://i.st... | habedi/stack-exchange-dataset |
88,200 | Prove that the number of full nodes plus one is qual to the number of leaves in a nonempty binary tree | <p>I'm trying to write an induction statement to prove a full node in a tree but I have no idea how to do that. I've always been terrible when it comes to logic. Where do I even start with this?</p>

<p>I know that a full node has 2 children.</p>
 | proof techniques trees binary trees induction | 1 | Prove that the number of full nodes plus one is qual to the number of leaves in a nonempty binary tree -- (proof techniques trees binary trees induction)
<p>I'm trying to write an induction statement to prove a full node in a tree but I have no idea how to do that. I've always been terrible when it comes to logic. Wher... | habedi/stack-exchange-dataset |
88,206 | Efficiently compute parallel matrix-vector product for block vectors with FFTs? | <p>Assume I have $P$ processors, each having a different vector $v_p$ of size $N$, $p=1, ..., P$. I learned in this <a href="https://cs.stackexchange.com/questions/88181/efficiently-compute-parallel-matrix-vector-product-for-block-vectors">question/answer</a> that for computing the matrix-vector product 
$$w = (E\o... | algorithms parallel computing matrices numerical algorithms fourier transform | 1 | Efficiently compute parallel matrix-vector product for block vectors with FFTs? -- (algorithms parallel computing matrices numerical algorithms fourier transform)
<p>Assume I have $P$ processors, each having a different vector $v_p$ of size $N$, $p=1, ..., P$. I learned in this <a href="https://cs.stackexchange.com/que... | habedi/stack-exchange-dataset |
88,208 | Inserting values at maximal distance from current value | <p>I have the following problem.
Given an array A, filled with 0s, we should set some elements to be equal 1, considering such rules:</p>

<ol>
<li>If all elements equal 0,set A[0] to 1</li>
<li>Next 1 should be set at maximal distance from any other 1s. At this
stage it will be A[size-1].</li>&... | data structures dynamic programming binary trees | 1 | Inserting values at maximal distance from current value -- (data structures dynamic programming binary trees)
<p>I have the following problem.
Given an array A, filled with 0s, we should set some elements to be equal 1, considering such rules:</p>

<ol>
<li>If all elements equal 0,set A[0] to 1</li>
... | habedi/stack-exchange-dataset |
88,209 | prove every language got a language that is harder | <p>I am prety stuck over here:</p>
<blockquote>
<p>prove or disprove that every <span class="math-container">$L$</span> got <span class="math-container">$L'$</span> s.t <span class="math-container">$L'\geq L$</span> and for every <span class="math-container">$L''\geq L$</span></p>
<p><span class="math-conta... | computability reductions undecidability | 1 | prove every language got a language that is harder -- (computability reductions undecidability)
<p>I am prety stuck over here:</p>
<blockquote>
<p>prove or disprove that every <span class="math-container">$L$</span> got <span class="math-container">$L'$</span> s.t <span class="math-container">$L'\geq L$</span> ... | habedi/stack-exchange-dataset |
88,213 | Finding (and possibly extracting) source code in heterogenous text data set | <p>I'm looking for a way to recognize and possibly extract source code from text files that may contain only source code, source code mixed with plain text or just plain text without any source code. </p>

<p>There's different source code contained in the data set, just to name a few examples: Java, C, Python, ... | data mining pattern recognition | 1 | Finding (and possibly extracting) source code in heterogenous text data set -- (data mining pattern recognition)
<p>I'm looking for a way to recognize and possibly extract source code from text files that may contain only source code, source code mixed with plain text or just plain text without any source code. </p>&#x... | habedi/stack-exchange-dataset |
88,215 | Unique Stable Solution in Stable Marriage Problem: Is it Pareto-efficient and a Nash Equilibrium? | <p>The <a href="ftp://cramton.umd.edu/econ415/deferred-acceptance-algorithm.pdf" rel="nofollow noreferrer">deferred acceptance algorithm</a> solves the Stable Marriage Problem in a two-sided network, where each agent has complete preferences over each agent of the other side. There is always at least one stable matchin... | game theory pareto | 1 | Unique Stable Solution in Stable Marriage Problem: Is it Pareto-efficient and a Nash Equilibrium? -- (game theory pareto)
<p>The <a href="ftp://cramton.umd.edu/econ415/deferred-acceptance-algorithm.pdf" rel="nofollow noreferrer">deferred acceptance algorithm</a> solves the Stable Marriage Problem in a two-sided network... | habedi/stack-exchange-dataset |
88,216 | Given that f(n)>0 and constant c>0 Prove that f(n)+c = O(f(n)) or provide a counter-example if it's false | <p><strong>Question:</strong> </p>

<p>Given that f(n)>0 and c>0 </p>

<p>Prove that f(n)+c = O(f(n)) or provide a counter-example if it's false.</p>

<p><strong>My Effort to solve:</strong> \begin{eqnarray*}
f(n) + c \space \leq \space d\cdot&f(n)\space for \space all\space n \geq n... | asymptotics | 1 | Given that f(n)>0 and constant c>0 Prove that f(n)+c = O(f(n)) or provide a counter-example if it's false -- (asymptotics)
<p><strong>Question:</strong> </p>

<p>Given that f(n)>0 and c>0 </p>

<p>Prove that f(n)+c = O(f(n)) or provide a counter-example if it's false.</p>

<p><strong>My Effor... | habedi/stack-exchange-dataset |
88,224 | Find the best set of triples of objects, using each object at max one time | <p>I stumbled upon an interesting problem and I'm stuck with it, since I can't find parallels to other problems or algorithms to solve it.</p>

<p>We have a set of objects $O = \{a,b,c,...,z\}$, objects can make triples, e.g. $T=(a,b,c)$ $a,b,c \in O$ and we have a set of triples $X = \{T_1, ... T_n\}$. Each t... | algorithms combinatorics | 1 | Find the best set of triples of objects, using each object at max one time -- (algorithms combinatorics)
<p>I stumbled upon an interesting problem and I'm stuck with it, since I can't find parallels to other problems or algorithms to solve it.</p>

<p>We have a set of objects $O = \{a,b,c,...,z\}$, objects can ... | habedi/stack-exchange-dataset |
88,266 | Poly-time reduction is not antisymmetric | <blockquote>
<p><strong>Lemma.</strong> <em>(Transitivity)</em> "<span class="math-container">$\leq_p$</span>" is a transitive relation on languages, i.e., if <span class="math-container">$L_1 \leq_p L_2$</span> and <span class="math-container">$L_2 \leq_p L_3$</span>, then <span class="math-container">$L... | complexity theory time complexity polynomial time | 1 | Poly-time reduction is not antisymmetric -- (complexity theory time complexity polynomial time)
<blockquote>
<p><strong>Lemma.</strong> <em>(Transitivity)</em> "<span class="math-container">$\leq_p$</span>" is a transitive relation on languages, i.e., if <span class="math-container">$L_1 \leq_p L_2$</span... | habedi/stack-exchange-dataset |
88,274 | Why does soundness imply consistency? | <p>I was reading the question <a href="https://cs.stackexchange.com/questions/24700/consistency-and-completeness-imply-soundness">Consistency and completeness imply soundness?</a> and the first statement in it says:</p>

<blockquote>
 <p>I understand that soundness implies consistency.</p>
</blockquote... | terminology logic first order logic propositional logic incompleteness | 1 | Why does soundness imply consistency? -- (terminology logic first order logic propositional logic incompleteness)
<p>I was reading the question <a href="https://cs.stackexchange.com/questions/24700/consistency-and-completeness-imply-soundness">Consistency and completeness imply soundness?</a> and the first statement in... | habedi/stack-exchange-dataset |
88,276 | Need to understand signals received vs sent | <p>What is meant by in the following statement (from the paper titled "<a href="https://www.usenix.org/legacy/publications/library/proceedings/sa92/stein.pdf" rel="nofollow noreferrer">Implementing Lightweight Threads</a>"):</p>

<blockquote>
 <p>As in singlethreaded processes, the number of signals receiv... | operating systems threads | 1 | Need to understand signals received vs sent -- (operating systems threads)
<p>What is meant by in the following statement (from the paper titled "<a href="https://www.usenix.org/legacy/publications/library/proceedings/sa92/stein.pdf" rel="nofollow noreferrer">Implementing Lightweight Threads</a>"):</p>

<blockq... | habedi/stack-exchange-dataset |
88,282 | What is the difference between undecidable language and Turing Recognizable language? | <p>I was wondering what is the difference difference undecidable language and Turing recognizable language. I've seen in some cases where they ask:</p>

<ol>
<li>Prove that the language $ A_{TM} = \{ \ <M,w> | \ M \mbox{ is a Turing Machine accepting } w\}$ is undecidable.</li>
<li>Prove that the ... | computability undecidability semi decidability | 1 | What is the difference between undecidable language and Turing Recognizable language? -- (computability undecidability semi decidability)
<p>I was wondering what is the difference difference undecidable language and Turing recognizable language. I've seen in some cases where they ask:</p>

<ol>
<li>Prove th... | habedi/stack-exchange-dataset |
88,286 | Perfect matching in a bipartite regular graph in linear time | <p>Given a $G=(V,E)$ bipartite, undirected, 4-regular graph, I would like to find a perfect matching in linear time.</p>

<p>It is easy to show that there is a perfect matching for the graph, by using flow and showing a flow of size $|V|/2$.</p>

<p>Using flow networks, we can also use Dinic's algorithm... | algorithms graphs network flow matching bipartite matching | 1 | Perfect matching in a bipartite regular graph in linear time -- (algorithms graphs network flow matching bipartite matching)
<p>Given a $G=(V,E)$ bipartite, undirected, 4-regular graph, I would like to find a perfect matching in linear time.</p>

<p>It is easy to show that there is a perfect matching for the gr... | habedi/stack-exchange-dataset |
88,308 | Is there a name for "yield first result parallel map"? | <h1>Context</h1>

<p>In randomized algorithms two schemes of computation are common:</p>

<ul>
<li>Las Vegas algorithms with random running time</li>
<li>Randomized algorithms that have a probability of success, and have to be executed multiple times before getting the answer</li>
</ul>
... | randomized algorithms parallel computing mapreduce | 1 | Is there a name for "yield first result parallel map"? -- (randomized algorithms parallel computing mapreduce)
<h1>Context</h1>

<p>In randomized algorithms two schemes of computation are common:</p>

<ul>
<li>Las Vegas algorithms with random running time</li>
<li>Randomized algorithms that have... | habedi/stack-exchange-dataset |
88,313 | Proof that n^2 = O(logn)? | <p>DEFINITION: $f = O(g)$ if positive integers c and $n_0$ exist such that for every integer $n$ $\geq$ $n_0$, $f(n) ≤ c·g(n)$</p>

<p>so:</p>

<p>$n^2 \leq c·log(n)$</p>

<p>$\frac{n^2}{log(n)} \leq c$</p>

<p>is this enough proof? since the fraction will grow larger and larger dependin... | asymptotics | 1 | Proof that n^2 = O(logn)? -- (asymptotics)
<p>DEFINITION: $f = O(g)$ if positive integers c and $n_0$ exist such that for every integer $n$ $\geq$ $n_0$, $f(n) ≤ c·g(n)$</p>

<p>so:</p>

<p>$n^2 \leq c·log(n)$</p>

<p>$\frac{n^2}{log(n)} \leq c$</p>

<p>is this enough proof? since the fr... | habedi/stack-exchange-dataset |
88,318 | Utilization of static evaluation functions in chess | <p><strong>Disclaimer: I'm <em>very new</em> to computer science & game programming</strong></p>

<p>I'm having trouble with understanding how to implement a static evaluation function in chess. The logic seems simple like just apply a weight to each piece on the board and subtract the pieces from each side... | game theory board games | 1 | Utilization of static evaluation functions in chess -- (game theory board games)
<p><strong>Disclaimer: I'm <em>very new</em> to computer science & game programming</strong></p>

<p>I'm having trouble with understanding how to implement a static evaluation function in chess. The logic seems simple like just... | habedi/stack-exchange-dataset |
88,368 | Checking if there is a single path that visits all nodes in a directed graph | <pre><code>Given a directed acyclic graph G, give a linear time algorithm to determine if the
graph has a directed path that visits every vertex.
</code></pre>
<p>You can assume you are given a list of nodes and two adjacency lists: Enter[v] which contains all the edges entering node v, and Exit[v] which co... | graphs | 1 | Checking if there is a single path that visits all nodes in a directed graph -- (graphs)
<pre><code>Given a directed acyclic graph G, give a linear time algorithm to determine if the
graph has a directed path that visits every vertex.
</code></pre>
<p>You can assume you are given a list of nodes and two adj... | habedi/stack-exchange-dataset |
88,371 | Given a regular language $U$, when does there exist $V$ such that $U^\omega$ = $\lim V$? | <p>What I know is that $W = \lim V$ for some $V$ if and only if $W$ is the language of some deterministic buchi automata, namely that of $V$.</p>

<p>So, to attack this problem I tried to come up with some language of the form $U^\omega$ which cannot be determinized. But I keep failing trying to come up with so... | regular languages buchi automata | 1 | Given a regular language $U$, when does there exist $V$ such that $U^\omega$ = $\lim V$? -- (regular languages buchi automata)
<p>What I know is that $W = \lim V$ for some $V$ if and only if $W$ is the language of some deterministic buchi automata, namely that of $V$.</p>

<p>So, to attack this problem I tried ... | habedi/stack-exchange-dataset |
88,374 | What do we call a greedy algorithm that tracks the best $n > 1$ solutions? | <p>A naive greedy algorithm tries to find an optimal solution based on the best solution so far, hence it may get stuck in local optima.</p>

<p>To avoid this problem, we may keep track of the best $n > 1$ solutions (instead of the best only). What is the name(s) of this algorithm?</p>

<p>Surprising... | algorithms optimization terminology greedy algorithms | 1 | What do we call a greedy algorithm that tracks the best $n > 1$ solutions? -- (algorithms optimization terminology greedy algorithms)
<p>A naive greedy algorithm tries to find an optimal solution based on the best solution so far, hence it may get stuck in local optima.</p>

<p>To avoid this problem, we may kee... | habedi/stack-exchange-dataset |
88,376 | Proving ambiguity of this Context Free Grammar | <p>I ran into this exercise problem from <em><strong>Introduction To The Theory Of Computation</strong></em> by Sipser. Given a context free grammar:</p>

<p>$ S \rightarrow SS \ | \ T \\ T \rightarrow aTb \ | \ ab $</p>

<p>I have to show that the grammar is ambiguous. So I have to find at least two le... | automata context free | 1 | Proving ambiguity of this Context Free Grammar -- (automata context free)
<p>I ran into this exercise problem from <em><strong>Introduction To The Theory Of Computation</strong></em> by Sipser. Given a context free grammar:</p>

<p>$ S \rightarrow SS \ | \ T \\ T \rightarrow aTb \ | \ ab $</p>

<p>I hav... | habedi/stack-exchange-dataset |
88,377 | Run Time of Nested Loop | <p>In the following loop </p>

<pre><code>for i = 1 to n 
 doSomething O(1)
 for j = 1 to k
 doSomething O(1)
</code></pre>

<p>Is the runtime still $O(nk)$ even with the expression in the outer loop? Because if I change the order of the loops and $n \neq k$ then doSomething... | loops | 1 | Run Time of Nested Loop -- (loops)
<p>In the following loop </p>

<pre><code>for i = 1 to n 
 doSomething O(1)
 for j = 1 to k
 doSomething O(1)
</code></pre>

<p>Is the runtime still $O(nk)$ even with the expression in the outer loop? Because if I change the order of the lo... | habedi/stack-exchange-dataset |
88,387 | Finding the smallest string that contains a given set of substrings | <p>The algorithm I am looking for has the following requirements: Input is a set of strings. You are looking for a string containing all input strings. The resulting string should be as short as possible. At least shorter than just concatenating all input strings if possible.</p>

<p>Examples:</p>

<pre... | algorithms strings substrings | 1 | Finding the smallest string that contains a given set of substrings -- (algorithms strings substrings)
<p>The algorithm I am looking for has the following requirements: Input is a set of strings. You are looking for a string containing all input strings. The resulting string should be as short as possible. At least sho... | habedi/stack-exchange-dataset |
88,390 | Big O notation for recursive algorithm | <p>In order to find Big O for a recursive algorithm, it is needed to know the stopping criteria of that algorithm. For the recursive algorithm to find Factorial of a number it is very easy to find the stopping criteria.</p>

<pre><code>int fact(int n)
{
 if((n==1)||(n==0)) return 1;
 else retr... | algorithm analysis asymptotics runtime analysis recursion | 1 | Big O notation for recursive algorithm -- (algorithm analysis asymptotics runtime analysis recursion)
<p>In order to find Big O for a recursive algorithm, it is needed to know the stopping criteria of that algorithm. For the recursive algorithm to find Factorial of a number it is very easy to find the stopping criteria... | habedi/stack-exchange-dataset |
88,392 | CURE algorithm: what does moving the representative points towards the centroid do? | <p>The CURE algorithm is a method of clustering data. An outline of it can be found here on slide 5: <a href="https://www.slideshare.net/ellepiu/cure-clustering-algorithm" rel="nofollow noreferrer">https://www.slideshare.net/ellepiu/cure-clustering-algorithm</a>. I personally learnt it from this video: <a href="https:/... | algorithms machine learning clustering | 1 | CURE algorithm: what does moving the representative points towards the centroid do? -- (algorithms machine learning clustering)
<p>The CURE algorithm is a method of clustering data. An outline of it can be found here on slide 5: <a href="https://www.slideshare.net/ellepiu/cure-clustering-algorithm" rel="nofollow norefe... | habedi/stack-exchange-dataset |
88,398 | Primality testing: Why is dividing a number $n$ by every integer between 2 and $\sqrt{n}$ an inefficient test? | <p>In the paper "PRIMES is in P" the following is said (page 1):</p>

<blockquote>
 <p>Let PRIMES denote the set of all prime numbers. The definition of prime numbers already gives a way of determining if a number $n$ is in PRIMES: try dividing $n$ by every number $m \leq \sqrt{n}$ — if any m divides $n$ t... | complexity theory primes | 1 | Primality testing: Why is dividing a number $n$ by every integer between 2 and $\sqrt{n}$ an inefficient test? -- (complexity theory primes)
<p>In the paper "PRIMES is in P" the following is said (page 1):</p>

<blockquote>
 <p>Let PRIMES denote the set of all prime numbers. The definition of prime numbers... | habedi/stack-exchange-dataset |
88,400 | Wrong DFA from NFA. String Does not contains 110 | <p>I am doing problem <a href="http://aduni.org/courses/theory/courseware/psets/Problem_Set_01.html" rel="nofollow noreferrer">1.g</a>.
My Approach is to first create a NFA that accepts this string i.e. all strings having 110. Then converting it into DFA and then complementing it. I have the answer what should I ge... | formal languages finite automata | 1 | Wrong DFA from NFA. String Does not contains 110 -- (formal languages finite automata)
<p>I am doing problem <a href="http://aduni.org/courses/theory/courseware/psets/Problem_Set_01.html" rel="nofollow noreferrer">1.g</a>.
My Approach is to first create a NFA that accepts this string i.e. all strings having 110. Th... | habedi/stack-exchange-dataset |
88,402 | Problems in Complexity Theory | <p>I'm studying Complexity Theory. Many times i found written that in complexity theory every problem come in pair, that is a <strong>search</strong> version and <strong>verification</strong> version.
But why this happens ? What establish this ?</p>
 | complexity theory | 1 | Problems in Complexity Theory -- (complexity theory)
<p>I'm studying Complexity Theory. Many times i found written that in complexity theory every problem come in pair, that is a <strong>search</strong> version and <strong>verification</strong> version.
But why this happens ? What establish this ?</p>
 | habedi/stack-exchange-dataset |
88,403 | Why nondeterminism? | <p>Theory of computation often involves nondeterministic models of computation. Some examples include nondeterministic finite automata (NFAs), nondeterministic pushdown automata (PDAs), and nondeterministic Turing machines. Real computers, however, are deterministic (or at best, randomized).</p>

<blockquote>&#... | complexity theory automata computation models nondeterminism reference question | 1 | Why nondeterminism? -- (complexity theory automata computation models nondeterminism reference question)
<p>Theory of computation often involves nondeterministic models of computation. Some examples include nondeterministic finite automata (NFAs), nondeterministic pushdown automata (PDAs), and nondeterministic Turing m... | habedi/stack-exchange-dataset |
88,411 | timed automata - advance only in certain states | <p>I am currently looking into timed automata for a project.
I am thinking about a timed automaton where a clock only advances when the automaton is in a certain state.
However, my little knowledge in the domain makes me wonder whether somebody already defined timed automata like that.</p>

<p>As an exa... | automata real time | 1 | timed automata - advance only in certain states -- (automata real time)
<p>I am currently looking into timed automata for a project.
I am thinking about a timed automaton where a clock only advances when the automaton is in a certain state.
However, my little knowledge in the domain makes me wonder whether some... | habedi/stack-exchange-dataset |
88,414 | Complexity of a loop | <blockquote>
 <p>If the body of a simple for loop has time complexity $O(n)$ and it is
 executed $n-1$ times what is the time complexity of the complete loop?</p>
</blockquote>

<p>I am trying to figure out the correct answer to this question for my upcoming exam. My reasoning is that if the body... | algorithm analysis runtime analysis loops | 1 | Complexity of a loop -- (algorithm analysis runtime analysis loops)
<blockquote>
 <p>If the body of a simple for loop has time complexity $O(n)$ and it is
 executed $n-1$ times what is the time complexity of the complete loop?</p>
</blockquote>

<p>I am trying to figure out the correct answer to ... | habedi/stack-exchange-dataset |
88,416 | Is there a contradiction between "set-theoretic" and "formal" definition of "Big-O"? | <ul>
<li>$O(n) = \{n, n^{2}, n^{1000000}, 2^{n}, ...\}$ [<a href="https://stackoverflow.com/questions/471199/what-is-the-difference-between-%CE%98n-and-on">Source A</a>], [<a href="https://en.wikipedia.org/wiki/Big_O_notation#Family_of_Bachmann%E2%80%93Landau_notations" rel="nofollow noreferrer">Source B</a>]</li>&... | time complexity asymptotics landau notation | 1 | Is there a contradiction between "set-theoretic" and "formal" definition of "Big-O"? -- (time complexity asymptotics landau notation)
<ul>
<li>$O(n) = \{n, n^{2}, n^{1000000}, 2^{n}, ...\}$ [<a href="https://stackoverflow.com/questions/471199/what-is-the-difference-between-%CE%98n-and-on">Source A</a>], [<a href="h... | habedi/stack-exchange-dataset |
88,419 | Portfolio allocation with a few twists | <p><em>A similar question has been asked <a href="https://cs.stackexchange.com/questions/71051/integer-solution-that-approximates-a-desired-stock-split">here</a>, but this one is more complicated and has more constraints.</em> </p>

<p>I'm trying to find an algorithm to solve the following (real-life) problem:... | optimization combinatorics integer programming resource allocation | 1 | Portfolio allocation with a few twists -- (optimization combinatorics integer programming resource allocation)
<p><em>A similar question has been asked <a href="https://cs.stackexchange.com/questions/71051/integer-solution-that-approximates-a-desired-stock-split">here</a>, but this one is more complicated and has more ... | habedi/stack-exchange-dataset |
88,422 | Meaning of # in descriptions of languages | <p>This is a very simple question, but I cannot find the answer anywhere, mostly because I don't know how else to ask about what I'm looking for. I have a homework assignment that has to do with pumping lemma, which asks me to use the pumping lemma to prove that the language given is not regular.</p>

<p>{x₁#x₂... | formal languages regular languages pumping lemma | 1 | Meaning of # in descriptions of languages -- (formal languages regular languages pumping lemma)
<p>This is a very simple question, but I cannot find the answer anywhere, mostly because I don't know how else to ask about what I'm looking for. I have a homework assignment that has to do with pumping lemma, which asks me ... | habedi/stack-exchange-dataset |
88,425 | I can not understand some petri net properties ( quasi-liveness and liveness ) | <p>Can anyone please help me understand the quasi-liveness and liveness properties of petri nets. Suppose that you explain that to a person with 10 years old.</p>

<p>For my part, i have the following definitions.
- quasi-liveness petri net: its mean that every transition in the net can be enabled at least ... | automata petri nets | 1 | I can not understand some petri net properties ( quasi-liveness and liveness ) -- (automata petri nets)
<p>Can anyone please help me understand the quasi-liveness and liveness properties of petri nets. Suppose that you explain that to a person with 10 years old.</p>

<p>For my part, i have the following definit... | habedi/stack-exchange-dataset |
88,439 | Among $k$ unit vectors, find odd set with sum length less than 1 | <p>I have $k$ unit vectors in $\mathbb{R}^k$. Can I efficiently identify a set of $2n+1$ vectors $v_1, \dots v_{2n+1}$ such that $\sum_{i< j} v_i\cdot v_j < -n$ for any $n$ -- or determine that no such set exists?</p>

<p>As some motivation, if I have 3 vectors (so that $n=1$), the minimum value of their ... | optimization linear algebra search problem | 1 | Among $k$ unit vectors, find odd set with sum length less than 1 -- (optimization linear algebra search problem)
<p>I have $k$ unit vectors in $\mathbb{R}^k$. Can I efficiently identify a set of $2n+1$ vectors $v_1, \dots v_{2n+1}$ such that $\sum_{i< j} v_i\cdot v_j < -n$ for any $n$ -- or determine that no such... | habedi/stack-exchange-dataset |
88,440 | The set of all eventually periodic words is not Buchi Recognizable? | <p>An $\omega$-word $s \in \Sigma^\omega$ is eventually periodic if it is of the form $s = uv^\omega$ for finite words $u, v \in \Sigma^*$.</p>

<p>I want to show that the set of all eventually periodic words is not buchi-recognizable.</p>

<p>I do not know how to proceed. My attempt was to find a part ... | strings buchi automata | 1 | The set of all eventually periodic words is not Buchi Recognizable? -- (strings buchi automata)
<p>An $\omega$-word $s \in \Sigma^\omega$ is eventually periodic if it is of the form $s = uv^\omega$ for finite words $u, v \in \Sigma^*$.</p>

<p>I want to show that the set of all eventually periodic words is not ... | habedi/stack-exchange-dataset |
88,442 | PAC learning of axis-aligned rectangles | <p>I've been reading the proof that axis-aligned rectangles are PAC learnable from the book Foundations of Machine Learning by Mohri (<a href="https://i.stack.imgur.com/odD4q.png" rel="nofollow noreferrer">Proof pt. 1</a>, <a href="https://i.stack.imgur.com/kVWfU.png" rel="nofollow noreferrer">Proof pt. 2</a>), and a s... | machine learning | 1 | PAC learning of axis-aligned rectangles -- (machine learning)
<p>I've been reading the proof that axis-aligned rectangles are PAC learnable from the book Foundations of Machine Learning by Mohri (<a href="https://i.stack.imgur.com/odD4q.png" rel="nofollow noreferrer">Proof pt. 1</a>, <a href="https://i.stack.imgur.com/... | habedi/stack-exchange-dataset |
88,444 | Number of non-XOR gates needed to implement an n-bit boolean function | <p>There are $2^{2^n}$ possible functions that have $n$ boolean inputs and a single boolean output. Some of these functions have very short boolean logic circuits. Some have longer circuits.</p>

<p>A <a href="https://en.wikipedia.org/wiki/Circuit_complexity#History" rel="nofollow noreferrer">classic result in ... | asymptotics circuits | 1 | Number of non-XOR gates needed to implement an n-bit boolean function -- (asymptotics circuits)
<p>There are $2^{2^n}$ possible functions that have $n$ boolean inputs and a single boolean output. Some of these functions have very short boolean logic circuits. Some have longer circuits.</p>

<p>A <a href="https:... | habedi/stack-exchange-dataset |
88,445 | Prove that the depth of every vertex in a cycle is $\le \lfloor \frac{n}{2} \rfloor$ in a breadth first search? | <p>Suppose I have an undirected graph that consists only of a cycle. Each vertex has a depth value that must be $1$ greater than its predecessor (i.e. if we reach vertex $F$ from vertex $C$ which has a depth of $2$, then $F$ has a depth of $3$). The beginning vertex has a depth of $0$. I need to show that every vertex ... | graph traversal | 1 | Prove that the depth of every vertex in a cycle is $\le \lfloor \frac{n}{2} \rfloor$ in a breadth first search? -- (graph traversal)
<p>Suppose I have an undirected graph that consists only of a cycle. Each vertex has a depth value that must be $1$ greater than its predecessor (i.e. if we reach vertex $F$ from vertex $... | habedi/stack-exchange-dataset |
88,495 | The Potential function for Fibonacci heaps | <p>I am trying to get a better understanding of Fibonacci Heaps. I noticed the
following definition for the potential function.
$$ \Phi(F)=|W| +2\cdot \text{# marks}. $$
I do not understand why it is defined that way, or what its significant is. I am hoping somebody can explain it to me. </p>
 | algorithm analysis data structures amortized analysis | 1 | The Potential function for Fibonacci heaps -- (algorithm analysis data structures amortized analysis)
<p>I am trying to get a better understanding of Fibonacci Heaps. I noticed the
following definition for the potential function.
$$ \Phi(F)=|W| +2\cdot \text{# marks}. $$
I do not understand why it is define... | habedi/stack-exchange-dataset |
88,501 | For some $n$, how can we check whether there exists $a,b \in \mathbb{N}$ such that $a^b = n$ in polynomial time? | <p>For some given $n$, how can we check whether there exists $a,b \in \mathbb{N}$ ($b > 0$) such that $a^b = n$ in polynomial time with respect to the number of digits in $n$?</p>
 | complexity theory polynomial time | 1 | For some $n$, how can we check whether there exists $a,b \in \mathbb{N}$ such that $a^b = n$ in polynomial time? -- (complexity theory polynomial time)
<p>For some given $n$, how can we check whether there exists $a,b \in \mathbb{N}$ ($b > 0$) such that $a^b = n$ in polynomial time with respect to the number of digi... | habedi/stack-exchange-dataset |
88,502 | Graph families with high $k$-community | <p>Just a quick question here, is there a known description of a graph family where for every graph $G=(V,E)$ it holds that for every $(u,v) \in E$ you have $|N(u) \cap N(v)| \geq k$? There was a definition for such graph as $k$-community. Even non-trivial examples (e.g., cliques) might be interesting.</p>

<p>... | graphs clustering | 1 | Graph families with high $k$-community -- (graphs clustering)
<p>Just a quick question here, is there a known description of a graph family where for every graph $G=(V,E)$ it holds that for every $(u,v) \in E$ you have $|N(u) \cap N(v)| \geq k$? There was a definition for such graph as $k$-community. Even non-trivial e... | habedi/stack-exchange-dataset |
88,514 | Deletion of record from B+ tree | <p>I was going through the B+ tree deletion operation from the book <em><strong>Database System Concepts, 6th Edition</strong></em> by Henry F. Korth. One particular thing caught my attention.</p>

<p>A B+ tree is given. We have to delete the record <em>"Gold"</em> from this tree.<a href="https://i.stack.imgur.... | data structures search trees b tree | 1 | Deletion of record from B+ tree -- (data structures search trees b tree)
<p>I was going through the B+ tree deletion operation from the book <em><strong>Database System Concepts, 6th Edition</strong></em> by Henry F. Korth. One particular thing caught my attention.</p>

<p>A B+ tree is given. We have to delete ... | habedi/stack-exchange-dataset |
88,515 | How to write decoder for compressed stringified objects | <p><strong>Aim</strong>: schema aware transformation.</p>

<p>I've written a <a href="https://github.com/nimndata/nimnjs-node" rel="nofollow noreferrer">code(in js)</a> which can transform data <code>{projectDetails: [ {detail : {}, id : "gwl" }], name: "amit"}</code> into string <code>@gwl|amit</code>. But I'm... | algorithms | 1 | How to write decoder for compressed stringified objects -- (algorithms)
<p><strong>Aim</strong>: schema aware transformation.</p>

<p>I've written a <a href="https://github.com/nimndata/nimnjs-node" rel="nofollow noreferrer">code(in js)</a> which can transform data <code>{projectDetails: [ {detail : {}, id : "g... | habedi/stack-exchange-dataset |
88,516 | Are Kernel Codes (which are written in C) compiled during boot time? | <p>I have a confusion regarding how the Kernel is loaded during the boot time. The intuition I have is like following:</p>

<p>During installation of an OS, the compiled Code of the Kernel (depending on the architecture of the system) is written to the part of the Primary Memory that is restricted to the OS. Wh... | operating systems os kernel c | 1 | Are Kernel Codes (which are written in C) compiled during boot time? -- (operating systems os kernel c)
<p>I have a confusion regarding how the Kernel is loaded during the boot time. The intuition I have is like following:</p>

<p>During installation of an OS, the compiled Code of the Kernel (depending on the a... | habedi/stack-exchange-dataset |
88,526 | Can I assume that a percentage of the time can be parallelized? | <p>I study computer science and hardware. Some problem are about parallel computing and applied Amdahl's law. For instance, some calculation is that the sequential part of a program takes x seconds and the parallel part takes y-x seconds. Can I then safely assume that it is the same percentage of the time that is paral... | algorithm analysis runtime analysis parallel computing | 1 | Can I assume that a percentage of the time can be parallelized? -- (algorithm analysis runtime analysis parallel computing)
<p>I study computer science and hardware. Some problem are about parallel computing and applied Amdahl's law. For instance, some calculation is that the sequential part of a program takes x second... | habedi/stack-exchange-dataset |
88,532 | Algebraic (spectral) algorithms for the minimum spanning tree problem | <p>Are there any algorithms that use the <strong>spectral</strong> properties of a graph to solve the minimum spanning tree problem? </p>

<p>To clarify further what I have in mind, starting with the Laplacian matrix I want to algebraically arrive at the required set of edges. This is opposed to Prim's or Krusk... | algorithms graphs minimum spanning tree | 1 | Algebraic (spectral) algorithms for the minimum spanning tree problem -- (algorithms graphs minimum spanning tree)
<p>Are there any algorithms that use the <strong>spectral</strong> properties of a graph to solve the minimum spanning tree problem? </p>

<p>To clarify further what I have in mind, starting with t... | habedi/stack-exchange-dataset |
88,538 | Reducing the infinite language problem to halting problem | <p>Let: $INF = \{ w \in \Sigma^* | \quad |L(M_w)| = \infty \} $. </p>

<p>It is easy to show with Rices theorem that $INF$ is not decidable.
($INF$ is non-trivial because of $\emptyset$ and $\Sigma^*$).</p>

<p>How can you show this with a reduction onto the halting problem (for example)?</p>
&#... | computability reductions undecidability halting problem | 1 | Reducing the infinite language problem to halting problem -- (computability reductions undecidability halting problem)
<p>Let: $INF = \{ w \in \Sigma^* | \quad |L(M_w)| = \infty \} $. </p>

<p>It is easy to show with Rices theorem that $INF$ is not decidable.
($INF$ is non-trivial because of $\emptyset$ and... | habedi/stack-exchange-dataset |
88,541 | How did they cancel out O-terms in this fraction? | <p>While reading a book about algorithms, I came across this derivation:</p>

<p>$$
\frac{2a_0(2N) \ln(2N) + O(2N)}{2a_0N\ln N+O(N)} =
\frac{2\ln(2N) + O(1)}{\ln N+O(1)} =
2 + O\left(\frac{1}{\log N}\right).
$$</p>

<p>Could somebody please explain to me how we went from the left to the ... | asymptotics landau notation | 1 | How did they cancel out O-terms in this fraction? -- (asymptotics landau notation)
<p>While reading a book about algorithms, I came across this derivation:</p>

<p>$$
\frac{2a_0(2N) \ln(2N) + O(2N)}{2a_0N\ln N+O(N)} =
\frac{2\ln(2N) + O(1)}{\ln N+O(1)} =
2 + O\left(\frac{1}{\log N}\right).
$$</p... | habedi/stack-exchange-dataset |
88,543 | Methods of finding a PDA | <p>I am working on finding a PDA that accepts the following language:</p>

<pre><code>L = {0^i 1^j 0^k 1^l | i < j and k < l}
</code></pre>

<p>I am having trouble figuring out how to break this down/ where to start. I am able to form simpler PDA's such as when there are twice as many 0's as 1... | automata pushdown automata | 1 | Methods of finding a PDA -- (automata pushdown automata)
<p>I am working on finding a PDA that accepts the following language:</p>

<pre><code>L = {0^i 1^j 0^k 1^l | i < j and k < l}
</code></pre>

<p>I am having trouble figuring out how to break this down/ where to start. I am able to form si... | habedi/stack-exchange-dataset |
88,570 | Proving NP hardness about graph creation | <p>I have graph creation problem. </p>

<p>Given a set of nodes of graph, and node constraints such as given every node's number of neighbors and number of neighbors of neighbors and so on. I want to create a graph that can satisfy all these constraints (# of constraints is polynomial in n). </p>

<p>I ... | graphs np complete np hard np | 1 | Proving NP hardness about graph creation -- (graphs np complete np hard np)
<p>I have graph creation problem. </p>

<p>Given a set of nodes of graph, and node constraints such as given every node's number of neighbors and number of neighbors of neighbors and so on. I want to create a graph that can satisfy all ... | habedi/stack-exchange-dataset |
88,577 | What does the "big O complexity" of a function mean? | <p>What do people mean when they refer to the "big O complexity" of a function? What is the big O complexity of $9n^2 + 10n$, for example?</p>
 | terminology asymptotics landau notation reference question | 1 | What does the "big O complexity" of a function mean? -- (terminology asymptotics landau notation reference question)
<p>What do people mean when they refer to the "big O complexity" of a function? What is the big O complexity of $9n^2 + 10n$, for example?</p>
 | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.