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 |
|---|---|---|---|---|---|---|
89,206 | Fast computation of k-fibonacci numbers | <p>Let's define the sequence of $k$-Fibonacci numbers as
$$ F_i = 2^i, ~~ 0 \leq i \leq k-1 $$
$$ F_i = F_{i-1} + \dots + F_{i-k}, ~~ i \geq k $$</p>

<p>I have a <a href="https://www.e-olymp.com/en/problems/5081" rel="nofollow noreferrer">problem</a> which requires to compute $n$-th $k$-Fibonacci numbe... | time complexity combinatorics recurrence relation efficiency | 1 | Fast computation of k-fibonacci numbers -- (time complexity combinatorics recurrence relation efficiency)
<p>Let's define the sequence of $k$-Fibonacci numbers as
$$ F_i = 2^i, ~~ 0 \leq i \leq k-1 $$
$$ F_i = F_{i-1} + \dots + F_{i-k}, ~~ i \geq k $$</p>

<p>I have a <a href="https://www.e-olymp.com/en... | habedi/stack-exchange-dataset |
89,207 | Show that a language is decidable iff some enumerator enumerates the language in lexicographic order | <p>The proof is given in the below:</p>
<blockquote>
<p>If <span class="math-container">$A$</span> is decidable, the enumerator operates by generating the strings in lexicographic order and testing each in turn for membership in <span class="math-container">$A$</span> using the decider. Those strings which are ... | computability undecidability | 1 | Show that a language is decidable iff some enumerator enumerates the language in lexicographic order -- (computability undecidability)
<p>The proof is given in the below:</p>
<blockquote>
<p>If <span class="math-container">$A$</span> is decidable, the enumerator operates by generating the strings in lexicograph... | habedi/stack-exchange-dataset |
89,212 | Saving information from reaching definition | <p>I am learning about compilers at the moment and in my textbook it is briefly mentioned that UD/DU (Use-Def, Def-Use Chains) a way of saving information from the reaching definition is. It is just said that, <em>when a variable is used, it has a list of the reaching definitions</em>.</p>

<p>The problem that ... | compilers data flow analysis | 1 | Saving information from reaching definition -- (compilers data flow analysis)
<p>I am learning about compilers at the moment and in my textbook it is briefly mentioned that UD/DU (Use-Def, Def-Use Chains) a way of saving information from the reaching definition is. It is just said that, <em>when a variable is used, it ... | habedi/stack-exchange-dataset |
89,222 | Advantages of FPGAs over GPUs | <p>What are the advantages of using FPGAs over GPGPUs? It seems like GPGPUs have the best of CPUs and GPUs combined.</p>
 | computer architecture cpu | 1 | Advantages of FPGAs over GPUs -- (computer architecture cpu)
<p>What are the advantages of using FPGAs over GPGPUs? It seems like GPGPUs have the best of CPUs and GPUs combined.</p>
 | habedi/stack-exchange-dataset |
89,223 | Myhill-Nerode Theorem DFA Minimization | <p>I am learning how to minimize a DFA. One helpful approach is the Myhill-Nerode Theorem, which explains:</p>

<ol>
<li>Draw a table for all pairs of states (P,Q)</li>
<li>Mark all pairs where P is a final state and Q is not a final state. </li>
<li>If there are any unmarked pairs such that [delta(... | finite automata | 1 | Myhill-Nerode Theorem DFA Minimization -- (finite automata)
<p>I am learning how to minimize a DFA. One helpful approach is the Myhill-Nerode Theorem, which explains:</p>

<ol>
<li>Draw a table for all pairs of states (P,Q)</li>
<li>Mark all pairs where P is a final state and Q is not a final state. </l... | habedi/stack-exchange-dataset |
89,229 | Face recognition on on tilted images | <p>From what I learned, viola jones needs images with faces upfront. Tilting the head a few degrees to each side can botch the algorithm. Is it possible to take an image, take a several rotated copies of it and run the algorithm on each one?</p>

<p>This limitation sounds like only a minor neusense to me. Is th... | image processing facial recognition | 1 | Face recognition on on tilted images -- (image processing facial recognition)
<p>From what I learned, viola jones needs images with faces upfront. Tilting the head a few degrees to each side can botch the algorithm. Is it possible to take an image, take a several rotated copies of it and run the algorithm on each one?<... | habedi/stack-exchange-dataset |
89,232 | Show that the regular language is contained in another | <p>Let L1 and L2 be two non empty regular language. How can I show that the following expression is correct with an example ? 
$\bigotimes$ denote the transducer cross product.</p>

<p>$L_1^+ \bigotimes L_2^+$ contains $(L_1 \bigotimes L_2)^+$</p>

<p>================================================... | regular languages regular expressions transducers | 1 | Show that the regular language is contained in another -- (regular languages regular expressions transducers)
<p>Let L1 and L2 be two non empty regular language. How can I show that the following expression is correct with an example ? 
$\bigotimes$ denote the transducer cross product.</p>

<p>$L_1^+ \bigot... | habedi/stack-exchange-dataset |
89,245 | How approximate sine using Taylor series | <p>I need to approximate the sine function without internal libraries. I used Taylor series in 0 to solve this, but my program works for some values, but for others awful results.
The program gets x value, unit (degrees or radians) and how many words we want use for the approximation.
For values like </p>
&... | algorithms approximation numerical algorithms | 1 | How approximate sine using Taylor series -- (algorithms approximation numerical algorithms)
<p>I need to approximate the sine function without internal libraries. I used Taylor series in 0 to solve this, but my program works for some values, but for others awful results.
The program gets x value, unit (degrees or r... | habedi/stack-exchange-dataset |
89,252 | Minimum number of vertices whose removal makes the graph an independent set | <p>It is known that finding an independent set (or a clique) of size at least $k$ in a graph is $W[1]$ hard, so it is unlikely that there is $f(k)\cdot n^{O(1)}$ time algorithm for finding an independent set of size greater than equal to $k$.</p>

<p>I was looking at the complementary problem - "<strong>Whether... | algorithms np hard clique parameterized complexity | 1 | Minimum number of vertices whose removal makes the graph an independent set -- (algorithms np hard clique parameterized complexity)
<p>It is known that finding an independent set (or a clique) of size at least $k$ in a graph is $W[1]$ hard, so it is unlikely that there is $f(k)\cdot n^{O(1)}$ time algorithm for finding... | habedi/stack-exchange-dataset |
89,260 | Dijkstra's algorithm: why are distances initialized to infinity and not some negative number? | <p>I'm a high schooler who has been self-learning graph algorithms for a month or two now. </p>

<p>I was wondering why the distance array in Dijkstra's algorithm is initialized to infinity (INT_MAX in C++) when it could just be set to a negative number? Since Dijkstra's isn't even used for negative numbers, wh... | algorithms graphs | 1 | Dijkstra's algorithm: why are distances initialized to infinity and not some negative number? -- (algorithms graphs)
<p>I'm a high schooler who has been self-learning graph algorithms for a month or two now. </p>

<p>I was wondering why the distance array in Dijkstra's algorithm is initialized to infinity (INT_... | habedi/stack-exchange-dataset |
89,269 | Soft question: program result verification | <p>Let's say there's a cloud computing service that allows people to run arbitrary programs and get the results. The idea being that your machine is too slow, and you don't want to overwhelm it. If your program is something like "factorize 15672965357291016", then it's a perfect candidate for this service, because you ... | distributed systems | 1 | Soft question: program result verification -- (distributed systems)
<p>Let's say there's a cloud computing service that allows people to run arbitrary programs and get the results. The idea being that your machine is too slow, and you don't want to overwhelm it. If your program is something like "factorize 156729653572... | habedi/stack-exchange-dataset |
89,271 | Is there a way to find a simple regular expression for this language? | <p>Let $\Sigma$ be 0,1,2. I am interested in the language of all strings $w$ such that the sum of $w$ characters (where the char 0 is treated as the number 0, the char 1 as the number 1 etc) is divideable by 5. Obviously this is a regular language, and I can also find a simple linear grammer. </p>

<p>My idea f... | formal languages regular languages regular expressions | 1 | Is there a way to find a simple regular expression for this language? -- (formal languages regular languages regular expressions)
<p>Let $\Sigma$ be 0,1,2. I am interested in the language of all strings $w$ such that the sum of $w$ characters (where the char 0 is treated as the number 0, the char 1 as the number 1 etc)... | habedi/stack-exchange-dataset |
89,276 | What is the big-$\Omega$ complexity of Fermat's Little Theorem? | <p>Fermat's Little Theorem states that if an integer $n$ is prime them
$$
a^n \equiv a \pmod n \hspace{10mm} (*)
$$
for any $a \in \mathbb{N}$</p>

<p>My question is, is it correct to say that testing $(*)$ for some given $a$ has complexity $\Omega (n)$, since we would have to calculate $a^n$ wh... | complexity theory primes modular arithmetic | 1 | What is the big-$\Omega$ complexity of Fermat's Little Theorem? -- (complexity theory primes modular arithmetic)
<p>Fermat's Little Theorem states that if an integer $n$ is prime them
$$
a^n \equiv a \pmod n \hspace{10mm} (*)
$$
for any $a \in \mathbb{N}$</p>

<p>My question is, is it correct to... | habedi/stack-exchange-dataset |
89,280 | Inference rules for deriving invariants in Hoare logic | <p>The following algorithm is supposed to compare two strings $S_1$ and $S_2$ ("/\" for empty string):</p>

<pre><code>X = S1 
Y = S2

E = true 
// (1) S1 = S2 <=> X = Y and E = true
while X != /\ and Y != /\ and E == true 
 if head(X) == head(Y) 
 X ... | logic propositional logic loop invariants hoare logic | 1 | Inference rules for deriving invariants in Hoare logic -- (logic propositional logic loop invariants hoare logic)
<p>The following algorithm is supposed to compare two strings $S_1$ and $S_2$ ("/\" for empty string):</p>

<pre><code>X = S1 
Y = S2

E = true 
// (1) S1 = S2 <=> X = Y an... | habedi/stack-exchange-dataset |
89,290 | data structure admitting top items with prefix | <p>A trie can answer a query for all items with a certain prefix in $O(m + \log n)$ time, where $m$ is the number of matches and $n$ is the number of items. A trie also supports $O(\log n)$ insertion and deletion and takes $O(n)$ space.</p>

<p>Now suppose each item has a score. I am looking for a data structur... | data structures search algorithms search trees | 1 | data structure admitting top items with prefix -- (data structures search algorithms search trees)
<p>A trie can answer a query for all items with a certain prefix in $O(m + \log n)$ time, where $m$ is the number of matches and $n$ is the number of items. A trie also supports $O(\log n)$ insertion and deletion and take... | habedi/stack-exchange-dataset |
89,295 | Time complexity of computing binomial coefficients (with binary representation of integers) | <p>Given two integers $n$ and $k$, I want to compute the exact value of the binomial coefficient ${n \choose k}$.</p>

<p>Here $n$ and $k$ are given in their binary representation, meaning that the size of the input is about $\log n + \log k$.</p>

<p>How fast, in big-O notation, can we compute ${n \cho... | algorithms time complexity | 1 | Time complexity of computing binomial coefficients (with binary representation of integers) -- (algorithms time complexity)
<p>Given two integers $n$ and $k$, I want to compute the exact value of the binomial coefficient ${n \choose k}$.</p>

<p>Here $n$ and $k$ are given in their binary representation, meaning... | habedi/stack-exchange-dataset |
89,301 | What's the directory structure on disk that keeps the information of all files? | <p>I'm reading Operating System Concepts by Avi Silberschatz(9thE), in chapter 11 <em>File-System Interface</em>, when the author explains the concepts of file, he states that</p>

<blockquote>
 <p>The information about all files is kept in the directory structure, which
 also resides on secondary sto... | operating systems filesystems | 1 | What's the directory structure on disk that keeps the information of all files? -- (operating systems filesystems)
<p>I'm reading Operating System Concepts by Avi Silberschatz(9thE), in chapter 11 <em>File-System Interface</em>, when the author explains the concepts of file, he states that</p>

<blockquote>
... | habedi/stack-exchange-dataset |
89,305 | Algorithm for weighted elliptic curve fit | <p><strong>Background:</strong>
I was trying to detect a face solely on the bases of features and the confidence of the features found.
I am using a method to identify the features along with the response (confidence). Stronger features have higher responses.
I was trying to identify rotations of face. So, ... | algorithms image processing mathematical programming video | 1 | Algorithm for weighted elliptic curve fit -- (algorithms image processing mathematical programming video)
<p><strong>Background:</strong>
I was trying to detect a face solely on the bases of features and the confidence of the features found.
I am using a method to identify the features along with the response (... | habedi/stack-exchange-dataset |
89,312 | Find the center node on a weighted, non-directed graph | <p>So I have a problem, and it's an assignment from school.<br>
<img src="https://imgur.com/CohjU8Y.jpg" alt="Graph"><br>
This is a figure made out of matchsticks.
The goal is to find the optimal location to light up the figure so that it burns in minimal time. You can only light it up at integer positions ... | graphs weighted graphs | 1 | Find the center node on a weighted, non-directed graph -- (graphs weighted graphs)
<p>So I have a problem, and it's an assignment from school.<br>
<img src="https://imgur.com/CohjU8Y.jpg" alt="Graph"><br>
This is a figure made out of matchsticks.
The goal is to find the optimal location to light up the figu... | habedi/stack-exchange-dataset |
89,325 | Logistic model and Linear regression model | <p>I am reading the book "An introduction to statistical learning with applications in R". I am reading Logistic Regression and I don't understand why when it's compared to linear regression model, the author said that "the problem with this approach: for balances close to zero we predict a negative probability of defa... | algorithms | 1 | Logistic model and Linear regression model -- (algorithms)
<p>I am reading the book "An introduction to statistical learning with applications in R". I am reading Logistic Regression and I don't understand why when it's compared to linear regression model, the author said that "the problem with this approach: for balan... | habedi/stack-exchange-dataset |
89,333 | How to prove a reduction | <p>I'm just a little confused about the wordings for reductions and would appreciate some help as I am very new to reductions.</p>

<p>I have a question where I have two sets, A and B, and I have to provide a reduction A $\leq_p$ B and then I have to prove that the reduction is correct. </p>

<p>What do... | time complexity reductions | 1 | How to prove a reduction -- (time complexity reductions)
<p>I'm just a little confused about the wordings for reductions and would appreciate some help as I am very new to reductions.</p>

<p>I have a question where I have two sets, A and B, and I have to provide a reduction A $\leq_p$ B and then I have to prov... | habedi/stack-exchange-dataset |
89,342 | How to solve a polynomial of the form y = ax^3 + bx^2 + cx + d using the incremental algorithm in computer graphics | <p>I am studying Computer Graphics and need to design an incremental algorithm for solving the polynomial $y = ax^3 + bx^2 + cx + d$, and then implement that in OpenGL. The input will be the values of $a, b,c,d$ and the desired output is a <em>line/curve</em> to be drawn. The values of $x$ would be in the range $1\leq ... | algorithms graphics polynomials | 1 | How to solve a polynomial of the form y = ax^3 + bx^2 + cx + d using the incremental algorithm in computer graphics -- (algorithms graphics polynomials)
<p>I am studying Computer Graphics and need to design an incremental algorithm for solving the polynomial $y = ax^3 + bx^2 + cx + d$, and then implement that in OpenGL... | habedi/stack-exchange-dataset |
89,346 | Convert (x + y = z) to propositional logic formula for 8-bit numbers | <p>(Note: this was asked in the cstheory stackexchange, but I was told this is a more appropriate place for it.)</p>

<p>I have three 8-bit 2's-complement numbers (X, Y, and Z). I want to find a propositional logic formula using only the variables (x<sub>1</sub>, x<sub>2</sub>... x<sub>8</sub>, y<sub>1</sub>...... | propositional logic bit manipulation bit blasting | 1 | Convert (x + y = z) to propositional logic formula for 8-bit numbers -- (propositional logic bit manipulation bit blasting)
<p>(Note: this was asked in the cstheory stackexchange, but I was told this is a more appropriate place for it.)</p>

<p>I have three 8-bit 2's-complement numbers (X, Y, and Z). I want to ... | habedi/stack-exchange-dataset |
89,349 | Is the problem of traversing every vertex of a graph (not necessarily once) without crossing an edge more than once in P? | <p>I know that finding a Hamiltonian circuit is in NP and I know that finding an Eulerian circuit is in P. However, what about the following problem:</p>

<ul>
<li>Must leave the starting vertex and visit every other vertex;</li>
<li>You may only return to the start after visiting every other vertex;</l... | algorithms complexity theory graphs np complete np hard | 1 | Is the problem of traversing every vertex of a graph (not necessarily once) without crossing an edge more than once in P? -- (algorithms complexity theory graphs np complete np hard)
<p>I know that finding a Hamiltonian circuit is in NP and I know that finding an Eulerian circuit is in P. However, what about the follow... | habedi/stack-exchange-dataset |
89,357 | Show that an NP-Complete problem exists that is contained in SPACE(n) | <p>The problem I am working on is the following:</p>

<blockquote>
 <p>Show that there exists an <span class="math-container">$NP$</span>-Complete problem in <span class="math-container">$SPACE(n)$</span>.
 Does the existence of such a problem imply that <span class="math-container">$NP$</span> is con... | complexity theory time complexity np complete space complexity | 1 | Show that an NP-Complete problem exists that is contained in SPACE(n) -- (complexity theory time complexity np complete space complexity)
<p>The problem I am working on is the following:</p>

<blockquote>
 <p>Show that there exists an <span class="math-container">$NP$</span>-Complete problem in <span class... | habedi/stack-exchange-dataset |
89,360 | How to calculate number of nodes opened by BFS? | <p>In the below diagram, each node takes up a space of 2KB. I need to find the total memory consumed to reach the goal : I</p>

<p>I know that the equation for BFS is</p>

<p>b<sup>1</sup> + b<sup>2</sup> + ...... + (b<sup>d+1</sup> - b)</p>

<p>Where b is the branching factor and d the depth</p... | algorithms algorithm analysis search algorithms search trees | 1 | How to calculate number of nodes opened by BFS? -- (algorithms algorithm analysis search algorithms search trees)
<p>In the below diagram, each node takes up a space of 2KB. I need to find the total memory consumed to reach the goal : I</p>

<p>I know that the equation for BFS is</p>

<p>b<sup>1</sup> +... | habedi/stack-exchange-dataset |
89,363 | How to compute quotient subgroup efficiently? | <p>Let $G$ be a finite group given by the table representation and a normal subgroup $H$ of $G$ is given. I want to compute $G/H$ that is quotient group. </p>

<p>Model of computation is RAM</p>

<p>For all pair of $a$ and $b$ in $G$ just check $a.b - b.a = 0$ , but it is going to take much time $O(n^2)... | algorithms computer algebra group theory | 1 | How to compute quotient subgroup efficiently? -- (algorithms computer algebra group theory)
<p>Let $G$ be a finite group given by the table representation and a normal subgroup $H$ of $G$ is given. I want to compute $G/H$ that is quotient group. </p>

<p>Model of computation is RAM</p>

<p>For all pair ... | habedi/stack-exchange-dataset |
89,364 | Does every language in BPP have a mapping reduction to ATM? | <p>Does every language $C$ in the class $BPP$ have a mapping reduction to $A_{TM}$?
$(C\leq _{m} A_{TM})$</p>

<p>$BPP$ is the class of languages that have a probabilistic $TM$ that accepts them with an error $\epsilon$ less than 1/3.</p>

<p>$A_{TM}$ is the acceptance language, takes as input a $TM... | complexity theory probabilistic algorithms | 1 | Does every language in BPP have a mapping reduction to ATM? -- (complexity theory probabilistic algorithms)
<p>Does every language $C$ in the class $BPP$ have a mapping reduction to $A_{TM}$?
$(C\leq _{m} A_{TM})$</p>

<p>$BPP$ is the class of languages that have a probabilistic $TM$ that accepts them with ... | habedi/stack-exchange-dataset |
89,369 | what does the author mean by directory structure in operating system? | <p>I'm reading <em>Operating System Concepts</em> by Avi Silberschatz(9thE), in section 11.4 File-System Mounting, the author explains the steps of filesystem mounting as follows:</p>

<blockquote>
 <ol>
 <li>The operating system is given the
 name of the device and the mount point—the location w... | operating systems filesystems | 1 | what does the author mean by directory structure in operating system? -- (operating systems filesystems)
<p>I'm reading <em>Operating System Concepts</em> by Avi Silberschatz(9thE), in section 11.4 File-System Mounting, the author explains the steps of filesystem mounting as follows:</p>

<blockquote>
 <ol... | habedi/stack-exchange-dataset |
89,373 | Is finding cache size possible with information given? | <p>An 8-way set-associative cache is used in a computer in which the real memory size is 2<sup>22</sup> bytes. The line size is 16 bytes, and there are 2<sup>6</sup> lines per set. 
A) What is the size of the cache in bytes?</p>

<p>What I (think) I understand: 
Cache line and cache block are synonymous... | computer architecture cpu cache cpu memory hardware cpu pipelines | 1 | Is finding cache size possible with information given? -- (computer architecture cpu cache cpu memory hardware cpu pipelines)
<p>An 8-way set-associative cache is used in a computer in which the real memory size is 2<sup>22</sup> bytes. The line size is 16 bytes, and there are 2<sup>6</sup> lines per set. 
A) What ... | habedi/stack-exchange-dataset |
89,381 | Runtime analysis of bit operations | <p>In class we have learned that division takes O($k^2$) where k is the bitlength of the numbers used in the operation. What would be the runtime of a function that looks like this?</p>

<pre><code>while a % 2 == 0:
 a = a / 2
</code></pre>

<p>I am guessing the worst case is $O(log(k)k^2)$ a... | runtime analysis | 1 | Runtime analysis of bit operations -- (runtime analysis)
<p>In class we have learned that division takes O($k^2$) where k is the bitlength of the numbers used in the operation. What would be the runtime of a function that looks like this?</p>

<pre><code>while a % 2 == 0:
 a = a / 2
</code></pre>
... | habedi/stack-exchange-dataset |
89,392 | Finding bicliques in a bipartite graph of minimum size | <p>Let $G=(U \cup V, E)$ denotes a bipartite graph. A biclique $C = (U, V)$ is a subgraph of $G$ induced by a pair of two disjoint subsets $U' \subseteq U$, $V' \subseteq V$, such that $\forall u \in U', v \in V': (u, v) \in E$.</p>

<p>Given $\delta$, I'd like to identify bicliques $(U',V')$ such that $|V'| \... | graphs approximation clique | 1 | Finding bicliques in a bipartite graph of minimum size -- (graphs approximation clique)
<p>Let $G=(U \cup V, E)$ denotes a bipartite graph. A biclique $C = (U, V)$ is a subgraph of $G$ induced by a pair of two disjoint subsets $U' \subseteq U$, $V' \subseteq V$, such that $\forall u \in U', v \in V': (u, v) \in E$.</p... | habedi/stack-exchange-dataset |
89,404 | Can't Understand this Subset Construction Proof | <p>This proof is from Introduction to Automata Theory Languages and Computation by Hopcroft & Ullman and is regarding a 'bad case' for subset construction.</p>

<p>The NFA which is being converted is as follows:</p>

<p><a href="https://i.stack.imgur.com/s7Kpg.png" rel="nofollow noreferrer"><img src... | automata finite automata proof techniques | 1 | Can't Understand this Subset Construction Proof -- (automata finite automata proof techniques)
<p>This proof is from Introduction to Automata Theory Languages and Computation by Hopcroft & Ullman and is regarding a 'bad case' for subset construction.</p>

<p>The NFA which is being converted is as follows:</... | habedi/stack-exchange-dataset |
89,406 | How to prove that non-antipodal vertices cannot be a diameter of a convex polygon? | <p>I am learning <a href="https://en.wikipedia.org/wiki/Rotating_calipers#Shamos's_algorithm" rel="nofollow noreferrer">Shamos's rotating calipers algorithm</a> for finding the diameter of a convex polygon in <a href="http://euro.ecom.cmu.edu/people/faculty/mshamos/1978ShamosThesis.pdf" rel="nofollow noreferrer">hi... | computational geometry convex hull | 1 | How to prove that non-antipodal vertices cannot be a diameter of a convex polygon? -- (computational geometry convex hull)
<p>I am learning <a href="https://en.wikipedia.org/wiki/Rotating_calipers#Shamos's_algorithm" rel="nofollow noreferrer">Shamos's rotating calipers algorithm</a> for finding the diameter of a co... | habedi/stack-exchange-dataset |
89,419 | Why is the set for which a decision problem is true called a "language"? | <p>When we have a decision problem, " does $f(x)=1$ hold?", we call the set of strings $x$ for which the answer is yes a "language".</p>

<p>Why this strange terminology?</p>
 | terminology | 1 | Why is the set for which a decision problem is true called a "language"? -- (terminology)
<p>When we have a decision problem, " does $f(x)=1$ hold?", we call the set of strings $x$ for which the answer is yes a "language".</p>

<p>Why this strange terminology?</p>
 | habedi/stack-exchange-dataset |
89,429 | How do you implement a language with greater capabilities using subordinate languages? | <p>I've heard that C++ and Python where implemented using C. How can someone make an object oriented language out of something that doesn't support objects?</p>

<p>I've read in the book "Math You Can`t Use - Patents, Copyright and Software" that code is considered an equivalent of mathematics because it will e... | programming languages mathematical programming | 1 | How do you implement a language with greater capabilities using subordinate languages? -- (programming languages mathematical programming)
<p>I've heard that C++ and Python where implemented using C. How can someone make an object oriented language out of something that doesn't support objects?</p>

<p>I've rea... | habedi/stack-exchange-dataset |
89,440 | How does the strong form of the PCP theorem imply the inapproximability of Max-XORSAT? | <blockquote>
<blockquote>
<p><strong>Theorem 11.4</strong> For any constant <span class="math-container">$\delta > 0$</span>, every problem in NP has probabilistically checkable proofs of length poly(<span class="math-container">$n$</span>), where the verifier flips <span class="math-container">$O(\log n)$</... | approximation | 1 | How does the strong form of the PCP theorem imply the inapproximability of Max-XORSAT? -- (approximation)
<blockquote>
<blockquote>
<p><strong>Theorem 11.4</strong> For any constant <span class="math-container">$\delta > 0$</span>, every problem in NP has probabilistically checkable proofs of length poly(<sp... | habedi/stack-exchange-dataset |
89,444 | Does godel's incompleteness theorem still hold if we have a TM that can do an infinity amount of computations? | <p>I have heard whisperings that if we have a turing machine that is allowed to compute infinitely many steps in finite time, then we can solve the halting problem.</p>

<p>This made me wonder, if we have such a TM, do Godel's incompleteness theorems then not hold anymore?</p>

<p>My intuition is: If th... | turing machines incompleteness | 1 | Does godel's incompleteness theorem still hold if we have a TM that can do an infinity amount of computations? -- (turing machines incompleteness)
<p>I have heard whisperings that if we have a turing machine that is allowed to compute infinitely many steps in finite time, then we can solve the halting problem.</p>
... | habedi/stack-exchange-dataset |
89,449 | Parameters of a linear code | <p>Consider the code $C=\{c=(c_1...c_n): c \in \Bbb F_q^n, c_1=c_n\} \subset \Bbb F_q^n$.</p>

<p>I was able to prove that the code is a linear code because it is closed under addition and scalar multiplication. 
Also, it is clear that the length is n. </p>

<p>However I am having a hard time with m... | coding theory | 1 | Parameters of a linear code -- (coding theory)
<p>Consider the code $C=\{c=(c_1...c_n): c \in \Bbb F_q^n, c_1=c_n\} \subset \Bbb F_q^n$.</p>

<p>I was able to prove that the code is a linear code because it is closed under addition and scalar multiplication. 
Also, it is clear that the length is n. </p>
... | habedi/stack-exchange-dataset |
89,460 | Does Gödel's first incompleteness theorem apply to quantifier-free arithmetics? | <p>Gödel's first incompleteness theorem states roughly that <em>"for any axiomatization of arithmetic, there are statements that can neither be proven to be false nor true."</em></p>

<p>Does this <em>still hold when it comes to quantifier-free statements</em>?</p>

<p>I.e. if we have the structure of a... | incompleteness | 1 | Does Gödel's first incompleteness theorem apply to quantifier-free arithmetics? -- (incompleteness)
<p>Gödel's first incompleteness theorem states roughly that <em>"for any axiomatization of arithmetic, there are statements that can neither be proven to be false nor true."</em></p>

<p>Does this <em>still hold ... | habedi/stack-exchange-dataset |
89,464 | Union-Find link-by-rank preserve a root | <p>Suppose I have two union-find trees with roots $x$ and $y$ respectively. I want to join them in constant time (this is normally possible since I already "hold" the roots) but I need $x$ to be the root of the merged tree. I don't know what rank $x$ or $y$ have (or more precisely formulated I need this to work always ... | data structures union find | 1 | Union-Find link-by-rank preserve a root -- (data structures union find)
<p>Suppose I have two union-find trees with roots $x$ and $y$ respectively. I want to join them in constant time (this is normally possible since I already "hold" the roots) but I need $x$ to be the root of the merged tree. I don't know what rank $... | habedi/stack-exchange-dataset |
89,468 | Finding a (Small-Big-Medium) subsequence | <blockquote>
 <p>Given a list of $n$ non repeating integer numbers $L:=(x_1,\dots,x_n)$ develop an algorithm that decides if there are $x_{i_1},x_{i_2},x_{i_3}\in L$ such that $i_1<i_2<i_3$ and $x_{i_1}<x_{i_3}<x_{i_2}$. Only a yes-no answer is required.</p>
</blockquote>

<p>The statement ... | algorithms divide and conquer subsequences | 1 | Finding a (Small-Big-Medium) subsequence -- (algorithms divide and conquer subsequences)
<blockquote>
 <p>Given a list of $n$ non repeating integer numbers $L:=(x_1,\dots,x_n)$ develop an algorithm that decides if there are $x_{i_1},x_{i_2},x_{i_3}\in L$ such that $i_1<i_2<i_3$ and $x_{i_1}<x_{i_3}<x_{... | habedi/stack-exchange-dataset |
89,472 | Union-Find with link-by-rank to represent a binary field with simple operations | <p>I have a field $X$ of given length $n$ which is filled with zeroes in the beginning.</p>

<p>I only need these 3 simple operations:</p>

<p>GET_VALUE$(i)$: returns the value of $i$-th cell ($X[i]$)</p>

<p>SET_TO_1$(i)$:basically $X[i] \leftarrow 1$ for $i < n - 1$, otherwise nothing (the ... | data structures union find | 1 | Union-Find with link-by-rank to represent a binary field with simple operations -- (data structures union find)
<p>I have a field $X$ of given length $n$ which is filled with zeroes in the beginning.</p>

<p>I only need these 3 simple operations:</p>

<p>GET_VALUE$(i)$: returns the value of $i$-th cell ... | habedi/stack-exchange-dataset |
89,473 | How is density of a substance in grams per cubic centimeter a discrete attribute? | <p>I'm going over the different types of attributes in data-mining (nominal, ordinal, discrete, etc) and there is one example in the book that states that the density of a substance in grams per cubic centimeter is a discrete attribute. Why is this? I confuses me that this is the case but it also says that the distance... | data mining | 1 | How is density of a substance in grams per cubic centimeter a discrete attribute? -- (data mining)
<p>I'm going over the different types of attributes in data-mining (nominal, ordinal, discrete, etc) and there is one example in the book that states that the density of a substance in grams per cubic centimeter is a disc... | habedi/stack-exchange-dataset |
89,479 | A second question on "Show a TM-recognizable language of TMs can be expressed by TM-description language of equivalent TMs" | <p>Let B={M1,M2,...} be a Turing-recognizable language consisting of TM descriptions. Show that there is a decidable language C consisting of TM descriptions s.t. every machine in B has an equivalent machine in C and vice versa.</p>

<p>I saw a hint on solving this question which is given in the following pictu... | formal languages turing machines computability undecidability | 1 | A second question on "Show a TM-recognizable language of TMs can be expressed by TM-description language of equivalent TMs" -- (formal languages turing machines computability undecidability)
<p>Let B={M1,M2,...} be a Turing-recognizable language consisting of TM descriptions. Show that there is a decidable language C c... | habedi/stack-exchange-dataset |
89,487 | How to reduce halting problem to the problem of whether a Turing Machine accepts infinitely many inputs? | <p>The language $\{w \mid w \in \{0,1\}^{*}\text{ and }M_w\text{ accepts infinitely many inputs}\}$ is undecidable, where $M_w$ is the Turing machine represented by $w$.</p>

<p>I am confused because I do not know how to reduce this problem. Maybe it works with the complement of the Halting problem?</p>
 | turing machines reductions undecidability halting problem | 1 | How to reduce halting problem to the problem of whether a Turing Machine accepts infinitely many inputs? -- (turing machines reductions undecidability halting problem)
<p>The language $\{w \mid w \in \{0,1\}^{*}\text{ and }M_w\text{ accepts infinitely many inputs}\}$ is undecidable, where $M_w$ is the Turing machine re... | habedi/stack-exchange-dataset |
89,489 | Knapsack problem question | <p>Based on <a href="https://www.youtube.com/watch?v=8LusJS5-AGo&t=191s" rel="nofollow noreferrer">this video</a>, the tutor explains the knapsack problem with dynamic programming approach. One thing is not cleared in this video, which is my main question. </p>

<p>All the values on the first row (except 0... | algorithms dynamic programming knapsack problems | 1 | Knapsack problem question -- (algorithms dynamic programming knapsack problems)
<p>Based on <a href="https://www.youtube.com/watch?v=8LusJS5-AGo&t=191s" rel="nofollow noreferrer">this video</a>, the tutor explains the knapsack problem with dynamic programming approach. One thing is not cleared in this video, which... | habedi/stack-exchange-dataset |
89,497 | Show that the single-tape TMs that can not write on the portion the portion of the tape containing the input string recognize only regular languages | <p>Show that the single-tape TMs that can not write on the portion the portion of the tape containing the input string recognize only regular languages.</p>

<p>The first part of the answer in a book said that:</p>

<p>We give a DFA <span class="math-container">$A$</span> that is equivalent to TM <span ... | complexity theory turing machines computability | 1 | Show that the single-tape TMs that can not write on the portion the portion of the tape containing the input string recognize only regular languages -- (complexity theory turing machines computability)
<p>Show that the single-tape TMs that can not write on the portion the portion of the tape containing the input string... | habedi/stack-exchange-dataset |
89,517 | How do these alternative definitions of one-way functions compare? | <p>I've seen competing requirements in the definitions for one-way functions. Namely</p>

<p>$$
\underset{x,r}{\mathbb{P}}\big(f(B(f(x),r)) = f(x)\big) = o(n^{-c})
$$
and
$$
\underset{x}{\mathbb{E}}\left[\underset{r}{\mathbb{P}}\big(f(B(f(x),r)) = f(x)\big)\right] = o(n^{-c})
$$</p>
... | pseudo random generators one way functions | 1 | How do these alternative definitions of one-way functions compare? -- (pseudo random generators one way functions)
<p>I've seen competing requirements in the definitions for one-way functions. Namely</p>

<p>$$
\underset{x,r}{\mathbb{P}}\big(f(B(f(x),r)) = f(x)\big) = o(n^{-c})
$$
and
$$
\un... | habedi/stack-exchange-dataset |
89,519 | Playing the game of life on an infinite grid | <p>I would like to implement Conway's game of life on a grid that is infinite in all directions. It should be initialized with an initial pattern and then run, e.g, like this:</p>

<pre><code>set(-500,200)
set(-501,201)
set(-502,202)
start()
</code></pre>

<p>What data structure should I... | data structures | 1 | Playing the game of life on an infinite grid -- (data structures)
<p>I would like to implement Conway's game of life on a grid that is infinite in all directions. It should be initialized with an initial pattern and then run, e.g, like this:</p>

<pre><code>set(-500,200)
set(-501,201)
set(-502,202)
... | habedi/stack-exchange-dataset |
89,531 | Problem with the pseudo random number generator One-Time-Pad | <p>I've started learning cryptography in class and we've come across One-Time-Pads, in which the key (uniformally agreed upon) is as long as the message itself. Then you turn the message into bits, do $XOR$ and get the cipher text. This encrypts the message and to decrypt the message you'd do $XOR$ with the cipher and... | randomized algorithms randomness cryptography encryption | 1 | Problem with the pseudo random number generator One-Time-Pad -- (randomized algorithms randomness cryptography encryption)
<p>I've started learning cryptography in class and we've come across One-Time-Pads, in which the key (uniformally agreed upon) is as long as the message itself. Then you turn the message into bits,... | habedi/stack-exchange-dataset |
89,537 | Smallest possible DFA for a language over {0,1}* with third to last symbol 1 should have 4 states not 8. Where am I going wrong in my DFA? | <p>So I was reading Micheal Sipser's Introduction to TOC and when I stumbled upon this aforementioned question , he'd the following dfa :</p>

<p><a href="https://i.stack.imgur.com/65I1a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/65I1a.png" alt="The dfa in the book"></a></p>

<p>... | finite automata | 1 | Smallest possible DFA for a language over {0,1}* with third to last symbol 1 should have 4 states not 8. Where am I going wrong in my DFA? -- (finite automata)
<p>So I was reading Micheal Sipser's Introduction to TOC and when I stumbled upon this aforementioned question , he'd the following dfa :</p>

<p><a hre... | habedi/stack-exchange-dataset |
89,542 | Why is it better to do the data flow analysis in the basic blocks | <p>I have been reading about compilers and it is said that doing the data flow analysis in the basic blocks is more optimal.</p>

<p>Sadly, quoting the exact source, would be slightly hard as it is not in English, but a quote from <a href="https://en.wikipedia.org/wiki/Data-flow_analysis" rel="nofollow noreferr... | compilers data flow analysis | 1 | Why is it better to do the data flow analysis in the basic blocks -- (compilers data flow analysis)
<p>I have been reading about compilers and it is said that doing the data flow analysis in the basic blocks is more optimal.</p>

<p>Sadly, quoting the exact source, would be slightly hard as it is not in English... | habedi/stack-exchange-dataset |
89,558 | Find the loop invariant of the given while loop | <p>I don't know how to find a loop invariant. I'm not sure where to start. Can anyone find the loop invariant of the given program and explain your method please.</p>

<pre><code>{n ≥ 0 ∧ i = 0}
while i < n − 1 loop
b[i] := a[i + 1];
i:=i + 1
end loop
{∀j.(0 ≤ j < n − 1 → b[j] = a[j ... | proof techniques loop invariants hoare logic proof assistants | 1 | Find the loop invariant of the given while loop -- (proof techniques loop invariants hoare logic proof assistants)
<p>I don't know how to find a loop invariant. I'm not sure where to start. Can anyone find the loop invariant of the given program and explain your method please.</p>

<pre><code>{n ≥ 0 ∧ i = 0}&... | habedi/stack-exchange-dataset |
89,559 | Under what circumstances are one-way functions reducible to their hard-core bits? | <p>I've seen competing claims about hard-core predicates. On the one hand, there's the basic definition</p>

<blockquote>
 <p>Let $f : \{0,1\}^n \rightarrow \{0,1\}^k$ and $b : \{0,1\}^n \rightarrow \{0,1\}$ be computable in polynomial time. We say that $f$ is a one-way function with hard-core bit $b$ if, ... | one way functions | 1 | Under what circumstances are one-way functions reducible to their hard-core bits? -- (one way functions)
<p>I've seen competing claims about hard-core predicates. On the one hand, there's the basic definition</p>

<blockquote>
 <p>Let $f : \{0,1\}^n \rightarrow \{0,1\}^k$ and $b : \{0,1\}^n \rightarrow \{0... | habedi/stack-exchange-dataset |
89,566 | Length of shortest word accepted by exactly one of two DFAs | <p>Let $M_1$ and $M_2$ be two deterministic finite automata with $M_1$ having $n$ states, and $M_2$ having $m$ states, over the same alphabet $\Sigma$. Show that if $M_1$ and $M_2$ are not equivalent, then there is some string $\omega \in \Sigma^*$ of length at most $n \times m$ that is in exclusively $M_1$ or $M_2$.</... | finite automata | 1 | Length of shortest word accepted by exactly one of two DFAs -- (finite automata)
<p>Let $M_1$ and $M_2$ be two deterministic finite automata with $M_1$ having $n$ states, and $M_2$ having $m$ states, over the same alphabet $\Sigma$. Show that if $M_1$ and $M_2$ are not equivalent, then there is some string $\omega \in ... | habedi/stack-exchange-dataset |
89,570 | Can Floyd-Warshall algorithm be used in an undirected graph with negative edges? | <p>So i know that it cannot be used if the directed graph has negative cycle, but what about the undirected graphs with negative edges? </p>

<p>is it going to always work, or sometimes or never?</p>
 | algorithms graphs | 1 | Can Floyd-Warshall algorithm be used in an undirected graph with negative edges? -- (algorithms graphs)
<p>So i know that it cannot be used if the directed graph has negative cycle, but what about the undirected graphs with negative edges? </p>

<p>is it going to always work, or sometimes or never?</p>
 | habedi/stack-exchange-dataset |
89,572 | Adding the requirement of linear time on infinitely many inputs into the class $P$ | <p>Is the following problem computable in polynomial time?</p>

<p><strong>Input:</strong> $<M_1>$, encoding of a determinstic TM that runs in polynomial time ($L(M_1)\in P$)</p>

<p><strong>Output:</strong> $<M_2>$, encoding of a determinstic TM that runs in polynomial time ($L(M_2)\in P$),... | complexity theory turing machines computability time complexity polynomial time | 1 | Adding the requirement of linear time on infinitely many inputs into the class $P$ -- (complexity theory turing machines computability time complexity polynomial time)
<p>Is the following problem computable in polynomial time?</p>

<p><strong>Input:</strong> $<M_1>$, encoding of a determinstic TM that run... | habedi/stack-exchange-dataset |
89,573 | Is it possible to transfer a point from one camera to another, given n corresponding points? | <p>I have 2 images of a scene taken at one moment by two identical cameras (similar cameras intrinsic parameters) by to arbitrary locations and at two arbitrary orientations (different cameras poses).
On the images n points correspondence p_i1={x_i1, y_i1, z_i1}↔p_i2={x_i2, y_i2, z_i2}, i=1,2,...,n are given. Let f... | computational geometry computer vision image processing linear algebra | 1 | Is it possible to transfer a point from one camera to another, given n corresponding points? -- (computational geometry computer vision image processing linear algebra)
<p>I have 2 images of a scene taken at one moment by two identical cameras (similar cameras intrinsic parameters) by to arbitrary locations and at two ... | habedi/stack-exchange-dataset |
89,577 | Should we eliminate left recursion before using NPDA to simulate CFG? | <p>I read the book "Introduction to the Theory of. Computation, Third Edition by Michael Sipser".</p>
<p>It says:</p>
<blockquote>
<p>If a language is context free, then some pushdown automaton recognizes it.</p>
<p>Let A be a CFL. From the definition we know that A has a CFG,
G, generatin... | context free formal grammars pushdown automata parsers | 1 | Should we eliminate left recursion before using NPDA to simulate CFG? -- (context free formal grammars pushdown automata parsers)
<p>I read the book "Introduction to the Theory of. Computation, Third Edition by Michael Sipser".</p>
<p>It says:</p>
<blockquote>
<p>If a language is context free, the... | habedi/stack-exchange-dataset |
89,584 | Reduce ATM to CFTM | <p>How would I reduce $A_{TM}$ to $CF_{TM}$ when:
$A_{TM}=\{<M,w>|M$ is a Turing Machine description and $w\in L(M)\} $</p>

<p>$CF_{TM} =\{<M> | M$ is a Turing Machine description $L(M)$ is a context-free language.$\}$</p>

<p>My problem is this: $A_{TM}$ deals with all $TM$s how would... | complexity theory computability np complete | 1 | Reduce ATM to CFTM -- (complexity theory computability np complete)
<p>How would I reduce $A_{TM}$ to $CF_{TM}$ when:
$A_{TM}=\{<M,w>|M$ is a Turing Machine description and $w\in L(M)\} $</p>

<p>$CF_{TM} =\{<M> | M$ is a Turing Machine description $L(M)$ is a context-free language.$\}$</p>
... | habedi/stack-exchange-dataset |
89,593 | NL Completeness Log space reduction $PATH$ to $EQ_{DFA}$ | <p>Let $$PATH = \{(G, s, t) | \exists \text{ a directed path from $s$ to $t$ in $G$}\},$$ 
$$EQ_{DFA} = \{(M_1, M_2) | \text{DFA $M_1$ and $M_2$ over the same alphabet are equivalent}\}.$$
Is there a log space reduction from $PATH$ to $EQ_{DFA}$? </p>

<p>My attempt was to first show that there exists a... | complexity theory finite automata | 1 | NL Completeness Log space reduction $PATH$ to $EQ_{DFA}$ -- (complexity theory finite automata)
<p>Let $$PATH = \{(G, s, t) | \exists \text{ a directed path from $s$ to $t$ in $G$}\},$$ 
$$EQ_{DFA} = \{(M_1, M_2) | \text{DFA $M_1$ and $M_2$ over the same alphabet are equivalent}\}.$$
Is there a log space reduct... | habedi/stack-exchange-dataset |
89,601 | Does the inverse of a one-way function $f$ being reducible to a predicate $b$ imply that $b$ is a hard-core bit for $f$? | <p>I'm working with this definition for one-way functions: </p>

<blockquote>
 <p>We call $f$ a (strong) one-way function if </p>
 
 <ol>
 <li>it is computable in polynomial time</li>
 <li>for any polynomial time randomized algorithm $B$ and any constant $c$
 $$
\mathbb{P}\bi... | one way functions | 1 | Does the inverse of a one-way function $f$ being reducible to a predicate $b$ imply that $b$ is a hard-core bit for $f$? -- (one way functions)
<p>I'm working with this definition for one-way functions: </p>

<blockquote>
 <p>We call $f$ a (strong) one-way function if </p>
 
 <ol>
 <li>it ... | habedi/stack-exchange-dataset |
89,603 | Finding the maximum of a random forest | <p>If we have some collection of decision trees with single-variable splits and a constant value at each leaf node, the average over all trees gives some function from $\mathbb{R}^n \to \mathbb{R}$. Is it possible to efficiently find the subspace on which this function achieves its maximum? Enumerating all intersection... | algorithms optimization machine learning combinatorics | 1 | Finding the maximum of a random forest -- (algorithms optimization machine learning combinatorics)
<p>If we have some collection of decision trees with single-variable splits and a constant value at each leaf node, the average over all trees gives some function from $\mathbb{R}^n \to \mathbb{R}$. Is it possible to effi... | habedi/stack-exchange-dataset |
89,610 | Chord protocol - How should I go about mapping nodes to placeholders on the ring? | <p>In the real world, how is a node mapped to the position on the ring, 
Each nodes's IP address is hashed using SHA-1 hashing algorithm which will produce this hash - 73.128.154.69 hashed into 60CBFB98C9052A425D684A2C3D8D8D38424129A3. 
This should have been in the range of 0 to (2^m) - 1 where m is the number ... | distributed systems communication protocols protocols peer to peer | 1 | Chord protocol - How should I go about mapping nodes to placeholders on the ring? -- (distributed systems communication protocols protocols peer to peer)
<p>In the real world, how is a node mapped to the position on the ring, 
Each nodes's IP address is hashed using SHA-1 hashing algorithm which will produce this h... | habedi/stack-exchange-dataset |
89,620 | Why does the distribution of pseudorandom numbers change when operating like this? | <p>We were introduced to the standard C <code>rand()</code> function, and how to use it.</p>

<p>At some point during the class we were asked how to roll a die. The simple answer was to create a random number, take its modulo 6, and add 1.</p>

<pre><code>rand()%6 + 1
</code></pre>

<p>Howev... | probability theory pseudo random generators | 1 | Why does the distribution of pseudorandom numbers change when operating like this? -- (probability theory pseudo random generators)
<p>We were introduced to the standard C <code>rand()</code> function, and how to use it.</p>

<p>At some point during the class we were asked how to roll a die. The simple answer w... | habedi/stack-exchange-dataset |
89,626 | Regex for divisibility by 123 in binary strings | <p>Is there a regex that checks for divisibility by 123 in binary strings?</p>
<p>This question can be found in the Algorithms’ textbook by Sedgewick and Wayne <a href="https://algs4.cs.princeton.edu/54regexp/" rel="nofollow noreferrer">official website</a> (question 7b in the Creative Exercises section).</p>
<... | regular expressions | 1 | Regex for divisibility by 123 in binary strings -- (regular expressions)
<p>Is there a regex that checks for divisibility by 123 in binary strings?</p>
<p>This question can be found in the Algorithms’ textbook by Sedgewick and Wayne <a href="https://algs4.cs.princeton.edu/54regexp/" rel="nofollow noreferrer">offici... | habedi/stack-exchange-dataset |
89,633 | Calculating unbalanced binary trees | <p>Two-part question:</p>

<ol>
<li><p>Is there any more specific name than "unbalanced binary tree" to describe the tree below? The distinguishing characteristics are:</p>

<p>i. The root node and left children must have either 0 or 2 children.</p>

<p>ii. Right children must have 0 childre... | algorithms binary trees | 1 | Calculating unbalanced binary trees -- (algorithms binary trees)
<p>Two-part question:</p>

<ol>
<li><p>Is there any more specific name than "unbalanced binary tree" to describe the tree below? The distinguishing characteristics are:</p>

<p>i. The root node and left children must have either 0 or 2... | habedi/stack-exchange-dataset |
89,658 | Space complexity for connectivity problem with given graph diameter | <p>Given $(G,D,d)$, a graph, the graph diameter and the maximum outdegree of the graph.
Verify that $G$ is strongly connected in $O(D\log d + \log n)$ space complexity.</p>

<hr>

<p>I thought about using the $STCON$ problem for the whole nodes in the graph, but that will yield a space complexity of... | graphs space complexity | 1 | Space complexity for connectivity problem with given graph diameter -- (graphs space complexity)
<p>Given $(G,D,d)$, a graph, the graph diameter and the maximum outdegree of the graph.
Verify that $G$ is strongly connected in $O(D\log d + \log n)$ space complexity.</p>

<hr>

<p>I thought about usin... | habedi/stack-exchange-dataset |
89,663 | An algorithm for k-way array partitioning | <p>I am trying to implement <a href="https://en.wikipedia.org/wiki/Samplesort" rel="nofollow noreferrer">samplesort</a> in MPI. The first step of samplesort is to partition the array with $n - 1$ splitters $s_1, s_2, \cdots, s_{n-1}$ into $n$ subsequences, where subsequence $i$ all have values in the range of $[s_i, s_... | sorting quicksort partitions | 1 | An algorithm for k-way array partitioning -- (sorting quicksort partitions)
<p>I am trying to implement <a href="https://en.wikipedia.org/wiki/Samplesort" rel="nofollow noreferrer">samplesort</a> in MPI. The first step of samplesort is to partition the array with $n - 1$ splitters $s_1, s_2, \cdots, s_{n-1}$ into $n$ s... | habedi/stack-exchange-dataset |
89,664 | Defining polynomial hierarchy with oracle machines and quantifiers | <p>While trying to understand the concept of polynomial hierarchy, I noticed that there are several ways to define it. And the most confusing thing about the situation is to see the equivalence between those definitions intuitively. What I want to know for now is the relation between oracle machines and existential/uni... | polynomial time oracle machines | 1 | Defining polynomial hierarchy with oracle machines and quantifiers -- (polynomial time oracle machines)
<p>While trying to understand the concept of polynomial hierarchy, I noticed that there are several ways to define it. And the most confusing thing about the situation is to see the equivalence between those definiti... | habedi/stack-exchange-dataset |
89,673 | Given a number, getting a grid position in a spiral pattern | <pre><code>+---------------+---------------+---------------+---------------+---------------+
| id: 20 | id: 19 | id: 18 | id: 17 | id: 16 |
| pos: (-2, -2) | pos: (-1, -2) | pos: (0, -2) | pos: (1, -2) | pos: (2, -2) |
+---------------+---------------+---------------+--... | algorithms | 1 | Given a number, getting a grid position in a spiral pattern -- (algorithms)
<pre><code>+---------------+---------------+---------------+---------------+---------------+
| id: 20 | id: 19 | id: 18 | id: 17 | id: 16 |
| pos: (-2, -2) | pos: (-1, -2) | pos: (0, -2) | pos: (1, -2... | habedi/stack-exchange-dataset |
89,677 | Is the following figure DAG? | <p>I have been through multiple definitions of DAG and all of them say that it is a directed graph without cycles. Also, it is said that it has topological ordering.</p>

<p>Now the following figure is directed graph and does not have cycles.</p>

<p><a href="https://i.stack.imgur.com/wlibv.png" rel="no... | graphs data structures dag | 1 | Is the following figure DAG? -- (graphs data structures dag)
<p>I have been through multiple definitions of DAG and all of them say that it is a directed graph without cycles. Also, it is said that it has topological ordering.</p>

<p>Now the following figure is directed graph and does not have cycles.</p>
... | habedi/stack-exchange-dataset |
89,683 | Find if *any* path exists between vertices in a directed acyclic graph | <p>Given a directed acyclic (and unweighted) graph and two distinct vertices S and T, is there an algorithm that will tell me if there is <em>any</em> path (not necessarily the shortest one) between the two? If it helps, I don't need the list of vertices on this path, just the fact that path exists.</p>

<p>I s... | graphs | 1 | Find if *any* path exists between vertices in a directed acyclic graph -- (graphs)
<p>Given a directed acyclic (and unweighted) graph and two distinct vertices S and T, is there an algorithm that will tell me if there is <em>any</em> path (not necessarily the shortest one) between the two? If it helps, I don't need the... | habedi/stack-exchange-dataset |
89,688 | Algorithm: Shortest path (walk) with keys and doors | <p>I'm trying to solve the following algorithm question:</p>

<blockquote>
 <p>A maze is given by a graph (with let's say $v$ vertices and $e$
 edges), where $k$ vertices are different keys and, $k$ vertices are
 the corresponding doors (there is always one key for a single door)
 and one ve... | algorithms graphs shortest path | 1 | Algorithm: Shortest path (walk) with keys and doors -- (algorithms graphs shortest path)
<p>I'm trying to solve the following algorithm question:</p>

<blockquote>
 <p>A maze is given by a graph (with let's say $v$ vertices and $e$
 edges), where $k$ vertices are different keys and, $k$ vertices are&#... | habedi/stack-exchange-dataset |
89,689 | Using Myhill-Nerode to prove that language is not regular | <p>L = {$xy ∈ \{a, b\}^∗ : |x| = |y|$ and x contains the substring aa}</p>

<p>I am trying to prove that this language is not regular using MyHill-Nerode theorem but I am unable to find equivelance classes of this language. 
Thanks.</p>
 | formal languages regular languages | 1 | Using Myhill-Nerode to prove that language is not regular -- (formal languages regular languages)
<p>L = {$xy ∈ \{a, b\}^∗ : |x| = |y|$ and x contains the substring aa}</p>

<p>I am trying to prove that this language is not regular using MyHill-Nerode theorem but I am unable to find equivelance classes of this ... | habedi/stack-exchange-dataset |
89,701 | What is the complexity class of this variant of Subset sum? | <p>Let's represent Subset Sum problem with binary arrays instead of numbers.
Example: given two-dimensional array</p>

<pre><code>[1, 0, 0] (4)
[1, 0, 1] (5)
[0, 0, 1] (1)
</code></pre>

<p>is there set of one-dimensional arrays, sum of which is equal to</p>

<pre><code>[1, 0, 0,... | complexity theory np complete subset sum | 1 | What is the complexity class of this variant of Subset sum? -- (complexity theory np complete subset sum)
<p>Let's represent Subset Sum problem with binary arrays instead of numbers.
Example: given two-dimensional array</p>

<pre><code>[1, 0, 0] (4)
[1, 0, 1] (5)
[0, 0, 1] (1)
</code></pre>
... | habedi/stack-exchange-dataset |
89,704 | Are there any stochastic models of non determinism in the rate of program execution? | <p>We know that typical operating systems and high level languages (especially those with garbage collection) cannot be used for real time operating systems. Java & jet engines don't mix, and consequently a lot of study has gone into researching and developing real time operating systems.</p>

<p>Is there ... | reference request operating systems randomness | 1 | Are there any stochastic models of non determinism in the rate of program execution? -- (reference request operating systems randomness)
<p>We know that typical operating systems and high level languages (especially those with garbage collection) cannot be used for real time operating systems. Java & jet engines d... | habedi/stack-exchange-dataset |
89,706 | How to derive dependently typed eliminators? | <p>In dependently-typed programming, there are two main ways of decomposing data and performing recursion:</p>

<ul>
<li><strong>Dependent pattern matching</strong>: function definitions are given as multiple clauses. Unification ensures that all omitted cases are impossible, and an external solver ensures ... | reference request recursion type theory dependent types inductive datatypes | 1 | How to derive dependently typed eliminators? -- (reference request recursion type theory dependent types inductive datatypes)
<p>In dependently-typed programming, there are two main ways of decomposing data and performing recursion:</p>

<ul>
<li><strong>Dependent pattern matching</strong>: function definit... | habedi/stack-exchange-dataset |
89,710 | Existential Theory of the Reals in NP? | <p>It is known that the existential theory of the reals is decidable in PSPACE (via John Canny), but as far as I can tell no one has demonstrated that it is in NP. This confuses me because it seems like a short certificate for a given formula would be an example of values for the variables included in the formula that ... | algorithms complexity theory np hard np | 1 | Existential Theory of the Reals in NP? -- (algorithms complexity theory np hard np)
<p>It is known that the existential theory of the reals is decidable in PSPACE (via John Canny), but as far as I can tell no one has demonstrated that it is in NP. This confuses me because it seems like a short certificate for a given f... | habedi/stack-exchange-dataset |
89,729 | Pushdown Automaton for $L = \{ w_1 w_2 : |w_1| =|w_2| , w_1 \neq w_2 \} $ | <p>So i know that $L =$ { $ {w_1 w_2 : |w_1| =|w_2| , w_1 \neq w_2} $ } </p>

<p>is a CFL, but i cannot make a PDA for it because it doesn't make any sense to me why this is CFL</p>

<p>i even know the grammar for it but i cannot draw the PDA because :</p>

<p>even if we determine the middle of ... | formal languages context free pushdown automata | 1 | Pushdown Automaton for $L = \{ w_1 w_2 : |w_1| =|w_2| , w_1 \neq w_2 \} $ -- (formal languages context free pushdown automata)
<p>So i know that $L =$ { $ {w_1 w_2 : |w_1| =|w_2| , w_1 \neq w_2} $ } </p>

<p>is a CFL, but i cannot make a PDA for it because it doesn't make any sense to me why this is CFL</p>
... | habedi/stack-exchange-dataset |
89,730 | Is {a^n (a+b)^n | n>0} a Deterministic CFL? | <p><span class="math-container">$L = \{ a^n (a+b)^n | n>0\}$</span></p>

<p>A book I'm reading says it is, but considering we can't know where the second part gonna start, and it might start with a as well, then how can we accept this using a DPDA? Like after reading the first part (<span class="math-cont... | formal languages automata context free pushdown automata | 1 | Is {a^n (a+b)^n | n>0} a Deterministic CFL? -- (formal languages automata context free pushdown automata)
<p><span class="math-container">$L = \{ a^n (a+b)^n | n>0\}$</span></p>

<p>A book I'm reading says it is, but considering we can't know where the second part gonna start, and it might start with a as... | habedi/stack-exchange-dataset |
89,731 | Complexity for nested #P? | <p>Consider a problem such as weighted model counting for propositional logic. The problem of enumerating all models <code>M</code> of a logic formula <code>f</code> and summing their weights <code>w(M)</code> is #P. What happens if the weight is a function of the model and the task of computing the weight <code>w(M)</... | complexity theory complexity classes | 1 | Complexity for nested #P? -- (complexity theory complexity classes)
<p>Consider a problem such as weighted model counting for propositional logic. The problem of enumerating all models <code>M</code> of a logic formula <code>f</code> and summing their weights <code>w(M)</code> is #P. What happens if the weight is a fun... | habedi/stack-exchange-dataset |
89,736 | Is the set of all Context free languages a Context sensitive Language? ( can we build a LBA that decides whether a given language is CFL or not?) | <p>What i mean is that can we code each CFL ( the same way we code each turing machine in the Universal Turing Machine ) and build a Linear bounded Automata in such a way that for each input ( which is a code of a particular CFL) decides whether this is a context free language ( accept ) or not?</p>

<p>I hope ... | formal languages turing machines automata context free | 1 | Is the set of all Context free languages a Context sensitive Language? ( can we build a LBA that decides whether a given language is CFL or not?) -- (formal languages turing machines automata context free)
<p>What i mean is that can we code each CFL ( the same way we code each turing machine in the Universal Turing Mac... | habedi/stack-exchange-dataset |
89,747 | Why is a Fibonacci-Tree of rank 1 consolidated with one of rank n in this Fibonacci-Heap? | <p>In the solution to problem 2 of <a href="http://theory.stanford.edu/~trevisan/w4231/fall99/handouts/sol3.pdf" rel="nofollow noreferrer">this</a> exercise sheet:</p>

<blockquote>
 <p>The height of $n$-node Binomial Heap is always $O(\log{n})$. Show
 that this is not the case for Fibonacci He... | data structures heaps | 1 | Why is a Fibonacci-Tree of rank 1 consolidated with one of rank n in this Fibonacci-Heap? -- (data structures heaps)
<p>In the solution to problem 2 of <a href="http://theory.stanford.edu/~trevisan/w4231/fall99/handouts/sol3.pdf" rel="nofollow noreferrer">this</a> exercise sheet:</p>

<blockquote>
 <p>The ... | habedi/stack-exchange-dataset |
89,754 | Can the turing machine accept these type of languages in O(n)? or better? $L = \{a^n b^n c^n ... d^n | n > 0\}$ | <p>$L = \{a^n b^n c^n ... d^n | n>0 \}$</p>

<p>so for example $L = \{a^n b^n | n>0 \}$ , $L = \{a^n b^n c^n| n>0 \}$ and such</p>

<p>can the turing machine accept these in O(n)? if yes then what about a better time complexity like O(logn) or O(1)?</p>

<p>my take on this is: yes becau... | formal languages turing machines automata | 1 | Can the turing machine accept these type of languages in O(n)? or better? $L = \{a^n b^n c^n ... d^n | n > 0\}$ -- (formal languages turing machines automata)
<p>$L = \{a^n b^n c^n ... d^n | n>0 \}$</p>

<p>so for example $L = \{a^n b^n | n>0 \}$ , $L = \{a^n b^n c^n| n>0 \}$ and such</p>

<p>c... | habedi/stack-exchange-dataset |
89,764 | Doubt regarding binary trees and counting | <p><strong>Question:</strong> </p>

<p>A binary Tree T is semi-balanced, if for every node m in T: 
$$
\frac{R(m)}{2} <= L(m) <= 2*R(m)
$$
where, L(m) is the number of nodes in the left sub-tree of m and</p>

<p>R(m) is the number of nodes in the right sub-tree of m. </p>

... | recurrence relation binary trees | 1 | Doubt regarding binary trees and counting -- (recurrence relation binary trees)
<p><strong>Question:</strong> </p>

<p>A binary Tree T is semi-balanced, if for every node m in T: 
$$
\frac{R(m)}{2} <= L(m) <= 2*R(m)
$$
where, L(m) is the number of nodes in the left sub-tree of m and</p>&#... | habedi/stack-exchange-dataset |
89,765 | Can we convert any given turing machine to a turing machine with only 2 states? if so, how? | <p>So i remember reading somewhere that we can convert any turing machine into a turing machine with 2 states (or 3, i don't remember) but there was no proof for it and i couldn't find it either</p>

<p>So my question is :</p>

<p>For every turing machine, what is the minimum number of states that we ca... | formal languages turing machines automata | 1 | Can we convert any given turing machine to a turing machine with only 2 states? if so, how? -- (formal languages turing machines automata)
<p>So i remember reading somewhere that we can convert any turing machine into a turing machine with 2 states (or 3, i don't remember) but there was no proof for it and i couldn't f... | habedi/stack-exchange-dataset |
89,767 | Why can't OSes swap out processes that are waiting for I/O? | <p>In the book, <em>Operating System Concepts, 9th Edition</em>, there is this paragraph that I don't quite wrap my head around.</p>

<blockquote>
 <p>Swapping is constrained by other factors as well. If we want to swap a
 process, we must be sure that it is completely idle. Of particular
 concer... | operating systems memory management | 1 | Why can't OSes swap out processes that are waiting for I/O? -- (operating systems memory management)
<p>In the book, <em>Operating System Concepts, 9th Edition</em>, there is this paragraph that I don't quite wrap my head around.</p>

<blockquote>
 <p>Swapping is constrained by other factors as well. If we... | habedi/stack-exchange-dataset |
89,775 | Reduce ATM to the language of TM encodings concatenated by a string where the TM accepts both the string and its reverse | <p>Prove that the language $LM =\{\langle M,x\rangle\mid \ M \text{ accepts }x\text{ and rev}(x) \}$, where $\mathrm{rev}(x)$ is the reverse of the string $x$, is undecidable with a reduction from $A_{\mathrm{TM}}$. Note that the empty string belongs to $LM$.</p>
 | turing machines reductions undecidability | 1 | Reduce ATM to the language of TM encodings concatenated by a string where the TM accepts both the string and its reverse -- (turing machines reductions undecidability)
<p>Prove that the language $LM =\{\langle M,x\rangle\mid \ M \text{ accepts }x\text{ and rev}(x) \}$, where $\mathrm{rev}(x)$ is the reverse of the stri... | habedi/stack-exchange-dataset |
89,783 | Float multiplication | <p>While doing the multiplication <strong><code>1.4*0.8</code></strong> in a python program, I got the result as <strong><code>1.1199999999999999</code></strong>.</p>

<p>Why didn't I get <strong><code>1.12</code></strong> exactly?</p>

<p>In C programming language, the same expression gives <strong><co... | floating point number formats multiplication | 1 | Float multiplication -- (floating point number formats multiplication)
<p>While doing the multiplication <strong><code>1.4*0.8</code></strong> in a python program, I got the result as <strong><code>1.1199999999999999</code></strong>.</p>

<p>Why didn't I get <strong><code>1.12</code></strong> exactly?</p>
&... | habedi/stack-exchange-dataset |
89,789 | how can i proof $3^n$ has a greater growth than $n2^n$? | <p>i want to prove that $3^n$ has a greater growth than $n2^n$ or $3^n = O(n2^n)$. but how can i do it mathematically? by induction or contradiction or other ways of proof.</p>
 | asymptotics | 1 | how can i proof $3^n$ has a greater growth than $n2^n$? -- (asymptotics)
<p>i want to prove that $3^n$ has a greater growth than $n2^n$ or $3^n = O(n2^n)$. but how can i do it mathematically? by induction or contradiction or other ways of proof.</p>
 | habedi/stack-exchange-dataset |
89,792 | Is A times B of NP-complete languages A and B necessarily NP-hard? | <p>If both $A$ and $B$ are NP-complete languages, would $A \times B$ be necessarily NP-hard? Here, $A \times B = \{\langle u,v \rangle \mid u\in A, v\in B\}$. </p>

<p>So my colleague's answer was no, it's not necessarily NP-hard because you can verify in polynomial time that $u \in A$ and the same for $v \in B... | complexity theory np complete np hard | 1 | Is A times B of NP-complete languages A and B necessarily NP-hard? -- (complexity theory np complete np hard)
<p>If both $A$ and $B$ are NP-complete languages, would $A \times B$ be necessarily NP-hard? Here, $A \times B = \{\langle u,v \rangle \mid u\in A, v\in B\}$. </p>

<p>So my colleague's answer was no, i... | habedi/stack-exchange-dataset |
89,795 | An exact solution for biclique vertex-cover problem on a bipartite graph | <p>The biclique vertex-cover problem asks whether the vertex-set of the given graph can be covered with at most "k" bicliques (complete bipartite subgraphs).</p>

<p>It has been shown that "Biclique Vertex-Cover" is not fixed-parameter tractable unless P = NP in <a href="https://www.sciencedirect.com/science/ar... | algorithms graphs approximation set cover clique | 1 | An exact solution for biclique vertex-cover problem on a bipartite graph -- (algorithms graphs approximation set cover clique)
<p>The biclique vertex-cover problem asks whether the vertex-set of the given graph can be covered with at most "k" bicliques (complete bipartite subgraphs).</p>

<p>It has been shown t... | habedi/stack-exchange-dataset |
89,799 | Exact Analysis of the Merge Sort | <p>When doing the "inexact" analysis of the Merge Sort, the literature that I have seen usually consider that the input is an array with a even quantity of numbers and the recurrence relation is:</p>

<p>$T(n) = 2T(n/2) + \Theta(n)$</p>

<p>But how I can formally prove that even if I consider any input,... | algorithm analysis runtime analysis sorting mergesort | 1 | Exact Analysis of the Merge Sort -- (algorithm analysis runtime analysis sorting mergesort)
<p>When doing the "inexact" analysis of the Merge Sort, the literature that I have seen usually consider that the input is an array with a even quantity of numbers and the recurrence relation is:</p>

<p>$T(n) = 2T(n/2) ... | habedi/stack-exchange-dataset |
89,814 | Relative succinctness of NFAs and regular expressions | <p>What is known about the succintness of NFAs, relative to regular expressions?</p>

<p>In order to clarify the question, let me explain what I know. The regular languages can be characterized by any of the following:</p>

<ol>
<li>A language is regular iff it can be recognized by an NFA. </li>
... | finite automata regular expressions | 1 | Relative succinctness of NFAs and regular expressions -- (finite automata regular expressions)
<p>What is known about the succintness of NFAs, relative to regular expressions?</p>

<p>In order to clarify the question, let me explain what I know. The regular languages can be characterized by any of the following... | habedi/stack-exchange-dataset |
89,819 | Genetic Algorithm - Fit max circles inside box | <p>I am using a genetic algorithm to find the best way to pack circles inside a box without each touching the others and filling as much space as possible. My doubt is if an individual from a generation must be a circle or all the circles. </p>

<p>Can anyone help me on how would I go from here? Thank you</p>&#... | genetic algorithms packing | 1 | Genetic Algorithm - Fit max circles inside box -- (genetic algorithms packing)
<p>I am using a genetic algorithm to find the best way to pack circles inside a box without each touching the others and filling as much space as possible. My doubt is if an individual from a generation must be a circle or all the circles. <... | habedi/stack-exchange-dataset |
89,822 | Is global non-convex optimization NP-complete? | <p>Assume I have some non-convex function $f(x_1, x_2, ...)$ and I want to optimize it to find a global minimum. I feel like it is easy to show that this problem is in the class <strong>NP</strong> with the decision problem</p>

<p><em>Is there a set of points such that f < C?</em> </p>

<p>Where C i... | optimization np complete np decision problem mathematical programming | 1 | Is global non-convex optimization NP-complete? -- (optimization np complete np decision problem mathematical programming)
<p>Assume I have some non-convex function $f(x_1, x_2, ...)$ and I want to optimize it to find a global minimum. I feel like it is easy to show that this problem is in the class <strong>NP</strong> ... | habedi/stack-exchange-dataset |
89,828 | Master theorem for $T(n)=T(n-1)+O(n)$ | <p>The recurrence of selection sort is $$T(n) = T(n-1)+ O(n).$$ Can we apply the master theorem to this recurrence? I am confused because the master theorem can be applied to the following recurrence</p>

<p>$$T(n) = aT(n/b) + f(n),$$</p>

<p>where $a \ge 1$ and $b > 1$. But for selection sort, $b=1$... | recurrence relation master theorem | 1 | Master theorem for $T(n)=T(n-1)+O(n)$ -- (recurrence relation master theorem)
<p>The recurrence of selection sort is $$T(n) = T(n-1)+ O(n).$$ Can we apply the master theorem to this recurrence? I am confused because the master theorem can be applied to the following recurrence</p>

<p>$$T(n) = aT(n/b) + f(n),$$... | habedi/stack-exchange-dataset |
89,834 | Genetic algorithm - fit max circles inside box - what chromossomes? | <p>I am using a genetic algorithm to fit the max number of circles into a box. Right now my cromossomes are both coordinates of the each circle. I am not sure how to crossover and mutate the x and y coordenates in order not for the to converge but to keep a distance.</p>

<p>Can someone please shed some light? ... | genetic algorithms packing | 1 | Genetic algorithm - fit max circles inside box - what chromossomes? -- (genetic algorithms packing)
<p>I am using a genetic algorithm to fit the max number of circles into a box. Right now my cromossomes are both coordinates of the each circle. I am not sure how to crossover and mutate the x and y coordenates in order ... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.