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
33,082
Which measure of sortedness explains the phase transition in Quicksort's runtime?
<p>I'm currently creating a program to analyse the pathological cases of Quicksort. Namely, the transition of complexity from $O(n^2)$ to $O(n \log n)$ as a data set gets less ordered. Since Quicksort is a value-based algorithm, the choice of pivot determines its efficiency. We usually (Quicksort 3, and choosing a rand...
algorithms algorithm analysis quicksort
1
Which measure of sortedness explains the phase transition in Quicksort's runtime? -- (algorithms algorithm analysis quicksort) <p>I'm currently creating a program to analyse the pathological cases of Quicksort. Namely, the transition of complexity from $O(n^2)$ to $O(n \log n)$ as a data set gets less ordered. Since Qu...
habedi/stack-exchange-dataset
33,086
Is it possible to write an HTML compiler with no mutable state?
<p>That's probably a vague question but allow me to try and give an example:</p>&#xA;&#xA;<p>My compiler does transformations on HTML (from HTML to HTML). It scans a flattened DOM tree, and relies on lookbehinds (on elements pushed onto a stack) to decide what transformation to apply. I can give more detail if necessar...
compilers pushdown automata functional programming
1
Is it possible to write an HTML compiler with no mutable state? -- (compilers pushdown automata functional programming) <p>That's probably a vague question but allow me to try and give an example:</p>&#xA;&#xA;<p>My compiler does transformations on HTML (from HTML to HTML). It scans a flattened DOM tree, and relies on ...
habedi/stack-exchange-dataset
33,094
Polynomial Time Reduction - Does 0 calls to the black box still imply a reduction?
<p>Using the following definition:</p>&#xA;&#xA;<blockquote>&#xA; <p>Reduction: There is a polynomial-time reduction from problem $X$ to&#xA; problem $Y$ if arbitrary instances of problem $X$ can be solved using:</p>&#xA; &#xA; <ul>&#xA; <li>Polynomial number of standard computational steps, plus</li>&#xA; <li>Po...
reductions polynomial time
1
Polynomial Time Reduction - Does 0 calls to the black box still imply a reduction? -- (reductions polynomial time) <p>Using the following definition:</p>&#xA;&#xA;<blockquote>&#xA; <p>Reduction: There is a polynomial-time reduction from problem $X$ to&#xA; problem $Y$ if arbitrary instances of problem $X$ can be solv...
habedi/stack-exchange-dataset
33,100
Are fixed-point combinators general recursive?
<p>I don't know if I'm using the vocabulary correctly, but what I'm interested in is this: If your language has fixed-point combinators, is it Turing-complete?</p>&#xA;
programming languages turing completeness combinatory logic
1
Are fixed-point combinators general recursive? -- (programming languages turing completeness combinatory logic) <p>I don't know if I'm using the vocabulary correctly, but what I'm interested in is this: If your language has fixed-point combinators, is it Turing-complete?</p>&#xA;
habedi/stack-exchange-dataset
33,105
Brute force method to solve the 0-1 knapsack problem
<p>I know that the brute force method is not the best way to solve the 0-1 knapsack problem. I'm not quite getting the dynamic programming idea, but would like to know the following:</p>&#xA;&#xA;<ul>&#xA;<li>If the brute force method can solve the problem with 20 items in 1 second - how many items can it solve in one ...
algorithms efficiency knapsack problems
1
Brute force method to solve the 0-1 knapsack problem -- (algorithms efficiency knapsack problems) <p>I know that the brute force method is not the best way to solve the 0-1 knapsack problem. I'm not quite getting the dynamic programming idea, but would like to know the following:</p>&#xA;&#xA;<ul>&#xA;<li>If the brute ...
habedi/stack-exchange-dataset
33,113
Is there an efficient algorithm for expression equivalence?
<p>e.g. $xy+x+y=x+y(x+1)$ ?</p>&#xA;&#xA;<p>The expressions are from ordinary high-school algebra, but restricted to arithmetic addition and multiplication (e.g. $2+2=4; 2.3=6$), with no inverses, subtraction or division. Letters are variables.</p>&#xA;&#xA;<p>If it helps, we can forbid any expression representable wi...
complexity theory time complexity decision problem
1
Is there an efficient algorithm for expression equivalence? -- (complexity theory time complexity decision problem) <p>e.g. $xy+x+y=x+y(x+1)$ ?</p>&#xA;&#xA;<p>The expressions are from ordinary high-school algebra, but restricted to arithmetic addition and multiplication (e.g. $2+2=4; 2.3=6$), with no inverses, subtrac...
habedi/stack-exchange-dataset
33,122
Show that every grammar for an inherently ambiguous CFL has infinitely many ambiguities
<blockquote>&#xA; <p>Prove that if a CFL $L$ is inherently ambiguous, then for any grammar $G$ with $L(G) = L$, there are infinitely many strings in $L$ that have (at least) 2 different derivations in $G$.</p>&#xA;</blockquote>&#xA;&#xA;<p>Here's a sketch of a proof I have in mind:</p>&#xA;&#xA;<blockquote>&#xA; <p>S...
formal languages context free ambiguity
1
Show that every grammar for an inherently ambiguous CFL has infinitely many ambiguities -- (formal languages context free ambiguity) <blockquote>&#xA; <p>Prove that if a CFL $L$ is inherently ambiguous, then for any grammar $G$ with $L(G) = L$, there are infinitely many strings in $L$ that have (at least) 2 different ...
habedi/stack-exchange-dataset
33,127
Why aren't we researching more towards compile time guarantees?
<p>I love all that is compile time and I love the idea that once you compile a program a lot of guarantees are made about it's execution. Generally speaking a static type system (Haskell, C++, ...) seems to give stronger compile-time guarantees than any dynamic type system.</p>&#xA;&#xA;<p>From what I understand, Ada g...
programming languages type theory type checking software verification
1
Why aren't we researching more towards compile time guarantees? -- (programming languages type theory type checking software verification) <p>I love all that is compile time and I love the idea that once you compile a program a lot of guarantees are made about it's execution. Generally speaking a static type system (Ha...
habedi/stack-exchange-dataset
33,136
Is single-source single-destination shortest path problem easier than its single-source all-destination counterpart?
<p><a href="https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm" rel="nofollow">Dijkstra's algorithm (wiki)</a> and <a href="https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm" rel="nofollow">Bellman-Ford (wiki)</a> algorithm are two typical algorithms for the single-source <a href="https://en.wikipedia.org/...
algorithms complexity theory graphs reference request shortest path
1
Is single-source single-destination shortest path problem easier than its single-source all-destination counterpart? -- (algorithms complexity theory graphs reference request shortest path) <p><a href="https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm" rel="nofollow">Dijkstra's algorithm (wiki)</a> and <a href="http...
habedi/stack-exchange-dataset
33,141
Example of a superword w such that v^2 isn't its subword
<p>What is an example of an infinite word(superword) w such that if a nonempty word v belongs to L = {1,2,3}*, v^2 isn't a subword of w?</p>&#xA;&#xA;<p>For example if w = 123123123...123 and v = 123, v^2 = 123123 hence it's a subword of w, I can't seem to find a superword that fits the requirement.</p>&#xA;
formal languages
1
Example of a superword w such that v^2 isn't its subword -- (formal languages) <p>What is an example of an infinite word(superword) w such that if a nonempty word v belongs to L = {1,2,3}*, v^2 isn't a subword of w?</p>&#xA;&#xA;<p>For example if w = 123123123...123 and v = 123, v^2 = 123123 hence it's a subword of w, ...
habedi/stack-exchange-dataset
33,151
What's an "applicable event" in the context of the FLP paper?
<p>I am reading <em>Fischer, Michael J., Nancy A. Lynch, and Michael S. Paterson.</em> <strong>"Impossibility of distributed consensus with one faulty process."</strong> Journal of the ACM (JACM) 32.2 (1985): 374-382, available <a href="http://macs.citadel.edu/rudolphg/csci604/ImpossibilityofConsensus.pdf" rel="nofollo...
distributed systems
1
What's an "applicable event" in the context of the FLP paper? -- (distributed systems) <p>I am reading <em>Fischer, Michael J., Nancy A. Lynch, and Michael S. Paterson.</em> <strong>"Impossibility of distributed consensus with one faulty process."</strong> Journal of the ACM (JACM) 32.2 (1985): 374-382, available <a hr...
habedi/stack-exchange-dataset
33,153
Is $a^n b^n c^n$ context-free?
<p>I am new to grammars and I want to learn context free grammars which are the base of programming languages. After solving some problems, I encountered the language</p>&#xA;&#xA;<p>$$\{a^nb^nc^n\mid n\geq 1\}\,.$$</p>&#xA;&#xA;<p>Can anybody tell me if this is a context free language? I can't make any context free gr...
formal languages context free
1
Is $a^n b^n c^n$ context-free? -- (formal languages context free) <p>I am new to grammars and I want to learn context free grammars which are the base of programming languages. After solving some problems, I encountered the language</p>&#xA;&#xA;<p>$$\{a^nb^nc^n\mid n\geq 1\}\,.$$</p>&#xA;&#xA;<p>Can anybody tell me if...
habedi/stack-exchange-dataset
33,179
Encoding the pigeonhole principle in CBMC
<blockquote>&#xA; <p><a href="http://www.cprover.org/cbmc" rel="nofollow">CBMC</a> is a Bounded Model Checker for ANSI-C and C++ programs. It also supports SystemC using Scoot. It allows verifying array bounds (buffer overflows), pointer safety, ex­cep­tions and user-specified as­ser­tions.</p>&#xA;</blockquote>&#xA;&...
satisfiability discrete mathematics software verification
1
Encoding the pigeonhole principle in CBMC -- (satisfiability discrete mathematics software verification) <blockquote>&#xA; <p><a href="http://www.cprover.org/cbmc" rel="nofollow">CBMC</a> is a Bounded Model Checker for ANSI-C and C++ programs. It also supports SystemC using Scoot. It allows verifying array bounds (buf...
habedi/stack-exchange-dataset
33,181
Asymptotic runtime for querying an interval tree
<p>Suppose that we have an array of size <code>n</code> and we want to build an interval tree for all possible ranges that can be created inside this array. So in our leafs we have the ranges <code>[0], [1], [2], [3], ... , [n]</code>, and merging two of them together we end up having the root node holding the range <c...
data structures runtime analysis search trees
1
Asymptotic runtime for querying an interval tree -- (data structures runtime analysis search trees) <p>Suppose that we have an array of size <code>n</code> and we want to build an interval tree for all possible ranges that can be created inside this array. So in our leafs we have the ranges <code>[0], [1], [2], [3], .....
habedi/stack-exchange-dataset
33,189
Show that every infinite language has a non-regular subset
<p>I'm trying to solve this problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>Let $L$ be some infinite language, show that there exists a sub-language of $L$ that is not regular</p>&#xA;</blockquote>&#xA;&#xA;<p>But can this be correct? If I have the language $\{a\}^*$ for example, that's infinite but you can make a DFA for ...
formal languages regular languages
1
Show that every infinite language has a non-regular subset -- (formal languages regular languages) <p>I'm trying to solve this problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>Let $L$ be some infinite language, show that there exists a sub-language of $L$ that is not regular</p>&#xA;</blockquote>&#xA;&#xA;<p>But can this be...
habedi/stack-exchange-dataset
33,196
Selection type generated by nested loops where initial value is current value of parent loop
<p>Consider the generator of the selections:</p>&#xA;&#xA;<pre><code>for (i1 = 0; i1 &lt; 10; i1++)&#xA; for (i2 = i1; i2 &lt; 10; i2++)&#xA; for (i3 = i2; i3 &lt; 10; i3++)&#xA; for (i4 = i3; i4 &lt; 10; i4++)&#xA; printf("%d%d%d%d", i1, i2, i3, i4);&#xA;</code></pre>&#xA;&#xA;<p>R...
combinatorics notation selection problem
1
Selection type generated by nested loops where initial value is current value of parent loop -- (combinatorics notation selection problem) <p>Consider the generator of the selections:</p>&#xA;&#xA;<pre><code>for (i1 = 0; i1 &lt; 10; i1++)&#xA; for (i2 = i1; i2 &lt; 10; i2++)&#xA; for (i3 = i2; i3 &lt; 10; i3...
habedi/stack-exchange-dataset
33,219
Calculating genus of graph
<p>How to calculate genus of arbitrary graph? I am interested in any algorithm, even it based on full search.</p>&#xA;
algorithms graphs
1
Calculating genus of graph -- (algorithms graphs) <p>How to calculate genus of arbitrary graph? I am interested in any algorithm, even it based on full search.</p>&#xA;
habedi/stack-exchange-dataset
33,223
Comparing random access and sequential access
<p>Assume that we choose randomly $k$ distinct numbers $N_1$, $\dots$, $N_k$ in $\{1, \dots, k\}$ and we have a file of $k$ parts. We have these two cases :</p>&#xA;&#xA;<ol>&#xA;<li><p>We read (or write) sequentially from part $1$ to part $k$.</p></li>&#xA;<li><p>We read (or write) the part indexed $N_1$, then the par...
algorithm analysis computation models randomness memory access
1
Comparing random access and sequential access -- (algorithm analysis computation models randomness memory access) <p>Assume that we choose randomly $k$ distinct numbers $N_1$, $\dots$, $N_k$ in $\{1, \dots, k\}$ and we have a file of $k$ parts. We have these two cases :</p>&#xA;&#xA;<ol>&#xA;<li><p>We read (or write) s...
habedi/stack-exchange-dataset
33,224
n-th non-decreasing sequence
<p>I have a generator of non-decreasing sequences of numbers 0..M:</p>&#xA;&#xA;<pre><code>M = 9;&#xA;c = 0; //counter&#xA;&#xA;for (i1 = 0; i1 &lt;= M; i1++)&#xA; for (i2 = i1; i2 &lt;= M; i2++)&#xA; for (i3 = i2; i3 &lt;= M; i3++)&#xA; for (i4 = i3; i4 &lt;= M; i4++)&#xA; printf("...
algorithms combinatorics
1
n-th non-decreasing sequence -- (algorithms combinatorics) <p>I have a generator of non-decreasing sequences of numbers 0..M:</p>&#xA;&#xA;<pre><code>M = 9;&#xA;c = 0; //counter&#xA;&#xA;for (i1 = 0; i1 &lt;= M; i1++)&#xA; for (i2 = i1; i2 &lt;= M; i2++)&#xA; for (i3 = i2; i3 &lt;= M; i3++)&#xA; f...
habedi/stack-exchange-dataset
33,225
If one shows that UNIQUE k-SAT is in P, does it imply P=NP?
<p>Valiant &amp; Vazirani proved SAT is reducible to UNIQUE SAT under randomized probabilistic reductions in polynomial time. Calabro <em>et al</em>. showed that UNIQUE k-SAT is as hard as k-SAT. Now the question is, if someone shows that UNIQUE k-SAT is in P, does it imply P=NP?</p>&#xA;&#xA;<p><strong>References</s...
complexity theory satisfiability p vs np
1
If one shows that UNIQUE k-SAT is in P, does it imply P=NP? -- (complexity theory satisfiability p vs np) <p>Valiant &amp; Vazirani proved SAT is reducible to UNIQUE SAT under randomized probabilistic reductions in polynomial time. Calabro <em>et al</em>. showed that UNIQUE k-SAT is as hard as k-SAT. Now the question ...
habedi/stack-exchange-dataset
33,227
How does the Earley Parser store possible parses of an ambiguous sentence?
<p>I've got a pretty basic question concerning the Earley parser: In case of syntactic ambiguity ( <em>S -> NP VP(V NP(NP PP))</em> vs. <em>S -> NP VP(VP((V NP) PP)</em> ), are both parses stored in one chart or in two?</p>&#xA;&#xA;<p>the grammar im talking about is the following:&#xA;<code>&#xA;S -&gt; VP NP&#xA;VP -...
algorithms parsers ambiguity
1
How does the Earley Parser store possible parses of an ambiguous sentence? -- (algorithms parsers ambiguity) <p>I've got a pretty basic question concerning the Earley parser: In case of syntactic ambiguity ( <em>S -> NP VP(V NP(NP PP))</em> vs. <em>S -> NP VP(VP((V NP) PP)</em> ), are both parses stored in one chart or...
habedi/stack-exchange-dataset
33,228
Converting to CFG from a CFL?
<p>I am trying to learn CFG. Now to make a CFG from a CFL it is really difficult for me.</p>&#xA;&#xA;<p>Is there any simple rule or steps so that I can easily find a CFG for a CFL. I am trying to solve one problem for generating a CFG. The Problem statement is to find a CFG that generates the following CFL: $$\{a^ib^...
formal languages context free formal grammars
1
Converting to CFG from a CFL? -- (formal languages context free formal grammars) <p>I am trying to learn CFG. Now to make a CFG from a CFL it is really difficult for me.</p>&#xA;&#xA;<p>Is there any simple rule or steps so that I can easily find a CFG for a CFL. I am trying to solve one problem for generating a CFG. T...
habedi/stack-exchange-dataset
33,242
polynomial time reduction of 2 langauges
<p>If we can reduce a language y to x.</p>&#xA;&#xA;<p><code>x ≤P y</code> </p>&#xA;&#xA;<p>how do I prove</p>&#xA;&#xA;<pre><code> x(complement) ≤P y (complement)&#xA;</code></pre>&#xA;
complexity theory reductions polynomial time
1
polynomial time reduction of 2 langauges -- (complexity theory reductions polynomial time) <p>If we can reduce a language y to x.</p>&#xA;&#xA;<p><code>x ≤P y</code> </p>&#xA;&#xA;<p>how do I prove</p>&#xA;&#xA;<pre><code> x(complement) ≤P y (complement)&#xA;</code></pre>&#xA;
habedi/stack-exchange-dataset
33,245
Finding Triples that satisfy modulo equation in $O(n\log n)$ time
<p>Given $n$, I am trying to count the number of values $(a,b,c)$ that satisfy the following equation in $O(n\log n)$ time. I do not need the values themselves only the number of total values that satisfy the equation</p>&#xA;&#xA;<p>$$a^2 + b^3 = c^4 \mod n\,,$$</p>&#xA;&#xA;<p>where $a,b,c \in\{0,1,....,n-1\}$ and $n...
algorithms search algorithms binary trees binary search modular arithmetic
1
Finding Triples that satisfy modulo equation in $O(n\log n)$ time -- (algorithms search algorithms binary trees binary search modular arithmetic) <p>Given $n$, I am trying to count the number of values $(a,b,c)$ that satisfy the following equation in $O(n\log n)$ time. I do not need the values themselves only the numbe...
habedi/stack-exchange-dataset
33,247
Expressing pseudo-polynomial runtime solely in terms of the input size
<p>In case we have an algorithm which is pseudo-polynomial and runs in $O(n^2C)$ for some $C$ that is encoded in binary. Is it correct to say that if $C=2^n$ then $O(n^2C)=O(n^22^n)$&#xA;and because $n=\log C$ we can write that $O((\log C)^22^n)=O(2^n)$ because $2^n$ grows more rapidly than $\log C$? </p>&#xA;
algorithms asymptotics runtime analysis pseudo polynomial
1
Expressing pseudo-polynomial runtime solely in terms of the input size -- (algorithms asymptotics runtime analysis pseudo polynomial) <p>In case we have an algorithm which is pseudo-polynomial and runs in $O(n^2C)$ for some $C$ that is encoded in binary. Is it correct to say that if $C=2^n$ then $O(n^2C)=O(n^22^n)$&#...
habedi/stack-exchange-dataset
33,256
Evaluating Statements Using a Parse Tree
<p>I'm building a compiler. I already have a parse tree which I built using Bison for a grammar similar to the ANSI C grammar in this <a href="http://www.lysator.liu.se/c/ANSI-C-grammar-y.html#postfix-expression" rel="nofollow">link</a>. I see that for multiplicative expression in my parse tree, there can be 3 children...
algorithms graph traversal interpreters syntax trees
1
Evaluating Statements Using a Parse Tree -- (algorithms graph traversal interpreters syntax trees) <p>I'm building a compiler. I already have a parse tree which I built using Bison for a grammar similar to the ANSI C grammar in this <a href="http://www.lysator.liu.se/c/ANSI-C-grammar-y.html#postfix-expression" rel="nof...
habedi/stack-exchange-dataset
33,257
Show whether the language with almost as many 0 as 1 in every prefix is regular
<p>This is the exercise:</p>&#xA;&#xA;<blockquote>&#xA; <p>Let A be a language defined over the alphabet Σ = {0, 1} composed by the strings with the property that in every prefix, the number of 0s and the number of 1s differ by at most 2. Determine if A is a regular language and prove it.</p>&#xA;</blockquote>&#xA;&#x...
formal languages regular languages
1
Show whether the language with almost as many 0 as 1 in every prefix is regular -- (formal languages regular languages) <p>This is the exercise:</p>&#xA;&#xA;<blockquote>&#xA; <p>Let A be a language defined over the alphabet Σ = {0, 1} composed by the strings with the property that in every prefix, the number of 0s an...
habedi/stack-exchange-dataset
33,270
Why is $O(\log_{M/B} N/M)$ the same as $O(\log_{M/B} N/B)$?
<p>Where $N$ is the size of the input, $M$ is the size of your main memory and $B$ the amount of elements that you can transfer in one I/O.</p>&#xA;&#xA;<p>My idea is that since $B$ is usually much smaller than $M$ we can have</p>&#xA;&#xA;<p>$O\left(\frac{N}{B}\log_{\frac{M}{B}}\frac{N}{M}\right) = O\left(\frac{N}{B}\...
asymptotics arithmetic
1
Why is $O(\log_{M/B} N/M)$ the same as $O(\log_{M/B} N/B)$? -- (asymptotics arithmetic) <p>Where $N$ is the size of the input, $M$ is the size of your main memory and $B$ the amount of elements that you can transfer in one I/O.</p>&#xA;&#xA;<p>My idea is that since $B$ is usually much smaller than $M$ we can have</p>&#...
habedi/stack-exchange-dataset
33,272
Proof of Dijkstra Algorithm Optimality
<p>Has it been proven that Dijkstra's algorithm is optimal for asymptotic worst case of single-source shortest path on directed graphs? (Assume no preprocessing)</p>&#xA;&#xA;<p>I became curious when <a href="https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm" rel="nofollow">Wikipedia</a> mentioned it as the 'best kn...
algorithms algorithm analysis graphs shortest path
1
Proof of Dijkstra Algorithm Optimality -- (algorithms algorithm analysis graphs shortest path) <p>Has it been proven that Dijkstra's algorithm is optimal for asymptotic worst case of single-source shortest path on directed graphs? (Assume no preprocessing)</p>&#xA;&#xA;<p>I became curious when <a href="https://en.wikip...
habedi/stack-exchange-dataset
33,280
Hamming Weight to find the sum of 1 bits in the range between A and B inclusive
<p>I am trying to find the sum of 1 bits in the range between <strong>A</strong> and <strong>B</strong> inclusive, </p>&#xA;&#xA;<p>where -2^31 &lt;= A &lt;= B &lt;= 2^31 - 1</p>&#xA;&#xA;<p><strong>Input Format:</strong></p>&#xA;&#xA;<p>The first line contains the number of test cases T (&lt;=1000). Each of the next T...
algorithms logic runtime analysis
1
Hamming Weight to find the sum of 1 bits in the range between A and B inclusive -- (algorithms logic runtime analysis) <p>I am trying to find the sum of 1 bits in the range between <strong>A</strong> and <strong>B</strong> inclusive, </p>&#xA;&#xA;<p>where -2^31 &lt;= A &lt;= B &lt;= 2^31 - 1</p>&#xA;&#xA;<p><strong>In...
habedi/stack-exchange-dataset
33,288
Sorting a sorted array after increasing several elements
<p>I know that most of the efficient sort algorithms can run with a complexity of $O(n\cdot log(n))$, but this is given an unsorted array. </p>&#xA;&#xA;<p>However, given that the initial array is already sorted, is there an algorithm that can sort the array after multiplying several elements by 2 (or increasing them b...
algorithms sorting arrays
1
Sorting a sorted array after increasing several elements -- (algorithms sorting arrays) <p>I know that most of the efficient sort algorithms can run with a complexity of $O(n\cdot log(n))$, but this is given an unsorted array. </p>&#xA;&#xA;<p>However, given that the initial array is already sorted, is there an algorit...
habedi/stack-exchange-dataset
33,314
BCNF Decomposition: Confusion regarding given answer
<p>I encountered the following question:</p>&#xA;&#xA;<p>Given a relation R(A, B, C, D) with the following functional dependencies:<br>&#xA;A -> B, C -> D, B -> C.</p>&#xA;&#xA;<p>The BCNF Decomposition of R is:</p>&#xA;&#xA;<p>A) {(A,B), (C,D), (B,C)}<br>&#xA;B) {(A,B), (C,D), (A,C)}<br>&#xA;C) {(B,C), (A,D), (A,B)}<b...
database theory normal forms decomposition
1
BCNF Decomposition: Confusion regarding given answer -- (database theory normal forms decomposition) <p>I encountered the following question:</p>&#xA;&#xA;<p>Given a relation R(A, B, C, D) with the following functional dependencies:<br>&#xA;A -> B, C -> D, B -> C.</p>&#xA;&#xA;<p>The BCNF Decomposition of R is:</p>&#xA...
habedi/stack-exchange-dataset
33,316
How do I compute the huge numbers which occur in el gamal decryption?
<p>I'm trying to do decryption using el gamal. The formula to get the message M is &#xA;$$ M=\frac{b}{a^x} mod \:P $$ In one case, we may have $$ M=\frac{18}{62^{62}} mod \: 71 $$ This value cannot be computed on a calculator as $62^{62}$ gives an infinite value. How do we get the value of M?</p>&#xA;
modular arithmetic
1
How do I compute the huge numbers which occur in el gamal decryption? -- (modular arithmetic) <p>I'm trying to do decryption using el gamal. The formula to get the message M is &#xA;$$ M=\frac{b}{a^x} mod \:P $$ In one case, we may have $$ M=\frac{18}{62^{62}} mod \: 71 $$ This value cannot be computed on a calculator ...
habedi/stack-exchange-dataset
33,323
Returning m greatest elements from k sorted array
<p>We have $k$ sorted arrays, $A_1[1...n_1],...,A_k[1..n_k]$, where $n_1+n_2+...+n_k=n$.</p>&#xA;&#xA;<p>How can we get the $m$ greatest elements in running time $O(k + m\lg k)$?</p>&#xA;&#xA;<p>I have tried to use MIN-HEAP size of $k$ since we have $k$ arrays. I have to navigate through the ends of the $k$ array someh...
algorithms arrays selection problem
1
Returning m greatest elements from k sorted array -- (algorithms arrays selection problem) <p>We have $k$ sorted arrays, $A_1[1...n_1],...,A_k[1..n_k]$, where $n_1+n_2+...+n_k=n$.</p>&#xA;&#xA;<p>How can we get the $m$ greatest elements in running time $O(k + m\lg k)$?</p>&#xA;&#xA;<p>I have tried to use MIN-HEAP size ...
habedi/stack-exchange-dataset
33,328
Karnaugh map simplification
<p>I'm working through an example that looks like a fairly simple Karnaugh map and simplification, but I feel stupid that I can't seem to understand the correct answer.</p>&#xA;&#xA;<p><strong>This is the map:</strong><br>&#xA;<img src="https://i.stack.imgur.com/tI24m.png" alt="K-Map"></p>&#xA;&#xA;<p><strong>My groupi...
logic boolean algebra karnaugh map
1
Karnaugh map simplification -- (logic boolean algebra karnaugh map) <p>I'm working through an example that looks like a fairly simple Karnaugh map and simplification, but I feel stupid that I can't seem to understand the correct answer.</p>&#xA;&#xA;<p><strong>This is the map:</strong><br>&#xA;<img src="https://i.stack...
habedi/stack-exchange-dataset
33,331
How to write a DFA where the second digit is equal to the last digit of binary strings?
<p>I'm having some trouble writing a DFA for the language $$\{w =b_1\dots b_k \in\{0, 1\}^* \mid b \ge 2 \text{ and } b_2=b_k\}\,.$$</p>&#xA;&#xA;<p>What I thought for this is writing a DFA where there are 4 states, that accepts at the states (00) and (11), where the 1st element in the state is the 2nd element in the ...
regular languages automata finite automata
1
How to write a DFA where the second digit is equal to the last digit of binary strings? -- (regular languages automata finite automata) <p>I'm having some trouble writing a DFA for the language $$\{w =b_1\dots b_k \in\{0, 1\}^* \mid b \ge 2 \text{ and } b_2=b_k\}\,.$$</p>&#xA;&#xA;<p>What I thought for this is writing...
habedi/stack-exchange-dataset
33,334
Proving Linear Time Temporal Logic formula □ ◊ f ⇔ ◊ □ f
<p>I am new to this topic, <a href="http://en.wikipedia.org/wiki/Linear_temporal_logic" rel="nofollow">Linear Time Temporal Logic</a> and I am trying to prove this equivalence --</p>&#xA;&#xA;<p>$\Box\Diamond f \Leftrightarrow \Diamond\Box f$</p>&#xA;&#xA;<p>This is my take --</p>&#xA;&#xA;<p>Basic definitions:</p>&#xA...
logic proof techniques linear temporal logic temporal logic
1
Proving Linear Time Temporal Logic formula □ ◊ f ⇔ ◊ □ f -- (logic proof techniques linear temporal logic temporal logic) <p>I am new to this topic, <a href="http://en.wikipedia.org/wiki/Linear_temporal_logic" rel="nofollow">Linear Time Temporal Logic</a> and I am trying to prove this equivalence --</p>&#xA;&#xA;<p>$\B...
habedi/stack-exchange-dataset
33,341
Applying the context-free pumping lemma to a language with crossed nestings
<p>For proving language $\{a^nb^mc^nd^m \mid n,m &gt; 0\}$ is not context free.&#xA;Do I have to use $z = a^pb^pc^pd^p$ as pumping lemma string where $p$ is pumping length?</p>&#xA;&#xA;<p>Or do I have to use a string that would reflect than $n$ and $m$ does not have to be the same length?</p>&#xA;
formal languages context free pumping lemma
1
Applying the context-free pumping lemma to a language with crossed nestings -- (formal languages context free pumping lemma) <p>For proving language $\{a^nb^mc^nd^m \mid n,m &gt; 0\}$ is not context free.&#xA;Do I have to use $z = a^pb^pc^pd^p$ as pumping lemma string where $p$ is pumping length?</p>&#xA;&#xA;<p>Or do ...
habedi/stack-exchange-dataset
33,344
Runtime of Euclidean Algorithm
<p>Given two $n$-bits numbers $a$ and $b$, I am not sure on how to find the runtime of the euclidean algorithm for finding the $\gcd$ of $a,b$. The problem (for me) in here is that apart from the size of $a$ and $b$, I don't feel like I have any other information that will help me to know what is the runtime of the al...
algorithm analysis runtime analysis number theory
1
Runtime of Euclidean Algorithm -- (algorithm analysis runtime analysis number theory) <p>Given two $n$-bits numbers $a$ and $b$, I am not sure on how to find the runtime of the euclidean algorithm for finding the $\gcd$ of $a,b$. The problem (for me) in here is that apart from the size of $a$ and $b$, I don't feel like...
habedi/stack-exchange-dataset
33,350
Amortize time for a counter with the operations INCREMENT and DECREMENT
<p>Let a binary counter with the operations INCREMENT and DECREMENT. </p>&#xA;&#xA;<p>I need to show that you can't implement this kind of counter with constant amortized time per operation. </p>&#xA;&#xA;<p>Hence, I need to show that there's a series of $N$ operations with amortized time of $\omega(N)$.</p>&#xA;&#xA;<...
algorithm analysis runtime analysis amortized analysis
1
Amortize time for a counter with the operations INCREMENT and DECREMENT -- (algorithm analysis runtime analysis amortized analysis) <p>Let a binary counter with the operations INCREMENT and DECREMENT. </p>&#xA;&#xA;<p>I need to show that you can't implement this kind of counter with constant amortized time per operatio...
habedi/stack-exchange-dataset
33,354
Is emptiness of the intersection of the languages of two TMs decidable?
<p>Let </p>&#xA;&#xA;<p>$\qquad \mathrm{DISJOINT} = \{ \langle M_1,M_2 \rangle : M_1, M_2 \text{ are TMs and } L(M_1) \cap L(M_2) = \emptyset\}$.</p>&#xA;&#xA;<p>How do I know if this language is decidable or not? And How do I prove my answer?</p>&#xA;
computability turing machines undecidability
1
Is emptiness of the intersection of the languages of two TMs decidable? -- (computability turing machines undecidability) <p>Let </p>&#xA;&#xA;<p>$\qquad \mathrm{DISJOINT} = \{ \langle M_1,M_2 \rangle : M_1, M_2 \text{ are TMs and } L(M_1) \cap L(M_2) = \emptyset\}$.</p>&#xA;&#xA;<p>How do I know if this language is de...
habedi/stack-exchange-dataset
33,371
Reversing a List from a Context-Free Grammar
<p>Let's say I have a struct_declaration_list of the following type. How do I reverse it?</p>&#xA;&#xA;<pre><code>struct_declaration_list&#xA; : struct_declaration&#xA; | struct_declaration_list struct_declaration&#xA; ;&#xA;</code></pre>&#xA;&#xA;<p>P.S. Sorry I don't know the exact name of this kind of list ...
context free formal grammars
1
Reversing a List from a Context-Free Grammar -- (context free formal grammars) <p>Let's say I have a struct_declaration_list of the following type. How do I reverse it?</p>&#xA;&#xA;<pre><code>struct_declaration_list&#xA; : struct_declaration&#xA; | struct_declaration_list struct_declaration&#xA; ;&#xA;</code>...
habedi/stack-exchange-dataset
33,386
Multitape Turing machine with multiple non-blank tapes
<p>A multitape Turing machine is defined to have input only appear on one tape, with the rest of the tapes blank.</p>&#xA;&#xA;<p>Are there any formulations of a Turing machine that allow other tapes to be not blank? Why does the condition that the input only appears on one tape exist?</p>&#xA;
turing machines computation models tape complexity
1
Multitape Turing machine with multiple non-blank tapes -- (turing machines computation models tape complexity) <p>A multitape Turing machine is defined to have input only appear on one tape, with the rest of the tapes blank.</p>&#xA;&#xA;<p>Are there any formulations of a Turing machine that allow other tapes to be not...
habedi/stack-exchange-dataset
33,388
Help on using the pumping lemma?
<p>I'm trying to prove that a language is not regular. That language is: </p>&#xA;&#xA;<p>{w ∈ {a, b}* | amount of a's in w is equivalent to the amount of b's in w, mod 2}.</p>&#xA;&#xA;<p>I have an inkling that this language is not regular, so when I go to apply the pumping lemma, I would apply it on some subset of th...
regular languages automata finite automata pumping lemma
1
Help on using the pumping lemma? -- (regular languages automata finite automata pumping lemma) <p>I'm trying to prove that a language is not regular. That language is: </p>&#xA;&#xA;<p>{w ∈ {a, b}* | amount of a's in w is equivalent to the amount of b's in w, mod 2}.</p>&#xA;&#xA;<p>I have an inkling that this language...
habedi/stack-exchange-dataset
33,400
Why apply the assumed decide für HALT to the input and its code?
<p>In the lecture notes I have got in class I have the following proof for the halting problem not being recursive</p>&#xA;&#xA;<blockquote>&#xA; <ol>&#xA; <li>Assume $H$ is recursive and TM $M_1$ decides it.</li>&#xA; <li>Construct $M_2$ that&#xA; <ol>&#xA; <li>gets input $x$ in $\{0,1\}^*$ and transform it into ...
computability turing machines undecidability decision problem halting problem
1
Why apply the assumed decide für HALT to the input and its code? -- (computability turing machines undecidability decision problem halting problem) <p>In the lecture notes I have got in class I have the following proof for the halting problem not being recursive</p>&#xA;&#xA;<blockquote>&#xA; <ol>&#xA; <li>Assume $H$...
habedi/stack-exchange-dataset
33,401
Turing recognizable & decidable: binary strings with even length. Let A = {(M) | M is a DFA such that L(M) is not the same as EVEN}
<p>Having trouble with this homework problem. In order to show that A is Turing recognizable and decidable.</p>&#xA;&#xA;<p>$\text{EVEN} = \text{binary strings with even length}$</p>&#xA;&#xA;<p>$Let\;A = \{(M) | \,M\; \text{is a DFA such that L(M) is not the same as EVEN}$</p>&#xA;&#xA;<ol>&#xA;<li>$\text{Show that A ...
formal languages turing machines
1
Turing recognizable & decidable: binary strings with even length. Let A = {(M) | M is a DFA such that L(M) is not the same as EVEN} -- (formal languages turing machines) <p>Having trouble with this homework problem. In order to show that A is Turing recognizable and decidable.</p>&#xA;&#xA;<p>$\text{EVEN} = \text{binar...
habedi/stack-exchange-dataset
33,410
Need a hint! Karger's algorithm versus Kruskal, spanning tree distribution
<p>Let G = (V,E) be a unit-capacity graph with n vertices and m edges.</p>&#xA;&#xA;<p>Let T denote all the spanning trees in G.</p>&#xA;&#xA;<p>If we run Karger's algorithm, we will get a random spanning tree in T formed by the contracted edges, we denote this distribution of spanning trees by D1.</p>&#xA;&#xA;<p>On t...
graphs randomized algorithms spanning trees
1
Need a hint! Karger's algorithm versus Kruskal, spanning tree distribution -- (graphs randomized algorithms spanning trees) <p>Let G = (V,E) be a unit-capacity graph with n vertices and m edges.</p>&#xA;&#xA;<p>Let T denote all the spanning trees in G.</p>&#xA;&#xA;<p>If we run Karger's algorithm, we will get a random ...
habedi/stack-exchange-dataset
33,414
What is one method used to prove each palindrome is in its own Myhill-Nerode equivalence class?
<p>I understand how you can use a contradiction in regard to a DPDA to show a language has finitely many Myhill-Nerode equivalence classes, but what is the method used to show each string of a language accepting palindromes is in its own Myhill-Nerode class?</p>&#xA;&#xA;<p>Thanks</p>&#xA;
formal languages
1
What is one method used to prove each palindrome is in its own Myhill-Nerode equivalence class? -- (formal languages) <p>I understand how you can use a contradiction in regard to a DPDA to show a language has finitely many Myhill-Nerode equivalence classes, but what is the method used to show each string of a language ...
habedi/stack-exchange-dataset
33,424
Multiplication in $O(n\cdot \log n)$
<p>I was looking in <a href="http://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations">here</a>, and I noticed the best runtime for multiplication of two $n$-bits numbers is $O(n\cdot \log n \cdot 2^{O(\log^* n)}$, but I can easily notice an algorithm that runs in $O(n\cdot \log n)$. </p>&#xA;&#...
runtime analysis
1
Multiplication in $O(n\cdot \log n)$ -- (runtime analysis) <p>I was looking in <a href="http://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations">here</a>, and I noticed the best runtime for multiplication of two $n$-bits numbers is $O(n\cdot \log n \cdot 2^{O(\log^* n)}$, but I can easily notic...
habedi/stack-exchange-dataset
33,426
Pierce's Types and Programming Languages : circular definition of terms?
<p>In Pierce's <a href="http://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow noreferrer">book</a>, on page 26-27 it is given a definition of terms for a simple language using inference rules. </p>&#xA;&#xA;<p>In the picture below it is marked by red highlighting <strong>the problematic part</strong>.</p>&#xA;&#xA;<p...
formal grammars type theory typing induction
1
Pierce's Types and Programming Languages : circular definition of terms? -- (formal grammars type theory typing induction) <p>In Pierce's <a href="http://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow noreferrer">book</a>, on page 26-27 it is given a definition of terms for a simple language using inference rules. </...
habedi/stack-exchange-dataset
33,431
simple lower bound for constructing a Spanning tree
<p>i have to demonstrate that under the assumptions{Bidirectional Links, Total Reliability (no error during the execution), Connectivity, Distincts ids values, Multiple inititators (entities that starts the algorithm} the problems of constructing a spanning tree takes at least $\Omega(m)$ messages, where $m=|E|$</p>&#x...
distributed systems lower bounds spanning trees
1
simple lower bound for constructing a Spanning tree -- (distributed systems lower bounds spanning trees) <p>i have to demonstrate that under the assumptions{Bidirectional Links, Total Reliability (no error during the execution), Connectivity, Distincts ids values, Multiple inititators (entities that starts the algorith...
habedi/stack-exchange-dataset
33,432
Implement opposite() method to tell if there are two opposite numbers, (x,-x)
<blockquote>&#xA; <p>Let a dictionary with the operations <code>insert()</code>, <code>delete()</code> and <code>search()</code>. Each one of them has time complexity of $O(logn)$. Implement (efficiently) <code>opposite()</code> operation which return true if there are two opposite numbers in the dictionary (i.e. $5$ ...
data structures time complexity asymptotics
1
Implement opposite() method to tell if there are two opposite numbers, (x,-x) -- (data structures time complexity asymptotics) <blockquote>&#xA; <p>Let a dictionary with the operations <code>insert()</code>, <code>delete()</code> and <code>search()</code>. Each one of them has time complexity of $O(logn)$. Implement (...
habedi/stack-exchange-dataset
33,435
Can a solvable problem be encoded in a recursively enumerable language?
<p>Imagine I have a turing machine that can decide on a specific problem using a language. My question is that that problem (that can be decided by a TM M, with language L) can be encoded in a new language that is recursive enumerable.</p>&#xA;&#xA;<p>If yes, this would mean that every solvable problem can encoded in r...
turing machines decision problem
1
Can a solvable problem be encoded in a recursively enumerable language? -- (turing machines decision problem) <p>Imagine I have a turing machine that can decide on a specific problem using a language. My question is that that problem (that can be decided by a TM M, with language L) can be encoded in a new language that...
habedi/stack-exchange-dataset
33,438
How to write CFG for languages
<p>How do you write the CFG for the following language:</p>&#xA;&#xA;<p>{a<sup>x</sup> b<sup>y</sup> c a<sup>x+y</sup>}</p>&#xA;&#xA;<p>Is there some formula or rules I need to follow? An explanation will be so appreciated.</p>&#xA;&#xA;<p>What I tried is:</p>&#xA;&#xA;<p>First I broke a<sup>x+y</sup> into a<sup>x</sup...
context free
1
How to write CFG for languages -- (context free) <p>How do you write the CFG for the following language:</p>&#xA;&#xA;<p>{a<sup>x</sup> b<sup>y</sup> c a<sup>x+y</sup>}</p>&#xA;&#xA;<p>Is there some formula or rules I need to follow? An explanation will be so appreciated.</p>&#xA;&#xA;<p>What I tried is:</p>&#xA;&#xA;<...
habedi/stack-exchange-dataset
33,445
Single Source Shortest Path: What does the weights on the vertex and edges tell you?
<p><img src="https://i.stack.imgur.com/YCwfh.png" alt="enter image description here"></p>&#xA;&#xA;<p>In MIT's open courseware (<a href="http://courses.csail.mit.edu/6.006/spring11/lectures/lec15.pdf" rel="nofollow noreferrer">http://courses.csail.mit.edu/6.006/spring11/lectures/lec15.pdf</a>), I do not see how computi...
graphs shortest path
1
Single Source Shortest Path: What does the weights on the vertex and edges tell you? -- (graphs shortest path) <p><img src="https://i.stack.imgur.com/YCwfh.png" alt="enter image description here"></p>&#xA;&#xA;<p>In MIT's open courseware (<a href="http://courses.csail.mit.edu/6.006/spring11/lectures/lec15.pdf" rel="nof...
habedi/stack-exchange-dataset
33,452
Is there any algorithm can solve the following equations efficiently?
<p>$$ x_1 + x_2 + \cdots +x_n = c_1 $$&#xA;$$ \frac{x_1^2}{2} + \frac{x_2^2}{2} + \cdots +\frac{x_n^2}{2} = c_2 $$<br>&#xA;$$ \cdots $$&#xA;$$ \frac{x_1^n}{n!} + \frac{x_2^n}{n!} + \cdots +\frac{x_n^n}{n!} = c_n $$</p>&#xA;&#xA;<p>$c_1,\cdots,c_n$ are known constants. $x_1 \cdots x_n$ are the unknown variables to solve...
algorithms
1
Is there any algorithm can solve the following equations efficiently? -- (algorithms) <p>$$ x_1 + x_2 + \cdots +x_n = c_1 $$&#xA;$$ \frac{x_1^2}{2} + \frac{x_2^2}{2} + \cdots +\frac{x_n^2}{2} = c_2 $$<br>&#xA;$$ \cdots $$&#xA;$$ \frac{x_1^n}{n!} + \frac{x_2^n}{n!} + \cdots +\frac{x_n^n}{n!} = c_n $$</p>&#xA;&#xA;<p>$c_...
habedi/stack-exchange-dataset
33,454
Turing Machine Decidable: What right does the definition have to say what's not in language L?
<p>I'm having trouble understanding the definition of Turing Decidable. The definition goes something like this:</p>&#xA;&#xA;<blockquote>&#xA; <p>TM M decides language L iff the strings in L put M into the Accept state&#xA; and the strings NOT IN L put M into the Reject state</p>&#xA;</blockquote>&#xA;&#xA;<p>My pro...
turing machines
1
Turing Machine Decidable: What right does the definition have to say what's not in language L? -- (turing machines) <p>I'm having trouble understanding the definition of Turing Decidable. The definition goes something like this:</p>&#xA;&#xA;<blockquote>&#xA; <p>TM M decides language L iff the strings in L put M into ...
habedi/stack-exchange-dataset
33,459
Round robin tournament scheduling using divide and conquer
<p>I want to scheduling $n$ teams using divide and conquer method for $n \in \mathbb{N}$.My approach is that if $n$ is even divide it to to group $\frac{n}{2}$ and $\frac{n}{2}$ but if $n$ is odd, add auxiliary team and scheduling $n+1$ team at the end we remove the last team and in table every match between $n+1$ tea...
algorithms divide and conquer
1
Round robin tournament scheduling using divide and conquer -- (algorithms divide and conquer) <p>I want to scheduling $n$ teams using divide and conquer method for $n \in \mathbb{N}$.My approach is that if $n$ is even divide it to to group $\frac{n}{2}$ and $\frac{n}{2}$ but if $n$ is odd, add auxiliary team and sched...
habedi/stack-exchange-dataset
33,465
Free and bound variables
<p>I am familiar with free and bound variables theory , but while learning I somewhere saw &#xA;this lambda expression</p>&#xA;&#xA;<blockquote>&#xA; <p>((lambda var ((fn1 var) &amp; (fn2 var))) argument) </p>&#xA;</blockquote>&#xA;&#xA;<p>From what I have learned it seems to me as <code>var</code> is bounded in both ...
logic lambda calculus variable binding
1
Free and bound variables -- (logic lambda calculus variable binding) <p>I am familiar with free and bound variables theory , but while learning I somewhere saw &#xA;this lambda expression</p>&#xA;&#xA;<blockquote>&#xA; <p>((lambda var ((fn1 var) &amp; (fn2 var))) argument) </p>&#xA;</blockquote>&#xA;&#xA;<p>From what ...
habedi/stack-exchange-dataset
33,476
Dynamic Programming for finding shortest alternating paths between all pairs of vertices in a graph
<p>I'm learning Dynamic Programming (By myself) and in the textbook there is this question:</p>&#xA;<blockquote>&#xA;<p>Given two undirected graphs <span class="math-container">$G_1=(V,E_1)$</span> and <span class="math-container">$G_2=(V,E_2)$</span> over the same set of Vertices <span class="math-container">$V$</span...
algorithms dynamic programming shortest path
1
Dynamic Programming for finding shortest alternating paths between all pairs of vertices in a graph -- (algorithms dynamic programming shortest path) <p>I'm learning Dynamic Programming (By myself) and in the textbook there is this question:</p>&#xA;<blockquote>&#xA;<p>Given two undirected graphs <span class="math-cont...
habedi/stack-exchange-dataset
33,478
Why would this Semidefinite Program be Dual Infeasible?
<p>My semidefinite program amounts to two constraints, $L_1 = 0$ and $L_2 = 0$ where $L_i$ are linear functions of my variables $x_{ij}$ with the additional constraint that the $x_{ij}$ matrix is positive semidefinite. I see no way that this program would be infeasible, because just setting every variable to 0 would sa...
optimization
1
Why would this Semidefinite Program be Dual Infeasible? -- (optimization) <p>My semidefinite program amounts to two constraints, $L_1 = 0$ and $L_2 = 0$ where $L_i$ are linear functions of my variables $x_{ij}$ with the additional constraint that the $x_{ij}$ matrix is positive semidefinite. I see no way that this prog...
habedi/stack-exchange-dataset
33,479
An infinite language with no infinite RE or co-RE subsets?
<p>Are there any languages that are infinite (that is, they contain infinitely many strings) but which do not have any infinite subsets that are RE or co-RE languages? This seems related to <a href="http://en.wikipedia.org/wiki/Simple_set" rel="nofollow">simple sets</a>, but I can't seem to find any examples of languag...
computability
1
An infinite language with no infinite RE or co-RE subsets? -- (computability) <p>Are there any languages that are infinite (that is, they contain infinitely many strings) but which do not have any infinite subsets that are RE or co-RE languages? This seems related to <a href="http://en.wikipedia.org/wiki/Simple_set" re...
habedi/stack-exchange-dataset
33,480
Second order function formalization
<p>I need to work on a optimizer for a language whose operator are second order functions. </p>&#xA;&#xA;<p>They are the well known ones filter, map, reduce, fold, foreach etc. etc.</p>&#xA;&#xA;<p>I need to formalize as much as possible the language. I mean I would like to have at the end a description such this: </p>...
programming languages functional programming formal methods program optimization abstract data types
1
Second order function formalization -- (programming languages functional programming formal methods program optimization abstract data types) <p>I need to work on a optimizer for a language whose operator are second order functions. </p>&#xA;&#xA;<p>They are the well known ones filter, map, reduce, fold, foreach etc. e...
habedi/stack-exchange-dataset
33,483
Hadoop MapReduce Word Counting Example
<p><img src="https://i.stack.imgur.com/2VYG3.png" alt="enter image description here"></p>&#xA;&#xA;<p>In an example of the application of MapReduce provided by University of Utah, it says that Map() function emits &lt;"hello", 1> every time it sees hello where the reduce function counts the number of instances "hello" ...
algorithms parallel computing cluster
1
Hadoop MapReduce Word Counting Example -- (algorithms parallel computing cluster) <p><img src="https://i.stack.imgur.com/2VYG3.png" alt="enter image description here"></p>&#xA;&#xA;<p>In an example of the application of MapReduce provided by University of Utah, it says that Map() function emits &lt;"hello", 1> every ti...
habedi/stack-exchange-dataset
33,489
What does the set {n | n is an integer and n = n + 1} represent?
<p>I am reading Michael Sipser's book <em>Introduction to the Theory of Computation</em>, which mentions the set $$S = \{ n \mid \text{$n$ is an integer and $n = n + 1$}\}.$$ This doesn't make any sense to me.&#xA;I would understand if $n$ were equal to infinity or something, so it probably wouldn't matter if we added...
terminology computability number theory
1
What does the set {n | n is an integer and n = n + 1} represent? -- (terminology computability number theory) <p>I am reading Michael Sipser's book <em>Introduction to the Theory of Computation</em>, which mentions the set $$S = \{ n \mid \text{$n$ is an integer and $n = n + 1$}\}.$$ This doesn't make any sense to me....
habedi/stack-exchange-dataset
33,496
How to prove that this is NP complete?
<p>I'm trying to prove that if P = NP, then {⟨a, b, c⟩ : a + b = c} (as addition over N) is NP-complete.</p>&#xA;&#xA;<p>I think I managed to prove that it is in NP, but I'm not sure what would be a good NP complete problem to reduce to would be, or what algorithm to use. Any ideas?</p>&#xA;
complexity theory formal languages
1
How to prove that this is NP complete? -- (complexity theory formal languages) <p>I'm trying to prove that if P = NP, then {⟨a, b, c⟩ : a + b = c} (as addition over N) is NP-complete.</p>&#xA;&#xA;<p>I think I managed to prove that it is in NP, but I'm not sure what would be a good NP complete problem to reduce to woul...
habedi/stack-exchange-dataset
33,514
Natural Language Parser that can handle syntactic and lexical errors
<p>I have some background in natural language processing and I know that all parsers (top down or bottom up, or mix), at least when I studied just about a few years ago, cannot handle any error. A small error like a grammatical one or a spelling one will result in unexpected parsed tree.</p>&#xA;&#xA;<p>This is unaccep...
reference request natural language processing
1
Natural Language Parser that can handle syntactic and lexical errors -- (reference request natural language processing) <p>I have some background in natural language processing and I know that all parsers (top down or bottom up, or mix), at least when I studied just about a few years ago, cannot handle any error. A sma...
habedi/stack-exchange-dataset
33,518
PARTITION with 0-sum assumption
<p>The PARTITION problem:&#xA;$\{\{x_1,...,x_n\}: \exists I\subseteq[n], \sum_{i\in I}x_i=\sum_{i\notin I}x_i\}$&#xA;is well known to be NP-complete.</p>&#xA;&#xA;<blockquote>&#xA; <p>My question: does the partition problem remain NP-complete (as a promise-problem) if we are given that $\sum_{i=1}^n x_i=0$?. </p>&#xA;...
complexity theory np complete np hard
1
PARTITION with 0-sum assumption -- (complexity theory np complete np hard) <p>The PARTITION problem:&#xA;$\{\{x_1,...,x_n\}: \exists I\subseteq[n], \sum_{i\in I}x_i=\sum_{i\notin I}x_i\}$&#xA;is well known to be NP-complete.</p>&#xA;&#xA;<blockquote>&#xA; <p>My question: does the partition problem remain NP-complete (...
habedi/stack-exchange-dataset
33,519
Subset sum algorithm in O(n³ log n)?
<p>I think that I have found an algorithm which resolve exactly the subset sum problem in $O(N^3)$ in the worst case, only for positive numbers.</p>&#xA;&#xA;<p>After my research, I'm lost between all the algorithms for this problem.</p>&#xA;&#xA;<ul>&#xA;<li>$O(2^N*N)$ for the naive algorithm (I understand)</li>&#xA;<...
complexity theory landau notation p vs np knapsack problems
1
Subset sum algorithm in O(n³ log n)? -- (complexity theory landau notation p vs np knapsack problems) <p>I think that I have found an algorithm which resolve exactly the subset sum problem in $O(N^3)$ in the worst case, only for positive numbers.</p>&#xA;&#xA;<p>After my research, I'm lost between all the algorithms fo...
habedi/stack-exchange-dataset
33,524
Conversion from assembly program to low-level machine language
<p>While studying COMPILER-DESIGN through an online book from Google Books, referenced as <a href="http://books.google.co.in/books?id=igpL2CqjapYC&amp;pg=SA1-PA11#v=onepage&amp;q&amp;f=false" rel="nofollow"><em>Compiler Design</em> by A.A.Puntambekar</a>, I got stuck across a line. Actually, I am more curious to know t...
compilers code generation
1
Conversion from assembly program to low-level machine language -- (compilers code generation) <p>While studying COMPILER-DESIGN through an online book from Google Books, referenced as <a href="http://books.google.co.in/books?id=igpL2CqjapYC&amp;pg=SA1-PA11#v=onepage&amp;q&amp;f=false" rel="nofollow"><em>Compiler Design...
habedi/stack-exchange-dataset
33,534
Extended knapsack: is it NP-complete?
<p>I have a problem of this form coming from an application domain, similar to the classical knapsack problem but not quite the same:</p>&#xA;&#xA;<p>Maximize the value of</p>&#xA;&#xA;<p>($\sum_{i=1}^n v_i \cdot x_i) + B \cdot \frac{W}{r}$</p>&#xA;&#xA;<p>subject to</p>&#xA;&#xA;<p>$ \sum_{i=1}^n w_i \cdot x_i \leq W$...
complexity theory np hard knapsack problems
1
Extended knapsack: is it NP-complete? -- (complexity theory np hard knapsack problems) <p>I have a problem of this form coming from an application domain, similar to the classical knapsack problem but not quite the same:</p>&#xA;&#xA;<p>Maximize the value of</p>&#xA;&#xA;<p>($\sum_{i=1}^n v_i \cdot x_i) + B \cdot \frac...
habedi/stack-exchange-dataset
33,546
Stable marriage problem with more people then priorizations
<p>I am trying to solve a stable marriage problem where I have e.g. 20 women and 20 men, but they always only prioritise 4 pre-selected people of the opposite sex.</p>&#xA;&#xA;<ol>&#xA;<li>My algorithm distributes all men and women, so that everybody has 4 potential partners. This happens through the whole group of 20...
algorithms matching
1
Stable marriage problem with more people then priorizations -- (algorithms matching) <p>I am trying to solve a stable marriage problem where I have e.g. 20 women and 20 men, but they always only prioritise 4 pre-selected people of the opposite sex.</p>&#xA;&#xA;<ol>&#xA;<li>My algorithm distributes all men and women, s...
habedi/stack-exchange-dataset
33,550
The most efficient way of finding/storing neighbourhood info during octree creation
<p>Currently I have a program which at some point creates an octree and AFTER the creation loops through all the nodes, for every node (O(n<sup>2</sup>/2)) and thus finds the neighbours, by a brute-force box-box intersection check.</p>&#xA;&#xA;<p>Since that is causing a bottleneck in my program I am looking to optimis...
algorithms data structures optimization
1
The most efficient way of finding/storing neighbourhood info during octree creation -- (algorithms data structures optimization) <p>Currently I have a program which at some point creates an octree and AFTER the creation loops through all the nodes, for every node (O(n<sup>2</sup>/2)) and thus finds the neighbours, by a...
habedi/stack-exchange-dataset
33,551
Diophantine equations and P=NP
<p>It was proven that the problem of determining whether a given Diophantine equation has a solution is undecidable (and therefore has no polynomial time algorithm). But we can check proof certificates (that is, solutions to the equation) in linear time by plugging in our solution and evaluating. So the problem is in N...
complexity theory computability
1
Diophantine equations and P=NP -- (complexity theory computability) <p>It was proven that the problem of determining whether a given Diophantine equation has a solution is undecidable (and therefore has no polynomial time algorithm). But we can check proof certificates (that is, solutions to the equation) in linear tim...
habedi/stack-exchange-dataset
33,559
Underlying language to specify various types of logic
<p>There exist several different types of logic -- 1st order, 2nd and higher order with many different sets of inference rules possible.</p>&#xA;&#xA;<p>What I'm having trouble understanding is what's the "underlying logic" we use to talk about the various different types of logic. For instance, if we were limited to t...
logic higher order logic
1
Underlying language to specify various types of logic -- (logic higher order logic) <p>There exist several different types of logic -- 1st order, 2nd and higher order with many different sets of inference rules possible.</p>&#xA;&#xA;<p>What I'm having trouble understanding is what's the "underlying logic" we use to ta...
habedi/stack-exchange-dataset
33,569
Formulate the Marriage Problem into a Maximum-flow problem (Graph theory)
<p>Suppose I have $M=\{1,\ldots, n\}$ men and $W = \{1, \ldots, n\}$ women and $B =\{1, \ldots, m\}$ brokers, such that each broker knows a subset of $M \times W$ and for each pair in this subset a marriage can be set up among the corresponding man and women.</p>&#xA;&#xA;<p>Each broker $i$ can set up a maximum of $b_i...
graphs reductions optimization network flow
1
Formulate the Marriage Problem into a Maximum-flow problem (Graph theory) -- (graphs reductions optimization network flow) <p>Suppose I have $M=\{1,\ldots, n\}$ men and $W = \{1, \ldots, n\}$ women and $B =\{1, \ldots, m\}$ brokers, such that each broker knows a subset of $M \times W$ and for each pair in this subset a...
habedi/stack-exchange-dataset
33,571
Count all possible unions in a collection of sets
<p>Say we have a collections of sets $\mathcal X = \{X_1, \dots, X_n\}$ (not necessarily disjoint), and we want to count the number of possible unions of sets in $\mathcal X$, i.e. the size of $\{\bigcup_{Y \in \mathcal Y} Y \,|\, \mathcal Y \subseteq \mathcal X \}$.</p>&#xA;&#xA;<p>Is there a name for this problem?&#x...
combinatorics sets
1
Count all possible unions in a collection of sets -- (combinatorics sets) <p>Say we have a collections of sets $\mathcal X = \{X_1, \dots, X_n\}$ (not necessarily disjoint), and we want to count the number of possible unions of sets in $\mathcal X$, i.e. the size of $\{\bigcup_{Y \in \mathcal Y} Y \,|\, \mathcal Y \sub...
habedi/stack-exchange-dataset
33,573
How do I interpret a binary tree generated using Huffman coding algorithm?
<p><img src="https://i.stack.imgur.com/WqamR.png" alt="enter image description here"></p>&#xA;&#xA;<p>In the lecture note <a href="http://homepage.cs.uiowa.edu/~cremer/courses/hut11/huffmannotes.pdf" rel="nofollow noreferrer">here</a>, a binary tree was generated from the huffman algorithm. However it did not explain w...
binary trees encoding scheme
1
How do I interpret a binary tree generated using Huffman coding algorithm? -- (binary trees encoding scheme) <p><img src="https://i.stack.imgur.com/WqamR.png" alt="enter image description here"></p>&#xA;&#xA;<p>In the lecture note <a href="http://homepage.cs.uiowa.edu/~cremer/courses/hut11/huffmannotes.pdf" rel="nofoll...
habedi/stack-exchange-dataset
33,583
Running time analysis of a segment tree
<p>Can someone provide an analysis of the <strong>update</strong> and <strong>query</strong> operations of a segment tree?</p>&#xA;&#xA;<p>I thought of a way which goes like this - At every node, we make at most two recursive calls on the left and right sub-trees. If we could prove that one of these calls terminates fa...
data structures runtime analysis computational geometry binary trees search trees
1
Running time analysis of a segment tree -- (data structures runtime analysis computational geometry binary trees search trees) <p>Can someone provide an analysis of the <strong>update</strong> and <strong>query</strong> operations of a segment tree?</p>&#xA;&#xA;<p>I thought of a way which goes like this - At every nod...
habedi/stack-exchange-dataset
33,586
MIPS with one read port in the register file?
<p>I'm studying the MIPS multi-cycle datapath, and I'm wondering what would happen if there was only one read port in the register file for certain instructions.</p>&#xA;&#xA;<p>First, for R-type instructions, I know that it takes in 2 registers(for example, with 'add', rs and rt are both passed into read-port 1 and re...
computer architecture
1
MIPS with one read port in the register file? -- (computer architecture) <p>I'm studying the MIPS multi-cycle datapath, and I'm wondering what would happen if there was only one read port in the register file for certain instructions.</p>&#xA;&#xA;<p>First, for R-type instructions, I know that it takes in 2 registers(f...
habedi/stack-exchange-dataset
33,594
Forward checking with conflict directed backjumping
<p>Can somebody explain me how can I join forward checking with conflict directed backjumping in my CSP solver? I understand that when the consistency fails when I add a value to a variable, I should save all the instantiated variables of the restriction that fails, on the conflict set of the variable to which I gave a...
algorithms artificial intelligence constraint programming
1
Forward checking with conflict directed backjumping -- (algorithms artificial intelligence constraint programming) <p>Can somebody explain me how can I join forward checking with conflict directed backjumping in my CSP solver? I understand that when the consistency fails when I add a value to a variable, I should save ...
habedi/stack-exchange-dataset
33,595
What is the most efficient algorithm and data structure for maintaining connected component information on a dynamic graph?
<p>Say I have an undirected finite sparse graph, and need to be able to run the following queries efficiently:</p>&#xA;&#xA;<ul>&#xA;<li>$IsConnected(N_1, N_2)$ - returns $T$ if there is a path between $N_1$ and $N_2$, otherwise $F$</li>&#xA;<li>$ConnectedNodes(N)$ - returns the set of nodes which are reachable from $N...
algorithms graphs data structures
1
What is the most efficient algorithm and data structure for maintaining connected component information on a dynamic graph? -- (algorithms graphs data structures) <p>Say I have an undirected finite sparse graph, and need to be able to run the following queries efficiently:</p>&#xA;&#xA;<ul>&#xA;<li>$IsConnected(N_1, N_...
habedi/stack-exchange-dataset
33,596
Blob detection as Constraint satisfaction problem?
<p>In image processing I have a black and white image which is represented by matrix {0,1}, I have to find blob (a region of connected pixels) in it. I'm confused, can this problem be reduced to Constraint Satisfaction problem (as p/np complete)?</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/x3imb.png" alt="Typic...
np complete image processing computer vision graphics constraint programming
1
Blob detection as Constraint satisfaction problem? -- (np complete image processing computer vision graphics constraint programming) <p>In image processing I have a black and white image which is represented by matrix {0,1}, I have to find blob (a region of connected pixels) in it. I'm confused, can this problem be red...
habedi/stack-exchange-dataset
33,609
Proving correctness of a CFG by induction on length of strings generated
<p>Consider the following grammar with starting symbol of $S$.</p>&#xA;&#xA;<p>$$S \rightarrow 0S11\;|\;S1\;|\;0$$</p>&#xA;&#xA;<p>Let $L = \{0^i1^j:\; \ge 1\; and\; j \ge2i-2\}$ . Give a formal proof of the following claim : For all $n\;\ge0$, every string of length $n$ in $L$ can be generated by the grammar.</p>&#xA;...
formal languages context free formal grammars proof techniques
1
Proving correctness of a CFG by induction on length of strings generated -- (formal languages context free formal grammars proof techniques) <p>Consider the following grammar with starting symbol of $S$.</p>&#xA;&#xA;<p>$$S \rightarrow 0S11\;|\;S1\;|\;0$$</p>&#xA;&#xA;<p>Let $L = \{0^i1^j:\; \ge 1\; and\; j \ge2i-2\}$ ...
habedi/stack-exchange-dataset
33,613
Implementing an interval tree using arrays?
<p>Is it possible to create an interval tree using an array instead of the traditional pointer method? I know that for segment trees this is commonly done where the children of any element with index i are stored in 2i and 2i + 1 and the range is halved. For interval trees however, because the ranges added are not guar...
data structures search trees arrays intervals
1
Implementing an interval tree using arrays? -- (data structures search trees arrays intervals) <p>Is it possible to create an interval tree using an array instead of the traditional pointer method? I know that for segment trees this is commonly done where the children of any element with index i are stored in 2i and 2i...
habedi/stack-exchange-dataset
33,618
Big-O Notation of Anagram solution algorithm
<p>In <em>Solution 1: Checking Off</em> of <a href="http://interactivepython.org/runestone/static/pythonds/AlgorithmAnalysis/AnAnagramDetectionExample.html" rel="nofollow noreferrer">Problem Solving with Algorithms and Data Structures</a>, just beneath the <em>ActiveCode: 1</em> extract (included at the bottom of this ...
complexity theory algorithm analysis
1
Big-O Notation of Anagram solution algorithm -- (complexity theory algorithm analysis) <p>In <em>Solution 1: Checking Off</em> of <a href="http://interactivepython.org/runestone/static/pythonds/AlgorithmAnalysis/AnAnagramDetectionExample.html" rel="nofollow noreferrer">Problem Solving with Algorithms and Data Structure...
habedi/stack-exchange-dataset
33,624
Decision problem which belongs to P reduced to a decision problem which belongs to NP?
<p>Is it possible to have a decision problem $A$ which belongs to P and reduce it to a decision problem $B$ which belongs to NP, i.e. $A \leq_{\mathrm{p}} B$, where $A$ belongs to P, $B$ belongs to NP?</p>&#xA;
complexity theory complexity classes np
1
Decision problem which belongs to P reduced to a decision problem which belongs to NP? -- (complexity theory complexity classes np) <p>Is it possible to have a decision problem $A$ which belongs to P and reduce it to a decision problem $B$ which belongs to NP, i.e. $A \leq_{\mathrm{p}} B$, where $A$ belongs to P, $B$ b...
habedi/stack-exchange-dataset
33,627
Can all decision problems reduce to undecidable?
<p>If one could build a machine that for any input will never accept, but always loop forever, then will all problems reduce to this?</p>&#xA;&#xA;<p>Or did I just misunderstood the idea of reduction?</p>&#xA;
decision problem
1
Can all decision problems reduce to undecidable? -- (decision problem) <p>If one could build a machine that for any input will never accept, but always loop forever, then will all problems reduce to this?</p>&#xA;&#xA;<p>Or did I just misunderstood the idea of reduction?</p>&#xA;
habedi/stack-exchange-dataset
33,632
Why is DPLL better than brute force?
<p>I understand that by being clever about the way we navigate the search space of the SAT problem we're going to get better performance than by randomly choosing and testing solutions, though of course both methods have $O(2^n)$ time complexity. What are the specific reasons that DPLL gives better performance than bru...
satisfiability sat solvers
1
Why is DPLL better than brute force? -- (satisfiability sat solvers) <p>I understand that by being clever about the way we navigate the search space of the SAT problem we're going to get better performance than by randomly choosing and testing solutions, though of course both methods have $O(2^n)$ time complexity. What...
habedi/stack-exchange-dataset
33,633
Proof of equivalence of regular expressions (0 + 1)(0 + 1)* and (0 + 1)*(0 + 1)
<p>How would I prove that the regular expressions RS and SR where R = (0 + 1) and S = (0 + 1)* are equivalent? The '+' sign represents union of two regular expressions and two expressions RS are concatenated.</p>&#xA;&#xA;<p>From what I know, either you must prove using existing rules about equivalence of regular expre...
proof techniques regular expressions
1
Proof of equivalence of regular expressions (0 + 1)(0 + 1)* and (0 + 1)*(0 + 1) -- (proof techniques regular expressions) <p>How would I prove that the regular expressions RS and SR where R = (0 + 1) and S = (0 + 1)* are equivalent? The '+' sign represents union of two regular expressions and two expressions RS are con...
habedi/stack-exchange-dataset
33,635
Recovering the transition function of a Turing machine with a known number of states
<p>Suppose we have a Turing Machine and know how many states it has as well as bound on its running time, but do not initially know its transition function. Is it possible to determine its transition function (up to a relabeling of its states and disregard for inaccessible states) by noting its behavior on only finite...
computability turing machines
1
Recovering the transition function of a Turing machine with a known number of states -- (computability turing machines) <p>Suppose we have a Turing Machine and know how many states it has as well as bound on its running time, but do not initially know its transition function. Is it possible to determine its transition...
habedi/stack-exchange-dataset
33,640
Is every file an integer amount of bytes?
<p>I'm not sure whether I'm asking on the right site, since all the other questions seem to be a lot more abstract and theoretical. If I should remove the question, please tell me.</p>&#xA;&#xA;<p>Are all files on my computer an integer amount of bytes? That is, does every file on my computer consist of an amount of bi...
filesystems
1
Is every file an integer amount of bytes? -- (filesystems) <p>I'm not sure whether I'm asking on the right site, since all the other questions seem to be a lot more abstract and theoretical. If I should remove the question, please tell me.</p>&#xA;&#xA;<p>Are all files on my computer an integer amount of bytes? That is...
habedi/stack-exchange-dataset
33,642
Proof of Minsky Papert Symmetrization technique
<p>I frequently hear about the Minsky-Papert Symmetrization technique in many papers with a reference to the book of Minsky. I could not locate the book online. Could someone supply me a proof of the symmetrization technique?</p>&#xA;&#xA;<p>For instance, it is used in Lemma $5$ in this paper <a href="http://www.csee.u...
polynomials
1
Proof of Minsky Papert Symmetrization technique -- (polynomials) <p>I frequently hear about the Minsky-Papert Symmetrization technique in many papers with a reference to the book of Minsky. I could not locate the book online. Could someone supply me a proof of the symmetrization technique?</p>&#xA;&#xA;<p>For instance,...
habedi/stack-exchange-dataset
33,654
Prove or disprove: L^2 context free implies L is context free
<p>Clearly we have to disprove this. But I am finding it hard to prove it. I was trying in following way: Considering any non context free language L. I was trying to prove that L^2 is context free which will contradict given statement. But I don't know to how to prove it. Because by pumping lemma we can show only that...
formal languages context free
1
Prove or disprove: L^2 context free implies L is context free -- (formal languages context free) <p>Clearly we have to disprove this. But I am finding it hard to prove it. I was trying in following way: Considering any non context free language L. I was trying to prove that L^2 is context free which will contradict giv...
habedi/stack-exchange-dataset
33,666
Can regular languages be Turing complete?
<p>I was reading about <a href="http://www.nyu.edu/projects/barker/Iota/" rel="nofollow noreferrer">Iota and Jot</a> and found this section confusing:</p>&#xA;&#xA;<blockquote>&#xA; <p>Unlike Iota, where the syntactic tree for a string can branch either on the left or on the right, Jot syntax is uniformly left-branchi...
regular languages programming languages turing completeness
1
Can regular languages be Turing complete? -- (regular languages programming languages turing completeness) <p>I was reading about <a href="http://www.nyu.edu/projects/barker/Iota/" rel="nofollow noreferrer">Iota and Jot</a> and found this section confusing:</p>&#xA;&#xA;<blockquote>&#xA; <p>Unlike Iota, where the synt...
habedi/stack-exchange-dataset
33,671
Probability of probing $t$ locations in a Cuckoo hash is $O(\frac{1}{2^{t/2}})$ locations in the worst case
<p>I was told this question may be better received here.</p>&#xA;&#xA;<blockquote>&#xA; <p>Prove that the probability that an insertion into a cuckoo hash table&#xA; probes $t$ array locations is $O(\frac{1}{2^{t/2}})$. Keep in mind that there are two tables, each with size $s \ge 2n$, where $n$ is the number of elem...
algorithms algorithm analysis data structures hash tables
1
Probability of probing $t$ locations in a Cuckoo hash is $O(\frac{1}{2^{t/2}})$ locations in the worst case -- (algorithms algorithm analysis data structures hash tables) <p>I was told this question may be better received here.</p>&#xA;&#xA;<blockquote>&#xA; <p>Prove that the probability that an insertion into a cucko...
habedi/stack-exchange-dataset
33,675
Eliminating Null Productions from Context Free Grammar
<p>Here is a problem I am trying to solve:</p>&#xA;&#xA;<pre><code>S -&gt; 0A0 | 1B1 | BB&#xA;A -&gt; C&#xA;B -&gt; S | A&#xA;C -&gt; S | e&#xA;</code></pre>&#xA;&#xA;<p>I know that C is nullable (since it produces an epsilon) and A is nullable (since it produces C, which is nullable). My question is if B is nullable t...
context free formal grammars
1
Eliminating Null Productions from Context Free Grammar -- (context free formal grammars) <p>Here is a problem I am trying to solve:</p>&#xA;&#xA;<pre><code>S -&gt; 0A0 | 1B1 | BB&#xA;A -&gt; C&#xA;B -&gt; S | A&#xA;C -&gt; S | e&#xA;</code></pre>&#xA;&#xA;<p>I know that C is nullable (since it produces an epsilon) and ...
habedi/stack-exchange-dataset
33,678
NFA - string acceptance (decision problem) test
<p>I am interested in testing for a given string (w) whether it is in the language (L) defined by a nondeterministic finite automaton (A). I have some blurry point in my mind.</p>&#xA;&#xA;<p>What is the complexity of this test by using the NFA and backtracking? Assume my NFA has m states and string (w) has length n (|...
automata nondeterminism
1
NFA - string acceptance (decision problem) test -- (automata nondeterminism) <p>I am interested in testing for a given string (w) whether it is in the language (L) defined by a nondeterministic finite automaton (A). I have some blurry point in my mind.</p>&#xA;&#xA;<p>What is the complexity of this test by using the NF...
habedi/stack-exchange-dataset
33,680
How can I solve this constrained assignment problem?
<p>The assignment problem is defined as follows:</p>&#xA;&#xA;<blockquote>&#xA; <p>There are a number of agents and a number of tasks. Any agent can be&#xA; assigned to perform any task, incurring some cost that may vary&#xA; depending on the agent-task assignment. It is required to perform all&#xA; tasks by assign...
algorithms optimization combinatorics assignment problem
1
How can I solve this constrained assignment problem? -- (algorithms optimization combinatorics assignment problem) <p>The assignment problem is defined as follows:</p>&#xA;&#xA;<blockquote>&#xA; <p>There are a number of agents and a number of tasks. Any agent can be&#xA; assigned to perform any task, incurring some c...
habedi/stack-exchange-dataset
33,681
Why is the orthogonal line segment intersection algorithm $O(n\log n+R)$ instead of $O(n\log n + Rn)$?
<p><img src="https://i.stack.imgur.com/Nercq.png" alt="enter image description here"></p>&#xA;&#xA;<p>In the same lecture notes without providing many details it says that the complexity of the algorithm which uses a balanced search tree is $O(n\log n+R)$ where $R$ is the total amount of intersections.</p>&#xA;&#xA;<p>...
algorithms algorithm analysis computational geometry search trees
1
Why is the orthogonal line segment intersection algorithm $O(n\log n+R)$ instead of $O(n\log n + Rn)$? -- (algorithms algorithm analysis computational geometry search trees) <p><img src="https://i.stack.imgur.com/Nercq.png" alt="enter image description here"></p>&#xA;&#xA;<p>In the same lecture notes without providing ...
habedi/stack-exchange-dataset