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 |
|---|---|---|---|---|---|---|
99,079 | How can I write this backtracking algorithm using dynamic programming? | <p><strong>Problem:</strong></p>

<p>There are <span class="math-container">$n$</span> points on a map, <span class="math-container">$p_1,..p_n$</span>. There are two officers located initially at <span class="math-container">$(0,0)$</span> coordinate. They want to patrol all of these points with a minimum trav... | algorithms dynamic programming backtracking | 1 | How can I write this backtracking algorithm using dynamic programming? -- (algorithms dynamic programming backtracking)
<p><strong>Problem:</strong></p>

<p>There are <span class="math-container">$n$</span> points on a map, <span class="math-container">$p_1,..p_n$</span>. There are two officers located initiall... | habedi/stack-exchange-dataset |
99,081 | What is the "description" of a Turing machine? | <p>I am currently reading about the Halting Problem in my course on the theory of computation and the following was given in my lecture slides </p>

<p><a href="https://i.stack.imgur.com/3x5ws.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3x5ws.png" alt="enter image description here"></a></... | turing machines | 1 | What is the "description" of a Turing machine? -- (turing machines)
<p>I am currently reading about the Halting Problem in my course on the theory of computation and the following was given in my lecture slides </p>

<p><a href="https://i.stack.imgur.com/3x5ws.png" rel="nofollow noreferrer"><img src="https://i.... | habedi/stack-exchange-dataset |
99,085 | The number of balanced trees with N node and L leaves | <p>An algorithm is requested to calculate all balanced binary trees which can be built with <span class="math-container">$N$</span> nodes, having exactly <span class="math-container">$L$</span> leaves. A balanced tree is a binary tree in which the difference between the heights of the left and right subtrees is at most... | algorithms dynamic programming binary trees | 1 | The number of balanced trees with N node and L leaves -- (algorithms dynamic programming binary trees)
<p>An algorithm is requested to calculate all balanced binary trees which can be built with <span class="math-container">$N$</span> nodes, having exactly <span class="math-container">$L$</span> leaves. A balanced tree... | habedi/stack-exchange-dataset |
99,096 | How to prove prove $L(G) = \{~w\in\{a,b\}^*~|~\#_aw= \#_bw\}$ for my CFG $G$? | <p>For language <span class="math-container">$L = \{ x \in \{a,b\}^* \mid \#_a x = \#_b x \}$</span>, I came up with the following CFG:
<span class="math-container">$$S \rightarrow aSbS \mid bSaS \mid \varepsilon.$$</span>
It can be easily shown that it is correct (quick example, for string <span class="math-co... | context free formal grammars | 1 | How to prove prove $L(G) = \{~w\in\{a,b\}^*~|~\#_aw= \#_bw\}$ for my CFG $G$? -- (context free formal grammars)
<p>For language <span class="math-container">$L = \{ x \in \{a,b\}^* \mid \#_a x = \#_b x \}$</span>, I came up with the following CFG:
<span class="math-container">$$S \rightarrow aSbS \mid bSaS \mid \va... | habedi/stack-exchange-dataset |
99,099 | Variant of interval scheduling with varying task durations | <p>I am probably just missing the correct term for my problem to find the solution but here it goes:</p>

<p>I have a set of tasks with a given duration and an interval for each task in which it has to be completed. I now need to find start times for the tasks, so that </p>

<ol>
<li>each tasks is c... | algorithms optimization greedy algorithms scheduling intervals | 1 | Variant of interval scheduling with varying task durations -- (algorithms optimization greedy algorithms scheduling intervals)
<p>I am probably just missing the correct term for my problem to find the solution but here it goes:</p>

<p>I have a set of tasks with a given duration and an interval for each task in... | habedi/stack-exchange-dataset |
99,103 | Show that the Laplace smoothing for bigrams is a valid probability distribution | <p>If we consider any smoothing technique like laplace or delta smoothing. Intuitively we can see that the we are stealing from sequences with non zero probablity and re distribute to sequences with zero probablity and there by it should be a probability distribution function. But how do we prove this mathematically sa... | machine learning natural language processing | 1 | Show that the Laplace smoothing for bigrams is a valid probability distribution -- (machine learning natural language processing)
<p>If we consider any smoothing technique like laplace or delta smoothing. Intuitively we can see that the we are stealing from sequences with non zero probablity and re distribute to sequen... | habedi/stack-exchange-dataset |
99,106 | Prove or disprove if L is CFL? | <p>Given <span class="math-container">$L=\{a^ib^jc^k | i\neq j \space and \space j=k\}$</span>. 
Is this CFL? How do I write CFG for it or prove it with pumping lemma?
Thanks. </p>
 | context free | 1 | Prove or disprove if L is CFL? -- (context free)
<p>Given <span class="math-container">$L=\{a^ib^jc^k | i\neq j \space and \space j=k\}$</span>. 
Is this CFL? How do I write CFG for it or prove it with pumping lemma?
Thanks. </p>
 | habedi/stack-exchange-dataset |
99,108 | Positioning items to maximize separation | <p>Say we want to place n items on the real line. Let us denote the position of item i by <span class="math-container">$p_i$</span>. We have interval constraints on the position <span class="math-container">$p_i$</span>, i.e. we are given <span class="math-container">$l_i, r_i$</span> such that <span class="math-contai... | algorithms optimization np complete linear programming | 1 | Positioning items to maximize separation -- (algorithms optimization np complete linear programming)
<p>Say we want to place n items on the real line. Let us denote the position of item i by <span class="math-container">$p_i$</span>. We have interval constraints on the position <span class="math-container">$p_i$</span>... | habedi/stack-exchange-dataset |
99,111 | How can we form a graph from this problem? | <p><a href="https://i.stack.imgur.com/YzSDk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YzSDk.png" alt="enter image description here"></a></p>

<p>So from the above diagram, we can move either right or down. So a binary tree is built that way. It's written <code>"If we had intermingled co... | algorithms graphs data structures binary trees | 1 | How can we form a graph from this problem? -- (algorithms graphs data structures binary trees)
<p><a href="https://i.stack.imgur.com/YzSDk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YzSDk.png" alt="enter image description here"></a></p>

<p>So from the above diagram, we can move either r... | habedi/stack-exchange-dataset |
99,121 | There could not be an edge from u to v in a DAG, if w is before v in a topological order | <p>I am trying to prove that given a DAG. <strong>There exists a valid topological ordering that has v in front of u iff there is no path from u to v.</strong> The proof is related to the fact that reverse DFS post visit order satisfies the condition of topological order.
How do I construct a proof?</p>
 | algorithms graphs proof techniques dag | 1 | There could not be an edge from u to v in a DAG, if w is before v in a topological order -- (algorithms graphs proof techniques dag)
<p>I am trying to prove that given a DAG. <strong>There exists a valid topological ordering that has v in front of u iff there is no path from u to v.</strong> The proof is related to th... | habedi/stack-exchange-dataset |
99,146 | Floating point Euclidean norm optimization | <p>Past few days I've been struggling with floating point number exercises, trying to learn how they work and what are their limitations. The exercise I've encountered today is as follows:</p>

<blockquote>
 <p>The Euclidean norm of an n-dimensional vector <span class="math-container">$x$</span> with compo... | floating point | 1 | Floating point Euclidean norm optimization -- (floating point)
<p>Past few days I've been struggling with floating point number exercises, trying to learn how they work and what are their limitations. The exercise I've encountered today is as follows:</p>

<blockquote>
 <p>The Euclidean norm of an n-dimens... | habedi/stack-exchange-dataset |
99,154 | when to use preorder, postorder and inorder binary search tree traversal strategies | <p>What are some examples of when to use preorder/postorder practically? When does it make more sense than in-order?</p>
 | data structures | 1 | when to use preorder, postorder and inorder binary search tree traversal strategies -- (data structures)
<p>What are some examples of when to use preorder/postorder practically? When does it make more sense than in-order?</p>
 | habedi/stack-exchange-dataset |
99,162 | Running time analysis on computing the largest factor of an integer using Euler's subtraction-based algorithm | <p>For the following algorithm,</p>
<blockquote>
<p><span class="math-container">$X\leftarrow \{(i, n - i) | i = 1, ..., n- 1\}$</span></p>
<p><strong>while</strong> <span class="math-container">$\max_{(a, b)\in X}b > 0$</span> <strong>do</strong></p>
<p><span class="math-container">$\quad X \leftarr... | algorithms algorithm analysis runtime analysis | 1 | Running time analysis on computing the largest factor of an integer using Euler's subtraction-based algorithm -- (algorithms algorithm analysis runtime analysis)
<p>For the following algorithm,</p>
<blockquote>
<p><span class="math-container">$X\leftarrow \{(i, n - i) | i = 1, ..., n- 1\}$</span></p>
<p><st... | habedi/stack-exchange-dataset |
99,164 | Is there a *simple* proof that the intersection of a CFL and a regular language is a CFL? | <p>I am following a course on complexity theory where languages are a part of the course. There is a proof that no matter how hard I try to understand, it is till so complex that I cannot make it to half of the proof. Namely, the proof of the statement that the intersection of a CFL and a regular language is again CFL.... | regular languages context free proof techniques | 1 | Is there a *simple* proof that the intersection of a CFL and a regular language is a CFL? -- (regular languages context free proof techniques)
<p>I am following a course on complexity theory where languages are a part of the course. There is a proof that no matter how hard I try to understand, it is till so complex tha... | habedi/stack-exchange-dataset |
99,169 | Is it possible to do a NULL comparison in Relational Algebra? | <p>Please consider the following question given in a booklet:
<a href="https://i.stack.imgur.com/VJC1q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VJC1q.png" alt="enter image description here"></a></p>

<p>I have read about databases from <strong>Database System Concepts - by Henry F.... | databases relational algebra tuple relational calculus | 1 | Is it possible to do a NULL comparison in Relational Algebra? -- (databases relational algebra tuple relational calculus)
<p>Please consider the following question given in a booklet:
<a href="https://i.stack.imgur.com/VJC1q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VJC1q.png" alt="enter im... | habedi/stack-exchange-dataset |
99,170 | Max subarray product | <p>Is it possible to solve the max sub-array product problem using divide and conquer?</p>

<p>Given an integer array numbers, find the contiguous sub-array within an array (containing at least one number) which has the largest product.</p>

<p>Example 1:</p>

<p>Input: [2,3,-2,4] <br />
Out... | algorithms divide and conquer maximum subarray | 1 | Max subarray product -- (algorithms divide and conquer maximum subarray)
<p>Is it possible to solve the max sub-array product problem using divide and conquer?</p>

<p>Given an integer array numbers, find the contiguous sub-array within an array (containing at least one number) which has the largest product.</p... | habedi/stack-exchange-dataset |
99,176 | How can I reduce the time of this program | <p>I solved a problem similar to the knapsack problem.</p>

<p>There are two packages with a capacity of <span class="math-container">$P$</span> on a production line. We want to put <span class="math-container">$N$</span> items in them with the weights <span class="math-container">$w_1,...w_n$</span> in a pre-d... | algorithms dynamic programming | 1 | How can I reduce the time of this program -- (algorithms dynamic programming)
<p>I solved a problem similar to the knapsack problem.</p>

<p>There are two packages with a capacity of <span class="math-container">$P$</span> on a production line. We want to put <span class="math-container">$N$</span> items in the... | habedi/stack-exchange-dataset |
99,180 | Why does RAID-5 require an additional disk for parity blocks? | <p>I know that RAID-5 consists of block-level striping across multiple disks, but using an additional parity-check block on each disk .. and that at least two disks are required for striping.</p>

<p>And it's obvious that each parity block is specific to each disk it belongs to (and so there is no need for allo... | storage fault tolerance space partitioning | 1 | Why does RAID-5 require an additional disk for parity blocks? -- (storage fault tolerance space partitioning)
<p>I know that RAID-5 consists of block-level striping across multiple disks, but using an additional parity-check block on each disk .. and that at least two disks are required for striping.</p>

<p>An... | habedi/stack-exchange-dataset |
99,189 | Knapsack problem: equal profits | <p>I am looking for references to efficient algorithms that solve knapsack problem where all profits are equal.</p>
<p>More formal definition of the problem from <a href="https://en.wikipedia.org/wiki/List_of_knapsack_problems" rel="nofollow noreferrer">a Wikipedia article on KPs</a>:</p>
<blockquote>
<p>If... | time complexity optimization reference request knapsack problems | 1 | Knapsack problem: equal profits -- (time complexity optimization reference request knapsack problems)
<p>I am looking for references to efficient algorithms that solve knapsack problem where all profits are equal.</p>
<p>More formal definition of the problem from <a href="https://en.wikipedia.org/wiki/List_of_knaps... | habedi/stack-exchange-dataset |
99,214 | Two's complement max with a different base | <p>Working with fixed size integer representations,
use a number system with b-complement notation, base b = 9 and
n = 4 digits.
 What is the smallest number that can be represented in this number system?
State the number in decimal, and also express it in this number
system.
I assume that it wi... | number theory number formats | 1 | Two's complement max with a different base -- (number theory number formats)
<p>Working with fixed size integer representations,
use a number system with b-complement notation, base b = 9 and
n = 4 digits.
 What is the smallest number that can be represented in this number system?
State the number in de... | habedi/stack-exchange-dataset |
99,215 | Would memoization make any improvement to Strassen's algorithm? | <p>Could the run-time of the Strassen's algorithm be improved by adding Memoization to it?</p>
 | algorithms | 1 | Would memoization make any improvement to Strassen's algorithm? -- (algorithms)
<p>Could the run-time of the Strassen's algorithm be improved by adding Memoization to it?</p>
 | habedi/stack-exchange-dataset |
99,220 | Proving $L = \{a^nb^m \mid n, m≥0, n \neq m\}$ is not regular by use of Pumping Lemma | <p>I've been struggling with this problem for quite a while now and every explanation I have managed to find doesn't seem to correctly solve it. </p>

<h2>Question</h2>

<p>Proving <span class="math-container">$L = \{a^nb^m \mid n, m≥0, n \neq m\}$</span> is not regular by use of Pumping Lemma. I know ... | formal languages regular languages pumping lemma | 1 | Proving $L = \{a^nb^m \mid n, m≥0, n \neq m\}$ is not regular by use of Pumping Lemma -- (formal languages regular languages pumping lemma)
<p>I've been struggling with this problem for quite a while now and every explanation I have managed to find doesn't seem to correctly solve it. </p>

<h2>Question</h2>&#x... | habedi/stack-exchange-dataset |
99,226 | How is the Longest Common Sub-sequence of two sequences is a special case of the Sequence Alignment problem? | <p>Could anyone briefly show me how the Longest Common Sub-sequence of two sequences is a special case of the Sequence Alignment problem? I cannot wrap my head around this. Thank you.</p>
 | algorithms subsequences | 1 | How is the Longest Common Sub-sequence of two sequences is a special case of the Sequence Alignment problem? -- (algorithms subsequences)
<p>Could anyone briefly show me how the Longest Common Sub-sequence of two sequences is a special case of the Sequence Alignment problem? I cannot wrap my head around this. Thank you... | habedi/stack-exchange-dataset |
99,230 | Why does Locality Sensitive Hashing use multiple sets of hash tables? How does it guarantee similarity? | <p>With locality sensitive hashing (specifically multi-probe hashing <a href="http://www.cs.princeton.edu/cass/papers/mplsh_vldb07.pdf" rel="nofollow noreferrer">http://www.cs.princeton.edu/cass/papers/mplsh_vldb07.pdf</a>) how are the guarantee of similarity returns made? Why are there multiple tables involved in the ... | hashing | 1 | Why does Locality Sensitive Hashing use multiple sets of hash tables? How does it guarantee similarity? -- (hashing)
<p>With locality sensitive hashing (specifically multi-probe hashing <a href="http://www.cs.princeton.edu/cass/papers/mplsh_vldb07.pdf" rel="nofollow noreferrer">http://www.cs.princeton.edu/cass/papers/m... | habedi/stack-exchange-dataset |
99,235 | What is the simplest/smallest subset an OOP language like C#/JavaScript that is Turing-complete? | <p>This question is not meant to be too theoretical or nitpicky. I have experience programming, so <strong>I'm trying to get a better understanding of what it takes to get Turing-completeness by using my intuition about practical programming languages</strong>.</p>

<p>Basically: What minimal elements of a lang... | turing completeness intuition | 1 | What is the simplest/smallest subset an OOP language like C#/JavaScript that is Turing-complete? -- (turing completeness intuition)
<p>This question is not meant to be too theoretical or nitpicky. I have experience programming, so <strong>I'm trying to get a better understanding of what it takes to get Turing-completen... | habedi/stack-exchange-dataset |
99,252 | Many-One Reducibility of decision problems for complexity theory? | <p>A <a href="https://en.wikipedia.org/wiki/Many-one_reduction" rel="nofollow noreferrer">many-one reduction</a> of problem <span class="math-container">$A$</span> to problem <span class="math-container">$B$</span> is essentially a function that converts a problem instance in problem <span class="math-container">$A$</s... | complexity theory np complete reductions | 1 | Many-One Reducibility of decision problems for complexity theory? -- (complexity theory np complete reductions)
<p>A <a href="https://en.wikipedia.org/wiki/Many-one_reduction" rel="nofollow noreferrer">many-one reduction</a> of problem <span class="math-container">$A$</span> to problem <span class="math-container">$B$<... | habedi/stack-exchange-dataset |
99,259 | Can someone explain this conclusion for Finite State Machines? | <p>PS It isn't a homework problem..
(But the results seems to be working for me when I checked manually a couple of values of m and n)</p>

<p>Let's say I have two FSM's(calling them <strong>A</strong> and <strong>B</strong>)</p>

<ul>
<li>A is the the machine for checking divisibility by any +v... | automata finite automata | 1 | Can someone explain this conclusion for Finite State Machines? -- (automata finite automata)
<p>PS It isn't a homework problem..
(But the results seems to be working for me when I checked manually a couple of values of m and n)</p>

<p>Let's say I have two FSM's(calling them <strong>A</strong> and <strong>B... | habedi/stack-exchange-dataset |
99,261 | Can a context-senstive gramma contains production rule $cB\rightarrow Bc$? | <p>Some textbook show that the grammar <span class="math-container">$G=(N,T,P,S)$</span> below belongs to context-senstive grammars:</p>

<ol>
<li>S->aSBC</li>
<li>S->abc</li>
<li>cB->Bc</li>
<li>bG->bb</li>
</ol>

<p>where N={S,B}, T={a,b,c}.</p>

<p>I am confused by the fac... | formal languages automata | 1 | Can a context-senstive gramma contains production rule $cB\rightarrow Bc$? -- (formal languages automata)
<p>Some textbook show that the grammar <span class="math-container">$G=(N,T,P,S)$</span> below belongs to context-senstive grammars:</p>

<ol>
<li>S->aSBC</li>
<li>S->abc</li>
<li>cB->Bc</li>&#x... | habedi/stack-exchange-dataset |
99,268 | Finding libraries of formalized mathematics | <p>I want to formalize <strong>Interval Newton Methods</strong> in <strong>Isabelle</strong>. As a research, I have the curiosity of whether there is anything done in the field. For that, I need to know what mathematical contents have been formalized in different proof assistants. </p>

<p>For Isabelle, this is... | reference request automated theorem proving | 1 | Finding libraries of formalized mathematics -- (reference request automated theorem proving)
<p>I want to formalize <strong>Interval Newton Methods</strong> in <strong>Isabelle</strong>. As a research, I have the curiosity of whether there is anything done in the field. For that, I need to know what mathematical conten... | habedi/stack-exchange-dataset |
99,269 | Proof that the Blank Tape Halting Problem is undecideable | <p>I have seen a few proofs that the Blank Tape Halting Problem is undecideable, however I'd like to check if the following is a valid proof (and if it isn't why not)</p>

<p><em>Proof:</em> Suppose that the Blank Tape Halting problem is decideable, then there exists a universal turing machine <span class="math... | turing machines computability | 1 | Proof that the Blank Tape Halting Problem is undecideable -- (turing machines computability)
<p>I have seen a few proofs that the Blank Tape Halting Problem is undecideable, however I'd like to check if the following is a valid proof (and if it isn't why not)</p>

<p><em>Proof:</em> Suppose that the Blank Tape ... | habedi/stack-exchange-dataset |
99,274 | Why are FPGA's less efficient than fully hard-coded ASIC's? | <p>A <a href="https://en.wikipedia.org/wiki/Field-programmable_gate_array" rel="nofollow noreferrer">Field-programmable gate array</a> (FPGA) is generally more efficient than using a "hard-coded" processor like a CPU or GPU for highly specific applications like bitcoin mining or doing structurally identical computation... | computer architecture | 1 | Why are FPGA's less efficient than fully hard-coded ASIC's? -- (computer architecture)
<p>A <a href="https://en.wikipedia.org/wiki/Field-programmable_gate_array" rel="nofollow noreferrer">Field-programmable gate array</a> (FPGA) is generally more efficient than using a "hard-coded" processor like a CPU or GPU for highl... | habedi/stack-exchange-dataset |
99,284 | A problem on constrained combinatorics | <p>Not sure if this is a proper place, but I really don't know where else to ask. I'm craving for an algorithm generating certain sequences of numbers (the problem comes from physics).</p>

<p>I'm looking for all such sequences of <span class="math-container">$a_n$</span> an <span class="math-container">$b_n$</... | algorithms combinatorics integer partitions | 1 | A problem on constrained combinatorics -- (algorithms combinatorics integer partitions)
<p>Not sure if this is a proper place, but I really don't know where else to ask. I'm craving for an algorithm generating certain sequences of numbers (the problem comes from physics).</p>

<p>I'm looking for all such sequen... | habedi/stack-exchange-dataset |
99,289 | Interpretation of Backtracking Algorithm Problem - weighted matching | <p>I am attempting to resolve the following problem using Backtracking:</p>

<blockquote>
 <p>Suppose that you have <span class="math-container">$n$</span> men and <span class="math-container">$n$</span> women and two matrices P y Q (n x n); such that <span class="math-container">$P_{ij}$</span> is the pre... | optimization backtracking | 1 | Interpretation of Backtracking Algorithm Problem - weighted matching -- (optimization backtracking)
<p>I am attempting to resolve the following problem using Backtracking:</p>

<blockquote>
 <p>Suppose that you have <span class="math-container">$n$</span> men and <span class="math-container">$n$</span> wom... | habedi/stack-exchange-dataset |
99,294 | Egg dropping puzzle | <p>My problem is a modification of the known problem. Suppose you have a building with n floors. (Where n can be any size). Furthermore you have an indestructible egg at your disposal. If the egg is thrown from a floor which is not the maximum one gets a message. If the floor was too high you don't get a message. How... | algorithms | 1 | Egg dropping puzzle -- (algorithms)
<p>My problem is a modification of the known problem. Suppose you have a building with n floors. (Where n can be any size). Furthermore you have an indestructible egg at your disposal. If the egg is thrown from a floor which is not the maximum one gets a message. If the floor was t... | habedi/stack-exchange-dataset |
99,297 | A hangman variation: determining a string by guessing substrings contained in it | <p>I came up with this Hangman variation, where you must figure out the hidden word by asking whether a string is a substring of this word. E.g. if the hidden word is "abracadabra" and I guess "cad" I will get a positive result, and if I guess "arb" I get a negative result. When I guess the word I win.</p>

<p>... | runtime analysis strings substrings | 1 | A hangman variation: determining a string by guessing substrings contained in it -- (runtime analysis strings substrings)
<p>I came up with this Hangman variation, where you must figure out the hidden word by asking whether a string is a substring of this word. E.g. if the hidden word is "abracadabra" and I guess "cad"... | habedi/stack-exchange-dataset |
99,301 | If value of LP relaxation of s-t minimum cuts is P ,then wen can find a s-t cut at most P edges? | <p>My problem is mainly from this lecture notes on convex optimization <a href="https://cs.uwaterloo.ca/~lapchi/cs798/L08.pdf" rel="nofollow noreferrer">here</a> page4</p>

<p>Consider a s-t Minimum problem, on unweighted undirected graph <span class="math-container">$G=(V,E)$</span>,we can formalize in followi... | algorithms graphs optimization network flow minimum cuts | 1 | If value of LP relaxation of s-t minimum cuts is P ,then wen can find a s-t cut at most P edges? -- (algorithms graphs optimization network flow minimum cuts)
<p>My problem is mainly from this lecture notes on convex optimization <a href="https://cs.uwaterloo.ca/~lapchi/cs798/L08.pdf" rel="nofollow noreferrer">here</a>... | habedi/stack-exchange-dataset |
99,303 | Infinite Huffman Tree | <p>We have to derive an optimal binary encoding for the infinite set of symbols <span class="math-container">$\{s_1, s_2, \dots \}$</span>. They're distribution is given by
<span class="math-container">$$p(s_i) = 9 \cdot 10^{-i}$$</span></p>

<p>My intuition was to use a Huffman encoding. Obviously the Huff... | information theory huffman coding | 1 | Infinite Huffman Tree -- (information theory huffman coding)
<p>We have to derive an optimal binary encoding for the infinite set of symbols <span class="math-container">$\{s_1, s_2, \dots \}$</span>. They're distribution is given by
<span class="math-container">$$p(s_i) = 9 \cdot 10^{-i}$$</span></p>

<p>M... | habedi/stack-exchange-dataset |
99,320 | Reduce EXACT 3-SET COVER to a Crossword Puzzle | <p>I have an assignment where I have to prove that solving a <strong>crossword puzzle</strong> is an <span class="math-container">$NP$</span>-complete problem by reducing from <strong>EXACT 3-SET COVER</strong>. I have more or less given up at this point. If anyone could give me a hint or know where to find the proof, ... | complexity theory np complete reductions | 1 | Reduce EXACT 3-SET COVER to a Crossword Puzzle -- (complexity theory np complete reductions)
<p>I have an assignment where I have to prove that solving a <strong>crossword puzzle</strong> is an <span class="math-container">$NP$</span>-complete problem by reducing from <strong>EXACT 3-SET COVER</strong>. I have more or ... | habedi/stack-exchange-dataset |
99,328 | Finding duplicates in a stream of numbers | <p>This is an interview question.<br>
Say you have a function <code>foo()</code> which returns some integer.<br>
You need to write an algorithm that does the following: </p>

<p>(1). Call <code>foo()</code> in a loop, till the returned value of <code>foo()</code> is -1.<br>
(2). Ret... | algorithms efficiency hash | 1 | Finding duplicates in a stream of numbers -- (algorithms efficiency hash)
<p>This is an interview question.<br>
Say you have a function <code>foo()</code> which returns some integer.<br>
You need to write an algorithm that does the following: </p>

<p>(1). Call <code>foo()</code> in a l... | habedi/stack-exchange-dataset |
99,336 | Traversing a graph in finite time, maximizing utility | <p>I am working on a problem in robotics, where we have a problem of having finite time horizon T, and a set of actions. Each take some time to perform and each have a utility. We can transition from any action to another after completing that particular action, and each transition takes a unique, finite time. Our goal... | graphs weighted graphs | 1 | Traversing a graph in finite time, maximizing utility -- (graphs weighted graphs)
<p>I am working on a problem in robotics, where we have a problem of having finite time horizon T, and a set of actions. Each take some time to perform and each have a utility. We can transition from any action to another after completing... | habedi/stack-exchange-dataset |
99,337 | Given a list of values, choose the greatest possible number of sorted values | <p>Given an array of numbers, I want to select some entries, preserving their order, so that I end up with the longest possible sorted sub-array. It does not matter which entries I discard in the process. In case it matters, each value may only appear once.</p>

<p>How might I attack this problem?</p>

... | algorithms | 1 | Given a list of values, choose the greatest possible number of sorted values -- (algorithms)
<p>Given an array of numbers, I want to select some entries, preserving their order, so that I end up with the longest possible sorted sub-array. It does not matter which entries I discard in the process. In case it matters, ea... | habedi/stack-exchange-dataset |
99,341 | Is the power of a regular language regular? Is the root of a regular language regular? | <p>If <span class="math-container">$A$</span> is a regular set, then:</p>

<p><span class="math-container">$L_1=\{x\mid\exists n \geq0, \exists y \in A: y=x^n\}$</span>,</p>

<p><span class="math-container">$L_2=\{x\mid \exists n \geq0, \exists y\in A: x=y^n\}$</span>.</p>

<p>Which one of them ... | formal languages regular languages | 1 | Is the power of a regular language regular? Is the root of a regular language regular? -- (formal languages regular languages)
<p>If <span class="math-container">$A$</span> is a regular set, then:</p>

<p><span class="math-container">$L_1=\{x\mid\exists n \geq0, \exists y \in A: y=x^n\}$</span>,</p>

<p... | habedi/stack-exchange-dataset |
99,349 | Designing a context free grammar for a language; When to use the empty string | <p><span class="math-container">$L= \{a^{2i}b^{j}vc^{j}(ac)^{i} | i,j \ge 0, v \in \{a,b\}^*\}$</span> over the alphabet <span class="math-container">$\Sigma = \{a,b,c\}$</span></p>

<p>How can a grammar be created from the language without the use of the empty string. Below is my example that does use the emp... | regular languages context free strings | 1 | Designing a context free grammar for a language; When to use the empty string -- (regular languages context free strings)
<p><span class="math-container">$L= \{a^{2i}b^{j}vc^{j}(ac)^{i} | i,j \ge 0, v \in \{a,b\}^*\}$</span> over the alphabet <span class="math-container">$\Sigma = \{a,b,c\}$</span></p>

<p>How... | habedi/stack-exchange-dataset |
99,350 | Did Date and Darwen's "Third Manifesto" have a lasting impact? | <p>In 1995, two DB theory researchers, C.J. Date and H. Darwen, published a text with the rather impressive-sounding name <a href="https://en.wikipedia.org/wiki/The_Third_Manifesto" rel="nofollow noreferrer">"The Third Manifesto"</a> with their ideas regarding future DBMSes, which would better harmonize a relational mo... | database theory databases history research | 1 | Did Date and Darwen's "Third Manifesto" have a lasting impact? -- (database theory databases history research)
<p>In 1995, two DB theory researchers, C.J. Date and H. Darwen, published a text with the rather impressive-sounding name <a href="https://en.wikipedia.org/wiki/The_Third_Manifesto" rel="nofollow noreferrer">"... | habedi/stack-exchange-dataset |
99,352 | Showing $2^x$ is a lower bound | <p>How do I show that <span class="math-container">$2^x - x^2 \in \Omega(2^x)$</span>?</p>

<p>Basically, I know that this means that <span class="math-container">$\exists a, x_0 \in \mathbb{R^+}, \forall x \in \mathbb{N}, a.2^x \leq 2^x - x^2$</span>.</p>

<p>I worked around a bit with this and I seeme... | asymptotics proof techniques lower bounds | 1 | Showing $2^x$ is a lower bound -- (asymptotics proof techniques lower bounds)
<p>How do I show that <span class="math-container">$2^x - x^2 \in \Omega(2^x)$</span>?</p>

<p>Basically, I know that this means that <span class="math-container">$\exists a, x_0 \in \mathbb{R^+}, \forall x \in \mathbb{N}, a.2^x \leq ... | habedi/stack-exchange-dataset |
99,353 | What is the algorithm for a decider to get the language accepted by a DFA? | <p>I am trying to understand the larger problem of the decidability of the equality of two DFAs. I understand that this problem can be solved using minimizing DFAs, but my textbook states this can be done using symmetric difference.</p>

<p>Theorem: Let <span class="math-container">$EQ$</span> be a language, wh... | turing machines finite automata decision problem sets | 1 | What is the algorithm for a decider to get the language accepted by a DFA? -- (turing machines finite automata decision problem sets)
<p>I am trying to understand the larger problem of the decidability of the equality of two DFAs. I understand that this problem can be solved using minimizing DFAs, but my textbook state... | habedi/stack-exchange-dataset |
99,359 | Describing the Language of a grammar in set theoretic notation where the length of strings need to be remembered | <p>I am not well versed in this topic so please pardon any ambiguous notation.
I am trying to describe the language of this grammar in set-theoretic notation.</p>

<p>The Grammar is given by:</p>

<p><span class="math-container">$ S \rightarrow ASA|B$</span></p>

<p><span class="math-contain... | regular languages context free strings | 1 | Describing the Language of a grammar in set theoretic notation where the length of strings need to be remembered -- (regular languages context free strings)
<p>I am not well versed in this topic so please pardon any ambiguous notation.
I am trying to describe the language of this grammar in set-theoretic notation.<... | habedi/stack-exchange-dataset |
99,364 | How to find the number of Binary Search Trees with given number of nodes and leaves? | <p>With 7 nodes of distinct values (<strong>unique</strong>), how many Binary search trees (BST) can be formed such that:</p>

<ul>
<li>Exactly <span class="math-container">$1$</span> leaf node(s) present?</li>
<li>Exactly <span class="math-container">$2$</span> leaf nodes present?</li>
</ul>
&#... | algorithms data structures dynamic programming binary search trees | 1 | How to find the number of Binary Search Trees with given number of nodes and leaves? -- (algorithms data structures dynamic programming binary search trees)
<p>With 7 nodes of distinct values (<strong>unique</strong>), how many Binary search trees (BST) can be formed such that:</p>

<ul>
<li>Exactly <span c... | habedi/stack-exchange-dataset |
99,366 | Stable matching with asymmetric arrays (gale shapley) | <p>I was reading this thread <a href="https://cs.stackexchange.com/questions/7545/the-stable-marriage-algorithm-with-asymmetric-arrays">The stable marriage algorithm with asymmetric arrays</a> and started to solve the problem asked in this thread about matching 5 students with 10 dorms.</p>

<p>One of the answe... | algorithms optimization matching | 1 | Stable matching with asymmetric arrays (gale shapley) -- (algorithms optimization matching)
<p>I was reading this thread <a href="https://cs.stackexchange.com/questions/7545/the-stable-marriage-algorithm-with-asymmetric-arrays">The stable marriage algorithm with asymmetric arrays</a> and started to solve the problem as... | habedi/stack-exchange-dataset |
99,379 | Hiring problem from CLRS | <p>Hiring problem is discussed in section 5.1 and 5.2 of the CLRS and I'm referring <a href="http://sites.math.rutgers.edu/~ajl213/CLRS/Ch5.pdf" rel="nofollow noreferrer">this</a> for exercise solutions.</p>

<p>However, for Exercise question 5.2-2 my solution deviates from the one given in the reference and mi... | algorithm analysis combinatorics randomized algorithms | 1 | Hiring problem from CLRS -- (algorithm analysis combinatorics randomized algorithms)
<p>Hiring problem is discussed in section 5.1 and 5.2 of the CLRS and I'm referring <a href="http://sites.math.rutgers.edu/~ajl213/CLRS/Ch5.pdf" rel="nofollow noreferrer">this</a> for exercise solutions.</p>

<p>However, for Ex... | habedi/stack-exchange-dataset |
99,412 | CLRS pseudocode involving both subscripting and property access of a data structure | <p>In Introduction to Algorithms, the stack data structure's enqueue operation has the following pseudocode</p>

<pre><code>ENQUEUE(Q,x)
Q[Q.tail] = x
if Q.tail == Q.length
 Q.tail = 1
else Q.tail = Q.tail + 1
</code></pre>

<p>I started writing it in Swift and figured the queue s... | programming languages pseudocode | 1 | CLRS pseudocode involving both subscripting and property access of a data structure -- (programming languages pseudocode)
<p>In Introduction to Algorithms, the stack data structure's enqueue operation has the following pseudocode</p>

<pre><code>ENQUEUE(Q,x)
Q[Q.tail] = x
if Q.tail == Q.length
 Q... | habedi/stack-exchange-dataset |
99,421 | What if an $L$-complete problem has $NC^1$ circuits? More generally, what evidence is there against $NC^1=L$? | <p>What if an <span class="math-container">$L$</span>-complete problem has <span class="math-container">$NC^1$</span> circuits? More generally, what evidence is there against <span class="math-container">$NC^1=L$</span>?</p>
 | complexity theory logic complexity classes space complexity circuits | 1 | What if an $L$-complete problem has $NC^1$ circuits? More generally, what evidence is there against $NC^1=L$? -- (complexity theory logic complexity classes space complexity circuits)
<p>What if an <span class="math-container">$L$</span>-complete problem has <span class="math-container">$NC^1$</span> circuits? More gen... | habedi/stack-exchange-dataset |
99,432 | interval scheduling algorithm | <p>can any one explain why the greedy algorithm solution i.e sorting according to finishing time is optimal in the interval scheduling algorithm ?? I want proof in layman's language. <a href="https://www.youtube.com/watch?v=Oe9bxU8lbxE&t=925s" rel="nofollow noreferrer">I was watching this video and i am not able to... | algorithms greedy algorithms intervals | 1 | interval scheduling algorithm -- (algorithms greedy algorithms intervals)
<p>can any one explain why the greedy algorithm solution i.e sorting according to finishing time is optimal in the interval scheduling algorithm ?? I want proof in layman's language. <a href="https://www.youtube.com/watch?v=Oe9bxU8lbxE&t=925s... | habedi/stack-exchange-dataset |
99,433 | How are the prime numbers encoded in Knuth's example of fitting primes into memory cache? | <p>Could somebody please help me understand what is going on here (in plain English)? I think that <span class="math-container">$(k \mathbin{\&} 63)$</span> has the effect of modular division. Is that right? How are the primes encoded / how can I know exactly where a number starts and ends by moving my finger acros... | packing bit manipulation | 1 | How are the prime numbers encoded in Knuth's example of fitting primes into memory cache? -- (packing bit manipulation)
<p>Could somebody please help me understand what is going on here (in plain English)? I think that <span class="math-container">$(k \mathbin{\&} 63)$</span> has the effect of modular division. Is ... | habedi/stack-exchange-dataset |
99,440 | Is there a name for this graph search strategy? | <p>The standard implementation of breadth-first search looks like</p>

<pre><code>queue = [root]
while queue:
 node = queue.pop()
 visit(node)
 for_each child in node.children:
 queue.push(child)
</code></pre>

<p>Just by switching the queue to a stack:</p>
&#... | graphs trees graph traversal | 1 | Is there a name for this graph search strategy? -- (graphs trees graph traversal)
<p>The standard implementation of breadth-first search looks like</p>

<pre><code>queue = [root]
while queue:
 node = queue.pop()
 visit(node)
 for_each child in node.children:
 queue.push(child... | habedi/stack-exchange-dataset |
99,442 | Help writing a dynamic programming algorithm in English | <p>It’s Friday night and you have <span class="math-container">$n$</span> parties to go to. Party <span class="math-container">$i$</span> has a start time <span class="math-container">$s_i$</span> end time <span class="math-container">$t_i$</span> and a value <span class="math-container">$v_i \ge 0$</span>. Think of th... | algorithms dynamic programming knapsack problems pseudocode | 1 | Help writing a dynamic programming algorithm in English -- (algorithms dynamic programming knapsack problems pseudocode)
<p>It’s Friday night and you have <span class="math-container">$n$</span> parties to go to. Party <span class="math-container">$i$</span> has a start time <span class="math-container">$s_i$</span> en... | habedi/stack-exchange-dataset |
99,454 | Time complexity of a language whose alphabet has a single symbol | <p>Consider a language <span class="math-container">$L$</span> such that <span class="math-container">$L \subseteq \Sigma^*$</span>, where the cardinality of <span class="math-container">$\Sigma$</span> is <span class="math-container">$1$</span> (i.e. the alphabet has only one symbol). E.g. <span class="math-container"... | time complexity decision problem | 1 | Time complexity of a language whose alphabet has a single symbol -- (time complexity decision problem)
<p>Consider a language <span class="math-container">$L$</span> such that <span class="math-container">$L \subseteq \Sigma^*$</span>, where the cardinality of <span class="math-container">$\Sigma$</span> is <span class... | habedi/stack-exchange-dataset |
99,461 | How hard can identifying non-membership in a semi-decidable language be? | <p>A language is called semi-decidable if there is an algorithm for identifying members. There are well-known examples of semi-decidable languages where identifying non-members is equivalent to <span class="math-container">$\emptyset'$</span>, such as the Halting Problem.</p>

<p>My question is: how hard can id... | computability undecidability | 1 | How hard can identifying non-membership in a semi-decidable language be? -- (computability undecidability)
<p>A language is called semi-decidable if there is an algorithm for identifying members. There are well-known examples of semi-decidable languages where identifying non-members is equivalent to <span class="math-c... | habedi/stack-exchange-dataset |
99,477 | Does a notion of a context-free complete language exist? | <p>Is there a notion of a context-free complete language (in the analogous sense to a <span class="math-container">$NP$</span>-complete language)?</p>
 | formal languages computability context free reference request | 1 | Does a notion of a context-free complete language exist? -- (formal languages computability context free reference request)
<p>Is there a notion of a context-free complete language (in the analogous sense to a <span class="math-container">$NP$</span>-complete language)?</p>
 | habedi/stack-exchange-dataset |
99,478 | Distribute to pairs with efficient algorithms | <p>The task is to find a efficient algorithm to the following problem. There are n boys and n girls who need to be divided to pairs. You get a list with all possible pairs that could be made. It means that if the pair (a,b) is in the list then the boy a can be paired with the girls b.</p>

<p>It is known that e... | algorithms graphs eulerian paths | 1 | Distribute to pairs with efficient algorithms -- (algorithms graphs eulerian paths)
<p>The task is to find a efficient algorithm to the following problem. There are n boys and n girls who need to be divided to pairs. You get a list with all possible pairs that could be made. It means that if the pair (a,b) is in the li... | habedi/stack-exchange-dataset |
99,480 | The most subtle NP-"intermediate" problem | <p>What is the <span class="math-container">$NP$</span> problem whose status in <span class="math-container">$P$</span> or <span class="math-container">$NP$</span>-complete is still unsettled, as of 2018?</p>
<p>This question is inspired by the following two recent breakthroughs:</p>
<ol>
<li>The <a href="h... | complexity theory np complete reference request np np intermediate | 1 | The most subtle NP-"intermediate" problem -- (complexity theory np complete reference request np np intermediate)
<p>What is the <span class="math-container">$NP$</span> problem whose status in <span class="math-container">$P$</span> or <span class="math-container">$NP$</span>-complete is still unsettled, as of 2018?</... | habedi/stack-exchange-dataset |
99,492 | Confluence of beta expansion | <p>Let <span class="math-container">$\to_\beta$</span> be <span class="math-container">$\beta$</span>-reduction in the <span class="math-container">$\lambda$</span>-calculus. Define <span class="math-container">$\beta$</span>-expansion <span class="math-container">$\leftarrow_\beta$</span> by <span class="math-containe... | lambda calculus term rewriting | 1 | Confluence of beta expansion -- (lambda calculus term rewriting)
<p>Let <span class="math-container">$\to_\beta$</span> be <span class="math-container">$\beta$</span>-reduction in the <span class="math-container">$\lambda$</span>-calculus. Define <span class="math-container">$\beta$</span>-expansion <span class="math-c... | habedi/stack-exchange-dataset |
99,499 | decision trees and numeric attributes | <p>I have been reading a book about Decision Trees and it caught my attention the following part:</p>

<blockquote>
 <p>In case of numeric attributes, decision trees can be geometrically
 interpreted as a collection of hyperplanes, each orthogonal to one of
 the axes</p>
</blockquote>
&#x... | decision tree | 1 | decision trees and numeric attributes -- (decision tree)
<p>I have been reading a book about Decision Trees and it caught my attention the following part:</p>

<blockquote>
 <p>In case of numeric attributes, decision trees can be geometrically
 interpreted as a collection of hyperplanes, each orthogon... | habedi/stack-exchange-dataset |
99,513 | Dynamic Programming vs Memoization | <p>I am having trouble to understand <em>dynamic programming</em>. Mainly because of its name. As far as I understand, it's just another name of <em>memoization</em> or any tricks utilizing memoization.</p>

<p>Am I understanding correctly? Or is DP something else?</p>
 | terminology dynamic programming memoization | 1 | Dynamic Programming vs Memoization -- (terminology dynamic programming memoization)
<p>I am having trouble to understand <em>dynamic programming</em>. Mainly because of its name. As far as I understand, it's just another name of <em>memoization</em> or any tricks utilizing memoization.</p>

<p>Am I understandin... | habedi/stack-exchange-dataset |
99,519 | Solving "coin exchange" for coins of power values by greedy algorithm | <p>When <a href="https://en.wikipedia.org/wiki/Change-making_problem#Greedy_method" rel="nofollow noreferrer">solving the problem of coin exchange by greedy algorithm</a>, why will we will always have the correct result if the coin values are <span class="math-container">$1, a, a^2, \cdots, a^n$</span>, where <span cla... | greedy algorithms coin change | 1 | Solving "coin exchange" for coins of power values by greedy algorithm -- (greedy algorithms coin change)
<p>When <a href="https://en.wikipedia.org/wiki/Change-making_problem#Greedy_method" rel="nofollow noreferrer">solving the problem of coin exchange by greedy algorithm</a>, why will we will always have the correct re... | habedi/stack-exchange-dataset |
99,523 | Adding two running time from a function | <p>I have a method <code>Func()</code> that has two inner methods <code>Func1()</code> and <code>Func2()</code>. </p>

<p><code>Func1()</code> has a running time of <span class="math-container">$O(k\lvert M^2 \rvert (\lvert L \rvert +\lvert M \rvert \log \lvert M \rvert))$</span> and <code>Func2()</code> has a... | algorithm analysis runtime analysis | 1 | Adding two running time from a function -- (algorithm analysis runtime analysis)
<p>I have a method <code>Func()</code> that has two inner methods <code>Func1()</code> and <code>Func2()</code>. </p>

<p><code>Func1()</code> has a running time of <span class="math-container">$O(k\lvert M^2 \rvert (\lvert L \rve... | habedi/stack-exchange-dataset |
99,525 | Find shortest path for a volatile graph | <p>Let me define a volatile graph first:</p>

<p>It is an undirected graph in which the weight of each
edge varies every time we query it. That is, when we request the weight
w(e) of edge e, we obtain an approximate value ˆw(e) defined as follows:
wˆ(e) = w(e) + η, where η ∼ N (0, σ).
Here, N (0... | shortest path | 1 | Find shortest path for a volatile graph -- (shortest path)
<p>Let me define a volatile graph first:</p>

<p>It is an undirected graph in which the weight of each
edge varies every time we query it. That is, when we request the weight
w(e) of edge e, we obtain an approximate value ˆw(e) defined as follow... | habedi/stack-exchange-dataset |
99,529 | Proof for Turing Machines being able to simulate any algorithm in the same time complexity | <p>I have always read that Turing machines can simulate any algorithm, without changing the time complexity of the algorithm, and hence it is easier to study the Turing machine equivalent of the algorithm while doing proofs. </p>

<p>However, I am unable to find a proof for this statement. Is there a formal pro... | turing machines proof techniques | 1 | Proof for Turing Machines being able to simulate any algorithm in the same time complexity -- (turing machines proof techniques)
<p>I have always read that Turing machines can simulate any algorithm, without changing the time complexity of the algorithm, and hence it is easier to study the Turing machine equivalent of ... | habedi/stack-exchange-dataset |
99,530 | Stop and Wait retransmission of packets? | <p>In a communication link out of p packets one packet will be lost. If stop and wait protocol is used then expected number of retransmissions for a packet?</p>

<p>(A) P/(1-P)</p>

<p>(B) P</p>

<p>(C) 1/(1-P)</p>

<p>(D) 1/P</p>

<p>I am getting option a) as answer. Anyway to s... | computer networks | 1 | Stop and Wait retransmission of packets? -- (computer networks)
<p>In a communication link out of p packets one packet will be lost. If stop and wait protocol is used then expected number of retransmissions for a packet?</p>

<p>(A) P/(1-P)</p>

<p>(B) P</p>

<p>(C) 1/(1-P)</p>

<p>(D) 1... | habedi/stack-exchange-dataset |
99,536 | What is the definition of computable partial function? | <p>Let <span class="math-container">$f:\mathbb{N} \to \mathbb{N}$</span> be a computable partial functions and <span class="math-container">$T$</span> a Turing Machine which computes it. By this I understand that <span class="math-container">$T$</span> writes <span class="math-container">$f(n)$</span> on its tape and h... | computability computation models primitive recursion | 1 | What is the definition of computable partial function? -- (computability computation models primitive recursion)
<p>Let <span class="math-container">$f:\mathbb{N} \to \mathbb{N}$</span> be a computable partial functions and <span class="math-container">$T$</span> a Turing Machine which computes it. By this I understand... | habedi/stack-exchange-dataset |
99,539 | Number of ways to choose same number of elements from two different sets | <p>Given two sets of elements S and R, with p elements and q elements respectively. 1 <= p,q <= n. Now, the number of ways to choose same number of elements from set S and R is <span class="math-container">$$\sum_{i=0}^{\min(p, q)} pCi * qCi$$</span>. I want to calculate the result for all possible combinations o... | combinatorics discrete mathematics | 1 | Number of ways to choose same number of elements from two different sets -- (combinatorics discrete mathematics)
<p>Given two sets of elements S and R, with p elements and q elements respectively. 1 <= p,q <= n. Now, the number of ways to choose same number of elements from set S and R is <span class="math-contai... | habedi/stack-exchange-dataset |
99,546 | Using pumping lemma to prove {a^ib^j | i > j} non-regular | <p>I'm having issues using the pumping lemma to prove <span class="math-container">$L_2 = \{a^ib^j \mid i > j \}$</span> is non-regular. It's obvious to know that the language is non-regular as there is no way of tracking <span class="math-container">$a^{i's}$</span> and <span class="math-container">$b^{j's}$</spa... | formal languages regular languages pumping lemma | 1 | Using pumping lemma to prove {a^ib^j | i > j} non-regular -- (formal languages regular languages pumping lemma)
<p>I'm having issues using the pumping lemma to prove <span class="math-container">$L_2 = \{a^ib^j \mid i > j \}$</span> is non-regular. It's obvious to know that the language is non-regular as there is ... | habedi/stack-exchange-dataset |
99,548 | Converting an infix expression to postfix | <p>So the question is to convert the following expression to postfix:</p>

<pre><code>(a+b)^(p+q)^(r*s*t)
</code></pre>

<p>The answer I get when I calculate is: <code>ab+pq+^rs*t*^</code></p>

<p><strong>But</strong> the answer is given to be <code>ab+pq+rs*t*^^</code></p>

<p>I ass... | stacks | 1 | Converting an infix expression to postfix -- (stacks)
<p>So the question is to convert the following expression to postfix:</p>

<pre><code>(a+b)^(p+q)^(r*s*t)
</code></pre>

<p>The answer I get when I calculate is: <code>ab+pq+^rs*t*^</code></p>

<p><strong>But</strong> the answer is given ... | habedi/stack-exchange-dataset |
99,550 | Confusion regarding dependencies | <p>Let say we have a relation with 5 attributes <code>{A, B, C, D, E}</code>. Let say we have two candidate keys as <code>A</code> and <code>B,C</code>. Let us say we have a partial dependency as <code>B -> E</code> with regards to the candidate key <code>B,C</code>. The database designer decides that A will be the ... | normal forms | 1 | Confusion regarding dependencies -- (normal forms)
<p>Let say we have a relation with 5 attributes <code>{A, B, C, D, E}</code>. Let say we have two candidate keys as <code>A</code> and <code>B,C</code>. Let us say we have a partial dependency as <code>B -> E</code> with regards to the candidate key <code>B,C</code>... | habedi/stack-exchange-dataset |
99,553 | Several simple propositions about regular languages | <p>(Originally posted on Math-Stackexchange)
<a href="https://math.stackexchange.com/questions/2982949/regular-languages-and-regular-expressions">https://math.stackexchange.com/questions/2982949/regular-languages-and-regular-expressions</a></p>

<p>Notation:<br>
<span class="math-container">$\Sigma:=\{a... | regular languages pumping lemma | 1 | Several simple propositions about regular languages -- (regular languages pumping lemma)
<p>(Originally posted on Math-Stackexchange)
<a href="https://math.stackexchange.com/questions/2982949/regular-languages-and-regular-expressions">https://math.stackexchange.com/questions/2982949/regular-languages-and-regular-ex... | habedi/stack-exchange-dataset |
99,559 | The reverse DFA is not working as expected | <p>Assume a regular language contains all the strings that are ended with "01". We can draw the following DFA for it:</p>

<p><a href="https://i.stack.imgur.com/DQJtp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DQJtp.png" alt="enter image description here"></a></p>

<p>And I rever... | regular languages automata finite automata | 1 | The reverse DFA is not working as expected -- (regular languages automata finite automata)
<p>Assume a regular language contains all the strings that are ended with "01". We can draw the following DFA for it:</p>

<p><a href="https://i.stack.imgur.com/DQJtp.png" rel="nofollow noreferrer"><img src="https://i.sta... | habedi/stack-exchange-dataset |
99,565 | Prove regular languages are closed under f(n) = 2^n and f(n) = n^2 | <p>Suppose <span class="math-container">$ R $</span> is a regular language, let <span class="math-container">$ f(R) = \{ w \mid \exists x \text{ such that } |x| = f(|w|) \land wx \in R\}$</span>, prove that <span class="math-container">$ f(R) $</span> is regular for <span class="math-container">$ f(n) = 2^n $</span> an... | regular languages automata finite automata | 1 | Prove regular languages are closed under f(n) = 2^n and f(n) = n^2 -- (regular languages automata finite automata)
<p>Suppose <span class="math-container">$ R $</span> is a regular language, let <span class="math-container">$ f(R) = \{ w \mid \exists x \text{ such that } |x| = f(|w|) \land wx \in R\}$</span>, prove tha... | habedi/stack-exchange-dataset |
99,586 | How to prove that the erosion of a convex set by a convex set will result in a convex set? | <p>How to prove that given convex sets A and B, the <a href="https://en.wikipedia.org/wiki/Erosion_%28morphology%29" rel="nofollow noreferrer">erosion</a> of A by B will result in C - a convex set, too?</p>

<p>I was given this question as a test-preparation, and I think it shuold be a proof, but I don't know h... | image processing | 1 | How to prove that the erosion of a convex set by a convex set will result in a convex set? -- (image processing)
<p>How to prove that given convex sets A and B, the <a href="https://en.wikipedia.org/wiki/Erosion_%28morphology%29" rel="nofollow noreferrer">erosion</a> of A by B will result in C - a convex set, too?</p>&... | habedi/stack-exchange-dataset |
99,587 | Understanding basic queue and dequeue operations | <p>CLRS gives the following implementation for a queue's enqueue and dequeue operations</p>

<pre><code>head = 1
tail = 1

ENQUEUE(Q, x)
Q[Q.tail] = x
if Q.tail == Q.length
 Q.tail = 1
else Q.tail = Q.tail + 1

DEQUEUE(Q)
x = Q[Q.head]
if Q.head == Q.length
 ... | data structures queues | 1 | Understanding basic queue and dequeue operations -- (data structures queues)
<p>CLRS gives the following implementation for a queue's enqueue and dequeue operations</p>

<pre><code>head = 1
tail = 1

ENQUEUE(Q, x)
Q[Q.tail] = x
if Q.tail == Q.length
 Q.tail = 1
else Q.tail = Q.tai... | habedi/stack-exchange-dataset |
99,595 | Using Yao's principle to find a lower bound | <p><br>
This is a HW question, so I'm not expecting any answers, just a general guidance/help.</p>

<p>Definition. Given <span class="math-container">$\underset{\neq0}{\underbrace{s}}\in\left\{ 0,1\right\} ^{n}$</span>, a function <span class="math-container">$f:\left\{ 0,1\right\} ^{n}\to\left\{ 0,1\right\... | algorithms randomized algorithms lower bounds xor | 1 | Using Yao's principle to find a lower bound -- (algorithms randomized algorithms lower bounds xor)
<p><br>
This is a HW question, so I'm not expecting any answers, just a general guidance/help.</p>

<p>Definition. Given <span class="math-container">$\underset{\neq0}{\underbrace{s}}\in\left\{ 0,1\right\} ^{n... | habedi/stack-exchange-dataset |
99,597 | How to eliminate ambiguity of the follwing CFG? | <p>Consider the following CFG:</p>

<p><span class="math-container">$S\to AED | F \\
A \to Aa | a\\
B \to Bb | b\\
C \to Cc | c\\
D \to Dd | d\\
E \to bEc | bc\\
F \to aFd | BC$</span></p>

<p>The CFG produces <span class="math-container">$a^*bbb...ccc...d^*$</span> (equal num... | context free formal grammars ambiguity | 1 | How to eliminate ambiguity of the follwing CFG? -- (context free formal grammars ambiguity)
<p>Consider the following CFG:</p>

<p><span class="math-container">$S\to AED | F \\
A \to Aa | a\\
B \to Bb | b\\
C \to Cc | c\\
D \to Dd | d\\
E \to bEc | bc\\
F \to aFd | BC$</span></p>
... | habedi/stack-exchange-dataset |
99,605 | Is "super-exponential" a precise definition of algorithmic complexity? | <p>I cannot seem to find a precise definition of what "super-exponential" is supposed to refer to when one's talking about an algorithm's time complexity.</p>

<p>For instance, if an algorithm runs for <span class="math-container">$nC(n-1)$</span> steps, where <span class="math-container">$C(\cdot)$</span> is t... | time complexity terminology asymptotics runtime analysis | 1 | Is "super-exponential" a precise definition of algorithmic complexity? -- (time complexity terminology asymptotics runtime analysis)
<p>I cannot seem to find a precise definition of what "super-exponential" is supposed to refer to when one's talking about an algorithm's time complexity.</p>

<p>For instance, if... | habedi/stack-exchange-dataset |
99,612 | Justification for the pumping lemma of context free languages | <p>I understand intuitively why the pumping lemma for regular languages must hold. That is to recognize a infinite string with a finite amount of states you must repeat states and you can "pump" those repeated states as many times as you wish. </p>

<p>However for the context free language version I can't seem ... | context free pumping lemma | 1 | Justification for the pumping lemma of context free languages -- (context free pumping lemma)
<p>I understand intuitively why the pumping lemma for regular languages must hold. That is to recognize a infinite string with a finite amount of states you must repeat states and you can "pump" those repeated states as many t... | habedi/stack-exchange-dataset |
99,614 | Complexity of two cycles which differ by $1$ in length | <p>Given an undirected graph <span class="math-container">$G(V,E)$</span>, our problem asks whether <span class="math-container">$G$</span> contains <span class="math-container">$2$</span> simple cycles which differ by <span class="math-container">$1$</span> in length.</p>

<p>What is the complexity of this pro... | complexity theory graphs np complete np hard np | 1 | Complexity of two cycles which differ by $1$ in length -- (complexity theory graphs np complete np hard np)
<p>Given an undirected graph <span class="math-container">$G(V,E)$</span>, our problem asks whether <span class="math-container">$G$</span> contains <span class="math-container">$2$</span> simple cycles which dif... | habedi/stack-exchange-dataset |
99,624 | Why can we write almost any nonzero 2-adic integer in the same form? | <p>The title was difficult to formulate (I am open to suggestions). Two things bug me about this:</p>

<ol>
<li>"is almost any" is imprecise, which goes against Volume 1's statement on <em>definiteness</em>.</li>
<li>When he writes, "in other words", this means Prof. Knuth explained it to me in two ways... | number formats | 1 | Why can we write almost any nonzero 2-adic integer in the same form? -- (number formats)
<p>The title was difficult to formulate (I am open to suggestions). Two things bug me about this:</p>

<ol>
<li>"is almost any" is imprecise, which goes against Volume 1's statement on <em>definiteness</em>.</li>
<l... | habedi/stack-exchange-dataset |
99,643 | SIMD computational model | <p>Flynn's taxonomy contains three interesting computer architectures: SISD, SIMD, MIMD. </p>

<ul>
<li>For the SISD architecture, we have RAM computational model that simulate real SISD systems very well;</li>
<li>For the MIMD architecture, there is PRAM computation model that is capable to highlight m... | computation models | 1 | SIMD computational model -- (computation models)
<p>Flynn's taxonomy contains three interesting computer architectures: SISD, SIMD, MIMD. </p>

<ul>
<li>For the SISD architecture, we have RAM computational model that simulate real SISD systems very well;</li>
<li>For the MIMD architecture, there is PRAM... | habedi/stack-exchange-dataset |
99,657 | First problem to be considered np complete? | <p>What is the first problem that was demonstrated to be NP-Complete?</p>
 | algorithms np complete np | 1 | First problem to be considered np complete? -- (algorithms np complete np)
<p>What is the first problem that was demonstrated to be NP-Complete?</p>
 | habedi/stack-exchange-dataset |
99,683 | Running time based on smallest subtree | <p>I've constructed an algorithm on (rooted) binary trees, where the running time at a node depends on the size of its smaller subtree, where we compute from each leaf upwards towards the root.<br>
More specifically, at each node, a constant amount of time is required for each node in the smallest of its 2 subtrees... | runtime analysis binary trees | 1 | Running time based on smallest subtree -- (runtime analysis binary trees)
<p>I've constructed an algorithm on (rooted) binary trees, where the running time at a node depends on the size of its smaller subtree, where we compute from each leaf upwards towards the root.<br>
More specifically, at each node, a constant ... | habedi/stack-exchange-dataset |
99,685 | Is there a way to convert a program into a Boolean formula? | <p>Let's say I have a program <code>P</code>, in form of a binary code for x86 architecture. </p>

<p>I want to find a Boolean formula F (in form of CNF, or something like that), such that
<code>
F(input,output) = true iff P(input) = output
</code>
So to answer a question "what output does the p... | logic satisfiability formal methods software verification | 1 | Is there a way to convert a program into a Boolean formula? -- (logic satisfiability formal methods software verification)
<p>Let's say I have a program <code>P</code>, in form of a binary code for x86 architecture. </p>

<p>I want to find a Boolean formula F (in form of CNF, or something like that), such that&... | habedi/stack-exchange-dataset |
99,686 | what does the redundancy of a code means? | <p>I was reading a paper about a transposition and single deletion error correcting code and they claim that the redundancy of the code <em>was only</em> <span class="math-container">$\log(6n-3)$</span> bits. </p>

<p>But <em>what does that means?</em> I was trying to get that from the proof of that fact but w... | information theory coding theory error correcting codes | 1 | what does the redundancy of a code means? -- (information theory coding theory error correcting codes)
<p>I was reading a paper about a transposition and single deletion error correcting code and they claim that the redundancy of the code <em>was only</em> <span class="math-container">$\log(6n-3)$</span> bits. </p>&#x... | habedi/stack-exchange-dataset |
99,704 | Determining the linear address | <p>So I am working on a question that requires me to find the linear address.</p>

<p>Here's some information:<br>
Main memory size is 8GB, which translates to <span class="math-container">$2^{3} * 2^{30} = 2^{33}$</span>.<br>
Block size is 16KB each, which translates to <span class="math-container">$2^... | operating systems | 1 | Determining the linear address -- (operating systems)
<p>So I am working on a question that requires me to find the linear address.</p>

<p>Here's some information:<br>
Main memory size is 8GB, which translates to <span class="math-container">$2^{3} * 2^{30} = 2^{33}$</span>.<br>
Block size is 16KB each... | habedi/stack-exchange-dataset |
99,710 | Does finding a cycle with $\log n$ length in $\text{P}$? | <p>Let <span class="math-container">$G$</span> be an arbitrary graph with <span class="math-container">$n$</span> vertices and we want to find a simple cycle with <span class="math-container">$\log n$</span> length. Is there exists a known polynomial algorithm for this problem?</p>
 | algorithms complexity theory graphs lower bounds | 1 | Does finding a cycle with $\log n$ length in $\text{P}$? -- (algorithms complexity theory graphs lower bounds)
<p>Let <span class="math-container">$G$</span> be an arbitrary graph with <span class="math-container">$n$</span> vertices and we want to find a simple cycle with <span class="math-container">$\log n$</span> l... | habedi/stack-exchange-dataset |
99,714 | Proving a set is semi-decidable | <p>Let <span class="math-container">$S = \{ ⟨M,q⟩ | (\exists x) M $</span> reaches state <span class="math-container">$q$</span> when running <span class="math-container">$M$</span> on <span class="math-container">$x$$\}$</span>, where ⟨M,q⟩ is coded TM M and state q. </p>

<p>To prove that <span class="math-co... | turing machines semi decidability | 1 | Proving a set is semi-decidable -- (turing machines semi decidability)
<p>Let <span class="math-container">$S = \{ ⟨M,q⟩ | (\exists x) M $</span> reaches state <span class="math-container">$q$</span> when running <span class="math-container">$M$</span> on <span class="math-container">$x$$\}$</span>, where ⟨M,q⟩ is code... | habedi/stack-exchange-dataset |
99,731 | Uniform sampling over non-standard simplex | <p>Uniform sampling over a <span class="math-container">$n$</span>-dimensional standard simplex is described here: <a href="https://cs.stackexchange.com/questions/3227/uniform-sampling-from-a-simplex">Uniform sampling from a simplex</a></p>

<p>I want to sample one point from a non-standard simplex with vertice... | algorithms computational geometry probability theory | 1 | Uniform sampling over non-standard simplex -- (algorithms computational geometry probability theory)
<p>Uniform sampling over a <span class="math-container">$n$</span>-dimensional standard simplex is described here: <a href="https://cs.stackexchange.com/questions/3227/uniform-sampling-from-a-simplex">Uniform sampling f... | habedi/stack-exchange-dataset |
99,743 | Calculate Shortest Path (Shortest Time) Through a Store in a Graph | <p>There is an undirected graph and some of the vertices are said to be stores.
Person A wants to reach to person B <strong>with a present.</strong> That means person A has to stop by one of the vertices marked as stores and get the present first before ever reaching to person B. Moreover, each store has a specific... | algorithms graphs shortest path | 1 | Calculate Shortest Path (Shortest Time) Through a Store in a Graph -- (algorithms graphs shortest path)
<p>There is an undirected graph and some of the vertices are said to be stores.
Person A wants to reach to person B <strong>with a present.</strong> That means person A has to stop by one of the vertices marked a... | habedi/stack-exchange-dataset |
99,766 | Error in proof of decidability | <blockquote>
 <p><span class="math-container">$L=\{\left<M\right> \ | \ M $</span> is a TM s.t. <span class="math-container">$M$</span> does not accept any string starting with a '1' <span class="math-container">$\}$</span>.
 Assume the alphabet to be <span class="math-container">$\Sigma = \{0,1\}$</sp... | computability undecidability | 1 | Error in proof of decidability -- (computability undecidability)
<blockquote>
 <p><span class="math-container">$L=\{\left<M\right> \ | \ M $</span> is a TM s.t. <span class="math-container">$M$</span> does not accept any string starting with a '1' <span class="math-container">$\}$</span>.
 Assume the a... | habedi/stack-exchange-dataset |
99,771 | Approximating unique string occurrences using a small, fixed amount of memory | <p>Is there a small-memory way to <em>estimate</em> how many unique strings have been encountered without needing to know the strings themselves? The trick is that we only have a tiny amount of memory to track what strings we have seen. Tiny like a 64 bit integer or 64 byte string. (The EZ infinite-memory solution is... | algorithms data structures strings substrings | 1 | Approximating unique string occurrences using a small, fixed amount of memory -- (algorithms data structures strings substrings)
<p>Is there a small-memory way to <em>estimate</em> how many unique strings have been encountered without needing to know the strings themselves? The trick is that we only have a tiny amount... | habedi/stack-exchange-dataset |
99,778 | Longest substrings of common length with the same parity | <p>Given two sequences <span class="math-container">$a$</span> and <span class="math-container">$b$</span>, find largest <span class="math-container">$x$</span> such that in <span class="math-container">$a$</span> there is substring <span class="math-container">$A$</span> and substring <span class="math-container">$B$<... | algorithms strings efficiency substrings algorithm design | 1 | Longest substrings of common length with the same parity -- (algorithms strings efficiency substrings algorithm design)
<p>Given two sequences <span class="math-container">$a$</span> and <span class="math-container">$b$</span>, find largest <span class="math-container">$x$</span> such that in <span class="math-containe... | habedi/stack-exchange-dataset |
99,783 | how many boolean functions exist that satisfy the condition | <p>How many boolean functions exist that satisfy the following condition?
<span class="math-container">$$\neg f(x_1,x_2,x_3,....,x_n) = f(\neg x_1, \neg x_2,...,\neg x_n)$$</span></p>
 | combinatorics boolean algebra | 1 | how many boolean functions exist that satisfy the condition -- (combinatorics boolean algebra)
<p>How many boolean functions exist that satisfy the following condition?
<span class="math-container">$$\neg f(x_1,x_2,x_3,....,x_n) = f(\neg x_1, \neg x_2,...,\neg x_n)$$</span></p>
 | habedi/stack-exchange-dataset |
99,784 | A universal operator necessarily generates $\neg x$ for input $x,…,x$ | <p>I originally posted this on math.stackexchange, but then deleted it and moved it here since I think it would fit this site more.</p>

<p>I saw a claim in a slideshow from a basic computer architecture course that given some boolean operator <span class="math-container">$T(x_1,...,x_n)$</span>, if it is unive... | logic boolean algebra | 1 | A universal operator necessarily generates $\neg x$ for input $x,…,x$ -- (logic boolean algebra)
<p>I originally posted this on math.stackexchange, but then deleted it and moved it here since I think it would fit this site more.</p>

<p>I saw a claim in a slideshow from a basic computer architecture course that... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.