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 |
|---|---|---|---|---|---|---|
43,821 | Succinct bounded-sum array with $O(1)$ access | <p>Assume we have a $n$ sized integer array $A$, and that we know that $\sum_{i\in[n]}A[i] \le M$.</p>

<p>Assume we are using the RAM model with $\Theta(\log n)$ sized memory words (which can be read / written in $O(1)$ time), and that $M=n^{O(1)}$.</p>

<p>A standard implementation could allocate $\lc... | algorithms data structures arrays encoding scheme | 1 | Succinct bounded-sum array with $O(1)$ access -- (algorithms data structures arrays encoding scheme)
<p>Assume we have a $n$ sized integer array $A$, and that we know that $\sum_{i\in[n]}A[i] \le M$.</p>

<p>Assume we are using the RAM model with $\Theta(\log n)$ sized memory words (which can be read / written ... | habedi/stack-exchange-dataset |
43,825 | Do problems in P only reduce to NP and coNP problems? | <p>Consider the languages $B,C,D$, such that $B\le_p C$ and $B\le_p D$.<br>
<strong>Statement</strong>: $B\in P, D\in NP, C\in coNP$.</p>

<blockquote>
 <p>Is the statement true for every $B,C,D$?</p>
</blockquote>

<p>I know that the answer is no and I have tried to come up with a conunter... | complexity theory reductions np | 1 | Do problems in P only reduce to NP and coNP problems? -- (complexity theory reductions np)
<p>Consider the languages $B,C,D$, such that $B\le_p C$ and $B\le_p D$.<br>
<strong>Statement</strong>: $B\in P, D\in NP, C\in coNP$.</p>

<blockquote>
 <p>Is the statement true for every $B,C,D$?</p>
</block... | habedi/stack-exchange-dataset |
43,830 | Why do Shaefer's and Mahaney's Theorems not imply P = NP? | <p>I'm sure someone has thought about this before or immediately dismissed it, but why does Schaefer's dichotomy theory along with Mahaney's theorem on sparse sets not imply P = NP ? </p>

<p>Here's my reasoning: Create a language $L$ which is equal
to SAT intersected by an infinite decidable sparse set. ... | complexity theory np complete satisfiability p vs np | 1 | Why do Shaefer's and Mahaney's Theorems not imply P = NP? -- (complexity theory np complete satisfiability p vs np)
<p>I'm sure someone has thought about this before or immediately dismissed it, but why does Schaefer's dichotomy theory along with Mahaney's theorem on sparse sets not imply P = NP ? </p>

<p>Her... | habedi/stack-exchange-dataset |
43,845 | Does Thompson's algorithm produce optimal NFAs? | <p>I'm using Thompson's algorithm to convert from a regular expression to a NFA. Is Thompson's algorithm guaranteed to always output a minimal NFA, i.e., a NFA with the smallest possible number of states?</p>

<p>For instance, consider this example. I have the regular expression $(a|b)$. According to <a href... | formal languages finite automata optimization regular expressions | 1 | Does Thompson's algorithm produce optimal NFAs? -- (formal languages finite automata optimization regular expressions)
<p>I'm using Thompson's algorithm to convert from a regular expression to a NFA. Is Thompson's algorithm guaranteed to always output a minimal NFA, i.e., a NFA with the smallest possible number of sta... | habedi/stack-exchange-dataset |
43,849 | solving large nonlinear systems in parallel | <p>I am solving a large (~1e5 equations & unknowns) set of nonlinear equations using Newton-Raphson iterations. Currently I am using the GPU accelerated Krylov methods implemented in ViennaCL to solve the linear system to get the update increment. I am solving the system on a single 24 core, 64GB workstation wi... | distributed systems parallel computing linear algebra | 1 | solving large nonlinear systems in parallel -- (distributed systems parallel computing linear algebra)
<p>I am solving a large (~1e5 equations & unknowns) set of nonlinear equations using Newton-Raphson iterations. Currently I am using the GPU accelerated Krylov methods implemented in ViennaCL to solve the linear ... | habedi/stack-exchange-dataset |
43,852 | Why does Kadane's algorithm solve the maximum sub-array problem? | <p>I've tried to solve a exercise 4.1-5 in algorithm book "Introduction to algorithms". </p>

<p>it is about Maximum sub-array problem, which is an algorithm that determines the greatest sum of sub-array A[i], A[i+1] , ... , A[j] in given array A[1] , ... , A[n]. </p>

<p>The exercise is about developin... | algorithms optimization arrays | 1 | Why does Kadane's algorithm solve the maximum sub-array problem? -- (algorithms optimization arrays)
<p>I've tried to solve a exercise 4.1-5 in algorithm book "Introduction to algorithms". </p>

<p>it is about Maximum sub-array problem, which is an algorithm that determines the greatest sum of sub-array A[i], A... | habedi/stack-exchange-dataset |
43,856 | Operator precedence in propositional logic | <p>there is some kind of priorities for the elements in propositional logic ?</p>

<p>for example : p ∧¬q → r , given this ,we there may be two options </p>

<p>(p ∧¬q) → r OR p ∧ (¬q → r) , which one is the correct ?</p>
 | logic notation propositional logic | 1 | Operator precedence in propositional logic -- (logic notation propositional logic)
<p>there is some kind of priorities for the elements in propositional logic ?</p>

<p>for example : p ∧¬q → r , given this ,we there may be two options </p>

<p>(p ∧¬q) → r OR p ∧ (¬q → r) , which one is the correct ?</p... | habedi/stack-exchange-dataset |
43,864 | Finding a pair of non-overlapping bit vectors | <p>I give you a list of $n$ bitvectors of width $k$. Your goal is to return two bitvectors from the list that have no 1s in common, or else to report that no such pair exists.</p>

<p>For example, if I give you $[00110, 01100, 11000]$ then the only solution is $\{00110, 11000\}$. Alternatively, the input $[111,... | algorithms search algorithms | 1 | Finding a pair of non-overlapping bit vectors -- (algorithms search algorithms)
<p>I give you a list of $n$ bitvectors of width $k$. Your goal is to return two bitvectors from the list that have no 1s in common, or else to report that no such pair exists.</p>

<p>For example, if I give you $[00110, 01100, 11000... | habedi/stack-exchange-dataset |
43,874 | Greedy algorithm correctness proof for "Elegant Permuted Sum" (UVa 11158) | <p>Given a sequence of $2 \leq n \leq 50$ numbers $s = (s_1,s_2,...,s_n)$, find a permutation $a = (a_1,a_2,...,a_n)$ of $s$ such that $$\sum_{i=1}^{n-1} |a_i - a_{i+1}|$$ is maximized.</p>

<p>I found many codes that get "Accepted" in the online judge with the following greedy algorithm.</p>

<blockquo... | correctness proof greedy algorithms | 1 | Greedy algorithm correctness proof for "Elegant Permuted Sum" (UVa 11158) -- (correctness proof greedy algorithms)
<p>Given a sequence of $2 \leq n \leq 50$ numbers $s = (s_1,s_2,...,s_n)$, find a permutation $a = (a_1,a_2,...,a_n)$ of $s$ such that $$\sum_{i=1}^{n-1} |a_i - a_{i+1}|$$ is maximized.</p>

<p>I f... | habedi/stack-exchange-dataset |
43,875 | Why would a function be tabulated in advance and then retrieved? | <p>Given some function and assuming no concern for the time to compute the co-domain for its domain, when might it be preferable to compute and tabulate in advance the co-domain results of the function, and then retrieve it from the table rather than compute it?</p>

<p>For example, if the domain for $f(x)=x^2$... | algorithms memoization | 1 | Why would a function be tabulated in advance and then retrieved? -- (algorithms memoization)
<p>Given some function and assuming no concern for the time to compute the co-domain for its domain, when might it be preferable to compute and tabulate in advance the co-domain results of the function, and then retrieve it fro... | habedi/stack-exchange-dataset |
43,888 | pipeline execution time | <p>Lets suppose that 20 percent of the instructions in a program are branch instructions.The static prediction of the jumps supposes that the jumps don't happen.</p>

<p>I should find the execution time in two cases : When 30 percent of the branches happen and when 70 percent of the branches happen I also shoul... | computer architecture cpu pipelines | 1 | pipeline execution time -- (computer architecture cpu pipelines)
<p>Lets suppose that 20 percent of the instructions in a program are branch instructions.The static prediction of the jumps supposes that the jumps don't happen.</p>

<p>I should find the execution time in two cases : When 30 percent of the branch... | habedi/stack-exchange-dataset |
43,890 | How would you implement truly random hash functions in practice? | <p>Suppose that $[U] = [0,...,U-1]$ is the universe from which all elements will be taken, and $A$ a hash table of size $m$. </p>

<p>A hash function $h:[U]\rightarrow[m]$ is truly random if </p>

<p>For any set of distincts elements $\{x_{1},...,x_{k}\} \subseteq [U]$ and any set of values $u_{1},...,u... | algorithms probability theory randomized algorithms hash hash tables | 1 | How would you implement truly random hash functions in practice? -- (algorithms probability theory randomized algorithms hash hash tables)
<p>Suppose that $[U] = [0,...,U-1]$ is the universe from which all elements will be taken, and $A$ a hash table of size $m$. </p>

<p>A hash function $h:[U]\rightarrow[m]$ i... | habedi/stack-exchange-dataset |
43,892 | Show that the set of all TMs that move only to the right and loop for some input is decidable | <p>I am trying to prove that </p>

<p>$\qquad L=\{\langle M\rangle \mid M \text{ is a TM }, \exists w. \text{ in } M(w) \text{ the head moves only right and } M(w)\!\uparrow \}$</p>

<p>is decidable.</p>

<p>I thought about the following solution:<br>
Lets build $\hat{M}$, a TM that will de... | computability turing machines | 1 | Show that the set of all TMs that move only to the right and loop for some input is decidable -- (computability turing machines)
<p>I am trying to prove that </p>

<p>$\qquad L=\{\langle M\rangle \mid M \text{ is a TM }, \exists w. \text{ in } M(w) \text{ the head moves only right and } M(w)\!\uparrow \}$</p>&... | habedi/stack-exchange-dataset |
43,895 | Constructing languages in NPI other than through Ladner's Theorem | <p>I have seen proofs of Ladner's theorem which detail the construction of languages in NPI assuming P $\neq$ NP. However, I was wondering if there are any other constructions using the fact that sparse sets cannot be NP-complete assuming P $\neq$ NP (Mahaney's Theorem). Specifically, is it definite (assuming P $\neq... | complexity theory p vs np np intermediate | 1 | Constructing languages in NPI other than through Ladner's Theorem -- (complexity theory p vs np np intermediate)
<p>I have seen proofs of Ladner's theorem which detail the construction of languages in NPI assuming P $\neq$ NP. However, I was wondering if there are any other constructions using the fact that sparse set... | habedi/stack-exchange-dataset |
43,897 | If one-way functions exist are we definitely using them? | <p>I know that if one-way functions exist then there are certain universal one-way functions that exist, but to my knowledge they are too impractical to implement (which is the main reason why they are not being used in modern cryptographic protocols). However, if one-way functions exist are the modern implementations... | complexity theory cryptography one way functions | 1 | If one-way functions exist are we definitely using them? -- (complexity theory cryptography one way functions)
<p>I know that if one-way functions exist then there are certain universal one-way functions that exist, but to my knowledge they are too impractical to implement (which is the main reason why they are not bei... | habedi/stack-exchange-dataset |
43,901 | Recurrence relation complexity | <p>I just learned about recurrences and I just can't solve this problem. I have this recurrence relation:</p>

<p>$$
T(n) = \begin{cases}
k\cdot T(\frac{n}{k}) & n > 0\\
1 & n = 0\\
\end{cases}
$$</p>

<p>where $k$ is a constant number.</p>

<p>I tried drawing a re... | recurrence relation | 1 | Recurrence relation complexity -- (recurrence relation)
<p>I just learned about recurrences and I just can't solve this problem. I have this recurrence relation:</p>

<p>$$
T(n) = \begin{cases}
k\cdot T(\frac{n}{k}) & n > 0\\
1 & n = 0\\
\end{cases}
$$</p>

<p>where $k$ is... | habedi/stack-exchange-dataset |
43,902 | Proving that a set of grammars for a given finite language is decidable | <p>Let the language $$L = \left\{ \langle G \rangle \ |\ L(G) = \{1,\ldots , 1000\}, \text{ G is a CFG }\right\}$$</p>

<blockquote>
 <p>Prove that $L \in R$.</p>
</blockquote>

<p>Well, I think that for a start we need to check whether or not $L(G)$ is infinite, so we only need to check if the... | formal languages computability context free | 1 | Proving that a set of grammars for a given finite language is decidable -- (formal languages computability context free)
<p>Let the language $$L = \left\{ \langle G \rangle \ |\ L(G) = \{1,\ldots , 1000\}, \text{ G is a CFG }\right\}$$</p>

<blockquote>
 <p>Prove that $L \in R$.</p>
</blockquote>
&... | habedi/stack-exchange-dataset |
43,937 | Can a computer count to infinity? | <p>So, could a computer count to infinity assuming it was a super computer and had near unlimited amounts of ram and hard drive/solid state drive storage? I am being serious when I ask this.<br>
[This is what I am asking]: Wouldn't Infinity mean endless counting, and wouldn't <em>that</em> be infinity?</p>
 | counting mathematical programming | 1 | Can a computer count to infinity? -- (counting mathematical programming)
<p>So, could a computer count to infinity assuming it was a super computer and had near unlimited amounts of ram and hard drive/solid state drive storage? I am being serious when I ask this.<br>
[This is what I am asking]: Wouldn't Infinity me... | habedi/stack-exchange-dataset |
43,938 | What exactly is computation? | <p>I know what computation is in some vague sense (it is the thing computers do), but I would like a more rigorous definition. </p>

<p><code>Dictionary.com</code>'s definitions of computation, computing, calculate, and compute are circular, so it doesn't help. </p>

<p><code>Wikipedia</code> defines co... | terminology computability | 1 | What exactly is computation? -- (terminology computability)
<p>I know what computation is in some vague sense (it is the thing computers do), but I would like a more rigorous definition. </p>

<p><code>Dictionary.com</code>'s definitions of computation, computing, calculate, and compute are circular, so it does... | habedi/stack-exchange-dataset |
43,943 | Why a language specified by a regular expression is not a complement of a given language? | <p>I am taking a compiler MOOC online on my own time. The class is self paced. There is a question with an answer but I can't understand why the answer is correct.</p>
<p>Here is the question.</p>
<blockquote>
<p>For any language <span class="math-container">$L$</span>, the complement of the language (usual... | regular languages regular expressions | 1 | Why a language specified by a regular expression is not a complement of a given language? -- (regular languages regular expressions)
<p>I am taking a compiler MOOC online on my own time. The class is self paced. There is a question with an answer but I can't understand why the answer is correct.</p>
<p>Here is the ... | habedi/stack-exchange-dataset |
43,946 | Why the given lexical specification will not process the following strings? | <p>I'm taking a Compiler MOOC on my own time. The class is self paced. An answer was given to a question but I can't understand the answer. In fact I'm not even sure how to interpret the question.</p>
<p>Here is the question:</p>
<blockquote>
<p>Given the following lexical specification:</p>
<p><span cl... | regular expressions compilers lexical analysis | 1 | Why the given lexical specification will not process the following strings? -- (regular expressions compilers lexical analysis)
<p>I'm taking a Compiler MOOC on my own time. The class is self paced. An answer was given to a question but I can't understand the answer. In fact I'm not even sure how to interpret the quest... | habedi/stack-exchange-dataset |
43,953 | Given an array of size N, if you know that all of the elements are white except for one, how to find the index of that element efficiently? | <p>Yesterday while returning home, I walked past a house that had a camera. For some reason I started thinking about how these cameras work, and how you would use them in case of robbery. While thinking about everything that might happen in case of robbery, one problem came into my mind and it can be described as follo... | algorithms search algorithms | 1 | Given an array of size N, if you know that all of the elements are white except for one, how to find the index of that element efficiently? -- (algorithms search algorithms)
<p>Yesterday while returning home, I walked past a house that had a camera. For some reason I started thinking about how these cameras work, and h... | habedi/stack-exchange-dataset |
43,956 | Is weighted XOR-SAT NP-hard? | <p>Given $n$ boolean variables $x_1,\ldots,x_n$ each of which is assigned a positive cost $c_1,\ldots,c_n\in\mathbb{Z}_{>0}$ and a boolean function $f$ on these variables given in the form
$$f(x_1,\ldots,x_n)=\bigwedge_{i=1}^k\bigoplus_{j=1}^{l_i}x_{r_{ij}}$$
($\oplus$ denoting XOR) with $k\in\mathbb{Z}_{>... | optimization np hard satisfiability integer programming xor | 1 | Is weighted XOR-SAT NP-hard? -- (optimization np hard satisfiability integer programming xor)
<p>Given $n$ boolean variables $x_1,\ldots,x_n$ each of which is assigned a positive cost $c_1,\ldots,c_n\in\mathbb{Z}_{>0}$ and a boolean function $f$ on these variables given in the form
$$f(x_1,\ldots,x_n)=\bigwedge_... | habedi/stack-exchange-dataset |
43,976 | Prove L and {0,1}*-L are recursively enumerable | <p>Exercise ask : Prove which a binary language L is recursive if and only if both <strong><em>L</em></strong> and {0, 1}* - L are recursively enumerable.</p>

<p>Now I try to give a solution:
Suppose that L is recursively enumerable.Then, would exist two machines M and M' such that simulate M and M' at alt... | computability turing machines | 1 | Prove L and {0,1}*-L are recursively enumerable -- (computability turing machines)
<p>Exercise ask : Prove which a binary language L is recursive if and only if both <strong><em>L</em></strong> and {0, 1}* - L are recursively enumerable.</p>

<p>Now I try to give a solution:
Suppose that L is recursively en... | habedi/stack-exchange-dataset |
43,986 | Can this language be defined by a Context Free Grammer? | <p>I was solving one of my practice questions, defining a language with Context Free Grammar Productions , but I am stuck on one question , Here are my attempt:</p>

<p>Question: $L = \{a^n b^m c^p \mid n = m + p + 2\}$</p>

<pre><code>My Attempt: 

S -> aaBC

B -> aBb | ^

... | formal languages context free formal grammars | 1 | Can this language be defined by a Context Free Grammer? -- (formal languages context free formal grammars)
<p>I was solving one of my practice questions, defining a language with Context Free Grammar Productions , but I am stuck on one question , Here are my attempt:</p>

<p>Question: $L = \{a^n b^m c^p \mid n ... | habedi/stack-exchange-dataset |
44,006 | Exercise on Divide&Conquer's technique | <p>I need help on this exercise:
You are given an array of n elements, and you notice that some of the elements are duplicates; that is, they appear more than once in the array. Show how to remove all duplicates from the array in time O(n log n).</p>

<p>I find a solution but in O(n^2)... How can I apply D&... | algorithms algorithm analysis divide and conquer | 1 | Exercise on Divide&Conquer's technique -- (algorithms algorithm analysis divide and conquer)
<p>I need help on this exercise:
You are given an array of n elements, and you notice that some of the elements are duplicates; that is, they appear more than once in the array. Show how to remove all duplicates from the ar... | habedi/stack-exchange-dataset |
44,010 | Since we need space for recursive calls, is the space complexity of the recursive factorial is n? | <p>As <a href="https://en.wikipedia.org/wiki/Quicksort#Space_complexity" rel="nofollow">Wikipedia says</a>, quickSort needs O(log n) extra space when the following conditions are met:</p>

<ul>
<li>In-place partitioning is used. This unstable partition requires O(1)
space.</li>
<li>After partitionin... | algorithms recursion space analysis | 1 | Since we need space for recursive calls, is the space complexity of the recursive factorial is n? -- (algorithms recursion space analysis)
<p>As <a href="https://en.wikipedia.org/wiki/Quicksort#Space_complexity" rel="nofollow">Wikipedia says</a>, quickSort needs O(log n) extra space when the following conditions are me... | habedi/stack-exchange-dataset |
44,019 | Rewriting gates such as XOR into three basic gates? | <p>How would I rewrite an XOR gate into the three basic logic gates (AND, OR, NOT). To be more specific, I have to write it in such a way with 2 NOT gates, 2 OR gates, and 1 AND gate. I also have to do it with 1 OR gate, 2 AND gates, and 1 NOT gate.</p>

<p>I'm not looking for just the answer, I'm looking for a... | logic xor | 1 | Rewriting gates such as XOR into three basic gates? -- (logic xor)
<p>How would I rewrite an XOR gate into the three basic logic gates (AND, OR, NOT). To be more specific, I have to write it in such a way with 2 NOT gates, 2 OR gates, and 1 AND gate. I also have to do it with 1 OR gate, 2 AND gates, and 1 NOT gate.</p>... | habedi/stack-exchange-dataset |
44,022 | Understanding the definition of endless sets | <p>In a course on theoretical computer science we have to prove if sets are endless. I have two problems with the exercise:</p>

<ul>
<li>I don't understand exactly, what an endless set is (I find it very hard to understand, maybe because of the "endless")</li>
<li>I don't know, how I can prove that the... | terminology sets | 1 | Understanding the definition of endless sets -- (terminology sets)
<p>In a course on theoretical computer science we have to prove if sets are endless. I have two problems with the exercise:</p>

<ul>
<li>I don't understand exactly, what an endless set is (I find it very hard to understand, maybe because of... | habedi/stack-exchange-dataset |
44,030 | For a given certain situation how to prove that the system will never get into the state of Deadlock | <p>The situation is as follows</p>

<blockquote>
 <p>'m' process shares 'n' resources of same type. The maximum need of
 each process does not exceed 'n' and the sum all their maximum needs
 is always less than m+n. In this set up will deadlock ever occur</p>
</blockquote>

<p>This is... | operating systems concurrency deadlocks | 1 | For a given certain situation how to prove that the system will never get into the state of Deadlock -- (operating systems concurrency deadlocks)
<p>The situation is as follows</p>

<blockquote>
 <p>'m' process shares 'n' resources of same type. The maximum need of
 each process does not exceed 'n' an... | habedi/stack-exchange-dataset |
44,042 | How do I detect and rotate a square? | <p>I have recently written code for detecting path colors in a 2D grid and printing the corresponding path costs and it works fine for me.
<a href="https://drive.google.com/file/d/0BxGspYKkEPaEQVNXaEFydDdXejQ/view?usp=sharing" rel="nofollow noreferrer">Here's my code</a>; I am currently new to OpenCV and know only ... | image processing computer vision pattern recognition | 1 | How do I detect and rotate a square? -- (image processing computer vision pattern recognition)
<p>I have recently written code for detecting path colors in a 2D grid and printing the corresponding path costs and it works fine for me.
<a href="https://drive.google.com/file/d/0BxGspYKkEPaEQVNXaEFydDdXejQ/view?usp=sha... | habedi/stack-exchange-dataset |
44,045 | The control in the Turing Machine | <p>My question is about the control in the Turing Machine. As far as I know, the control of the Turing Machine is just a set of states. If the Machine needs to record something, it needs to write on the tape. </p>

<p>The following is an excerpt from Michael Sipser's Theory of Computation, the passage is about ... | turing machines automata | 1 | The control in the Turing Machine -- (turing machines automata)
<p>My question is about the control in the Turing Machine. As far as I know, the control of the Turing Machine is just a set of states. If the Machine needs to record something, it needs to write on the tape. </p>

<p>The following is an excerpt fr... | habedi/stack-exchange-dataset |
44,056 | Graph Families that are easy to color | <p>What are the non-trivial graph families that have a known chromatic number, or an easy way (polynomial-time algorithm) to compute the latter.</p>

<p>Examples would be:</p>

<ul>
<li>Kneser graphs</li>
<li>Chordal graphs</li>
</ul>

<p>Do you know any other families?</p>

... | graphs reference request colorings | 1 | Graph Families that are easy to color -- (graphs reference request colorings)
<p>What are the non-trivial graph families that have a known chromatic number, or an easy way (polynomial-time algorithm) to compute the latter.</p>

<p>Examples would be:</p>

<ul>
<li>Kneser graphs</li>
<li>Chordal g... | habedi/stack-exchange-dataset |
44,070 | How can a set offer better search performance than an array | <p>While reading the following tutorial on iOS development <a href="https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/FoundationClasses.html#//apple_ref/doc/uid/TP40011343-CH9-SW1" rel="nofollow">Working with Foundation</a> (section on Sets near the bottom), I came across the following ... | data structures efficiency arrays sets dictionaries | 1 | How can a set offer better search performance than an array -- (data structures efficiency arrays sets dictionaries)
<p>While reading the following tutorial on iOS development <a href="https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/FoundationClasses.html#//apple_ref/doc/uid/TP4001134... | habedi/stack-exchange-dataset |
44,072 | How is the micro code executed within a processor? | <p>How does the microprocessor convert the machine code to micro code?
What part of the processor is at play?</p>
 | computer architecture | 1 | How is the micro code executed within a processor? -- (computer architecture)
<p>How does the microprocessor convert the machine code to micro code?
What part of the processor is at play?</p>
 | habedi/stack-exchange-dataset |
44,076 | Why is O(n log n) the best runtime there is? | <p>I am taking a course on Coursera about algorithm design. The course said that a time of $O(n \log n)$ is considered to be good. </p>

<p>However, there are faster runtimes such as (from now on just assume it is in big o notataion), such as $1$, $n$, and $\log n$. I understand that it is almost impossible to ... | algorithms efficiency | 1 | Why is O(n log n) the best runtime there is? -- (algorithms efficiency)
<p>I am taking a course on Coursera about algorithm design. The course said that a time of $O(n \log n)$ is considered to be good. </p>

<p>However, there are faster runtimes such as (from now on just assume it is in big o notataion), such ... | habedi/stack-exchange-dataset |
44,078 | How to convert this type of languages to Context Free grammar? | <p>As I've already asked my Question about the solving Context Free Grammar 
$L = \{a^n b^m c^p \mid n = m + p + 2\}$</p>

<p><a href="https://cs.stackexchange.com/q/43986/35030">Can this language be defined by a Context Free Grammar?</a></p>

<p>Now i have just changed <code>n = m + p - 2</code> a... | formal languages context free | 1 | How to convert this type of languages to Context Free grammar? -- (formal languages context free)
<p>As I've already asked my Question about the solving Context Free Grammar 
$L = \{a^n b^m c^p \mid n = m + p + 2\}$</p>

<p><a href="https://cs.stackexchange.com/q/43986/35030">Can this language be defined by... | habedi/stack-exchange-dataset |
44,084 | Push down automata what to do when there is no suitable transition | <p>This is a question that has emerged from a recent quiz I have taken. In short</p>

<blockquote>
 <p>Consider the following transitions on a push down automaton. Assume the starting state is q. Which one of the following inputs will lead the automaton to state p with the stack containing the string XXZ?<... | formal languages context free automata pushdown automata | 1 | Push down automata what to do when there is no suitable transition -- (formal languages context free automata pushdown automata)
<p>This is a question that has emerged from a recent quiz I have taken. In short</p>

<blockquote>
 <p>Consider the following transitions on a push down automaton. Assume the sta... | habedi/stack-exchange-dataset |
44,089 | Find the subset of k element between n that maximize the total distance | <p>Given a set $Q\subset \mathbb{N}^m $ of $n$ points, we want to find the subset $S_{max}\subset Q$ of $k$ elements that maximize the total distance between them, according to the $\ell^1$ norm.</p>

<p>$$S_{max} = \arg \max_S\sum_{i,j \in S, i \ne j} d(x_i,x_j)$$</p>

<p>In my specific case, $Q\subset... | algorithms optimization combinatorics np hard | 1 | Find the subset of k element between n that maximize the total distance -- (algorithms optimization combinatorics np hard)
<p>Given a set $Q\subset \mathbb{N}^m $ of $n$ points, we want to find the subset $S_{max}\subset Q$ of $k$ elements that maximize the total distance between them, according to the $\ell^1$ norm.</... | habedi/stack-exchange-dataset |
44,090 | DTM that halts on a minimum one input | <p>I am trying to show that this is Turing Recognizable.</p>

<p>The language A, that is a DTM, T, that halts on a minimum of one input.</p>

<p>My justification is that of course it is because, you just need to check if an accept state is reachable. However, this seems like I am making it trivial.</p>&... | turing machines | 1 | DTM that halts on a minimum one input -- (turing machines)
<p>I am trying to show that this is Turing Recognizable.</p>

<p>The language A, that is a DTM, T, that halts on a minimum of one input.</p>

<p>My justification is that of course it is because, you just need to check if an accept state is reach... | habedi/stack-exchange-dataset |
44,091 | Symmetric Difference of Turing Recognizable and Finite Languages | <p>Let A be a Turing Recognizable Language and B a finite Language.
I want to prove that their symmetric difference is Turing Recognizable.</p>

<p>My reasoning: B is finite, therefore the finite number of strings can be put through a DTM , M, such that L(M)= A. If M accepts, then remove that string from B ... | formal languages computability closure properties semi decidability | 1 | Symmetric Difference of Turing Recognizable and Finite Languages -- (formal languages computability closure properties semi decidability)
<p>Let A be a Turing Recognizable Language and B a finite Language.
I want to prove that their symmetric difference is Turing Recognizable.</p>

<p>My reasoning: B is fin... | habedi/stack-exchange-dataset |
44,096 | How much bigger can an LR(1) automaton for a language be than the corresponding LR(0) automaton? | <p>In an LR(0) parser, each state consists of a collection of LR(0) items, which are productions annotated with a position. In an LR(1) parser, each state consists of a collection of LR(1) items, which are productions annotated with a position and a lookahead character.</p>

<p>It's known that given a state in ... | context free parsers lr k | 1 | How much bigger can an LR(1) automaton for a language be than the corresponding LR(0) automaton? -- (context free parsers lr k)
<p>In an LR(0) parser, each state consists of a collection of LR(0) items, which are productions annotated with a position. In an LR(1) parser, each state consists of a collection of LR(1) ite... | habedi/stack-exchange-dataset |
44,098 | SimRank on a weighted directed graph (how to calculate node similarity) | <p>I have a weighted directed graph (it's sparse, 35,000 nodes and 19 million edges) and would like to calculate similarity scores for pairs of nodes. <a href="https://en.wikipedia.org/wiki/SimRank#Basic_SimRank_equation" rel="nofollow">SimRank</a> would be ideal for this purpose, except that it applies to unweighted g... | graphs weighted graphs adjacency matrix sparse matrices | 1 | SimRank on a weighted directed graph (how to calculate node similarity) -- (graphs weighted graphs adjacency matrix sparse matrices)
<p>I have a weighted directed graph (it's sparse, 35,000 nodes and 19 million edges) and would like to calculate similarity scores for pairs of nodes. <a href="https://en.wikipedia.org/wi... | habedi/stack-exchange-dataset |
44,102 | What techniques can I use to hand-write a parser for an ambiguous grammar? | <p>I'm writing a compiler, and I've built a recursive-descent parser to handle the syntax analysis. I'd like to enhance the type system to support functions as a valid variable type, but I'm building a statically typed language, and my desired syntax for a function type renders the grammar temporarily* ambiguous until ... | compilers parsers ambiguity | 1 | What techniques can I use to hand-write a parser for an ambiguous grammar? -- (compilers parsers ambiguity)
<p>I'm writing a compiler, and I've built a recursive-descent parser to handle the syntax analysis. I'd like to enhance the type system to support functions as a valid variable type, but I'm building a statically... | habedi/stack-exchange-dataset |
44,109 | Why decision problem definition ignores Gödel incompleteness theorem? | <p>The following question assume that the decision problem definition (syntactic) has been written (and could be changed if it isn't able) to catch a concept (meaning, semantic) which has both nice implications and some models. So please don't answer "the definition is the definition".</p>

<p>Let be any usual ... | computability logic decision problem incompleteness | 1 | Why decision problem definition ignores Gödel incompleteness theorem? -- (computability logic decision problem incompleteness)
<p>The following question assume that the decision problem definition (syntactic) has been written (and could be changed if it isn't able) to catch a concept (meaning, semantic) which has both ... | habedi/stack-exchange-dataset |
44,120 | How to get the intersection of two regular languages? | <p>I was trying to figure out the value of the following expression.</p>

<p><code>(0 | 1)*00 ∩ (0 | 1)*01</code></p>

<p>I tried drawing DFAs for<code>(0 | 1)*00</code> and <code>(0 | 1)*01</code> separately and combine them using a table. </p>

<p>Is it the approach I should use? or is there a... | regular languages finite automata regular expressions | 1 | How to get the intersection of two regular languages? -- (regular languages finite automata regular expressions)
<p>I was trying to figure out the value of the following expression.</p>

<p><code>(0 | 1)*00 ∩ (0 | 1)*01</code></p>

<p>I tried drawing DFAs for<code>(0 | 1)*00</code> and <code>(0 | 1)*01<... | habedi/stack-exchange-dataset |
44,126 | Using dynamic programming to find the number ofl increasing subsequences | <p>I got this question today and I'm nowhere near the solution,
Given a sequence of real numbers (X1, X2, ..,Xn). write an algorithm as efficient there is, that finds the number of strictly increasing sub-sequences for every index j, that end with Xj.</p>

<p>My solution should include a recurrence formula ... | algorithms dynamic programming recursion correctness proof | 1 | Using dynamic programming to find the number ofl increasing subsequences -- (algorithms dynamic programming recursion correctness proof)
<p>I got this question today and I'm nowhere near the solution,
Given a sequence of real numbers (X1, X2, ..,Xn). write an algorithm as efficient there is, that finds the number o... | habedi/stack-exchange-dataset |
44,138 | Radix sort and changing bases | <p>I have recently learned about radix sort.
I am aware that you can change the base of the numbers you need to sort but I don't really understand why this is good for the radix sort.
Radix sort runtime is $O(d(n+k))$ where $d$ is the number of digits in the numbers, and $k$ is the base.
So shouldn't there ... | runtime analysis sorting radix sort | 1 | Radix sort and changing bases -- (runtime analysis sorting radix sort)
<p>I have recently learned about radix sort.
I am aware that you can change the base of the numbers you need to sort but I don't really understand why this is good for the radix sort.
Radix sort runtime is $O(d(n+k))$ where $d$ is the number... | habedi/stack-exchange-dataset |
44,155 | Proving that if $L=\{ a^n b^n c^n \colon n\ge 0 \}$ than $L\notin CFL$ | <p>I'm going over "Introduction to the Theory of Computation" by Michael Sipser in which there's an example of using the pumping lemma for CFLs to prove that $L=\{ a^n b^n c^n \colon n\ge 0 \}$ is not a CFL.</p>

<p>Now, in the book they do it in a way that I understand but I think it can be simplified, so here... | computability context free pumping lemma | 1 | Proving that if $L=\{ a^n b^n c^n \colon n\ge 0 \}$ than $L\notin CFL$ -- (computability context free pumping lemma)
<p>I'm going over "Introduction to the Theory of Computation" by Michael Sipser in which there's an example of using the pumping lemma for CFLs to prove that $L=\{ a^n b^n c^n \colon n\ge 0 \}$ is not a ... | habedi/stack-exchange-dataset |
44,160 | prove language is Context-free and not regular | <p>I have to prove that $\left \{ a, b \right \}^{\ast} - \left \{ a^ib^i | i\geq 0 \right \}$ is a context-free language and it's not regular.</p>

<p>So far I've got that this language is not regular because regular languages are closed under complementation and $\left \{ a^ib^i | i\geq 0 \right \}$ is a well... | formal languages context free regular languages closure properties | 1 | prove language is Context-free and not regular -- (formal languages context free regular languages closure properties)
<p>I have to prove that $\left \{ a, b \right \}^{\ast} - \left \{ a^ib^i | i\geq 0 \right \}$ is a context-free language and it's not regular.</p>

<p>So far I've got that this language is not... | habedi/stack-exchange-dataset |
44,161 | fixed point in regular expressions | <p>I've posted this question first on StackOverflow but this section seems more suited for this kind of questions.
Also I'm not trying to simply solve this exercise (it is a "parsing" exercise, once I'll figure out the regular expression I'll derive the equivalent Finite Automaton that accepts the language generate... | context free regular expressions parsers | 1 | fixed point in regular expressions -- (context free regular expressions parsers)
<p>I've posted this question first on StackOverflow but this section seems more suited for this kind of questions.
Also I'm not trying to simply solve this exercise (it is a "parsing" exercise, once I'll figure out the regular expressi... | habedi/stack-exchange-dataset |
44,165 | What is memcomputing? | <p>In recent article of <a href="http://www.popularmechanics.com/technology/a16308/memcomputer-quantum-computing-alternative/" rel="nofollow">PM</a> the memcomputing is presented. But I did not understand how it works, according to the text.</p>

<p>What is the general principle of work for this <code>memcomput... | computer architecture | 1 | What is memcomputing? -- (computer architecture)
<p>In recent article of <a href="http://www.popularmechanics.com/technology/a16308/memcomputer-quantum-computing-alternative/" rel="nofollow">PM</a> the memcomputing is presented. But I did not understand how it works, according to the text.</p>

<p>What is the g... | habedi/stack-exchange-dataset |
44,170 | Regular Expression from Context Free Grammar | <p>The purpose of this exercise is to write a program that recognize all the words derived from this grammar.
The time complexity of this program must be O(n) hence i must be able to derive a regular expression from the grammar</p>

<blockquote>
 <p>$S\rightarrow ASA\mid A$<br>
 $A\rightarrow aAa\... | formal languages context free regular expressions | 1 | Regular Expression from Context Free Grammar -- (formal languages context free regular expressions)
<p>The purpose of this exercise is to write a program that recognize all the words derived from this grammar.
The time complexity of this program must be O(n) hence i must be able to derive a regular expression from ... | habedi/stack-exchange-dataset |
44,171 | Help in understanding the implementation/application of scope trees | <p>I’m learning (self-taught) about language implementation and compiler design, and I’m implementing a toy language to cement the concepts in my mind. However, I’m having trouble understanding how scope trees are meant to be used.</p>

<p>In my toy language, I’m using the Visitor pattern to traverse the syntax... | data structures programming languages compilers | 1 | Help in understanding the implementation/application of scope trees -- (data structures programming languages compilers)
<p>I’m learning (self-taught) about language implementation and compiler design, and I’m implementing a toy language to cement the concepts in my mind. However, I’m having trouble understanding how s... | habedi/stack-exchange-dataset |
44,174 | Converting Regular expression to DFA by building syntax tree | <p>There is a way to convert regular expression to DFA (deterministic finite automata)
which is to build a syntax tree and then compute <strong>first pos</strong>, <strong>last pos</strong>, <strong>follow pos</strong>, and then use a Transition technique to build DFA for that particular regular expression. But thi... | automata finite automata regular expressions compilers syntax trees | 1 | Converting Regular expression to DFA by building syntax tree -- (automata finite automata regular expressions compilers syntax trees)
<p>There is a way to convert regular expression to DFA (deterministic finite automata)
which is to build a syntax tree and then compute <strong>first pos</strong>, <strong>last pos</... | habedi/stack-exchange-dataset |
44,175 | Prove language is regular | <p>let's have these two languages in the alphabet $\{a,b,c\}$:</p>

<p>$L_1 = \{ w \mid w \text{ is a palindrome and $|w| < 200$}\}$</p>

<p>$L_2 = \{ w \mid w \text{ is a suffix of $u$ and $|u|$ is a prime number and $u$ doesn't contain a $c$}\} $</p>

<p>and I have to prove that $L_1 ∪ L_2$... | formal languages regular languages | 1 | Prove language is regular -- (formal languages regular languages)
<p>let's have these two languages in the alphabet $\{a,b,c\}$:</p>

<p>$L_1 = \{ w \mid w \text{ is a palindrome and $|w| < 200$}\}$</p>

<p>$L_2 = \{ w \mid w \text{ is a suffix of $u$ and $|u|$ is a prime number and $u$ doesn't conta... | habedi/stack-exchange-dataset |
44,181 | Regular expression of a language over {a,b,c} which does not contain substring bbb | <p>I'm trying to figure out how to build a regular expression for a language that doesn't contain substring bbb. The alphabet is {a,b,c}. I'm trying to construct a DFA and convert to help me get the Regular Expression but still stuck as I found the DFA a bit complicated. I appreciate any help. Thanks!!!</p>

<p... | regular languages regular expressions | 1 | Regular expression of a language over {a,b,c} which does not contain substring bbb -- (regular languages regular expressions)
<p>I'm trying to figure out how to build a regular expression for a language that doesn't contain substring bbb. The alphabet is {a,b,c}. I'm trying to construct a DFA and convert to help me get... | habedi/stack-exchange-dataset |
44,187 | Expressing that a function converges to 1 with linear rate using Landau notation | <p>I am working on an algorithm which approximates a certain optimal quantity. The approximation becomes better when the size of the problem ($n$) becomes larger: the difference from the optimum is approximately $1/n$. </p>

<p>Initially, I wrote that the algorithm achieves an approximation of:</p>

<p... | asymptotics landau notation notation | 1 | Expressing that a function converges to 1 with linear rate using Landau notation -- (asymptotics landau notation notation)
<p>I am working on an algorithm which approximates a certain optimal quantity. The approximation becomes better when the size of the problem ($n$) becomes larger: the difference from the optimum is... | habedi/stack-exchange-dataset |
44,193 | Extra space of MergeSort | <p>Here is my implementation of mergeSort. I need <code>n</code> extra space for the helper array. But what about recursive calls? I call sort <code>log n</code> times. mergeRoutine is a tail call, and it doesn't add to the call stack. </p>

<p>The extra space I need equals to <code>n + log n</code>. How can th... | algorithms algorithm analysis sorting space complexity | 1 | Extra space of MergeSort -- (algorithms algorithm analysis sorting space complexity)
<p>Here is my implementation of mergeSort. I need <code>n</code> extra space for the helper array. But what about recursive calls? I call sort <code>log n</code> times. mergeRoutine is a tail call, and it doesn't add to the call stack.... | habedi/stack-exchange-dataset |
44,194 | Set of Turing machines that halt after exactly 14 steps | <p>Let $M_i$ be the Turing machine with Gödel number $i$. Let
$$A = \{i \mid M_i \text{ with input \(x\) halts after exactly 14 steps}\}$$
Is the set $A$ recursive?</p>
 | computability halting problem | 1 | Set of Turing machines that halt after exactly 14 steps -- (computability halting problem)
<p>Let $M_i$ be the Turing machine with Gödel number $i$. Let
$$A = \{i \mid M_i \text{ with input \(x\) halts after exactly 14 steps}\}$$
Is the set $A$ recursive?</p>
 | habedi/stack-exchange-dataset |
44,195 | pda: transformation between acceptance by empty stack and final states | <p>I am stuck with understanding the transformation of final-state acceptance automaton into empty-stack acceptance automaton. From everywhere that I've read, it always says introduce a new start state with a new start stack symbol, and another state after the original final states for emptying the stack. I understand ... | automata pushdown automata simulation | 1 | pda: transformation between acceptance by empty stack and final states -- (automata pushdown automata simulation)
<p>I am stuck with understanding the transformation of final-state acceptance automaton into empty-stack acceptance automaton. From everywhere that I've read, it always says introduce a new start state with... | habedi/stack-exchange-dataset |
44,196 | Are combinatory logic terms always larger? | <p>So there <a href="https://en.wikipedia.org/wiki/Combinatory_logic#Completeness_of_the_S-K_basis" rel="nofollow">is an algorithm</a> to convert lambda calculus terms to combinatory logic using SK combinators. It produces things that <em>explode</em> in size. I would like to know more about this explosion in size. I c... | lambda calculus functional programming combinatory logic | 1 | Are combinatory logic terms always larger? -- (lambda calculus functional programming combinatory logic)
<p>So there <a href="https://en.wikipedia.org/wiki/Combinatory_logic#Completeness_of_the_S-K_basis" rel="nofollow">is an algorithm</a> to convert lambda calculus terms to combinatory logic using SK combinators. It p... | habedi/stack-exchange-dataset |
44,205 | Depth perception - detect how far into a scene a user is looking | <p>I would like to know about how we can detect how 'deep' into a scene a user is looking. If looking into a 3D environment, with an object close to the user and one further away, how can we detect when the user is looking at the object further away? Or, rather, how can we detect which object a user is looking at in a ... | algorithms terminology | 1 | Depth perception - detect how far into a scene a user is looking -- (algorithms terminology)
<p>I would like to know about how we can detect how 'deep' into a scene a user is looking. If looking into a 3D environment, with an object close to the user and one further away, how can we detect when the user is looking at t... | habedi/stack-exchange-dataset |
44,219 | Flow in a network: Conservation of flow definition | <p>This might be too easy... But I just don't get it.</p>

<p>I've been reading about flow in networks and I stumbled upon this definition in wikipedia: <a href="https://en.wikipedia.org/wiki/Flow_network" rel="nofollow">https://en.wikipedia.org/wiki/Flow_network</a></p>

<p>$\sum\limits_{w\in V} f(u,w)... | network flow ford fulkerson max flow | 1 | Flow in a network: Conservation of flow definition -- (network flow ford fulkerson max flow)
<p>This might be too easy... But I just don't get it.</p>

<p>I've been reading about flow in networks and I stumbled upon this definition in wikipedia: <a href="https://en.wikipedia.org/wiki/Flow_network" rel="nofollow... | habedi/stack-exchange-dataset |
44,226 | How can a cyclic tag system halt with an output? | <p>For example, we can say we have a abstract program that, given a finite binary string as input, removes all of the zeros (i.e. 0010001101011 evaluates to 111111), which is definitely a Turing-computable function.</p>

<p>How can a cyclic tag system compute this (which it can, by definition of it being Turing... | computability turing machines | 1 | How can a cyclic tag system halt with an output? -- (computability turing machines)
<p>For example, we can say we have a abstract program that, given a finite binary string as input, removes all of the zeros (i.e. 0010001101011 evaluates to 111111), which is definitely a Turing-computable function.</p>

<p>How ... | habedi/stack-exchange-dataset |
44,249 | The running time of the knapsack problem is $O(n\cdot \min(B,V))$ and is not polynomial, why? | <p>My question is why the dynamic programming of the knapsack problem does run in polynomial time? The question is answered here <a href="https://cs.stackexchange.com/questions/32414/why-is-the-onw-algorithm-for-the-knapsack-problem-not-a-polynomial-one">Why is the O(nW) algorithm for the Knapsack problem not a polynom... | polynomial time knapsack problems | 1 | The running time of the knapsack problem is $O(n\cdot \min(B,V))$ and is not polynomial, why? -- (polynomial time knapsack problems)
<p>My question is why the dynamic programming of the knapsack problem does run in polynomial time? The question is answered here <a href="https://cs.stackexchange.com/questions/32414/why-... | habedi/stack-exchange-dataset |
44,250 | Traversing a graph with respect to some partial order | <p>Recently I was faced with the following Graph traversal problem:
"Given an arrangement of buildings in form of a DAG. All the buildings have to be colored, but there is an order for that represented by edges in the DAG. If there is an edge from A->B, this would mean building B can only be colored after building ... | algorithms graphs graph traversal | 1 | Traversing a graph with respect to some partial order -- (algorithms graphs graph traversal)
<p>Recently I was faced with the following Graph traversal problem:
"Given an arrangement of buildings in form of a DAG. All the buildings have to be colored, but there is an order for that represented by edges in the DAG. ... | habedi/stack-exchange-dataset |
44,259 | Is L closed under linear-time reductions? | <p>L is as usual the complexity class DSPACE($\log n$), of languages decidable using a deterministic Turing machine using logarithmic workspace.</p>

<blockquote>
 <p>Is L closed under linear-time reductions?</p>
</blockquote>

<p>It is possible that for some pair of languages Q and R, every li... | complexity theory reductions complexity classes space complexity | 1 | Is L closed under linear-time reductions? -- (complexity theory reductions complexity classes space complexity)
<p>L is as usual the complexity class DSPACE($\log n$), of languages decidable using a deterministic Turing machine using logarithmic workspace.</p>

<blockquote>
 <p>Is L closed under linear-tim... | habedi/stack-exchange-dataset |
44,263 | Program transformations for numeric stability | <p>There's tons of research on program transformations for optimization. Is there any research on transformations that improve numeric stability? Examples of such transformations might include:</p>

<ul>
<li>Transform $\log(\exp(a)+\exp(b))$ into $\max(a,b)+\log(\exp(a-\max(a,b))+\exp(b-\max(a,b)))$</li>&... | compilers floating point numerical algorithms | 1 | Program transformations for numeric stability -- (compilers floating point numerical algorithms)
<p>There's tons of research on program transformations for optimization. Is there any research on transformations that improve numeric stability? Examples of such transformations might include:</p>

<ul>
<li>T... | habedi/stack-exchange-dataset |
44,275 | For AVL Trees why is keeping a trit (left heavy, right heavy or balanced) sufficient? | <p>I was listening to Eric Demaine's video lecture on AVL trees and there was a claim that comes up that keeping a trit on each node (to indicate whether the node is left heavy, right heavy or balanced) should be sufficient for all AVL tree operations, so essentially we don't need to keep heights of the node for every ... | algorithms data structures trees | 1 | For AVL Trees why is keeping a trit (left heavy, right heavy or balanced) sufficient? -- (algorithms data structures trees)
<p>I was listening to Eric Demaine's video lecture on AVL trees and there was a claim that comes up that keeping a trit on each node (to indicate whether the node is left heavy, right heavy or bal... | habedi/stack-exchange-dataset |
44,286 | Hardness of problem related to number of subsets that satisfy a particular property | <p>I have the following algorithmic problem. I am given a set of elements. Each element has a set of properties. For example:</p>

<pre><code>A: has properties p1, p2, p4
B: has properties p2, p4
C: has properties p2, p1
</code></pre>

<p>The task is to find the number of subsets of eleme... | complexity theory combinatorics np hard boolean algebra counting | 1 | Hardness of problem related to number of subsets that satisfy a particular property -- (complexity theory combinatorics np hard boolean algebra counting)
<p>I have the following algorithmic problem. I am given a set of elements. Each element has a set of properties. For example:</p>

<pre><code>A: has proper... | habedi/stack-exchange-dataset |
44,296 | How to Prove NP-Completeness of Minimum Crossing Problem? | <blockquote>
 <p>In graph theory, the crossing number cr(G) of a graph G is the lowest
 number of edge crossings of a plane drawing of the graph G.
 (from wikipedia)</p>
</blockquote>

<p>I know that the problem of counting the <a href="https://en.wikipedia.org/wiki/Crossing_number_(graph_the... | complexity theory graphs np complete reductions crossing number | 1 | How to Prove NP-Completeness of Minimum Crossing Problem? -- (complexity theory graphs np complete reductions crossing number)
<blockquote>
 <p>In graph theory, the crossing number cr(G) of a graph G is the lowest
 number of edge crossings of a plane drawing of the graph G.
 (from wikipedia)</p>
</bl... | habedi/stack-exchange-dataset |
44,299 | Understanding Logical to Physical Addressing | <p>I am trying to understand the concept of logical to physical addressing.<br>
I am given 72 physical addresses (0-71) with values </p>

<p>A virtual address = 2^(p+w)
p = page bits
w = word bits</p>

<p>I know the page table is of size 6 indexed 0-5</p>

<p>If a page size is 16 wor... | operating systems virtual memory | 1 | Understanding Logical to Physical Addressing -- (operating systems virtual memory)
<p>I am trying to understand the concept of logical to physical addressing.<br>
I am given 72 physical addresses (0-71) with values </p>

<p>A virtual address = 2^(p+w)
p = page bits
w = word bits</p>

<p>I kn... | habedi/stack-exchange-dataset |
44,300 | Why is a negative number a pseudo-positive number in ones' complement? | <p>I'm studying ones' complement representation and I read in a book that a negative number in ones' complement is a pseudo-positive of value $R^n - 1 - |x|$.</p>

<p>However there is no demostration and I can't find it anywhere. If someone could tell me the reason I will be very thankful.</p>
 | number formats numeral representations | 1 | Why is a negative number a pseudo-positive number in ones' complement? -- (number formats numeral representations)
<p>I'm studying ones' complement representation and I read in a book that a negative number in ones' complement is a pseudo-positive of value $R^n - 1 - |x|$.</p>

<p>However there is no demostrati... | habedi/stack-exchange-dataset |
44,305 | Why are functional languages Turing complete? | <p>Perhaps my limited understanding of the subject is incorrect, but this is what I understand so far:</p>

<ul>
<li><p>Functional programming is based off of Lambda Calculus, formulated by
Alonzo Church.</p></li>
<li><p>Imperative programming is based off of the Turing machine model, made
by Al... | computability turing machines programming languages lambda calculus turing completeness | 1 | Why are functional languages Turing complete? -- (computability turing machines programming languages lambda calculus turing completeness)
<p>Perhaps my limited understanding of the subject is incorrect, but this is what I understand so far:</p>

<ul>
<li><p>Functional programming is based off of Lambda Cal... | habedi/stack-exchange-dataset |
44,326 | RAID: dedicated and distributed parity | <p>I understand what parity is (Sort of): 
A data recovery mechanism where missing data is calculated based on the data that exists. However i have encountered terminology which i can't define or put into perspective of the RAID system.</p>

<p>This terminology is 'dedicated' and 'distributed' Parity. Now i... | data structures | 1 | RAID: dedicated and distributed parity -- (data structures)
<p>I understand what parity is (Sort of): 
A data recovery mechanism where missing data is calculated based on the data that exists. However i have encountered terminology which i can't define or put into perspective of the RAID system.</p>

<p>Thi... | habedi/stack-exchange-dataset |
44,335 | Finding a segment which has equal number of segments before and after it | <p>I got this question in a past test that I'm trying to solve but i don't have the solutions to check my self:</p>

<p>Given a set of n segments $[a_i ,b_i]$ where $i=1,..,n$ and $a_i < b_i$.
write an algorithm which find a segment that the number of segments $[a_l ,b_l]$ before it $(b_l < a_i)$ are ... | algorithms time complexity search algorithms sorting | 1 | Finding a segment which has equal number of segments before and after it -- (algorithms time complexity search algorithms sorting)
<p>I got this question in a past test that I'm trying to solve but i don't have the solutions to check my self:</p>

<p>Given a set of n segments $[a_i ,b_i]$ where $i=1,..,n$ and $... | habedi/stack-exchange-dataset |
44,349 | Good snapshottable data structure for an in-memory index | <p>I'm designing an in-memory object database for a very specific use case. It is single writer, but must support efficient concurrent reads. Reads must be isolated. There is no query language, the database only supports:</p>

<ul>
<li>get object/-s by attribute/set of attributes (there may be support for e... | data structures concurrency databases | 1 | Good snapshottable data structure for an in-memory index -- (data structures concurrency databases)
<p>I'm designing an in-memory object database for a very specific use case. It is single writer, but must support efficient concurrent reads. Reads must be isolated. There is no query language, the database only supports... | habedi/stack-exchange-dataset |
44,350 | Algorithm for finding the root element | <p>I have the following interface:</p>

<pre><code>public interface TreeElement<T>{
 public List<TreeElement<T>> getChildren();
}
</code></pre>

<p>Now, suppose I have a collection of <code>TreeElement<T></code> representing a <strong><em>valid</em></strong> tree. ... | data structures trees | 1 | Algorithm for finding the root element -- (data structures trees)
<p>I have the following interface:</p>

<pre><code>public interface TreeElement<T>{
 public List<TreeElement<T>> getChildren();
}
</code></pre>

<p>Now, suppose I have a collection of <code>TreeElement<... | habedi/stack-exchange-dataset |
44,356 | Disprove that a function exists that counts the turing machines that halt on $\epsilon$ | <blockquote>
<p>Let <span class="math-container">$L(M_k) = \{ \langle M \rangle | M \text{ halts on }\epsilon \} \cap \Sigma^k $</span></p>
<p>Disprove that <span class="math-container">$\exists f\colon N \rightarrow \Sigma^* . f(k)=\langle M_k \rangle$</span>.</p>
</blockquote>
<p>I am not sure where I... | turing machines undecidability computation models | 1 | Disprove that a function exists that counts the turing machines that halt on $\epsilon$ -- (turing machines undecidability computation models)
<blockquote>
<p>Let <span class="math-container">$L(M_k) = \{ \langle M \rangle | M \text{ halts on }\epsilon \} \cap \Sigma^k $</span></p>
<p>Disprove that <span class=... | habedi/stack-exchange-dataset |
44,358 | How does Knuth measure the running time of this program? | <p>I'm reading "Structured Programming with go to Statements" by Knuth, and in it, he gives the following algorithm and a run-time cost analysis of some hypothetically generated code, letting $n$ stand for the number of times around the loop, and where instruction fetch and memory accesses cost one unit, so for example... | algorithm analysis runtime analysis | 1 | How does Knuth measure the running time of this program? -- (algorithm analysis runtime analysis)
<p>I'm reading "Structured Programming with go to Statements" by Knuth, and in it, he gives the following algorithm and a run-time cost analysis of some hypothetically generated code, letting $n$ stand for the number of ti... | habedi/stack-exchange-dataset |
44,368 | Is badly written code derogatory to the compiler? | <p>I was having a heated debate with a friend of mine (who considers me an idiot, mind you) and we were arguing about whether a compiler has an index, or coefficient, that judges how poorly code is written. Things such as useless for loops, declared variables that aren't used, excessively verbose parameter names, and t... | compilers | 1 | Is badly written code derogatory to the compiler? -- (compilers)
<p>I was having a heated debate with a friend of mine (who considers me an idiot, mind you) and we were arguing about whether a compiler has an index, or coefficient, that judges how poorly code is written. Things such as useless for loops, declared varia... | habedi/stack-exchange-dataset |
44,385 | Parse DAG into task tree | <p>Suppose we have a DAG of tasks:</p>

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

<p>Arrows represent flow (reversed dependencies: 8 must be run after 7). Some of the tasks (like 4, 5, 6) can be run in parallel (Par block). Dependent tasks (like 7, 8, 9) ... | algorithms compilers dag | 1 | Parse DAG into task tree -- (algorithms compilers dag)
<p>Suppose we have a DAG of tasks:</p>

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

<p>Arrows represent flow (reversed dependencies: 8 must be run after 7). Some of the tasks (like 4, 5, 6) can be run i... | habedi/stack-exchange-dataset |
44,390 | Computational complexity based in the input size | <p>In an <a href="https://cs.stackexchange.com/a/33921/9550">answer to a previous question</a> Luke Mathieson wrote:</p>

<blockquote>
 <p>A place where this might fall down is when you are working with numbers. As a number with magnitude $m$ can be encoded in $n=O(\log m)$ bits, if our running time were $... | complexity theory | 1 | Computational complexity based in the input size -- (complexity theory)
<p>In an <a href="https://cs.stackexchange.com/a/33921/9550">answer to a previous question</a> Luke Mathieson wrote:</p>

<blockquote>
 <p>A place where this might fall down is when you are working with numbers. As a number with magnit... | habedi/stack-exchange-dataset |
44,406 | Fast algorithm for clustering groups of elements given their size/time | <p>I don't know if there is a canonical problem reducing my practical problem, so I will just try to describe it the best that I can.</p>

<p>I would like to cluster files into the specified number of groups, where each groups size (= the sum of sizes of files in this group) is as close as possible to each othe... | complexity theory optimization cluster | 1 | Fast algorithm for clustering groups of elements given their size/time -- (complexity theory optimization cluster)
<p>I don't know if there is a canonical problem reducing my practical problem, so I will just try to describe it the best that I can.</p>

<p>I would like to cluster files into the specified number... | habedi/stack-exchange-dataset |
44,408 | Would a class in Linear Optimization/Programming be useful for a CS degree? | <p>Would a class in Linear Optimization/Programming be useful for a CS degree?</p>

<p>What is it used for or how useful is it.</p>

<p>Can someone please help me decide. Thanks in advance</p>
 | education | 1 | Would a class in Linear Optimization/Programming be useful for a CS degree? -- (education)
<p>Would a class in Linear Optimization/Programming be useful for a CS degree?</p>

<p>What is it used for or how useful is it.</p>

<p>Can someone please help me decide. Thanks in advance</p>
 | habedi/stack-exchange-dataset |
44,422 | What is the purpose of using NIL for representing null nodes? | <p>In my <em>Algorithms and Data Structures</em> course, professors, slides and the book (<a href="https://mitpress.mit.edu/books/introduction-algorithms" rel="nofollow noreferrer">Introduction to Algorithms, 3rd edition</a>) have been using the word <code>NIL</code> to denote for example a child of a node (in a tree) ... | algorithms terminology data structures notation | 1 | What is the purpose of using NIL for representing null nodes? -- (algorithms terminology data structures notation)
<p>In my <em>Algorithms and Data Structures</em> course, professors, slides and the book (<a href="https://mitpress.mit.edu/books/introduction-algorithms" rel="nofollow noreferrer">Introduction to Algorith... | habedi/stack-exchange-dataset |
44,442 | Does the Rabin-Karp really need me to care about applying a mod Q operation on the rolling hashes? | <p>I have been reading about the Rabin Karp algorithm and I kept wondering what's the big deal with keeping our rolling hashes values bounded by a value Q? </p>

<p>I'd thought that as our integer number representation on the typical computer is 2-complement, it's actually exactly equivalent as bounding all our... | algorithms strings rolling hash | 1 | Does the Rabin-Karp really need me to care about applying a mod Q operation on the rolling hashes? -- (algorithms strings rolling hash)
<p>I have been reading about the Rabin Karp algorithm and I kept wondering what's the big deal with keeping our rolling hashes values bounded by a value Q? </p>

<p>I'd thought... | habedi/stack-exchange-dataset |
44,454 | Eliminate non-local references from closure | <p>For a code similarity detection framework I need to eliminate references to non-local variables, for example having the following closure:</p>

<pre><code>{
 var a;
 var b;

 var f = function() {
 a = 5;
 b = 6;
 }

 f();
}
</code></pre>

<p>woul... | reference request programming languages compilers functional programming imperative programming | 1 | Eliminate non-local references from closure -- (reference request programming languages compilers functional programming imperative programming)
<p>For a code similarity detection framework I need to eliminate references to non-local variables, for example having the following closure:</p>

<pre><code>{
 v... | habedi/stack-exchange-dataset |
44,455 | Where is Program Counter (PC) stored? | <p>Where is program counter stored? CPU caches?</p>

<p>Also how big are these counters?</p>

<p>What happens if that memory has been filled up?</p>

<p>I know that it's a value that stores the next instruction for the CPU to process, as well as it increments with the size of the next instructio... | computer architecture | 1 | Where is Program Counter (PC) stored? -- (computer architecture)
<p>Where is program counter stored? CPU caches?</p>

<p>Also how big are these counters?</p>

<p>What happens if that memory has been filled up?</p>

<p>I know that it's a value that stores the next instruction for the CPU to proce... | habedi/stack-exchange-dataset |
44,459 | Showing that the pumping lemma cannot prove that some language is not regular | <p>I have this language $ L = a^* \cup \left \{ a^mb^n|m>n\geq 0 \right \}^* $ I have to prove that this language is not regular but still satisfies the pumping lemma for regular languages (Since the pumping lemma is a necessary but not sufficient condition for a language to be regular). 
First I made the leap ... | formal languages pumping lemma | 1 | Showing that the pumping lemma cannot prove that some language is not regular -- (formal languages pumping lemma)
<p>I have this language $ L = a^* \cup \left \{ a^mb^n|m>n\geq 0 \right \}^* $ I have to prove that this language is not regular but still satisfies the pumping lemma for regular languages (Since the pu... | habedi/stack-exchange-dataset |
44,469 | How profiling is done in trace scheduling? | <p>I'm trying to understand how trace scheduling works. The book that I'm reading, <em>Engineering a Compiler by Keith D. Cooper & Linda Torczon</em>, states that this method is using profiling. Profiling ranks each edge if the CFG by its frequency of execution. In other words the more a particular edge is followed... | compilers scheduling | 1 | How profiling is done in trace scheduling? -- (compilers scheduling)
<p>I'm trying to understand how trace scheduling works. The book that I'm reading, <em>Engineering a Compiler by Keith D. Cooper & Linda Torczon</em>, states that this method is using profiling. Profiling ranks each edge if the CFG by its frequenc... | habedi/stack-exchange-dataset |
44,471 | Complexity of finding these original parameters | <p>I am given (or rather, generate randomly) three positive integers $a, b, c$. I want to know if there exist integers $m \ge 2, s \ge 1$ such that $ms+m = a, ms+1 = b, 2s+1 = c$. If there are multiple solutions, I want the minimal (if possible). </p>

<p>It is clear that $c$ has to be odd, so if $c$ given to m... | algorithms complexity theory integers | 1 | Complexity of finding these original parameters -- (algorithms complexity theory integers)
<p>I am given (or rather, generate randomly) three positive integers $a, b, c$. I want to know if there exist integers $m \ge 2, s \ge 1$ such that $ms+m = a, ms+1 = b, 2s+1 = c$. If there are multiple solutions, I want the minim... | habedi/stack-exchange-dataset |
44,493 | Classical Computation without NOT | <p>Is it possible to do universal classical computation using bits and 2-bit gates when you cannot perform a NOT operation on a single bit (hence cant do CNOT and so on). If yes, what are the possible universal sets of gates that do not utilise the NOT transformation. Thanks!</p>

<p>EDIT: to clarify, you can p... | computation models circuits boolean algebra digital circuits | 1 | Classical Computation without NOT -- (computation models circuits boolean algebra digital circuits)
<p>Is it possible to do universal classical computation using bits and 2-bit gates when you cannot perform a NOT operation on a single bit (hence cant do CNOT and so on). If yes, what are the possible universal sets of g... | habedi/stack-exchange-dataset |
44,501 | Question as regards a proof of the Time Hierarchy Theorem | <p>I'm referring to the proof outlined here (and wikipedia.org):
<a href="https://proofwiki.org/wiki/Deterministic_Time_Hierarchy_Theorem" rel="nofollow">https://proofwiki.org/wiki/Deterministic_Time_Hierarchy_Theorem</a></p>

<p>In my understanding, if I relaxed the conditions such that $K$ decides the inp... | complexity theory time complexity | 1 | Question as regards a proof of the Time Hierarchy Theorem -- (complexity theory time complexity)
<p>I'm referring to the proof outlined here (and wikipedia.org):
<a href="https://proofwiki.org/wiki/Deterministic_Time_Hierarchy_Theorem" rel="nofollow">https://proofwiki.org/wiki/Deterministic_Time_Hierarchy_Theorem</... | habedi/stack-exchange-dataset |
44,507 | Reduction of SUBSET-SUM to SET-PARTITION | <p>There is a similar question that has been asked, but my question addresses particular detail of an answer.</p>

<p>I am trying to reduce SUBSET-SUM to SET-PARTITION. I found the following description:</p>

<p>SUBSET-SUM is defined as follows: Given a set <code>X</code> of integers and a target number... | complexity theory np complete reductions partitions | 1 | Reduction of SUBSET-SUM to SET-PARTITION -- (complexity theory np complete reductions partitions)
<p>There is a similar question that has been asked, but my question addresses particular detail of an answer.</p>

<p>I am trying to reduce SUBSET-SUM to SET-PARTITION. I found the following description:</p>
&#... | habedi/stack-exchange-dataset |
44,517 | Computing the number of squares which are intersected by a line internally | <p>There's a line from (x1,y1) to (x2,y2) in a grid of squares of unit length. Write a program to
compute the number of squares which are intersected by the line internally, i.e squares which are
only touched by the line should not be counted.
Notes
 x1,y1,x2,y2 are all integers.
 0 <= x1,y1,x2,y... | algorithms computational geometry arithmetic graphics | 1 | Computing the number of squares which are intersected by a line internally -- (algorithms computational geometry arithmetic graphics)
<p>There's a line from (x1,y1) to (x2,y2) in a grid of squares of unit length. Write a program to
compute the number of squares which are intersected by the line internally, i.e squa... | habedi/stack-exchange-dataset |
44,522 | Proof by induction concerning approximation algorithm for subset sum | <p><strong>Assignment question</strong></p>

<p>For algorithm APPROX-SUBSET-SUM, prove by induction on $i$ that for every element $y \in P_i$ that is at most the target sum $T$, there is a $z \in L_i$ such that</p>

<p>$$\frac{y}{(1+\frac{\epsilon}{2n})^i} \leq z \leq y$$</p>

<p>Here $\epsilon$... | approximation induction | 1 | Proof by induction concerning approximation algorithm for subset sum -- (approximation induction)
<p><strong>Assignment question</strong></p>

<p>For algorithm APPROX-SUBSET-SUM, prove by induction on $i$ that for every element $y \in P_i$ that is at most the target sum $T$, there is a $z \in L_i$ such that</p>... | habedi/stack-exchange-dataset |
44,527 | Difference between SRSW and MRSW safe Boolean registers | <p>I'm reading <a href="http://rads.stackoverflow.com/amzn/click/0123973376" rel="nofollow">The Art of Multiprocessor Programming</a> and am currently trying to understand Chapter 4 — The Foundations of Shared Memory.</p>

<p>In section 4.2 it is shown how to build a multi-reader, single-writer (MRSW) safe Bool... | concurrency shared memory | 1 | Difference between SRSW and MRSW safe Boolean registers -- (concurrency shared memory)
<p>I'm reading <a href="http://rads.stackoverflow.com/amzn/click/0123973376" rel="nofollow">The Art of Multiprocessor Programming</a> and am currently trying to understand Chapter 4 — The Foundations of Shared Memory.</p>

<p... | habedi/stack-exchange-dataset |
44,534 | How can there be undecidable languages in P/1? | <p>I didn't understand some things about <span class="math-container">$ P/POLY$</span> class, and I will be thankful if you could help me.
as I learned in class,</p>
<p>a turing machine M accepts language L with advice <span class="math-container">$ {a_n} $</span> if</p>
<p><span class="math-container">$\qq... | complexity theory time complexity undecidability complexity classes | 1 | How can there be undecidable languages in P/1? -- (complexity theory time complexity undecidability complexity classes)
<p>I didn't understand some things about <span class="math-container">$ P/POLY$</span> class, and I will be thankful if you could help me.
as I learned in class,</p>
<p>a turing machine M acce... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.