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 |
|---|---|---|---|---|---|---|
30,809 | Data structure for range-value-sum | <p>I have to be able to perform insert, delete, range-value-sum, and range-2-max-values with a data structure.</p>

<p>Range-value-sum(xl,xr): with a range [xl,xr] (for a range query), it reports the sum of values of all elements whose keys are in the range of [xl,xr], where xl and xr are real numbers and xl ≤ ... | data structures runtime analysis search trees dictionaries | 1 | Data structure for range-value-sum -- (data structures runtime analysis search trees dictionaries)
<p>I have to be able to perform insert, delete, range-value-sum, and range-2-max-values with a data structure.</p>

<p>Range-value-sum(xl,xr): with a range [xl,xr] (for a range query), it reports the sum of values... | habedi/stack-exchange-dataset |
30,816 | Proving NP-hardness of strange graph partition problem | <p>I am trying to show the following problem is NP-hard.</p>

<blockquote>
 <p><em>Inputs:</em> Integer $e$, and connected, undirected graph $G=(V,E)$, a vertex-weighted graph</p>
 
 <p><em>Output:</em> Partition of $G$, $G_p=(V,E_p)$ obtained by removing any $e$ edges from $E$ which maximizes</... | algorithms complexity theory np hard set cover | 1 | Proving NP-hardness of strange graph partition problem -- (algorithms complexity theory np hard set cover)
<p>I am trying to show the following problem is NP-hard.</p>

<blockquote>
 <p><em>Inputs:</em> Integer $e$, and connected, undirected graph $G=(V,E)$, a vertex-weighted graph</p>
 
 <p><em>... | habedi/stack-exchange-dataset |
30,817 | Word tiling, where you must use each tile exactly once | <p>Given words <span class="math-container">$w_1,\ldots,w_n$</span> in binary alphabet and another word <span class="math-container">$w$</span>, decide if <span class="math-container">$w$</span> can be written as a product <span class="math-container">$w = w_{i_1} \cdots w_{i_n}$</span> (in the monoid <span class="math... | complexity theory np complete strings permutations | 1 | Word tiling, where you must use each tile exactly once -- (complexity theory np complete strings permutations)
<p>Given words <span class="math-container">$w_1,\ldots,w_n$</span> in binary alphabet and another word <span class="math-container">$w$</span>, decide if <span class="math-container">$w$</span> can be written... | habedi/stack-exchange-dataset |
30,831 | How can I translate this quantified logical expression into english | <p>I was reading chapter-1 The Foundations: Logic and Proofs from <a href="http://www.amazon.in/Discrete-Mathematics-Applications-Kenneth-Rosen/dp/0072899050" rel="nofollow">this book</a>.</p>

<p>The chapter gives example of translating English sentence : "There is a woman who has taken a flight on every airli... | logic | 1 | How can I translate this quantified logical expression into english -- (logic)
<p>I was reading chapter-1 The Foundations: Logic and Proofs from <a href="http://www.amazon.in/Discrete-Mathematics-Applications-Kenneth-Rosen/dp/0072899050" rel="nofollow">this book</a>.</p>

<p>The chapter gives example of transla... | habedi/stack-exchange-dataset |
30,835 | Order of a pseudo code | <p>I am trying to find order of an bellow algorithm but I have no idea about, the problem like below</p>

<p>we have an array of $n$ element name $T[1...N]$ and we have that $0\leq T[i] \leq i$ and $T[i] \in \mathbb{Z}$ then if we have that $\sum_{i=1}^{n}T[i] = s$ what will be the order of following pseudo cod... | algorithms algorithm analysis time complexity | 1 | Order of a pseudo code -- (algorithms algorithm analysis time complexity)
<p>I am trying to find order of an bellow algorithm but I have no idea about, the problem like below</p>

<p>we have an array of $n$ element name $T[1...N]$ and we have that $0\leq T[i] \leq i$ and $T[i] \in \mathbb{Z}$ then if we have th... | habedi/stack-exchange-dataset |
31,850 | Finding recursion for runtime of code | <p>This is the first time we have to do recursive/closed form expressions WITH code in class and I really have no idea how to approach this. My course notes that the prof put up don't really help as he put up a basic example, but this one has lots of recursive calls in it.</p>

<p>I know that the first part len... | asymptotics runtime analysis recurrence relation | 1 | Finding recursion for runtime of code -- (asymptotics runtime analysis recurrence relation)
<p>This is the first time we have to do recursive/closed form expressions WITH code in class and I really have no idea how to approach this. My course notes that the prof put up don't really help as he put up a basic example, bu... | habedi/stack-exchange-dataset |
31,864 | Find path to point and avoid bear | <p>I'm so far a self taught programmer who's mostly been working on simple web and app development. But now my teacher wants me to enter a school competition in programming.
Of course the competition is based on problem solving and such, areas I'm guessing counts as computer science.
Even though I don't have mu... | algorithms artificial intelligence | 1 | Find path to point and avoid bear -- (algorithms artificial intelligence)
<p>I'm so far a self taught programmer who's mostly been working on simple web and app development. But now my teacher wants me to enter a school competition in programming.
Of course the competition is based on problem solving and such, area... | habedi/stack-exchange-dataset |
31,867 | Use of Big O Notation in a recent paper by Khot et al | <p>I'm reading a paper about Constraint Satisfaction Problems, specifically "<a href="http://eccc.hpi-web.de/report/2013/075/" rel="nofollow">A Characterization of Strong Approximation Resistance</a>", Subhash Khot, Madhur Tulsiani, Pratik Worah (ECCC TR13-075).</p>

<p>The following sentence appears in the thi... | asymptotics landau notation notation | 1 | Use of Big O Notation in a recent paper by Khot et al -- (asymptotics landau notation notation)
<p>I'm reading a paper about Constraint Satisfaction Problems, specifically "<a href="http://eccc.hpi-web.de/report/2013/075/" rel="nofollow">A Characterization of Strong Approximation Resistance</a>", Subhash Khot, Madhur T... | habedi/stack-exchange-dataset |
31,869 | Lovasz theta of even cycle | <p>How does one show Lovasz theta of even $n$-cycle ($n$ is even) is of form $\frac{n}{2}$? Why is the Lovasz theta of such cycles not of form $\frac{n \cos(\frac{\pi}{n})}{1+\cos(\frac{\pi}{n})}$. Could someone provide a derivation for even cycle Lovasz theta number. It is clear that the Shannon Capacity is $\frac{n}{... | graphs information theory | 1 | Lovasz theta of even cycle -- (graphs information theory)
<p>How does one show Lovasz theta of even $n$-cycle ($n$ is even) is of form $\frac{n}{2}$? Why is the Lovasz theta of such cycles not of form $\frac{n \cos(\frac{\pi}{n})}{1+\cos(\frac{\pi}{n})}$. Could someone provide a derivation for even cycle Lovasz theta n... | habedi/stack-exchange-dataset |
31,872 | Max heap conversion | <p>In the binary tree shown below, which of the following trees is created after 
conversion into a (max) heap? </p>

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

<p>There are 4 anwsers to choose : </p>

<p><img src="https://i.stack.imgur.com/sis... | binary trees heaps | 1 | Max heap conversion -- (binary trees heaps)
<p>In the binary tree shown below, which of the following trees is created after 
conversion into a (max) heap? </p>

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

<p>There are 4 anwsers to choose : </p>
&#x... | habedi/stack-exchange-dataset |
31,874 | How does the momentum term for backpropagation algorithm work? | <p>When updating the weights of a neural network using the backpropagation algorithm with a momentum term, should the learning rate be applied to the momentum term as well?</p>

<p>Most of the information I could find about using momentum have the equations looking something like this:</p>

<p>$W_{i}' =... | machine learning neural networks | 1 | How does the momentum term for backpropagation algorithm work? -- (machine learning neural networks)
<p>When updating the weights of a neural network using the backpropagation algorithm with a momentum term, should the learning rate be applied to the momentum term as well?</p>

<p>Most of the information I coul... | habedi/stack-exchange-dataset |
31,881 | How to find expected number of slots of a certain size k in hash table? | <p>If you can make no assumptions about the hash function, how can you find the expected number of slots of certain size k in a hash table? Looking more for a theoretical proof type of answer than a programming answer.</p>
 | algorithm analysis hash tables | 1 | How to find expected number of slots of a certain size k in hash table? -- (algorithm analysis hash tables)
<p>If you can make no assumptions about the hash function, how can you find the expected number of slots of certain size k in a hash table? Looking more for a theoretical proof type of answer than a programming a... | habedi/stack-exchange-dataset |
31,884 | Lower bound of this harmonic series sum | <p>I'm stuck on an excercise in my maths class. How can I find an explicit lower bound for the harmonic series sum:</p>

<p>$$\sum_{x=1}^{2^m}\frac{1}{x}\,?$$</p>
 | discrete mathematics | 1 | Lower bound of this harmonic series sum -- (discrete mathematics)
<p>I'm stuck on an excercise in my maths class. How can I find an explicit lower bound for the harmonic series sum:</p>

<p>$$\sum_{x=1}^{2^m}\frac{1}{x}\,?$$</p>
 | habedi/stack-exchange-dataset |
31,910 | Equivalence of some Automata & Language & NFA | <p>I read some note about Automaton Course. i see this note, that following all is the same. but i think the L(g) is not equal to NFA and regular expression. anyone could help me with defining the language of this figures (nfa, regular expression and grammar):</p>

<p><img src="https://i.stack.imgur.com/lFPFO.j... | formal languages regular languages automata formal grammars regular expressions | 1 | Equivalence of some Automata & Language & NFA -- (formal languages regular languages automata formal grammars regular expressions)
<p>I read some note about Automaton Course. i see this note, that following all is the same. but i think the L(g) is not equal to NFA and regular expression. anyone could help me with defin... | habedi/stack-exchange-dataset |
31,921 | Showing that A' is a regular language | <p>Let $\Sigma = \{0,1\}$, and suppose that $A$ is a regular language. 
Define $$A' = \{ u \mid \exists a, b \in\Sigma: abu \in A\}$$ i.e., $A'$ is obtained from $A$ by taking every string in $A$ and removing its first 2 characters. Show that $A'$ is regular.</p>

<p>My solution so far is:</p>

<ul>... | formal languages regular languages | 1 | Showing that A' is a regular language -- (formal languages regular languages)
<p>Let $\Sigma = \{0,1\}$, and suppose that $A$ is a regular language. 
Define $$A' = \{ u \mid \exists a, b \in\Sigma: abu \in A\}$$ i.e., $A'$ is obtained from $A$ by taking every string in $A$ and removing its first 2 characters. Show ... | habedi/stack-exchange-dataset |
31,928 | Solving recurrence relation with two recursive calls | <p>I'm studying the worst case runtime of quicksort under the condition that it will never do a <em>very</em> unbalanced partition for varying definitions of <em>very</em>.</p>

<p>In order to do this I ask myself the question what the runtime $T(n, p)$ would be in the case quicksort always happens to partition... | algorithm analysis runtime analysis recurrence relation | 1 | Solving recurrence relation with two recursive calls -- (algorithm analysis runtime analysis recurrence relation)
<p>I'm studying the worst case runtime of quicksort under the condition that it will never do a <em>very</em> unbalanced partition for varying definitions of <em>very</em>.</p>

<p>In order to do th... | habedi/stack-exchange-dataset |
31,938 | Are "Flow Free" puzzles NP-hard? | <p>A "Flow Free" puzzle consists of a positive integer $n$ and a set of (unordered) pairs of distinct vertices in the $n \times n$ <a href="http://mathworld.wolfram.com/GridGraph.html" rel="noreferrer">grid graph</a> such that each vertex is in at most one pair. A solution to such a puzzle is a set of undirected <a hre... | np hard square grid | 1 | Are "Flow Free" puzzles NP-hard? -- (np hard square grid)
<p>A "Flow Free" puzzle consists of a positive integer $n$ and a set of (unordered) pairs of distinct vertices in the $n \times n$ <a href="http://mathworld.wolfram.com/GridGraph.html" rel="noreferrer">grid graph</a> such that each vertex is in at most one pair.... | habedi/stack-exchange-dataset |
31,940 | I am having trouble understanding (and implementing) logistic regression for classifying into three classes | <p>(For reference, i am using Kevin P Murphy's Book "Machine Learning: A Probabilistic Perspective" and implementing with MATLAN - without any toolboxes)</p>

<p>I have a dataset with 392 samples (rows), each sample has 8 features (columns), one of which defines the class (i.e. column 1 of features is divided i... | machine learning | 1 | I am having trouble understanding (and implementing) logistic regression for classifying into three classes -- (machine learning)
<p>(For reference, i am using Kevin P Murphy's Book "Machine Learning: A Probabilistic Perspective" and implementing with MATLAN - without any toolboxes)</p>

<p>I have a dataset wit... | habedi/stack-exchange-dataset |
31,943 | Is randomly building a BST different from random sampling whole trees? | <p>What is the difference between a randomly built binary search tree (using n keys )and choosing a binary search tree (of n key) from a random distribution</p>
 | data structures binary trees search trees randomness sampling | 1 | Is randomly building a BST different from random sampling whole trees? -- (data structures binary trees search trees randomness sampling)
<p>What is the difference between a randomly built binary search tree (using n keys )and choosing a binary search tree (of n key) from a random distribution</p>
 | habedi/stack-exchange-dataset |
31,945 | Use a Monitor like a Semaphore? | <p>When using monitors for most concurrency problems, you can just put the critical section inside a monitor method and then invoke the method. However, there are some multiplexing problems wherein up to n threads can run their critical sections simultaneously. So we can say that it's useful to know how to use a monito... | concurrency synchronization | 1 | Use a Monitor like a Semaphore? -- (concurrency synchronization)
<p>When using monitors for most concurrency problems, you can just put the critical section inside a monitor method and then invoke the method. However, there are some multiplexing problems wherein up to n threads can run their critical sections simultane... | habedi/stack-exchange-dataset |
31,963 | How to find $c$ and $n_0$ for Big-Oh questions | <p>I understand the theory behind the definition of Big-Oh, but when I try a question, I don't get how you would find the $c$ and $n_0$ values.</p>

<p>For example: if $f(n) = n!$ and $g(n) = 2^n$, how would I go about finding the $c$ and $n_0$ values for $g(n) = O(f(n))$?</p>
 | asymptotics landau notation | 1 | How to find $c$ and $n_0$ for Big-Oh questions -- (asymptotics landau notation)
<p>I understand the theory behind the definition of Big-Oh, but when I try a question, I don't get how you would find the $c$ and $n_0$ values.</p>

<p>For example: if $f(n) = n!$ and $g(n) = 2^n$, how would I go about finding the $... | habedi/stack-exchange-dataset |
31,965 | Not understand exchanging argument proof for optimal prefix code | <p>I am currently reading the Algorithm Design textbook by Kleinberg and Tardos and I am having difficulty understanding a proof using an exchange argument</p>

<p>Statement: A binary tree corresponding to the optimal prefix code is full</p>

<p>Proof: This is easy to prove using an exchange argument. L... | proof techniques | 1 | Not understand exchanging argument proof for optimal prefix code -- (proof techniques)
<p>I am currently reading the Algorithm Design textbook by Kleinberg and Tardos and I am having difficulty understanding a proof using an exchange argument</p>

<p>Statement: A binary tree corresponding to the optimal prefix ... | habedi/stack-exchange-dataset |
31,981 | What is a partially computable function? | <p>In the book <em>Computability, Complexity, and Languages</em>, Martin Davis writes in chapter two:</p>

<blockquote>
 <p>A partial function is said to be partially computable if it is computed by some program. </p>
</blockquote>

<p>and also</p>

<blockquote>
 <p>A function is ... | terminology computability | 1 | What is a partially computable function? -- (terminology computability)
<p>In the book <em>Computability, Complexity, and Languages</em>, Martin Davis writes in chapter two:</p>

<blockquote>
 <p>A partial function is said to be partially computable if it is computed by some program. </p>
</blockquote... | habedi/stack-exchange-dataset |
31,990 | Min/max height of B-tree | <p>I have a question asking for the minimum and maximum height $h$ of a B-Tree with 1000 elements under following conditions:</p>

<ul>
<li>each block can save 1 to 4 records,</li>
<li>the number of internal nodes is between 3 and 5 and</li>
<li>the root has between 3 and 5 children. </li>
... | data structures trees | 1 | Min/max height of B-tree -- (data structures trees)
<p>I have a question asking for the minimum and maximum height $h$ of a B-Tree with 1000 elements under following conditions:</p>

<ul>
<li>each block can save 1 to 4 records,</li>
<li>the number of internal nodes is between 3 and 5 and</li>
<... | habedi/stack-exchange-dataset |
31,995 | Give an example of a language whose Myhill-Nerode equivalence relation is such that if $x,y \in \{0,1\}^*$ with $x \neq y$, then $[x] \neq [y]$ | <p>Suppose $\Sigma = \{0,1\}$. Provide an example of a language $L \subseteq \Sigma^*$ with the property that its associated Myhill-Nerode equivalence relation, $R_L$, is such that every one of its equivalence classes is a singleton set; that is, if $x,y \in \Sigma^*$ with $x \neq y$, then $[x] \neq [y]$, where $[x]$ ... | formal languages | 1 | Give an example of a language whose Myhill-Nerode equivalence relation is such that if $x,y \in \{0,1\}^*$ with $x \neq y$, then $[x] \neq [y]$ -- (formal languages)
<p>Suppose $\Sigma = \{0,1\}$. Provide an example of a language $L \subseteq \Sigma^*$ with the property that its associated Myhill-Nerode equivalence re... | habedi/stack-exchange-dataset |
32,019 | Intersections of some context-free languages | <p>Suppose We have Some language as follows:</p>

<p>$L_1=\{w^* | w=x \text{ and } x \in \Sigma^*\}$</p>

<p>$L_2=\{ww^R ww^R | w \in ( \Sigma + \Sigma)^*\}$</p>

<p>$L_3=\{w | w=xy, x,y \in \Sigma^*, y \text{ is a substring of } x\}$</p>

<p>1) there is a PDA (push down automata) that ... | formal languages context free automata pushdown automata | 1 | Intersections of some context-free languages -- (formal languages context free automata pushdown automata)
<p>Suppose We have Some language as follows:</p>

<p>$L_1=\{w^* | w=x \text{ and } x \in \Sigma^*\}$</p>

<p>$L_2=\{ww^R ww^R | w \in ( \Sigma + \Sigma)^*\}$</p>

<p>$L_3=\{w | w=xy, x,y \... | habedi/stack-exchange-dataset |
32,031 | Find the max of a convex function in fewest samples | <p>Suppose there is a convex function, and a certain domain interval. I want to find the max of this function within the interval. The goal is to minimize the number of times the function is evaluated, because evaluating it is expensive.</p>

<p>I can think of a naive solution involving evaluating the functio... | algorithms | 1 | Find the max of a convex function in fewest samples -- (algorithms)
<p>Suppose there is a convex function, and a certain domain interval. I want to find the max of this function within the interval. The goal is to minimize the number of times the function is evaluated, because evaluating it is expensive.</p>

... | habedi/stack-exchange-dataset |
32,033 | If $L$ is regular, must the language $L_1 = \{w : w^Rw \in L\}$ be regular, or may it be non-regular? | <p>The reverse, $w^{R}$, of a string $w = w_1w_2...w_n$ is the string $w_n...w_2w_1$. Suppose that L is a regular language. Must the language $L_1 = \{w : w^Rw \in L\}$ be regular, or may it be non-regular? Explain.</p>

<p>Intuitively, I suspect that $L_1$ may be nonregular, since the set of even-length pal... | formal languages regular languages | 1 | If $L$ is regular, must the language $L_1 = \{w : w^Rw \in L\}$ be regular, or may it be non-regular? -- (formal languages regular languages)
<p>The reverse, $w^{R}$, of a string $w = w_1w_2...w_n$ is the string $w_n...w_2w_1$. Suppose that L is a regular language. Must the language $L_1 = \{w : w^Rw \in L\}$ be regu... | habedi/stack-exchange-dataset |
32,036 | What is the difference between shortest distance and shortest path? | <p>I am studying graph currently. I found a question, which asks for</p>

<ol>
<li><p>The List <code>A[]</code> which shows shortest distances between $V$ and every
other vertex</p></li>
<li><p>The List <code>B[]</code> which shows shortest paths between $V$ and every other vertex </p></li>
</ol... | terminology graphs | 1 | What is the difference between shortest distance and shortest path? -- (terminology graphs)
<p>I am studying graph currently. I found a question, which asks for</p>

<ol>
<li><p>The List <code>A[]</code> which shows shortest distances between $V$ and every
other vertex</p></li>
<li><p>The List <code... | habedi/stack-exchange-dataset |
32,048 | Positional number representation | <p>There is a definition of integer representation:</p>

<blockquote>
 <p>A positional representation for integers that uses the binary digits 0
 and 1, in which the values represented by successive bits are
 additive, begin with 1, and are multiplied by successive integral
 power of 2, exce... | number formats | 1 | Positional number representation -- (number formats)
<p>There is a definition of integer representation:</p>

<blockquote>
 <p>A positional representation for integers that uses the binary digits 0
 and 1, in which the values represented by successive bits are
 additive, begin with 1, and are mul... | habedi/stack-exchange-dataset |
32,055 | Compute the Hamming code with odd parity for the memory word 1101 1001 0001 1011 | <p>This is the problem I have:</p>

<blockquote>
 <p>Compute the Hamming code with odd parity for the memory word 1101 1001
 0001 1011 (2 pts.). In your solution, mark the parity bits as in the
 following example, where parity bits are: 3, 5, 11, and 13</p>
</blockquote>

<pre><code>0... | memory hardware coding theory hamming code | 1 | Compute the Hamming code with odd parity for the memory word 1101 1001 0001 1011 -- (memory hardware coding theory hamming code)
<p>This is the problem I have:</p>

<blockquote>
 <p>Compute the Hamming code with odd parity for the memory word 1101 1001
 0001 1011 (2 pts.). In your solution, mark the p... | habedi/stack-exchange-dataset |
32,056 | Difference between equivalence and implication | <p>In terms of CTL formulae, what is the difference between equivalence and implication?</p>

<p>(prop = some proposition, && = conjunction, AG = CTL syntax for "globally holds")</p>

<p>E.g. AG (prop1 && prop2) versus (AG prop1) && (AG prop2)</p>

<p>Are those two formul... | logic model checking temporal logic computation tree logic | 1 | Difference between equivalence and implication -- (logic model checking temporal logic computation tree logic)
<p>In terms of CTL formulae, what is the difference between equivalence and implication?</p>

<p>(prop = some proposition, && = conjunction, AG = CTL syntax for "globally holds")</p>

<... | habedi/stack-exchange-dataset |
32,061 | Can there exist a recurrence relation for "sequential search"? | <p>I'm just confused, cause from my knowledge recurrence is applied mostly to recursive procedures or divide and conquer techniques etc.</p>
 | algorithms recurrence relation | 1 | Can there exist a recurrence relation for "sequential search"? -- (algorithms recurrence relation)
<p>I'm just confused, cause from my knowledge recurrence is applied mostly to recursive procedures or divide and conquer techniques etc.</p>
 | habedi/stack-exchange-dataset |
32,069 | Estimate the running time of counting nodes in a binary tree | <p>I am asked to write an efficient method that computes the number of nodes in T, and here is what I did:</p>

<pre><code>public int numOfNodes(Node t)
{
 if (t==null)
 return 0;

 return numOfNodes(t.left) + numOfNodes(t.right)+1;
}
</code></pre>

<p>Every node... | binary trees | 1 | Estimate the running time of counting nodes in a binary tree -- (binary trees)
<p>I am asked to write an efficient method that computes the number of nodes in T, and here is what I did:</p>

<pre><code>public int numOfNodes(Node t)
{
 if (t==null)
 return 0;

 return numOfNodes(... | habedi/stack-exchange-dataset |
32,073 | What algorithm is suitable for very small scale, time dependent optimization? | <p>I have a <strong>time-dependent</strong> (dynamic) optimization problem:
$$
f_t : [0;1]^2 \mapsto \mathbb{R}^+; t \in [1, \dots, n]
$$
$f_t$ is to be maximized. That is for each $t$ I would like to find a relatively high value of $f_t$. Mostly, $f_t$ is a relatively simple, continuous, unimodal func... | optimization heuristics | 1 | What algorithm is suitable for very small scale, time dependent optimization? -- (optimization heuristics)
<p>I have a <strong>time-dependent</strong> (dynamic) optimization problem:
$$
f_t : [0;1]^2 \mapsto \mathbb{R}^+; t \in [1, \dots, n]
$$
$f_t$ is to be maximized. That is for each $t$ I would lik... | habedi/stack-exchange-dataset |
32,075 | Runtime complexity of unary languages | <p>I am trying to find a unary language whose runtime complexity is exponential in $n$ (e.g. $\Theta(2^n)$ or a similar expression). But I am not sure how to reason about the runtime of such languages.</p>

<p>I tried the language: $L_1=\{1^{2^k}\}$. This language can be identified by counting the number of one... | time complexity | 1 | Runtime complexity of unary languages -- (time complexity)
<p>I am trying to find a unary language whose runtime complexity is exponential in $n$ (e.g. $\Theta(2^n)$ or a similar expression). But I am not sure how to reason about the runtime of such languages.</p>

<p>I tried the language: $L_1=\{1^{2^k}\}$. Th... | habedi/stack-exchange-dataset |
32,077 | Split-Find: maintaining dynamic graph connectivity information, under edge deletion | <p>Is there a data structure to keep track of the connected components of a dynamic graph, when the graph might by changing by deleting edges of the graph?</p>

<p>Let $G$ be an undirected graph. I have two operations I'd like to be able to perform:</p>

<ul>
<li><p>Delete$(u,v)$: delete the edge $... | graphs data structures union find | 1 | Split-Find: maintaining dynamic graph connectivity information, under edge deletion -- (graphs data structures union find)
<p>Is there a data structure to keep track of the connected components of a dynamic graph, when the graph might by changing by deleting edges of the graph?</p>

<p>Let $G$ be an undirected ... | habedi/stack-exchange-dataset |
32,081 | Detecting palindromes in binary numbers using a finite state machine | <p>In my first algorithms class we're creating these patterns that are supposed to model a finite state machine. We were given a task to think if we can figure out a way to detect palindromes in binary sequences (no points if we do, it's just a food for thought).</p>

<p>I specifically asked the professor, know... | regular languages finite automata | 1 | Detecting palindromes in binary numbers using a finite state machine -- (regular languages finite automata)
<p>In my first algorithms class we're creating these patterns that are supposed to model a finite state machine. We were given a task to think if we can figure out a way to detect palindromes in binary sequences ... | habedi/stack-exchange-dataset |
32,088 | LR(0) expressive power | <p>So I have grouped the following formalisms into a power hierarchy (and made classes for them):</p>

<h2>Class 1</h2>

<ul>
<li>DFA</li>
<li>NFA</li>
<li>NFAϵ</li>
<li>reg.exp</li>
</ul>

<h2>Class 2 (DCFL expressivity?)</h2>

<ul>
<li>LR(1)</li>
<li>DPDA</l... | formal languages automata parsers | 1 | LR(0) expressive power -- (formal languages automata parsers)
<p>So I have grouped the following formalisms into a power hierarchy (and made classes for them):</p>

<h2>Class 1</h2>

<ul>
<li>DFA</li>
<li>NFA</li>
<li>NFAϵ</li>
<li>reg.exp</li>
</ul>

<h2>Class 2 (DCFL expres... | habedi/stack-exchange-dataset |
32,090 | Proving that the average case complexity of binary search is O(log n) | <p>I know that the both the average and worst case complexity of binary search is O(log n) and I know how to prove the worst case complexity is O(log n) using recurrence relations.
But how would I go about proving that the average case complexity of binary search is O(log n)?</p>
 | algorithms time complexity average case binary search | 1 | Proving that the average case complexity of binary search is O(log n) -- (algorithms time complexity average case binary search)
<p>I know that the both the average and worst case complexity of binary search is O(log n) and I know how to prove the worst case complexity is O(log n) using recurrence relations.
But ho... | habedi/stack-exchange-dataset |
32,091 | Round-Robin Scheduler - What exactly is the quantum time used for? | <p>Suppose you have three stages for a job:</p>

<p>Creation stage = the job gets created</p>

<p>Executing stage = the job is executed/served </p>

<p>Finishing stage = the job is "marked" as finished.</p>

<p>Now, say the quantum time for a round-robin scheduler is 100ms. From what I u... | operating systems scheduling process scheduling | 1 | Round-Robin Scheduler - What exactly is the quantum time used for? -- (operating systems scheduling process scheduling)
<p>Suppose you have three stages for a job:</p>

<p>Creation stage = the job gets created</p>

<p>Executing stage = the job is executed/served </p>

<p>Finishing stage = the jo... | habedi/stack-exchange-dataset |
32,095 | Proof that L(M) = {accepts the string 1100 } is undecidable | <p>Let $$L_\ = \{\langle M\rangle \mid M \text{ is a Turing Machine that accepts the string 1100}\}\, .$$</p>

<p>To proof that the language $L$ is undecidable I should reduce something to $L$, right?</p>

<p>I tried with the classic $A\ TM$, but I could not figure out how to reduce properly.</p>
&#... | turing machines reductions undecidability | 1 | Proof that L(M) = {accepts the string 1100 } is undecidable -- (turing machines reductions undecidability)
<p>Let $$L_\ = \{\langle M\rangle \mid M \text{ is a Turing Machine that accepts the string 1100}\}\, .$$</p>

<p>To proof that the language $L$ is undecidable I should reduce something to $L$, right?</p>&... | habedi/stack-exchange-dataset |
32,101 | Offline scheduling fully determined arbitrary jobs in multiprocessor setting | <p>Let $\mathcal{J} = \{J_1,...,J_n\}$ be a set of jobs with each $J_i = [a_i,r_i,d_i]$ where the job becomes available at its arrival time $a_i$, requires $r_i$ execution time and needs to be finished at its deadline $d_i$ (hard real time). Assume we have $m$ processors available.</p>

<p>Given the above, what... | asymptotics scheduling | 1 | Offline scheduling fully determined arbitrary jobs in multiprocessor setting -- (asymptotics scheduling)
<p>Let $\mathcal{J} = \{J_1,...,J_n\}$ be a set of jobs with each $J_i = [a_i,r_i,d_i]$ where the job becomes available at its arrival time $a_i$, requires $r_i$ execution time and needs to be finished at its deadli... | habedi/stack-exchange-dataset |
32,110 | Proof of big theta using induction | <p>Here is a recursive definition for the runtime of some unspecified function. $a$ and $c$ are positive constants.</p>

<p>$T(n) = a$, if $n = 2$</p>

<p>$T(n) = 2T(n/2) + cn$ if $n > 2$
Use induction to prove that $T(n) = \Theta(n \log n)$</p>

<p>Any idea on how to solve this?</p>
 | algorithm analysis proof techniques recurrence relation recursion induction | 1 | Proof of big theta using induction -- (algorithm analysis proof techniques recurrence relation recursion induction)
<p>Here is a recursive definition for the runtime of some unspecified function. $a$ and $c$ are positive constants.</p>

<p>$T(n) = a$, if $n = 2$</p>

<p>$T(n) = 2T(n/2) + cn$ if $n > ... | habedi/stack-exchange-dataset |
32,112 | Does a graph always have a minimum spanning tree that is binary? | <p>I have a graph and I need to find a minimum spanning tree to a given graph. What is to be done so that the output obtained is a binary tree?</p>
 | graphs binary trees spanning trees minimum spanning tree | 1 | Does a graph always have a minimum spanning tree that is binary? -- (graphs binary trees spanning trees minimum spanning tree)
<p>I have a graph and I need to find a minimum spanning tree to a given graph. What is to be done so that the output obtained is a binary tree?</p>
 | habedi/stack-exchange-dataset |
32,114 | What problem cannot be solved by a short program? | <p>BACKGROUND:</p>

<p>Recently I tried to solve a certain difficult problem that gets as input an array of $n$ numbers. For $n=3$, the only solution I could find was to have a different treatment for each of the $n!=6$ orderings of the 3 numbers. I.e., there is one solution for the case $A>B>C$, another ... | complexity theory programming languages kolmogorov complexity | 1 | What problem cannot be solved by a short program? -- (complexity theory programming languages kolmogorov complexity)
<p>BACKGROUND:</p>

<p>Recently I tried to solve a certain difficult problem that gets as input an array of $n$ numbers. For $n=3$, the only solution I could find was to have a different treatmen... | habedi/stack-exchange-dataset |
32,116 | Sorting with a recursive oracle | <p>It is known that the runtime complexity of sorting is $\Theta (n \log n)$. But what if we have, for every input array of size $n$, an oracle that can sort any array of $k<n$ numbers in constant time?</p>

<p>In this case, the runtime of merge sort becomes $O(n)$. The recursive calls are cheap and the runt... | time complexity runtime analysis sorting oracle machines | 1 | Sorting with a recursive oracle -- (time complexity runtime analysis sorting oracle machines)
<p>It is known that the runtime complexity of sorting is $\Theta (n \log n)$. But what if we have, for every input array of size $n$, an oracle that can sort any array of $k<n$ numbers in constant time?</p>

<p>In t... | habedi/stack-exchange-dataset |
32,119 | Where would someone find amortized analysis more useful than average analysis and the opposite? | <p>I'm trying to understand the difference between these two. They both look at what happens on average, however amortized analysis is actually dealing with exactly the amount of operations you are doing in each step, while average analysis produces an expected cost based on probabilities.</p>

<p>For them to b... | algorithm analysis amortized analysis average case | 1 | Where would someone find amortized analysis more useful than average analysis and the opposite? -- (algorithm analysis amortized analysis average case)
<p>I'm trying to understand the difference between these two. They both look at what happens on average, however amortized analysis is actually dealing with exactly the... | habedi/stack-exchange-dataset |
32,144 | What if traversal order of two of pre-order, in-order and post-order is same? | <p>Supposing a tree T has the identical:</p>

<ol>
<li>Pre-order traversal and in-order traversal</li>
<li>Pre-order traversal and post-order traversal</li>
<li>In-order traversal and post-order traversal</li>
</ol>

<p>How does T look like?</p>

<p>From the previous discussion i... | binary trees | 1 | What if traversal order of two of pre-order, in-order and post-order is same? -- (binary trees)
<p>Supposing a tree T has the identical:</p>

<ol>
<li>Pre-order traversal and in-order traversal</li>
<li>Pre-order traversal and post-order traversal</li>
<li>In-order traversal and post-order traversal... | habedi/stack-exchange-dataset |
32,145 | Determining Number of States in a Turing Machine | <p>I am looking at an example Turing machine in my textbook, <em>Automata and Computability</em> by Dexter C. Kozen, and I'm confused as to how they determine the number of states this particular machine has. The example (Example 28.1, page 211) reads as follows:</p>

<blockquote>
 <p>Here is a TM that acc... | turing machines notation | 1 | Determining Number of States in a Turing Machine -- (turing machines notation)
<p>I am looking at an example Turing machine in my textbook, <em>Automata and Computability</em> by Dexter C. Kozen, and I'm confused as to how they determine the number of states this particular machine has. The example (Example 28.1, page ... | habedi/stack-exchange-dataset |
32,146 | How to properly solve this Hidden Markov Model problem? | <p>I got a an exercise problem which should be seen as a HMM scenario and argument some statements. However I'm quite confused about how to properly solve and argument my solutions.</p>

<p>Problem tells:</p>

<p><em>Imagine you want to determine the annual temperature centuries of years ago, when of co... | artificial intelligence hidden markov models | 1 | How to properly solve this Hidden Markov Model problem? -- (artificial intelligence hidden markov models)
<p>I got a an exercise problem which should be seen as a HMM scenario and argument some statements. However I'm quite confused about how to properly solve and argument my solutions.</p>

<p>Problem tells:</... | habedi/stack-exchange-dataset |
32,149 | What are system clock and CPU clock; and what are their functions? | <p>While reading a book, I came across a paragraph given below:</p>

<blockquote>
 <p>In order to synchronize all of a computer’s operations, a system clock—a small quartz 
 crystal located on the motherboard—is used. The system clock sends out a signal on a regular basis to all other computer compone... | computer architecture clocks | 1 | What are system clock and CPU clock; and what are their functions? -- (computer architecture clocks)
<p>While reading a book, I came across a paragraph given below:</p>

<blockquote>
 <p>In order to synchronize all of a computer’s operations, a system clock—a small quartz 
 crystal located on the moth... | habedi/stack-exchange-dataset |
32,151 | Is "duplicate" in RPN enough for replacing variable binding in term expressions? | <p>I try to work out some consequences of storing (or "communicating"/"transmitting") a rational number by a term expression using the following operators: $0$, $\mathsf{inc}$, $\mathsf{add}$, $\mathsf{mul}$, $\mathsf{neg}$, and $\mathsf{inv}$. Here $\mathsf{add}$ and $\mathsf{mul}$ are binary operators, $\mathsf{inc}$... | formal languages pushdown automata stacks term rewriting | 1 | Is "duplicate" in RPN enough for replacing variable binding in term expressions? -- (formal languages pushdown automata stacks term rewriting)
<p>I try to work out some consequences of storing (or "communicating"/"transmitting") a rational number by a term expression using the following operators: $0$, $\mathsf{inc}$, ... | habedi/stack-exchange-dataset |
32,155 | Fixed size set to contain the maximum number of given sets | <p>I asked this question in SO <a href="https://stackoverflow.com/questions/24104859/fixed-size-set-to-contain-the-maximum-number-of-given-sets">here</a></p>

<p>I have about 1000 sets of size <=5 containing numbers 1 to 100. </p>

<pre><code>{1}, {4}, {1,3}, {3,5,6}, {4,5,6,7}, {5,25,42,67,100} ...... | algorithms optimization | 1 | Fixed size set to contain the maximum number of given sets -- (algorithms optimization)
<p>I asked this question in SO <a href="https://stackoverflow.com/questions/24104859/fixed-size-set-to-contain-the-maximum-number-of-given-sets">here</a></p>

<p>I have about 1000 sets of size <=5 containing numbers 1 to ... | habedi/stack-exchange-dataset |
32,161 | What's the difference between Adaptive Control and a Kalman Filter? | <p>From my basic understanding of Adaptive Control, I understand that it uses the error and the velocity of the error to approximate the error in the solution space of a problem, thus allowing for guaranteed convergence under certain conditions and rapid adaptation to changing conditions. I've accumulated this knowledg... | machine learning | 1 | What's the difference between Adaptive Control and a Kalman Filter? -- (machine learning)
<p>From my basic understanding of Adaptive Control, I understand that it uses the error and the velocity of the error to approximate the error in the solution space of a problem, thus allowing for guaranteed convergence under cert... | habedi/stack-exchange-dataset |
32,163 | What's the difference between Adaptive Control and Hierarchical Reinforcement Learning? | <p>After watching Travis DeWolf <a href="http://1.usa.gov/1tg2n2I">presentation on scaling neural computation</a>, I'm a bit confused about the difference between Reinforcement Learning (whether hierarchical or not) and Adaptive Control. They both seem to be exploring environments and minimizing error through learning,... | machine learning reinforcement learning | 1 | What's the difference between Adaptive Control and Hierarchical Reinforcement Learning? -- (machine learning reinforcement learning)
<p>After watching Travis DeWolf <a href="http://1.usa.gov/1tg2n2I">presentation on scaling neural computation</a>, I'm a bit confused about the difference between Reinforcement Learning (... | habedi/stack-exchange-dataset |
32,181 | Find k maximum numbers from a heap of size n in O(klog(k)) time | <p>I have a binary heap with $n$ elements. I want to get the $k$ largest elements in this heap, in $O(k \log k)$ time. How do I do it?</p>

<p>(Calling deletemax $k$ times yields a $O(k \log n)$ complexity. I'm looking for $O(k \log k)$.)</p>

<p>The only solution I've come up with so far is the foll... | data structures heaps | 1 | Find k maximum numbers from a heap of size n in O(klog(k)) time -- (data structures heaps)
<p>I have a binary heap with $n$ elements. I want to get the $k$ largest elements in this heap, in $O(k \log k)$ time. How do I do it?</p>

<p>(Calling deletemax $k$ times yields a $O(k \log n)$ complexity. I'm looking... | habedi/stack-exchange-dataset |
32,195 | Hardness and approximation of a problem with a parameter | <p>Let $H$ be a decision problem, where we are given an integer $k$ and some object, say a graph or a formula. We know that $H$ is NP-complete for $k \geq c$, where $c$ is some constant like 3 ($H$ could be $k$-SAT, or $k$-vertex coloring, or something like that).</p>

<p>I have a problem $X$ I think is NP-comp... | np complete reductions approximation | 1 | Hardness and approximation of a problem with a parameter -- (np complete reductions approximation)
<p>Let $H$ be a decision problem, where we are given an integer $k$ and some object, say a graph or a formula. We know that $H$ is NP-complete for $k \geq c$, where $c$ is some constant like 3 ($H$ could be $k$-SAT, or $k... | habedi/stack-exchange-dataset |
32,204 | How to prove that $\{0^n 1^{5n} \mid n \ge 10000 \}$ is not a regular language? | <p>I proved that $$ \{ 0^n 1^{5n} \mid n \geq 0 \}$$ is not a regular language using Pumping Lemma by following way.</p>

<p>Solve by contradiction that $ L = \{0^n 1^{5n} \mid n \geq 0 \}$ is regular language.</p>

<ol>
<li><p>Let $0^p 1^{5p}$ be in L, where $p$ is the pumping length.</p></li>
... | formal languages regular languages pumping lemma | 1 | How to prove that $\{0^n 1^{5n} \mid n \ge 10000 \}$ is not a regular language? -- (formal languages regular languages pumping lemma)
<p>I proved that $$ \{ 0^n 1^{5n} \mid n \geq 0 \}$$ is not a regular language using Pumping Lemma by following way.</p>

<p>Solve by contradiction that $ L = \{0^n 1^{5n} \mid ... | habedi/stack-exchange-dataset |
32,213 | High Level Explanation of the Pumping Lemma | <p>I have a problem that I cannot figure out regarding using the pumping lemma to prove that a language is not regular. I don't understand how I go about proving through contradiction that the language is not regular.</p>

<p>When I read about the pumping lemma, all I am finding are complicated explanations inv... | formal languages regular languages pumping lemma | 1 | High Level Explanation of the Pumping Lemma -- (formal languages regular languages pumping lemma)
<p>I have a problem that I cannot figure out regarding using the pumping lemma to prove that a language is not regular. I don't understand how I go about proving through contradiction that the language is not regular.</p>&... | habedi/stack-exchange-dataset |
32,215 | Pumping Lemma for $L=\{a^{2k} b^n b^k \mid k\ge0, n\ge0\}$ | <p>$L=\{a^{2k}b^nb^k\mid k\geq0, n\geq0\}$ over alphabet $\{a,b\}$</p>

<p>How do I prove that $L$ is not regular using Pumping Lemma? All the examples I've come across had same exponents all around, and I'm a bit confused how should I write this down.</p>

<p>Should I start with $w=\{a^pb^pb^p\mid p\le... | formal languages pumping lemma | 1 | Pumping Lemma for $L=\{a^{2k} b^n b^k \mid k\ge0, n\ge0\}$ -- (formal languages pumping lemma)
<p>$L=\{a^{2k}b^nb^k\mid k\geq0, n\geq0\}$ over alphabet $\{a,b\}$</p>

<p>How do I prove that $L$ is not regular using Pumping Lemma? All the examples I've come across had same exponents all around, and I'm a bit con... | habedi/stack-exchange-dataset |
32,216 | How CPU know which process generated an interrupt? | <p>When a computer OS supports multi-program, it needs to have a scheduling algorithm to handle which process will be run by the cpu. </p>

<p>If a process is in state 'blocked' waiting for IO, the scheduling causes another process to be taken by the cpu while the process in state 'blocked' is waiting for a res... | operating systems | 1 | How CPU know which process generated an interrupt? -- (operating systems)
<p>When a computer OS supports multi-program, it needs to have a scheduling algorithm to handle which process will be run by the cpu. </p>

<p>If a process is in state 'blocked' waiting for IO, the scheduling causes another process to be ... | habedi/stack-exchange-dataset |
32,219 | When problem A reduces to problem B, which problem is more complex? | <p>When discussing complexity classes, when we say that problem $A$ reduces to problem $B$, are we saying that problem $A$ is at least as complex as problem $B$, or the other way around?</p>
 | complexity theory terminology reductions | 1 | When problem A reduces to problem B, which problem is more complex? -- (complexity theory terminology reductions)
<p>When discussing complexity classes, when we say that problem $A$ reduces to problem $B$, are we saying that problem $A$ is at least as complex as problem $B$, or the other way around?</p>
 | habedi/stack-exchange-dataset |
32,226 | How to prove that a language is not recursively enumerable | <p>How does one prove that some arbitrary language <span class="math-container">$L$</span> is <strong>not</strong> recursively enumerable?</p>

<p>I know I can prove that the language <span class="math-container">$L$</span> is recursively enumerable by constructing a Turing machine <span class="math-container">... | computability proof techniques semi decidability | 1 | How to prove that a language is not recursively enumerable -- (computability proof techniques semi decidability)
<p>How does one prove that some arbitrary language <span class="math-container">$L$</span> is <strong>not</strong> recursively enumerable?</p>

<p>I know I can prove that the language <span class="ma... | habedi/stack-exchange-dataset |
32,232 | Can every recursively enumerable language be defined with regular expression? | <p>Can every recursively enumerable language be defined with regular expression?</p>

<p>I came across this question, when studying for my test: Prove that for any finite language $L$, there is a Turing machine $M$ with $L(M) = L$ with time and space complexity $t(n) \leq n+1, s(n) \leq n+2$, respectively ($n$ ... | formal languages turing machines | 1 | Can every recursively enumerable language be defined with regular expression? -- (formal languages turing machines)
<p>Can every recursively enumerable language be defined with regular expression?</p>

<p>I came across this question, when studying for my test: Prove that for any finite language $L$, there is a ... | habedi/stack-exchange-dataset |
32,239 | Undecidability in the context of modern programming languages | <p>Imagine a program, executed by an interpreter to be a Turing Machine. Consider this code:</p>

<pre><code>x = read_input
print x
</code></pre>

<p>Does undecidability mean that there may possibly be an input to this program such that the program may never halt?</p>
 | undecidability | 1 | Undecidability in the context of modern programming languages -- (undecidability)
<p>Imagine a program, executed by an interpreter to be a Turing Machine. Consider this code:</p>

<pre><code>x = read_input
print x
</code></pre>

<p>Does undecidability mean that there may possibly be an input to ... | habedi/stack-exchange-dataset |
32,245 | Lamport Timestamps: When to Update Counters | <p>In the timepiece (excuse the pun) that is Time, Clocks and the Ordering of Events, Lamport describes the logical clock algorithm as the following:</p>

<ol>
<li>Each process $Pi$ increments $Ci$ between any two successive events. </li>
<li>If event a is the sending of a message m by process $Pi$, the... | distributed systems synchronization clocks | 1 | Lamport Timestamps: When to Update Counters -- (distributed systems synchronization clocks)
<p>In the timepiece (excuse the pun) that is Time, Clocks and the Ordering of Events, Lamport describes the logical clock algorithm as the following:</p>

<ol>
<li>Each process $Pi$ increments $Ci$ between any two su... | habedi/stack-exchange-dataset |
32,246 | how to prove a language is decidable | <p>Hopefully this is not a duplicate</p>

<p>How do I prove a Language L={a,b,c} is decidable or not</p>

<p>I read somewhere that if a turing machine accepts a language and halts on every input string then the language is decidable.</p>

<p>Having said that how do i design / prove that a turing... | decision problem | 1 | how to prove a language is decidable -- (decision problem)
<p>Hopefully this is not a duplicate</p>

<p>How do I prove a Language L={a,b,c} is decidable or not</p>

<p>I read somewhere that if a turing machine accepts a language and halts on every input string then the language is decidable.</p>
&#x... | habedi/stack-exchange-dataset |
32,258 | The meaning of $*$ in regular expressions | <p>I'm designing a Turing machine that decides a language denoted by a regular expression. Let's say this expression is $a^*bbc^*$. Does this machine accept the string $bb$ since $a^*$ and $c^*$ can have zero instances or more?</p>
 | turing machines regular expressions | 1 | The meaning of $*$ in regular expressions -- (turing machines regular expressions)
<p>I'm designing a Turing machine that decides a language denoted by a regular expression. Let's say this expression is $a^*bbc^*$. Does this machine accept the string $bb$ since $a^*$ and $c^*$ can have zero instances or more?</p>
 | habedi/stack-exchange-dataset |
32,260 | Converting DFA to regular expression | <p>I have the following DFA. (Yellow stated are accepting states.) I want to eliminate states step by step to find the regular expression of it.<br>
In my steps, I think there is a bug because I do not know what to do with state 4.</p>

<p><img src="https://i.stack.imgur.com/gvX7Y.png" alt="enter image desc... | automata regular expressions | 1 | Converting DFA to regular expression -- (automata regular expressions)
<p>I have the following DFA. (Yellow stated are accepting states.) I want to eliminate states step by step to find the regular expression of it.<br>
In my steps, I think there is a bug because I do not know what to do with state 4.</p>

... | habedi/stack-exchange-dataset |
32,263 | Finding approximately collinear points | <p>my issue comes from image processing. The image below is for a better understanding of the problem. I have to detect three dots (shown in black, marked with red arrows). The other points I get from my image after processing it are shown in green. As you can see I get many more points from the image than just the bla... | algorithms image processing | 1 | Finding approximately collinear points -- (algorithms image processing)
<p>my issue comes from image processing. The image below is for a better understanding of the problem. I have to detect three dots (shown in black, marked with red arrows). The other points I get from my image after processing it are shown in green... | habedi/stack-exchange-dataset |
32,264 | Why do we need "Bloom Filters" if we can use hash tables? | <p>A Bloom filter is a probabilistic data structure designed to tell, rapidly and memory-efficiently, whether an element is in the set or no. </p>

<p>If we can use hash tables where we have O(1) in best time, O(n) in a very bad situations. Why do we need a new abstract data structure that look-up for an elemen... | data structures bloom filters | 1 | Why do we need "Bloom Filters" if we can use hash tables? -- (data structures bloom filters)
<p>A Bloom filter is a probabilistic data structure designed to tell, rapidly and memory-efficiently, whether an element is in the set or no. </p>

<p>If we can use hash tables where we have O(1) in best time, O(n) in a... | habedi/stack-exchange-dataset |
32,267 | Need help to derive the Complexity! | <p>Please help me regarding this one! What will be the communication and computation complexity of this code??</p>

<pre><code>While (m>0) do
{
 While ((m mod 2)==0) do
 {
 m ← ⌊m/2⌋ 
 //parties communicate m times;
 }
m = m – 1;
}
</code></p... | algorithms complexity theory communication complexity | 1 | Need help to derive the Complexity! -- (algorithms complexity theory communication complexity)
<p>Please help me regarding this one! What will be the communication and computation complexity of this code??</p>

<pre><code>While (m>0) do
{
 While ((m mod 2)==0) do
 {
 m ← ⌊m/2... | habedi/stack-exchange-dataset |
32,269 | What is the Big O of T(n)? | <p>I have a homework that I should find the formula and the order of $T(n)$ given by</p>

<p>$$T(1) = 1 \qquad\qquad
 T(n) = \frac{T(n-1)}{T(n-1) + 1}\,.
$$</p>

<p>I've established that $T(n) = \frac{1}{n}$ but now I am a little confused. Is $T(n) \in O(\frac{1}{n})$ the correct answer for the... | algorithm analysis asymptotics recurrence relation | 1 | What is the Big O of T(n)? -- (algorithm analysis asymptotics recurrence relation)
<p>I have a homework that I should find the formula and the order of $T(n)$ given by</p>

<p>$$T(1) = 1 \qquad\qquad
 T(n) = \frac{T(n-1)}{T(n-1) + 1}\,.
$$</p>

<p>I've established that $T(n) = \frac{1}{n}$ but ... | habedi/stack-exchange-dataset |
32,276 | Complexity of natural language processing problems | <p>Which natural language processing problems are NP-Complete or NP-Hard?</p>

<p>I've searched the <a href="/questions/tagged/natural-lang-processing" class="post-tag" title="show questions tagged 'natural-lang-processing'" rel="tag">natural-lang-processing</a> and <a href="/questions/tagged/complexity... | complexity theory reference request np complete np hard natural language processing | 1 | Complexity of natural language processing problems -- (complexity theory reference request np complete np hard natural language processing)
<p>Which natural language processing problems are NP-Complete or NP-Hard?</p>

<p>I've searched the <a href="/questions/tagged/natural-lang-processing" class="post-tag" tit... | habedi/stack-exchange-dataset |
32,291 | Strongly connected components in graph | <p>Statement:<strong>SCC in G is same as Rev(G)</strong></p>

<p>Ex:Consider the following graph g</p>

<p>0->1</p>

<p>1->2</p>

<p>2->4</p>

<p>3->1</p>

<p>4->3</p>

<p>The strong components set would be S={0,1,2,3,4}</p>

<p>If I reverse the above grap... | algorithms graphs | 1 | Strongly connected components in graph -- (algorithms graphs)
<p>Statement:<strong>SCC in G is same as Rev(G)</strong></p>

<p>Ex:Consider the following graph g</p>

<p>0->1</p>

<p>1->2</p>

<p>2->4</p>

<p>3->1</p>

<p>4->3</p>

<p>The strong components set woul... | habedi/stack-exchange-dataset |
32,294 | What problem does cache coloring solve? | <p>According to what I have read from two different sources, cache coloring is (was?) required in order to:</p>

<ul>
<li><p><strong>Counter the problem of aliasing:</strong> Prevent two different virtual addresses with the same physical address from mapping to different cache sets. (According to a <a href=... | cpu cache virtual memory | 1 | What problem does cache coloring solve? -- (cpu cache virtual memory)
<p>According to what I have read from two different sources, cache coloring is (was?) required in order to:</p>

<ul>
<li><p><strong>Counter the problem of aliasing:</strong> Prevent two different virtual addresses with the same physical ... | habedi/stack-exchange-dataset |
32,295 | Model Checking: hardware vs software | <p>In short: What is the basic difference that allows model checking for hardware to be "easily" solvable, but makes it undecidable for software?</p>

<p>I guess it has to boil down to the difference between hardware being finite automata and software having the expressiveness of a Turing machine, which would b... | undecidability model checking software verification | 1 | Model Checking: hardware vs software -- (undecidability model checking software verification)
<p>In short: What is the basic difference that allows model checking for hardware to be "easily" solvable, but makes it undecidable for software?</p>

<p>I guess it has to boil down to the difference between hardware b... | habedi/stack-exchange-dataset |
32,296 | Acyclic Graph in NL | <p>From the book <em>The Nature of Computation</em> by Moore and Mertens, exercise 8.9:</p>

<blockquote>
 <p>Consider the problem ACYCLIC GRAPH of telling whether a directed graph is acyclic. Show that the problem is in NL, and then show that the problem is NL-complete.</p>
</blockquote>

<p>I... | complexity theory graphs space complexity | 1 | Acyclic Graph in NL -- (complexity theory graphs space complexity)
<p>From the book <em>The Nature of Computation</em> by Moore and Mertens, exercise 8.9:</p>

<blockquote>
 <p>Consider the problem ACYCLIC GRAPH of telling whether a directed graph is acyclic. Show that the problem is in NL, and then show t... | habedi/stack-exchange-dataset |
32,297 | 2-way Graph Partitioning problem | <p>We have a graph $G=(V,E)$ and we need to divide this graph into two clusters $A$ and $B$. Some pairs of vertices $u$, $v$ should not be in the same cluster, and we define an edge $(u,v) \in E$. The total cost of a solution is the total number of edges with endpoints both in the <em>same</em> cluster. My goal is to f... | algorithms graphs terminology partition problem | 1 | 2-way Graph Partitioning problem -- (algorithms graphs terminology partition problem)
<p>We have a graph $G=(V,E)$ and we need to divide this graph into two clusters $A$ and $B$. Some pairs of vertices $u$, $v$ should not be in the same cluster, and we define an edge $(u,v) \in E$. The total cost of a solution is the t... | habedi/stack-exchange-dataset |
32,304 | Comparing $2^{F_n}$ and $2^{\varphi^n}$ | <p>if we define $F_n$ be the $n$th fibonacci number and $\varphi$ be golden number then can we say that </p>

<p>$2^{F_n} \in \Theta(2^{\varphi^n})$</p>

<p>or in other word </p>

<p>$2^{\frac{\varphi^n - (-\varphi)^{-n}}{\sqrt{5}}} \in \Theta(2^{\varphi^n})$</p>

<p>It's simple to show ... | asymptotics | 1 | Comparing $2^{F_n}$ and $2^{\varphi^n}$ -- (asymptotics)
<p>if we define $F_n$ be the $n$th fibonacci number and $\varphi$ be golden number then can we say that </p>

<p>$2^{F_n} \in \Theta(2^{\varphi^n})$</p>

<p>or in other word </p>

<p>$2^{\frac{\varphi^n - (-\varphi)^{-n}}{\sqrt{5}}} \in \T... | habedi/stack-exchange-dataset |
32,311 | Proving the lower bound of compares in comparison based sorting | <p>I'm reading Sedgewick and Wayne's book of Algorithm. When I read the following proof in the attached picture, I don't understand why it assumed the comparison number is lg(number of leaves). Any help is appreciated!<img src="https://i.stack.imgur.com/qHTRv.png" alt="enter image description here"></p>
 | algorithms algorithm analysis runtime analysis sorting | 1 | Proving the lower bound of compares in comparison based sorting -- (algorithms algorithm analysis runtime analysis sorting)
<p>I'm reading Sedgewick and Wayne's book of Algorithm. When I read the following proof in the attached picture, I don't understand why it assumed the comparison number is lg(number of leaves). An... | habedi/stack-exchange-dataset |
32,320 | Is CYK still relevant today? | <p>I've come across the <a href="http://en.wikipedia.org/wiki/CYK_algorithm" rel="noreferrer">CYK algorithm</a> and was wondering, as it's quite old, if it is still relevant today. </p>

<p>Is it or an extension of it still being used in compilers (for example), or have other algorithms proven to be better? </p... | context free compilers dynamic programming parsers syntax trees | 1 | Is CYK still relevant today? -- (context free compilers dynamic programming parsers syntax trees)
<p>I've come across the <a href="http://en.wikipedia.org/wiki/CYK_algorithm" rel="noreferrer">CYK algorithm</a> and was wondering, as it's quite old, if it is still relevant today. </p>

<p>Is it or an extension of... | habedi/stack-exchange-dataset |
32,325 | Is there an algorithm that provably exists although we don't know what it is? | <p>In mathematics, there are many existence proofs that are non-constructive, so we know that a certain object exists although we don't know how to find it.</p>

<p>I am looking for similar results in computer science. In particular: is there a problem that we can prove it is decidable without showing an algori... | algorithms proof techniques | 1 | Is there an algorithm that provably exists although we don't know what it is? -- (algorithms proof techniques)
<p>In mathematics, there are many existence proofs that are non-constructive, so we know that a certain object exists although we don't know how to find it.</p>

<p>I am looking for similar results in ... | habedi/stack-exchange-dataset |
32,332 | Is ecological bin packing NP-hard? | <p>The ACM Contest Problem 102 (<a href="http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=38" rel="nofollow">HTML</a> or <a href="http://uva.onlinejudge.org/external/1/102.pdf" rel="nofollow">PDF</a>) can be paraphrased as:</p>

<blockquote>
 <p>Giv... | complexity theory optimization np hard | 1 | Is ecological bin packing NP-hard? -- (complexity theory optimization np hard)
<p>The ACM Contest Problem 102 (<a href="http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=38" rel="nofollow">HTML</a> or <a href="http://uva.onlinejudge.org/external/1/102.pdf" rel="n... | habedi/stack-exchange-dataset |
32,334 | Show that the string $( [ ) ]$ is not in a Dyck language | <p>I think I understand why the string $( [ ) ]$ is not in a Dyck language. </p>

<p>In my words, </p>

<p>D2* is all the dyck words of 2 parentheses.</p>

<p>From the definiton of $D2*$, every words must have exactly 2 pairs correctly nested pairs of parentheses.</p>

<p>All the words o... | formal languages context free formal grammars proof techniques | 1 | Show that the string $( [ ) ]$ is not in a Dyck language -- (formal languages context free formal grammars proof techniques)
<p>I think I understand why the string $( [ ) ]$ is not in a Dyck language. </p>

<p>In my words, </p>

<p>D2* is all the dyck words of 2 parentheses.</p>

<p>From the def... | habedi/stack-exchange-dataset |
32,338 | Show that $0^i$ where $i$ is a power of 2 is not context free | <p>I'm having difficulty trying to use the pumping lemma in order to show that $L= \{0^i \mid \ i \text{ is a power of 2 }\} $ is not context free.</p>

<p>I"m starting by stating that $ s = 0^p$ and then $ s = uvxyz $ and that in order for a language to be context free it must follow the 3 conditions: $|vy| &g... | formal languages context free pumping lemma | 1 | Show that $0^i$ where $i$ is a power of 2 is not context free -- (formal languages context free pumping lemma)
<p>I'm having difficulty trying to use the pumping lemma in order to show that $L= \{0^i \mid \ i \text{ is a power of 2 }\} $ is not context free.</p>

<p>I"m starting by stating that $ s = 0^p$ and t... | habedi/stack-exchange-dataset |
32,350 | How do you show that repeatedly dividing $n$ by $2$ takes $\log_2n$ steps to reach $1$? | <p>I don't see why $n, n/2, n/4, n/8, \dots, 1$ takes $\log_2 n$ steps. Is there a more general statement on this repeated division?</p>
 | discrete mathematics | 1 | How do you show that repeatedly dividing $n$ by $2$ takes $\log_2n$ steps to reach $1$? -- (discrete mathematics)
<p>I don't see why $n, n/2, n/4, n/8, \dots, 1$ takes $\log_2 n$ steps. Is there a more general statement on this repeated division?</p>
 | habedi/stack-exchange-dataset |
32,357 | Is the height of the tree the number of edges or number of nodes? | <p>I'm so confused by some of the theorems online about tree heights. Does tree height mean the number of edges or nodes? if nodes, does it include the node it is counting from? Can the height of a tree start from 0?</p>
 | graphs terminology trees | 1 | Is the height of the tree the number of edges or number of nodes? -- (graphs terminology trees)
<p>I'm so confused by some of the theorems online about tree heights. Does tree height mean the number of edges or nodes? if nodes, does it include the node it is counting from? Can the height of a tree start from 0?</p>
... | habedi/stack-exchange-dataset |
32,359 | Leveling array values with the smallest move | <p>I'm not an expert of the theory of algorithm, so please forgive me if this problem is nonsense, but I want to find good algorithm to solve below problem.</p>

<p>There is a array of integer each of which has been assigned with random initial value such like [1,5,-3,4] or [123, 543, 295, -703, …]</p>

... | algorithms | 1 | Leveling array values with the smallest move -- (algorithms)
<p>I'm not an expert of the theory of algorithm, so please forgive me if this problem is nonsense, but I want to find good algorithm to solve below problem.</p>

<p>There is a array of integer each of which has been assigned with random initial value ... | habedi/stack-exchange-dataset |
32,376 | Time Complexity $\Theta$ vs. $\Omega$ | <p>If an algorithm has running time of $\Theta(n^2)$, is it possible to have a best-case running time of $\Omega(n)$? Or is the fastest running time only $c n^2$ for some constant factor $c$?</p>
 | asymptotics landau notation | 1 | Time Complexity $\Theta$ vs. $\Omega$ -- (asymptotics landau notation)
<p>If an algorithm has running time of $\Theta(n^2)$, is it possible to have a best-case running time of $\Omega(n)$? Or is the fastest running time only $c n^2$ for some constant factor $c$?</p>
 | habedi/stack-exchange-dataset |
32,379 | How can finite sets be represented as a type? | <p><em>Manually self-migrated from stack overflow.</em></p>

<p>A set of objects of a type T is often represented using its indicator function (<code>set T</code> = <code>T -> bool</code>). However, for practical purposes this representation isn't necessarily very useful. For instance, if T is the natural ... | type theory sets inductive datatypes | 1 | How can finite sets be represented as a type? -- (type theory sets inductive datatypes)
<p><em>Manually self-migrated from stack overflow.</em></p>

<p>A set of objects of a type T is often represented using its indicator function (<code>set T</code> = <code>T -> bool</code>). However, for practical purpose... | habedi/stack-exchange-dataset |
32,391 | In computer science how is using passive voice regarded? | <p>A soft question, when I was in high school and in University I took scientific writing classes and people told me I should use passive voice as much as possible to sound objective, but when I entered grad school people told me I should not use passive voice unless I work in Chemistry. So Which one should I follow?</... | research | 1 | In computer science how is using passive voice regarded? -- (research)
<p>A soft question, when I was in high school and in University I took scientific writing classes and people told me I should use passive voice as much as possible to sound objective, but when I entered grad school people told me I should not use pa... | habedi/stack-exchange-dataset |
32,392 | Why can the alphabet be represented in numbers in base 256 | <p>This is in context of hashing of strings. I'm not sure why a string like, CS, could be represented as CS = 'c'*256 + 's'</p>

<p>Does anyone know about this? </p>
 | hash | 1 | Why can the alphabet be represented in numbers in base 256 -- (hash)
<p>This is in context of hashing of strings. I'm not sure why a string like, CS, could be represented as CS = 'c'*256 + 's'</p>

<p>Does anyone know about this? </p>
 | habedi/stack-exchange-dataset |
32,395 | Wouldn't a Red-Black tree fix up after insertion mess up the BST ordering? | <p>I've been reading about fixing up after an insertion into a red black tree. (<a href="http://web.cse.ohio-state.edu/~lai/2331/0.Red-Black%20Trees.pdf" rel="nofollow">http://web.cse.ohio-state.edu/~lai/2331/0.Red-Black%20Trees.pdf</a>)</p>

<p>The most surprising part is not that there are 6 things that we ne... | data structures search trees | 1 | Wouldn't a Red-Black tree fix up after insertion mess up the BST ordering? -- (data structures search trees)
<p>I've been reading about fixing up after an insertion into a red black tree. (<a href="http://web.cse.ohio-state.edu/~lai/2331/0.Red-Black%20Trees.pdf" rel="nofollow">http://web.cse.ohio-state.edu/~lai/2331/0.... | habedi/stack-exchange-dataset |
32,397 | Is there a difference between perfect, full and complete tree? | <p>Is there a difference between perfect, full and complete tree? Or are these the same words to describe the same situation?</p>
 | graphs terminology trees | 1 | Is there a difference between perfect, full and complete tree? -- (graphs terminology trees)
<p>Is there a difference between perfect, full and complete tree? Or are these the same words to describe the same situation?</p>
 | habedi/stack-exchange-dataset |
32,405 | Integer Linear Programs: An instance or not? | <p>Given a set of integers $\{x_0, x_1, ... , x_{n-1}, x_n\} \subseteq \mathbb{Z}$, a set of integer variables $\{y_0, y_1, ... ,y_{n-1}, y_n\} \subseteq \mathbb{Z}$ and an integer $m \in \mathbb{Z}$ is the following equation an instance of an integer linear program (ILP):</p>

<p>$
(x_1\cdot y_1) + (x_1\cd... | decision problem integer programming | 1 | Integer Linear Programs: An instance or not? -- (decision problem integer programming)
<p>Given a set of integers $\{x_0, x_1, ... , x_{n-1}, x_n\} \subseteq \mathbb{Z}$, a set of integer variables $\{y_0, y_1, ... ,y_{n-1}, y_n\} \subseteq \mathbb{Z}$ and an integer $m \in \mathbb{Z}$ is the following equation an inst... | habedi/stack-exchange-dataset |
32,408 | Regular expression for a binary number that includes "10" and has an odd number of 0's | <p>I have been struggling trying to write a regular expression for a binary number that includes "10" and has an odd number of 0's, so far I have (1) * (00) * 10(1010) * (00) * (1) * but it doesn't accept 0100 for example or 010101 etc, also if I write a finite automata for this how do I prove its correctness ?</p>&#... | formal languages regular expressions | 1 | Regular expression for a binary number that includes "10" and has an odd number of 0's -- (formal languages regular expressions)
<p>I have been struggling trying to write a regular expression for a binary number that includes "10" and has an odd number of 0's, so far I have (1) * (00) * 10(1010) * (00) * (1) * but it... | habedi/stack-exchange-dataset |
32,417 | Recurrence relation with a number value (not n) | <p>I'm learning how to use recursion trees to solve recurrence relations and while I know how to solve it for the form</p>

<p>$$T(n) = aT\big(\frac{n}{4}\big) + n$$</p>

<p>I'm stuck when the equation has a numerical term, like</p>

<p>$$T(n) = aT\big(\frac{n}{4}\big) + 3$$</p>

<p>Usin... | recurrence relation | 1 | Recurrence relation with a number value (not n) -- (recurrence relation)
<p>I'm learning how to use recursion trees to solve recurrence relations and while I know how to solve it for the form</p>

<p>$$T(n) = aT\big(\frac{n}{4}\big) + n$$</p>

<p>I'm stuck when the equation has a numerical term, like</p... | habedi/stack-exchange-dataset |
32,419 | Can anyone explain why this is an inadmissible recurrence case that cannot be solved by the master theorem? | <p><a href="http://en.wikipedia.org/wiki/Master_theorem#Inadmissible_equations" rel="nofollow">Wikipedia</a> says that the following recurrence is <em>inadmissible</em> since there is a non-polynomial difference between $f(n) = \frac{n}{\log n}$ and $n^{\log_b a}$:</p>

<p>$$ T(n) = 2T\left(\frac{n}{2}\right) +... | recurrence relation master theorem | 1 | Can anyone explain why this is an inadmissible recurrence case that cannot be solved by the master theorem? -- (recurrence relation master theorem)
<p><a href="http://en.wikipedia.org/wiki/Master_theorem#Inadmissible_equations" rel="nofollow">Wikipedia</a> says that the following recurrence is <em>inadmissible</em> sin... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.