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 |
|---|---|---|---|---|---|---|
35,215 | Does there exist $O(n)$ worst case sorting algorithm for sorting a list of integers? | <p>When I looked on <a href="http://en.wikipedia.org/wiki/Best,_worst_and_average_case" rel="nofollow">wikipedia</a>, all the sorting algorithms listed have worst case $O(n^2)$.</p>

<p>My question is suppose we are given a list of integers, each of which is in some fixed, finite set (i.e. $\{-1, 0, 1\}$). Does... | sorting | 1 | Does there exist $O(n)$ worst case sorting algorithm for sorting a list of integers? -- (sorting)
<p>When I looked on <a href="http://en.wikipedia.org/wiki/Best,_worst_and_average_case" rel="nofollow">wikipedia</a>, all the sorting algorithms listed have worst case $O(n^2)$.</p>

<p>My question is suppose we ar... | habedi/stack-exchange-dataset |
35,218 | Turn biased random number generator into uniform | <p>I'm looking at a problem in the book Introduction to Algorithms by Cormen et al. It says that if we are given a random number generator rand() which satisfies the distribution:</p>

<p>$P(X = 0) = p,\;\;P(X=1)=1-p,\;\;0<p<1$,</p>

<p>then we can use rand() as a subroutine to create a unbiased s... | probability theory randomized algorithms | 1 | Turn biased random number generator into uniform -- (probability theory randomized algorithms)
<p>I'm looking at a problem in the book Introduction to Algorithms by Cormen et al. It says that if we are given a random number generator rand() which satisfies the distribution:</p>

<p>$P(X = 0) = p,\;\;P(X=1)=1-p,... | habedi/stack-exchange-dataset |
35,231 | Problem A is polynomially reducible to problem B... what can we say about A and B? | <p>This is a question on a practice final. </p>

<blockquote>
 <p>Problem A is polynomially reducible to problem B. Which of the following
 statements is correct?</p>
 
 <p>I. <em>If problem A is solvable in a polynomial time then problem B is solvable in polynomial time</em>.</p>
 
... | complexity theory np complete np hard np | 1 | Problem A is polynomially reducible to problem B... what can we say about A and B? -- (complexity theory np complete np hard np)
<p>This is a question on a practice final. </p>

<blockquote>
 <p>Problem A is polynomially reducible to problem B. Which of the following
 statements is correct?</p>
 ... | habedi/stack-exchange-dataset |
35,233 | Creating a one-to-one mapping between a N-length list and M workers? | <p>I have a list of length <em>N</em>, and I have <em>M</em> workers. I want each of my workers to independently select a contiguous section of the list, with the property that every element of my list is selected by exactly one worker.</p>

<p>Using the SQL notion of <code>offset</code> and <code>limit</code>... | algorithms | 1 | Creating a one-to-one mapping between a N-length list and M workers? -- (algorithms)
<p>I have a list of length <em>N</em>, and I have <em>M</em> workers. I want each of my workers to independently select a contiguous section of the list, with the property that every element of my list is selected by exactly one worke... | habedi/stack-exchange-dataset |
35,236 | Asymptotic analysis for quicksort on special case | <p>I have the following problem for homework:</p>

<p>Given an array of the form $[m+1, m+2,..., n, 1, 2,..., m]$ as an input,
analyze quicksort's run time complexity.
TIP: check for $m > \frac{n}{2}$ and $m \le \frac{n}{2}$ </p>

<p><strong>The quicksort algorithm is the deterministic ver... | time complexity quicksort | 1 | Asymptotic analysis for quicksort on special case -- (time complexity quicksort)
<p>I have the following problem for homework:</p>

<p>Given an array of the form $[m+1, m+2,..., n, 1, 2,..., m]$ as an input,
analyze quicksort's run time complexity.
TIP: check for $m > \frac{n}{2}$ and $m \le \frac... | habedi/stack-exchange-dataset |
35,242 | Non-deterministic algorithm to check if a list has some given value | <p>I know that I can build a non-deterministic algorithm with a <code>CHOICE</code> function that verifies if a value <code>x</code> is in an array in O(1) time complexity.</p>

<p>The usual algorithm to do that is</p>

<pre><code>find (A, x)
 j = CHOICE(1, .. , A.length)
 if A[j] == x
... | complexity theory nondeterminism | 1 | Non-deterministic algorithm to check if a list has some given value -- (complexity theory nondeterminism)
<p>I know that I can build a non-deterministic algorithm with a <code>CHOICE</code> function that verifies if a value <code>x</code> is in an array in O(1) time complexity.</p>

<p>The usual algorithm to do... | habedi/stack-exchange-dataset |
35,268 | Let $L_4$ $\subseteq$ {0,1}$^*$ be the set of all palindromes whose first character is 1. Give a context-free grammar for $L_4$ | <p>Let $L_4$ $\subseteq$ {0,1}$^*$ be the set of all palindromes whose first character is 1. Give a context-free grammar for $L_4$.</p>

<p>I just wanted to check if my grammar is correct or not.</p>

<p>$$A \rightarrow 1B1$$
$$B \rightarrow 0B0\;|\;1B\;|\;0B\;|\;A\;|\;\epsilon$$</p>
 | context free formal grammars | 1 | Let $L_4$ $\subseteq$ {0,1}$^*$ be the set of all palindromes whose first character is 1. Give a context-free grammar for $L_4$ -- (context free formal grammars)
<p>Let $L_4$ $\subseteq$ {0,1}$^*$ be the set of all palindromes whose first character is 1. Give a context-free grammar for $L_4$.</p>

<p>I just wan... | habedi/stack-exchange-dataset |
35,272 | Genetic Algorithm, Neural Network, Deep Learning, Machine Learning Similarities and Applications? | <p>I am a computer engineering student and trying to get the idea behind all these Artificial Intelligence Concepts and applications. I know little theoretically about machine learning and some high level brief introduction of artificial intelligence as a whole and neural network. What i am interested in is knowing the... | machine learning artificial intelligence neural networks genetic algorithms | 1 | Genetic Algorithm, Neural Network, Deep Learning, Machine Learning Similarities and Applications? -- (machine learning artificial intelligence neural networks genetic algorithms)
<p>I am a computer engineering student and trying to get the idea behind all these Artificial Intelligence Concepts and applications. I know ... | habedi/stack-exchange-dataset |
35,278 | Hash values that are impossible to reach | <p>I was just curious as to if there are (or could by) any hash values that are impossible to compute due to the implementation of the algorithm. For example, SHA-256 produces a value that is 256-bits long. Technically, there are $2^{256}$ possible hash values that can be computed. Is it possible that a specific sequen... | cryptography hash | 1 | Hash values that are impossible to reach -- (cryptography hash)
<p>I was just curious as to if there are (or could by) any hash values that are impossible to compute due to the implementation of the algorithm. For example, SHA-256 produces a value that is 256-bits long. Technically, there are $2^{256}$ possible hash va... | habedi/stack-exchange-dataset |
35,280 | Can someone clarify this unification algorithm? | <p>I've been having trouble understanding a unification algorithm for first order logic, as I don't know what a compound expression is. I googled it, but found nothing relevant. I also don't know what a list means in this context. A list of what? </p>

<p>Edit: I think I've cleared up with compound expressions ... | logic artificial intelligence first order logic unification | 1 | Can someone clarify this unification algorithm? -- (logic artificial intelligence first order logic unification)
<p>I've been having trouble understanding a unification algorithm for first order logic, as I don't know what a compound expression is. I googled it, but found nothing relevant. I also don't know what a list... | habedi/stack-exchange-dataset |
35,283 | Decidable product with an undecidable projection | <p>I got some problems with building a set, which should looks like this: $S = A\times B \subset N \times N $, where $S$ is decidable but $A$ is undecidable. </p>

<p>Could somebody give me a clue how to actually do this? </p>
 | computability | 1 | Decidable product with an undecidable projection -- (computability)
<p>I got some problems with building a set, which should looks like this: $S = A\times B \subset N \times N $, where $S$ is decidable but $A$ is undecidable. </p>

<p>Could somebody give me a clue how to actually do this? </p>
 | habedi/stack-exchange-dataset |
35,285 | Picking an $m$ which minimises the sum $\sum_{i=1}^{i=n} |x_i-m|$ where $x_i$ is an element of the list $[x_1,x_2,...,x_n]$ | <p>I've got the following problem:</p>

<p>Tommy has a toy consisting of wooden posts and in each move he can either hit one post (which decreases its height by 1) or pull out a post (which increases its height by one). Tommy wants to set all poles to the same height but he must do that using minimal ammount of... | algorithms proof techniques | 1 | Picking an $m$ which minimises the sum $\sum_{i=1}^{i=n} |x_i-m|$ where $x_i$ is an element of the list $[x_1,x_2,...,x_n]$ -- (algorithms proof techniques)
<p>I've got the following problem:</p>

<p>Tommy has a toy consisting of wooden posts and in each move he can either hit one post (which decreases its heig... | habedi/stack-exchange-dataset |
35,291 | Definition of a size of type | <p>In B. Pierce's <a href="http://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow noreferrer">book</a> "Types and Programming Languages", he talks about the size of types (see pictures below).</p>

<p>I searched the book for a definition but could not find one. I only found a definition for the size of terms, ... | terminology type theory type checking | 1 | Definition of a size of type -- (terminology type theory type checking)
<p>In B. Pierce's <a href="http://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow noreferrer">book</a> "Types and Programming Languages", he talks about the size of types (see pictures below).</p>

<p>I searched the book for a definition b... | habedi/stack-exchange-dataset |
35,298 | Can a language recognized by a NFA be recognized by a push down or Turing machine? | <p>Every single NFA has an equivalent DFA representation so that every language recognized by NFA is recognized by the DFA, but is it also true that the language recognized by NFA is recognized by a push down automata and a Turing machine? </p>
 | formal languages | 1 | Can a language recognized by a NFA be recognized by a push down or Turing machine? -- (formal languages)
<p>Every single NFA has an equivalent DFA representation so that every language recognized by NFA is recognized by the DFA, but is it also true that the language recognized by NFA is recognized by a push down automa... | habedi/stack-exchange-dataset |
35,300 | If A is polynomial time reducible to B such that B <= A, does it mean B must be a polynomial time algorithm? | <p>I don't understand what it means for A to be polynomial time reducible to B. I'm guessing is that we can revised the algorithm some how such that it becomes B, where B is a polynomial time algorithm.</p>

<p>Can someone point out if I have this completely wrong?</p>
 | complexity theory polynomial time | 1 | If A is polynomial time reducible to B such that B <= A, does it mean B must be a polynomial time algorithm? -- (complexity theory polynomial time)
<p>I don't understand what it means for A to be polynomial time reducible to B. I'm guessing is that we can revised the algorithm some how such that it becomes B, where B i... | habedi/stack-exchange-dataset |
35,302 | How to find upper and lower bound without using formula | <p>I'm studying discrete math for tomorrow's exam and got stuck in the below question. I tried to google it and couldn't find anything useful.</p>

<p>Prove the following sum is $\Theta (n^2)$ (we have to find $O(n^2)$ and $\Omega (n^2)$)</p>

<ol>
<li><p>$P(n)= 1+2+3+4\cdots + n$</p></li>
<li><... | runtime analysis discrete mathematics | 1 | How to find upper and lower bound without using formula -- (runtime analysis discrete mathematics)
<p>I'm studying discrete math for tomorrow's exam and got stuck in the below question. I tried to google it and couldn't find anything useful.</p>

<p>Prove the following sum is $\Theta (n^2)$ (we have to find $O(... | habedi/stack-exchange-dataset |
35,303 | In general, does $f(g)$ and $f(h)$ have the same time complexity? | <p>I thought about this question while looking at a textbook where it wanted me to compare the time complexity of $\lg^*(n)$ and $\lg^*(\lg(n))$</p>

<p>Now it is well known that $\lg^*$ is a tremendously slow growing function, so what is inside of $\lg^*$ shouldn't contribute to its complexity.</p>

<p... | asymptotics | 1 | In general, does $f(g)$ and $f(h)$ have the same time complexity? -- (asymptotics)
<p>I thought about this question while looking at a textbook where it wanted me to compare the time complexity of $\lg^*(n)$ and $\lg^*(\lg(n))$</p>

<p>Now it is well known that $\lg^*$ is a tremendously slow growing function, s... | habedi/stack-exchange-dataset |
35,311 | Can someone provide a trivial example to the "reduction" procedure used to prove hardness? | <p>I cannot comprehend how you can prove hardness between two NP complete problems.</p>

<p>For example, let X be a NP hard problem, I want to prove Y is also NP hard.</p>

<p>I can do this by reducing X to Y, if Y is as difficult as X then it is NP hard, otherwise it is not.</p>

<p>But how is ... | complexity theory reductions np hard | 1 | Can someone provide a trivial example to the "reduction" procedure used to prove hardness? -- (complexity theory reductions np hard)
<p>I cannot comprehend how you can prove hardness between two NP complete problems.</p>

<p>For example, let X be a NP hard problem, I want to prove Y is also NP hard.</p>
&#x... | habedi/stack-exchange-dataset |
35,317 | Devise a backtracking algorithm to allocate $p$ projects to $s$ students | <p>There are $p$ projects and $s$ students where $p \le s$. Multiple students can work on the same project but the same student cannot work on multiple projects. All projects must be allocated and all students must have a project. I need to compute and display all possible ways of allocating projects to students under ... | algorithms backtracking | 1 | Devise a backtracking algorithm to allocate $p$ projects to $s$ students -- (algorithms backtracking)
<p>There are $p$ projects and $s$ students where $p \le s$. Multiple students can work on the same project but the same student cannot work on multiple projects. All projects must be allocated and all students must hav... | habedi/stack-exchange-dataset |
35,321 | How many comparisons do we need to find min and max of n numbers? | <p>Suppose we have given a list of 100 numbers. Then How can we calculate the minimum number of comparisons required to find the minimum and the maximum of 100 numbers.</p>

<p>Recurrence for the above problem is</p>

<p>$$T(n)=T(\lceil \frac{n}{2} \rceil) + T(\lfloor \frac{n}{2} \rfloor) + 2$$
$$\a... | algorithm analysis recurrence relation | 1 | How many comparisons do we need to find min and max of n numbers? -- (algorithm analysis recurrence relation)
<p>Suppose we have given a list of 100 numbers. Then How can we calculate the minimum number of comparisons required to find the minimum and the maximum of 100 numbers.</p>

<p>Recurrence for the above ... | habedi/stack-exchange-dataset |
35,327 | LazyHeap data structure with $O(n)$ Insert, Delete, and Return operations | <p>Consider a data structure called LazyHeap that supports the following operations:</p>

<ul>
<li><p>INSERT(x): Given an element $x$, insert it into the data structure. It has no cost.</p></li>
<li><p>DELETE(x): Delete $x$ from the data structure. It has no cost.</p></li>
<li><p>RETURN: Return an e... | algorithms data structures heaps | 1 | LazyHeap data structure with $O(n)$ Insert, Delete, and Return operations -- (algorithms data structures heaps)
<p>Consider a data structure called LazyHeap that supports the following operations:</p>

<ul>
<li><p>INSERT(x): Given an element $x$, insert it into the data structure. It has no cost.</p></li>&#... | habedi/stack-exchange-dataset |
35,333 | PRNG bad seeding and von Neumann unbiasing | <p>Large period PRNGs such as Mersenne Twister require good seeding otherwise the initial output in the sequence may not seem to be high-quality, at least for the first few words (and in the way that is useful in production). For example, Marsaglia talked about seeding methods in his May 2003 Communications of the ACM... | probability theory randomness pseudo random generators | 1 | PRNG bad seeding and von Neumann unbiasing -- (probability theory randomness pseudo random generators)
<p>Large period PRNGs such as Mersenne Twister require good seeding otherwise the initial output in the sequence may not seem to be high-quality, at least for the first few words (and in the way that is useful in prod... | habedi/stack-exchange-dataset |
35,339 | How can this grammar parse such an input? | <p>I've an example which I simply don't get at all. </p>

<blockquote>
 <p>Implement an attributed grammar that checks that either </p>
 
 <ul>
 <li>the word ends in $b$ or</li>
 <li>each prefix of the word contains at least as many $b$s as $a$s</li>
 </ul>
 
 <p>E.g. the... | formal grammars compilers parsers attribute grammars | 1 | How can this grammar parse such an input? -- (formal grammars compilers parsers attribute grammars)
<p>I've an example which I simply don't get at all. </p>

<blockquote>
 <p>Implement an attributed grammar that checks that either </p>
 
 <ul>
 <li>the word ends in $b$ or</li>
 <li>each... | habedi/stack-exchange-dataset |
35,346 | What is it called when two problems are similar? | <p>Suppose that there are two problems $P$ and $Q$.</p>

<p>How can I say that "solving $P$ is same thing with solving $Q$"?</p>

<p>For instance, if $P$ is NP-Hard, then we can say "$P$ can be solved in polynomial time iff there exists an algorithm $A$ that solves $Q$ in polynomial time".</p>

... | complexity theory terminology | 1 | What is it called when two problems are similar? -- (complexity theory terminology)
<p>Suppose that there are two problems $P$ and $Q$.</p>

<p>How can I say that "solving $P$ is same thing with solving $Q$"?</p>

<p>For instance, if $P$ is NP-Hard, then we can say "$P$ can be solved in polynomial time ... | habedi/stack-exchange-dataset |
35,350 | Give an example of a non-regular language $L$ such that $L^*$ is regular | <p>I can't think of an example of a non-regular language $L$ such that $L^*$ is regular. . Any help ?</p>
 | formal languages regular languages | 1 | Give an example of a non-regular language $L$ such that $L^*$ is regular -- (formal languages regular languages)
<p>I can't think of an example of a non-regular language $L$ such that $L^*$ is regular. . Any help ?</p>
 | habedi/stack-exchange-dataset |
35,351 | Algorithms: Difference Constraints | <p>I'm currently studying for my algorithms final and I came across a practice problem that I can't seem to figure out. Here's the problem:</p>

<blockquote>
 <p>Consider the following set of difference constraints:</p>

<pre><code>x1 - x4 <= 1 
x2 - x1 <= 2 
x2 - x4 <= 0 
x... | algorithms shortest path | 1 | Algorithms: Difference Constraints -- (algorithms shortest path)
<p>I'm currently studying for my algorithms final and I came across a practice problem that I can't seem to figure out. Here's the problem:</p>

<blockquote>
 <p>Consider the following set of difference constraints:</p>

<pre><code>x1... | habedi/stack-exchange-dataset |
35,353 | Proving that the set of non-universal CFGs is not in NP | <p>How do I prove that $\overline{\mathrm{ALL_{CFG}}}$ does not fall in NP, where </p>

<p>$\qquad\mathrm{ALL_{CFG}} = \{\langle G \rangle \mid G \text{ is a CFG}, L(G) = \Sigma^* \}$</p>
 | complexity theory context free np | 1 | Proving that the set of non-universal CFGs is not in NP -- (complexity theory context free np)
<p>How do I prove that $\overline{\mathrm{ALL_{CFG}}}$ does not fall in NP, where </p>

<p>$\qquad\mathrm{ALL_{CFG}} = \{\langle G \rangle \mid G \text{ is a CFG}, L(G) = \Sigma^* \}$</p>
 | habedi/stack-exchange-dataset |
35,358 | What will trigger a worst time search for a binary heap and what is the run time? | <p>I thought if the values in a max or min heap is monotonically increasing or decreasing, then this will trigger a worst case run time of $\mathcal{O}(n)$ because you will have to go through each and every single node to get to the value you want.</p>

<p>However, many sources state that heap has a worst case ... | data structures heaps priority queues | 1 | What will trigger a worst time search for a binary heap and what is the run time? -- (data structures heaps priority queues)
<p>I thought if the values in a max or min heap is monotonically increasing or decreasing, then this will trigger a worst case run time of $\mathcal{O}(n)$ because you will have to go through eac... | habedi/stack-exchange-dataset |
35,361 | When inserting into a binary tree, is there a universal agreed upon place to insert then new node to minimize complexity? | <p>Do programmers (in real life), always insert at the top node or somewhere else? Because in my text book CLRS it is not made very clear, so the insertion process can take a best case of O(1), if you insert it just at the right place, or a worst case when you have to rebalance the entire tree.</p>

<p>So in pr... | data structures binary trees | 1 | When inserting into a binary tree, is there a universal agreed upon place to insert then new node to minimize complexity? -- (data structures binary trees)
<p>Do programmers (in real life), always insert at the top node or somewhere else? Because in my text book CLRS it is not made very clear, so the insertion process ... | habedi/stack-exchange-dataset |
35,365 | How can I use the NP complexity Venn diagram to quickly see which class of NP problem can be poly reducible to another class? | <p>I'm so bad at solving the problem of the type:</p>

<blockquote>
 <p>"If $A$ is an <strong>NP-complete</strong> problem, $B$ is reducible to $A$, then $B$ is..." </p>
</blockquote>

<p>That I have to come here and ask these silly questions each and every time I encounter them.</p>

<... | complexity theory proof techniques complexity classes intuition | 1 | How can I use the NP complexity Venn diagram to quickly see which class of NP problem can be poly reducible to another class? -- (complexity theory proof techniques complexity classes intuition)
<p>I'm so bad at solving the problem of the type:</p>

<blockquote>
 <p>"If $A$ is an <strong>NP-complete</stron... | habedi/stack-exchange-dataset |
35,366 | Can't see how this can be true: any connected undirected graph $G$ contains vertex v such that removing v results in another connected Graph $G'$ | <p>I am attempting to prove this result but I found a case where I can easily disprove this statement.</p>

<blockquote>
 <p>Suppose $G$ is a graph with two nodes u, v and an edge (u,v) and respective self edges, then removing the edge u,v results in two nodes left, therefore leaving the resulting graph di... | graphs | 1 | Can't see how this can be true: any connected undirected graph $G$ contains vertex v such that removing v results in another connected Graph $G'$ -- (graphs)
<p>I am attempting to prove this result but I found a case where I can easily disprove this statement.</p>

<blockquote>
 <p>Suppose $G$ is a graph w... | habedi/stack-exchange-dataset |
35,371 | Why do we believe that PSPACE ≠ EXPTIME? | <p>I'm having trouble intuitively understanding why PSPACE is generally believed to be different from EXPTIME. If PSPACE is the set of problems solvable in space polynomial in the input size $f(n)$, then how can there be a class of problems that experience greater exponential time blowup and do not make use of exponen... | complexity theory complexity classes intuition | 1 | Why do we believe that PSPACE ≠ EXPTIME? -- (complexity theory complexity classes intuition)
<p>I'm having trouble intuitively understanding why PSPACE is generally believed to be different from EXPTIME. If PSPACE is the set of problems solvable in space polynomial in the input size $f(n)$, then how can there be a cla... | habedi/stack-exchange-dataset |
35,385 | "For small values of n, O(n) can be treated as if it's O(1)" | <p>I've heard several times that for sufficiently small values of n, O(n) can be thought about/treated as if it's O(1).</p>
<p><a href="https://docs.microsoft.com/en-us/archive/blogs/ericlippert/strings-immutability-and-persistence" rel="nofollow noreferrer">Example</a>:</p>
<blockquote>
<p>The motivation f... | asymptotics | 1 | "For small values of n, O(n) can be treated as if it's O(1)" -- (asymptotics)
<p>I've heard several times that for sufficiently small values of n, O(n) can be thought about/treated as if it's O(1).</p>
<p><a href="https://docs.microsoft.com/en-us/archive/blogs/ericlippert/strings-immutability-and-persistence" rel="... | habedi/stack-exchange-dataset |
35,388 | Language equivalence proof | <p>Can anyone explain to me how the following is true for any language?</p>

<p>$$L^+ = LL^* = L^*L$$</p>

<p>I'm confused because $L^*$ is the set of all words including the empty string, while $L^+$ is the set of all words excluding the empty string. I don't understand how concatenating $L^*$ with $L$... | formal languages | 1 | Language equivalence proof -- (formal languages)
<p>Can anyone explain to me how the following is true for any language?</p>

<p>$$L^+ = LL^* = L^*L$$</p>

<p>I'm confused because $L^*$ is the set of all words including the empty string, while $L^+$ is the set of all words excluding the empty string. I ... | habedi/stack-exchange-dataset |
35,391 | Characterizing the range of a polytime function | <p>Is it true that an infinite language is in P iff it is the range of a length increasing polytime function? I ask because I know that it is a basic result in computability theory that a set is recursive iff it is the range of an increasing recursive function and I was wondering if there might be an analogue in compl... | complexity theory reductions polynomial time | 1 | Characterizing the range of a polytime function -- (complexity theory reductions polynomial time)
<p>Is it true that an infinite language is in P iff it is the range of a length increasing polytime function? I ask because I know that it is a basic result in computability theory that a set is recursive iff it is the ra... | habedi/stack-exchange-dataset |
35,392 | If algorithm runs $\theta(n)$ in time T, doubling input size has what effect on time T? | <p>In other words, is there a relationship between the step size and the actual running time? Suppose that the algorithm is run on identical machine.</p>
 | algorithms asymptotics runtime analysis | 1 | If algorithm runs $\theta(n)$ in time T, doubling input size has what effect on time T? -- (algorithms asymptotics runtime analysis)
<p>In other words, is there a relationship between the step size and the actual running time? Suppose that the algorithm is run on identical machine.</p>
 | habedi/stack-exchange-dataset |
35,393 | Given a Red-Black Tree of n keys, is there a way to quickly determine if a red-node exists? | <p>My best attempt at a specific case of the problem where $n =$ 256:</p>

<p>For a specific case that a RB tree has 256 nodes, we can use the RB tree theorem to deduce that the height of the tree $h \leq 2*lg(n+1)$ then $h\leq 16$ for $n =$ 256.</p>

<p>But this doesn't exactly help me deduce whether ... | data structures trees binary trees search trees balanced search trees | 1 | Given a Red-Black Tree of n keys, is there a way to quickly determine if a red-node exists? -- (data structures trees binary trees search trees balanced search trees)
<p>My best attempt at a specific case of the problem where $n =$ 256:</p>

<p>For a specific case that a RB tree has 256 nodes, we can use the RB... | habedi/stack-exchange-dataset |
35,401 | Unclear about proof for unique MST given graph G with distinct weights | <p><a href="http://homepages.math.uic.edu/~leon/cs-mcs401-s08/handouts/mst.pdf" rel="nofollow noreferrer">http://homepages.math.uic.edu/~leon/cs-mcs401-s08/handouts/mst.pdf</a>
<img src="https://i.stack.imgur.com/EmQ6S.png" alt="enter image description here"></p>

<p>I have some trouble understanding the pr... | graphs proof techniques spanning trees | 1 | Unclear about proof for unique MST given graph G with distinct weights -- (graphs proof techniques spanning trees)
<p><a href="http://homepages.math.uic.edu/~leon/cs-mcs401-s08/handouts/mst.pdf" rel="nofollow noreferrer">http://homepages.math.uic.edu/~leon/cs-mcs401-s08/handouts/mst.pdf</a>
<img src="https://i.stac... | habedi/stack-exchange-dataset |
35,411 | If $L$ is a $CFL$, then why isn't $L^*$ also $CFL$ | <p>I was studying closure properties of CFLs and I came across this. I want to understand why $L^*$ is not a CFL, can anyone explain me in depth with simple examples?</p>
 | formal languages context free closure properties | 1 | If $L$ is a $CFL$, then why isn't $L^*$ also $CFL$ -- (formal languages context free closure properties)
<p>I was studying closure properties of CFLs and I came across this. I want to understand why $L^*$ is not a CFL, can anyone explain me in depth with simple examples?</p>
 | habedi/stack-exchange-dataset |
35,414 | The significance of bounded parameters in complexity | <p>A lot of complexity results are given with respect to bounded cases where results are more favourable. </p>

<p>For example, the <a href="http://en.wikipedia.org/wiki/Graph_isomorphism_problem" rel="nofollow">graph isomorphism problem</a> — which is GI-complete in general — is known to be tractable in cases ... | complexity theory | 1 | The significance of bounded parameters in complexity -- (complexity theory)
<p>A lot of complexity results are given with respect to bounded cases where results are more favourable. </p>

<p>For example, the <a href="http://en.wikipedia.org/wiki/Graph_isomorphism_problem" rel="nofollow">graph isomorphism proble... | habedi/stack-exchange-dataset |
35,415 | Measure two qubits, one from entangled pair, in Bell basis? | <p>In quantum teleportation we require both sender (Alice) and receiver (Bob) to share an entangled pair of qubits in the $|\beta_{00}\rangle$ <a href="http://en.wikipedia.org/wiki/Bell_state" rel="nofollow">Bell state</a>. Then, if Alice wants to teleport a quibt $|v\rangle$ to Bob, she needs to measure $|v\rangle$ an... | quantum computing | 1 | Measure two qubits, one from entangled pair, in Bell basis? -- (quantum computing)
<p>In quantum teleportation we require both sender (Alice) and receiver (Bob) to share an entangled pair of qubits in the $|\beta_{00}\rangle$ <a href="http://en.wikipedia.org/wiki/Bell_state" rel="nofollow">Bell state</a>. Then, if Alic... | habedi/stack-exchange-dataset |
35,419 | Does amortized complexity always equal to worst case complexity divided by n? | <p>Is it true that given any operation that takes O(f(n)) amount of time, we do this n times in a process, then the amortized cost is O(f(n))/n?</p>

<p>I'm confused because this statement is so simple and applicable, I don't see the need for accounting method or potential method if we can just divide the worst... | amortized analysis | 1 | Does amortized complexity always equal to worst case complexity divided by n? -- (amortized analysis)
<p>Is it true that given any operation that takes O(f(n)) amount of time, we do this n times in a process, then the amortized cost is O(f(n))/n?</p>

<p>I'm confused because this statement is so simple and appl... | habedi/stack-exchange-dataset |
35,423 | Are all adjacency matrices represented by 0 and 1s? | <p>Are there any cases when adjacency matrix should have entries other than 0 and 1?</p>
 | graphs adjacency matrix | 1 | Are all adjacency matrices represented by 0 and 1s? -- (graphs adjacency matrix)
<p>Are there any cases when adjacency matrix should have entries other than 0 and 1?</p>
 | habedi/stack-exchange-dataset |
35,425 | Time complexity of solving a set of 2-sat instances? | <p>Suppose I have a set of 2-SAT instances, the set is of size $2^{3C}$ for some constant $C$. What is the time complexity of solving all instances using the fastest known 2-SAT solver? </p>
 | algorithms search algorithms | 1 | Time complexity of solving a set of 2-sat instances? -- (algorithms search algorithms)
<p>Suppose I have a set of 2-SAT instances, the set is of size $2^{3C}$ for some constant $C$. What is the time complexity of solving all instances using the fastest known 2-SAT solver? </p>
 | habedi/stack-exchange-dataset |
35,427 | Modified Bellman Ford to find minmum cost cycle in O(E²V) time? | <p>I'm thinking about how you can modify Bellman Ford a bit to calculate the minimum weight cycle in an undirected graph with positive weights. Note that the constraint is that the algorithm must run in $O(VE^2)$ times, and Bellman Ford runs $O(VE)$ time so we are looking at a modification that runs $O(E)$</p>

... | algorithms graphs search algorithms shortest path | 1 | Modified Bellman Ford to find minmum cost cycle in O(E²V) time? -- (algorithms graphs search algorithms shortest path)
<p>I'm thinking about how you can modify Bellman Ford a bit to calculate the minimum weight cycle in an undirected graph with positive weights. Note that the constraint is that the algorithm must run i... | habedi/stack-exchange-dataset |
35,429 | What is the complexity of recurrence $T(n) = T(n-1) + 1/n$ | <p>What is the complexity of the follwoing recurrence? $$T(n) = T(n-1) + 1/n$$</p>

<p>I highly suspect the answer to be $O(1)$, because your work reduces by $1$ each time, so by the $n$th time it would be $T(n-n) = T(0)$ and your initial task reduces to 0.</p>
 | time complexity | 1 | What is the complexity of recurrence $T(n) = T(n-1) + 1/n$ -- (time complexity)
<p>What is the complexity of the follwoing recurrence? $$T(n) = T(n-1) + 1/n$$</p>

<p>I highly suspect the answer to be $O(1)$, because your work reduces by $1$ each time, so by the $n$th time it would be $T(n-n) = T(0)$ and your i... | habedi/stack-exchange-dataset |
35,434 | Is there a flaw in this Wikipedia proof of cycle property of Minimum Spanning Tree? | <p>On <a href="http://en.wikipedia.org/wiki/Minimum_spanning_tree#Cycle_property" rel="nofollow noreferrer">wikipedia</a>, there is a proof for the cycle property of the Minimum Spanning Tree as follows: </p>

<blockquote>
 <p>Cycle Property:
 <strong>For any cycle C in the graph, if the weight of an ... | correctness proof spanning trees | 1 | Is there a flaw in this Wikipedia proof of cycle property of Minimum Spanning Tree? -- (correctness proof spanning trees)
<p>On <a href="http://en.wikipedia.org/wiki/Minimum_spanning_tree#Cycle_property" rel="nofollow noreferrer">wikipedia</a>, there is a proof for the cycle property of the Minimum Spanning Tree as fol... | habedi/stack-exchange-dataset |
35,436 | Do all greedy algorithm produce just the first solution, no matter how bad it is? | <p>In all the exampls of the greedy algorithms I've seen so far, such as activity selection problem and unit-sized set coverage problem, the algorithm is usually very simple and intuitive and returns the first set that satisfies the constrain under greedy strategy.</p>

<p>For example, in the activity selection... | algorithms greedy algorithms | 1 | Do all greedy algorithm produce just the first solution, no matter how bad it is? -- (algorithms greedy algorithms)
<p>In all the exampls of the greedy algorithms I've seen so far, such as activity selection problem and unit-sized set coverage problem, the algorithm is usually very simple and intuitive and returns the ... | habedi/stack-exchange-dataset |
35,439 | Calculating the number of unique BST generatable from n keys, why is my number so large | <p>I want to find the number of distinct BSTs I can get with 3 unique keys (i.e. 1, 2, 3)</p>

<p>Here's my solution:
<img src="https://i.stack.imgur.com/bdxUN.png" alt="enter image description here"></p>

<ul>
<li><p>In case 1, we have each node have possibility, 3, 2, 1, respectively,
so 3... | trees probability theory permutations | 1 | Calculating the number of unique BST generatable from n keys, why is my number so large -- (trees probability theory permutations)
<p>I want to find the number of distinct BSTs I can get with 3 unique keys (i.e. 1, 2, 3)</p>

<p>Here's my solution:
<img src="https://i.stack.imgur.com/bdxUN.png" alt="enter i... | habedi/stack-exchange-dataset |
35,450 | How can I learn about CS? | <p>I am an Junior in college and I have come to the realization that my school didn't to that good of a job of actually teaching real CS to the students. On my own, I have become a fairly proficient programmer, but I know I would be a lot better If I was more confident in my ability to swim on a lower level of the sta... | computability data structures discrete mathematics | 1 | How can I learn about CS? -- (computability data structures discrete mathematics)
<p>I am an Junior in college and I have come to the realization that my school didn't to that good of a job of actually teaching real CS to the students. On my own, I have become a fairly proficient programmer, but I know I would be a lot... | habedi/stack-exchange-dataset |
35,452 | Understanding Instruction Cycle? | <p>A basic instruction cycle consists of these 5 stages.</p>

<blockquote>
 <h2>Instruction Cycle</h2>
 
 <ol>
 <li>IF - Instruction Fetch</li>
 <li>RD - Instruction Decode and Register Read</li>
 <li>EX - Execute</li>
 <li>MA - Memory Access</li>
 <li>WB - Write Back</li... | computer architecture | 1 | Understanding Instruction Cycle? -- (computer architecture)
<p>A basic instruction cycle consists of these 5 stages.</p>

<blockquote>
 <h2>Instruction Cycle</h2>
 
 <ol>
 <li>IF - Instruction Fetch</li>
 <li>RD - Instruction Decode and Register Read</li>
 <li>EX - Execute</li>
... | habedi/stack-exchange-dataset |
35,455 | Is order of bits in byte really not of concern? | <p>What I can't wrap my head around is sentence repeated everywhere I look, that order of bits in byte is not important(not of my, as a programmer, concern).
My question then is if there is possibility that it makes difference?</p>

<p>For example, I crate a binary file with just 0x1 in it (represented on m... | computer architecture memory access | 1 | Is order of bits in byte really not of concern? -- (computer architecture memory access)
<p>What I can't wrap my head around is sentence repeated everywhere I look, that order of bits in byte is not important(not of my, as a programmer, concern).
My question then is if there is possibility that it makes difference?... | habedi/stack-exchange-dataset |
35,467 | Greedy proof: Correctness versus optimality | <p>I am really confused after surveying a bunch of material online about correctness versus optimality proof for greedy algorithms. Some website even uses both correctness and optimal in the same sentence!</p>

<p>From my best unconfirmed understanding, the optimal proof uses "greedy stay ahead" where I need to... | proof techniques greedy algorithms | 1 | Greedy proof: Correctness versus optimality -- (proof techniques greedy algorithms)
<p>I am really confused after surveying a bunch of material online about correctness versus optimality proof for greedy algorithms. Some website even uses both correctness and optimal in the same sentence!</p>

<p>From my best u... | habedi/stack-exchange-dataset |
35,475 | How to enumerate minimal covers of a set | <p>I have a set $S$ and a set $P = \{P_{1},...,P_{n}\}$ with $\bigcup P_{i} = S$. I want to find all the inclusion-minimal subsets of $P$ that are covers of $S$.</p>

<p>What is the best algorithm for enumerating all the inclusion-minimal covers of $S$ contained in a set $P$ and what is its running time?</p>&#x... | algorithms reference request enumeration set cover | 1 | How to enumerate minimal covers of a set -- (algorithms reference request enumeration set cover)
<p>I have a set $S$ and a set $P = \{P_{1},...,P_{n}\}$ with $\bigcup P_{i} = S$. I want to find all the inclusion-minimal subsets of $P$ that are covers of $S$.</p>

<p>What is the best algorithm for enumerating al... | habedi/stack-exchange-dataset |
35,476 | Using A* search with different heuristic values | <p>I am currently trying to use A* to create cyclical routes (for plotting driving routes of set distances). I want to find a driving route from my start location that is as close to my specified length as possible. If it is bigger or smaller that is fine, just as close as possible</p>

<p>I have therefore adap... | algorithms search algorithms search problem searching | 1 | Using A* search with different heuristic values -- (algorithms search algorithms search problem searching)
<p>I am currently trying to use A* to create cyclical routes (for plotting driving routes of set distances). I want to find a driving route from my start location that is as close to my specified length as possibl... | habedi/stack-exchange-dataset |
35,479 | Hamming and BCH codes | <p>Why are Hamming codes the best 1-error-correcting codes? 
I need references. I know that hamming codes are the best 1-error-correcting codes but I want to know why they are best?</p>
 | coding theory error correcting codes hamming code | 1 | Hamming and BCH codes -- (coding theory error correcting codes hamming code)
<p>Why are Hamming codes the best 1-error-correcting codes? 
I need references. I know that hamming codes are the best 1-error-correcting codes but I want to know why they are best?</p>
 | habedi/stack-exchange-dataset |
35,483 | Why do heuristic functions only approximate the real value of the cost? | <p>As stated in the title I'm wondering why do heuristic functions only approximate the real value of the cost? I understand it can never overestimate, but can it ensure the cost is accurate?</p>
 | artificial intelligence search algorithms heuristics | 1 | Why do heuristic functions only approximate the real value of the cost? -- (artificial intelligence search algorithms heuristics)
<p>As stated in the title I'm wondering why do heuristic functions only approximate the real value of the cost? I understand it can never overestimate, but can it ensure the cost is accurate... | habedi/stack-exchange-dataset |
35,484 | Determining the minimum number of edges to add in order to be 3-connected | <p>A graph $G$ is said to be $3$-connected if it has no $2$-vertex cutsets (i.e., at least three vertices must be deleted to disconnect the graph). As far as I know, it is possible to determine if a simple graph is $3$-connected in $O(n)$ time (example: <a href="http://www2.tu-ilmenau.de/combinatorial-optimization/Schm... | algorithms graphs reference request | 1 | Determining the minimum number of edges to add in order to be 3-connected -- (algorithms graphs reference request)
<p>A graph $G$ is said to be $3$-connected if it has no $2$-vertex cutsets (i.e., at least three vertices must be deleted to disconnect the graph). As far as I know, it is possible to determine if a simple... | habedi/stack-exchange-dataset |
35,490 | Mathematical model for a webpage layout? | <p>Getting layout right (even if only a structure is considered) with HTML5/CSS3 is still more like an art or black magic.</p>

<p>On the other hand, there are other GUI systems (like wxWindows and Tcl/Tk) and some GUI research (like The Auckland Layout Model, ALM, and <a href="https://hal.inria.fr/hal-00953333... | modelling user interface hci | 1 | Mathematical model for a webpage layout? -- (modelling user interface hci)
<p>Getting layout right (even if only a structure is considered) with HTML5/CSS3 is still more like an art or black magic.</p>

<p>On the other hand, there are other GUI systems (like wxWindows and Tcl/Tk) and some GUI research (like The... | habedi/stack-exchange-dataset |
35,492 | Fast implementation of basic addition algorithm | <blockquote>
 <p>Write code for a modified version of the Grade School addition algorithm that adds the integer one to an m-digit integer. Thus, this modified algorithm does not even need a second number being added. Design the algorithm to be fast, so that it avoids doing excessive work on carries of zero.</p>&#x... | algorithms arithmetic | 1 | Fast implementation of basic addition algorithm -- (algorithms arithmetic)
<blockquote>
 <p>Write code for a modified version of the Grade School addition algorithm that adds the integer one to an m-digit integer. Thus, this modified algorithm does not even need a second number being added. Design the algorithm to... | habedi/stack-exchange-dataset |
35,495 | Why is the CPU Involved During Keyboard Echo? | <p>I'm currently studying for a computer science exam, and I've come across a concept that has me somewhat stumped.</p>

<blockquote>
 <p>When one types a key on the keyboard, an ASCII character is transmitted to the CPU. Upon reception of this character, the CPU outputs the same character to the screen. T... | computer architecture operating systems user interface | 1 | Why is the CPU Involved During Keyboard Echo? -- (computer architecture operating systems user interface)
<p>I'm currently studying for a computer science exam, and I've come across a concept that has me somewhat stumped.</p>

<blockquote>
 <p>When one types a key on the keyboard, an ASCII character is tra... | habedi/stack-exchange-dataset |
35,524 | Cycle of length k with no repeated edges | <p>I need to figure out what is the minimum complexity class (L, NL, P, NPC etc..) of the following problem: Given an undirected graph G, is there exist a cycle (doesn't have to be a simple cycle) with no repeating edges, of a size at least k? (i.e. the number of edges in the cycle is at least k)</p>

<p>I thou... | complexity theory | 1 | Cycle of length k with no repeated edges -- (complexity theory)
<p>I need to figure out what is the minimum complexity class (L, NL, P, NPC etc..) of the following problem: Given an undirected graph G, is there exist a cycle (doesn't have to be a simple cycle) with no repeating edges, of a size at least k? (i.e. the nu... | habedi/stack-exchange-dataset |
35,525 | What kind of recurrence relations has p < 0? | <p>By the master method, 
$T(n) = aT(\frac {n}{b})+\Theta(n^k\log^pn)$
where $p$ is real.</p>

<p>I know $\log^4n=\log(\log(\log(\log n)))$ but how do you calculate something like $\log^pn$ where $p<0$?</p>
 | recurrence relation master theorem | 1 | What kind of recurrence relations has p < 0? -- (recurrence relation master theorem)
<p>By the master method, 
$T(n) = aT(\frac {n}{b})+\Theta(n^k\log^pn)$
where $p$ is real.</p>

<p>I know $\log^4n=\log(\log(\log(\log n)))$ but how do you calculate something like $\log^pn$ where $p<0$?</p>
 | habedi/stack-exchange-dataset |
35,532 | What is the correct representation of Master Theorem? | <p>What I'm taught in my class -<br></p>

<blockquote>
 <p>$T(n)=aT(\frac{n}{b})+\theta(n^k\log^pn)$<br>
 where $a\geq1$, $b>1$, $k\geq1$ and $p$ is a real number.<br></p>
 
 <ol>
 <li>if $a>b^k$ then, $T(n)=\theta(n^{\log_ab})$</li>
 <li>if $a=b^k$ then,
 <ul>
 <li... | time complexity asymptotics runtime analysis recurrence relation | 1 | What is the correct representation of Master Theorem? -- (time complexity asymptotics runtime analysis recurrence relation)
<p>What I'm taught in my class -<br></p>

<blockquote>
 <p>$T(n)=aT(\frac{n}{b})+\theta(n^k\log^pn)$<br>
 where $a\geq1$, $b>1$, $k\geq1$ and $p$ is a real number.<br></p>
... | habedi/stack-exchange-dataset |
35,543 | Concise way to say "increases with n or some term of n" | <p>I'm writing a thesis proposal and one of the systems involved has unknown complexity. It's not a focus of the proposal, but I wanted to include a line like this, as speculation:</p>

<blockquote>
 <p>Presumably the complexity of each new connection scales with the number of rules.</p>
</blockquote>&... | complexity theory terminology | 1 | Concise way to say "increases with n or some term of n" -- (complexity theory terminology)
<p>I'm writing a thesis proposal and one of the systems involved has unknown complexity. It's not a focus of the proposal, but I wanted to include a line like this, as speculation:</p>

<blockquote>
 <p>Presumably th... | habedi/stack-exchange-dataset |
35,545 | Prove that $\neg 0 = 1$ | <p>Starting from this definition <a href="https://en.wikipedia.org/wiki/Boolean_algebra_%28structure%29#Definition" rel="nofollow">https://en.wikipedia.org/wiki/Boolean_algebra_%28structure%29#Definition</a>, is the following a valid proof that $\neg 0 = 1$?</p>

<p>Instantiate a ∨ ¬a = 1 with a:=0 to get 0 ∨ ¬... | proof techniques boolean algebra | 1 | Prove that $\neg 0 = 1$ -- (proof techniques boolean algebra)
<p>Starting from this definition <a href="https://en.wikipedia.org/wiki/Boolean_algebra_%28structure%29#Definition" rel="nofollow">https://en.wikipedia.org/wiki/Boolean_algebra_%28structure%29#Definition</a>, is the following a valid proof that $\neg 0 = 1$?... | habedi/stack-exchange-dataset |
35,547 | What does it mean for something to be $\prod_x^y$-complete or $\sum_x^y$-complete? | <p>I'm having trouble understanding the definitions for complexity classes in the arithmetic heirarchy, and because of the naming schemes, "Googling" things is somewhat difficult. Can anyone provide me concrete examples of what it means for something to be $\prod_x^y$-complete or $\sum_x^y$-complete, and when we can s... | complexity theory recursion theory | 1 | What does it mean for something to be $\prod_x^y$-complete or $\sum_x^y$-complete? -- (complexity theory recursion theory)
<p>I'm having trouble understanding the definitions for complexity classes in the arithmetic heirarchy, and because of the naming schemes, "Googling" things is somewhat difficult. Can anyone provi... | habedi/stack-exchange-dataset |
35,553 | Minimal complexity for pairing two comparable sets with comparability restrictions | <p>A project at university (whose deadline has passed by now) presented the following problem:</p>

<blockquote>
 <p>Consider two finite sequences of (not necessarily distinct) real
 numbers $a_1,\ldots,a_n$ and $b_1,\ldots,b_n$ such that the $b_k$'s
 are a permutation of the $a_k$'s. The aim is ... | algorithms complexity theory sorting | 1 | Minimal complexity for pairing two comparable sets with comparability restrictions -- (algorithms complexity theory sorting)
<p>A project at university (whose deadline has passed by now) presented the following problem:</p>

<blockquote>
 <p>Consider two finite sequences of (not necessarily distinct) real&... | habedi/stack-exchange-dataset |
35,557 | Was there an attempt to make reusable regular expressions? | <p>In everyday practice I often encounter tasks which would benefit from being able to define aliases for chunks of regular expressions to reuse them later. Typical examples include: parsing a floating point number, a zip code or a telephone number. (Zip code may become particularly unwieldy).</p>

<p>Suppose y... | regular languages regular expressions | 1 | Was there an attempt to make reusable regular expressions? -- (regular languages regular expressions)
<p>In everyday practice I often encounter tasks which would benefit from being able to define aliases for chunks of regular expressions to reuse them later. Typical examples include: parsing a floating point number, a ... | habedi/stack-exchange-dataset |
35,558 | If $T(n+1)=T(n)+\lfloor \sqrt{n+1} \rfloor$ $\forall n\geq 1$, what is $T(m^2)$? | <blockquote>
 <p>$T(n+1)=T(n)+\lfloor \sqrt{n+1} \rfloor$ $\forall n\geq 1$ <br>
 $T(1)=1$<br><br>
 The value of $T(m^2)$ for m ≥ 1 is?
 <br></p>
</blockquote>

<p>Clearly you cannot apply master theorem because it is not of the form $T(n)=aT(\frac{n}{b})+f(n)$<br><br>
So I tried Bac... | asymptotics recurrence relation recursion | 1 | If $T(n+1)=T(n)+\lfloor \sqrt{n+1} \rfloor$ $\forall n\geq 1$, what is $T(m^2)$? -- (asymptotics recurrence relation recursion)
<blockquote>
 <p>$T(n+1)=T(n)+\lfloor \sqrt{n+1} \rfloor$ $\forall n\geq 1$ <br>
 $T(1)=1$<br><br>
 The value of $T(m^2)$ for m ≥ 1 is?
 <br></p>
</blockquote>

... | habedi/stack-exchange-dataset |
35,568 | Regular expression syntax | <p>am a little confused by regular expression to convert to NFAs. 
am actually test using </p>

<p><a href="http://www.regexr.com/" rel="nofollow">http://www.regexr.com/</a></p>

<p>but some of regular expression like </p>

<blockquote>
 <p>a*+ab</p>
</blockquote>

<p>is tha... | finite automata regular expressions | 1 | Regular expression syntax -- (finite automata regular expressions)
<p>am a little confused by regular expression to convert to NFAs. 
am actually test using </p>

<p><a href="http://www.regexr.com/" rel="nofollow">http://www.regexr.com/</a></p>

<p>but some of regular expression like </p>

<... | habedi/stack-exchange-dataset |
35,571 | 3/2 - Approximation probabilistic algorithm for MAX-3-COLOR | <p>I have a textbook question here regarding Max-3-Coloring and need some assistance with it. I have searched for any type of information regarding it but haven't found anything substantial. Here is the question:</p>

<blockquote>
 <p>In MAX-3-COLOR you are given a graph $G=(V,E)$ and your goal is to
 ... | algorithms approximation probabilistic algorithms 3 sat | 1 | 3/2 - Approximation probabilistic algorithm for MAX-3-COLOR -- (algorithms approximation probabilistic algorithms 3 sat)
<p>I have a textbook question here regarding Max-3-Coloring and need some assistance with it. I have searched for any type of information regarding it but haven't found anything substantial. Here is ... | habedi/stack-exchange-dataset |
35,573 | Are two non-Turing-recognizable languages closed under union? | <p>If I have two languages that aren't Turing-recognizable, is the union between them always not T-recognizable? Why?</p>
 | turing machines | 1 | Are two non-Turing-recognizable languages closed under union? -- (turing machines)
<p>If I have two languages that aren't Turing-recognizable, is the union between them always not T-recognizable? Why?</p>
 | habedi/stack-exchange-dataset |
35,577 | Kleene closure, concatenation problem | <p>If $L_1 = \emptyset$ , $L_2= \{a\}$
then what is $$L_1\cdot L_2^* \cup L_1^*$$</p>

<p>The answer given is $\{\epsilon\}$ but I think it should be $\{\epsilon,a\}$.
My Approach :<br> 
$L_1^* = \{\epsilon\}$ <br>
$L_2^* = \{\epsilon,a\}$ <br>
$L_1\cdot L_2^* = \{\epsilon,a\}$ <br>
$L_1... | formal languages regular languages | 1 | Kleene closure, concatenation problem -- (formal languages regular languages)
<p>If $L_1 = \emptyset$ , $L_2= \{a\}$
then what is $$L_1\cdot L_2^* \cup L_1^*$$</p>

<p>The answer given is $\{\epsilon\}$ but I think it should be $\{\epsilon,a\}$.
My Approach :<br> 
$L_1^* = \{\epsilon\}$ <br>
$L_... | habedi/stack-exchange-dataset |
35,581 | Min-Max number of shifts and reductions in bottom-up parser | <p>Given the Grammar has no unit or ɛ-productions,<br>
What is minimum & maximum number of shifts and reduce needed by bottom-up parser?</p>
 | compilers parsers syntax trees | 1 | Min-Max number of shifts and reductions in bottom-up parser -- (compilers parsers syntax trees)
<p>Given the Grammar has no unit or ɛ-productions,<br>
What is minimum & maximum number of shifts and reduce needed by bottom-up parser?</p>
 | habedi/stack-exchange-dataset |
35,600 | Kleene star and Kleene plus | <p>Let $\Sigma$ be an alphabet. Have a look at following definitions frequently used in literature containing Kleene star and Kleene plus.</p>

<p>$\Sigma^* := \Sigma^+ \cup \{\varepsilon\}$<br>
$\Sigma^+ := \Sigma^* \setminus \{\varepsilon\}$</p>

<p>These definitions lead to different sets iff $\v... | formal languages | 1 | Kleene star and Kleene plus -- (formal languages)
<p>Let $\Sigma$ be an alphabet. Have a look at following definitions frequently used in literature containing Kleene star and Kleene plus.</p>

<p>$\Sigma^* := \Sigma^+ \cup \{\varepsilon\}$<br>
$\Sigma^+ := \Sigma^* \setminus \{\varepsilon\}$</p>

<... | habedi/stack-exchange-dataset |
35,607 | Is it true that $FP^{NP[log\cdot n]} = FP^{NP}$ if $P = NP$? | <p>Is it true that $FP^{NP[log\cdot n]} = FP^{NP}$ if $P = NP$?</p>

<p>If I understand the polynomial hierarchy correctly, then, if $P = NP$, all complexity classes collapse to one class. Therefore the above two classes should also be equal.</p>
 | complexity theory complexity classes | 1 | Is it true that $FP^{NP[log\cdot n]} = FP^{NP}$ if $P = NP$? -- (complexity theory complexity classes)
<p>Is it true that $FP^{NP[log\cdot n]} = FP^{NP}$ if $P = NP$?</p>

<p>If I understand the polynomial hierarchy correctly, then, if $P = NP$, all complexity classes collapse to one class. Therefore the above ... | habedi/stack-exchange-dataset |
35,610 | Space penalties for the simulation of a non-deterministic Turing machine by a single-tape deterministic Turing machine | <p>If I have some non-deterministic Turing machine $NDTM$ running some process $Q$ and I wish to simulate the same process $Q$ with a deterministic single-tape Turing machine $DTM$, there will of course be an exponential slowdown. However, what penalty can one expect in terms of space resources? Unless one has access... | turing machines space complexity nondeterminism | 1 | Space penalties for the simulation of a non-deterministic Turing machine by a single-tape deterministic Turing machine -- (turing machines space complexity nondeterminism)
<p>If I have some non-deterministic Turing machine $NDTM$ running some process $Q$ and I wish to simulate the same process $Q$ with a deterministic ... | habedi/stack-exchange-dataset |
35,612 | Big Omega of 3-Sum Algorithm | <p>An optimized algorithm for the 3-sum problem with an input array <code>N</code> has
<code>O(N^2logN)</code> however I read that the Big Omega for this algorithm could be Omega(N) because you have to touch all entries once. But to me this doesn't make sense.</p>

<p>If you have to perform the 3-sum operat... | time complexity asymptotics arrays | 1 | Big Omega of 3-Sum Algorithm -- (time complexity asymptotics arrays)
<p>An optimized algorithm for the 3-sum problem with an input array <code>N</code> has
<code>O(N^2logN)</code> however I read that the Big Omega for this algorithm could be Omega(N) because you have to touch all entries once. But to me this doesn'... | habedi/stack-exchange-dataset |
35,614 | How does time/space complexity work with lisp | <p>I'm completely new to programming but I've had a course in computational complexity. I'm trying to read the book "Structure and Interpretation of Computer Programs." In the first few sections, the authors make some claims about the relative efficiency of tree recursive and iterative processes. I find it a little ... | lisp | 1 | How does time/space complexity work with lisp -- (lisp)
<p>I'm completely new to programming but I've had a course in computational complexity. I'm trying to read the book "Structure and Interpretation of Computer Programs." In the first few sections, the authors make some claims about the relative efficiency of tree... | habedi/stack-exchange-dataset |
35,622 | Average case algorithm analysis using Kolmogorov Incompressibility Method | <p>The Incompressibility Method is said to simplify the analysis of algorithms for the average case. From what I understand, this is because there is no need to compute all of the possible combinations of input for that algorithm and then derive an average complexity. Instead, a single incompressible string is taken as... | algorithm analysis kolmogorov complexity | 1 | Average case algorithm analysis using Kolmogorov Incompressibility Method -- (algorithm analysis kolmogorov complexity)
<p>The Incompressibility Method is said to simplify the analysis of algorithms for the average case. From what I understand, this is because there is no need to compute all of the possible combination... | habedi/stack-exchange-dataset |
35,623 | what is the best way to approach the construction of nondeterministic PDA's? | <p>I'm trying to construct a PDA for $L = \{w0^i1^j \mid w\text{ ends in } 01 \wedge 2i=3j\}$. My understanding is that I have to first accept an arbitrary number of zeros and ones and then nondeterministically guess "$01$" in $w$, however I am stuck with the rest. I understand the condition $i/3=j/2$, but how do ... | formal languages context free pushdown automata | 1 | what is the best way to approach the construction of nondeterministic PDA's? -- (formal languages context free pushdown automata)
<p>I'm trying to construct a PDA for $L = \{w0^i1^j \mid w\text{ ends in } 01 \wedge 2i=3j\}$. My understanding is that I have to first accept an arbitrary number of zeros and ones and then ... | habedi/stack-exchange-dataset |
35,634 | Closed-form solution to recurrence equation | <p>I have a recurrence relation of the form:</p>

<p>$f(0) = f(1) = 1, f(2) = 2$ (initial conditions).</p>

<p>$f(2n) = f(n+1) + f(n) + n$ for $n>1$.</p>

<p>$f(2n+1) = f(n) + f(n-1) + 1$ for $n>1$.</p>

<p>I have been able to simplify this equation a little bit, but I can't seem t... | recurrence relation | 1 | Closed-form solution to recurrence equation -- (recurrence relation)
<p>I have a recurrence relation of the form:</p>

<p>$f(0) = f(1) = 1, f(2) = 2$ (initial conditions).</p>

<p>$f(2n) = f(n+1) + f(n) + n$ for $n>1$.</p>

<p>$f(2n+1) = f(n) + f(n-1) + 1$ for $n>1$.</p>

<p>I have... | habedi/stack-exchange-dataset |
35,651 | Automaton accepting $\{a^{2i}bc^{2k} \mid i, k \in\mathbb{N}\}$ | <p>How can I produce an automaton accepting $\{a^{2i}bc^{2k} \mid i, k \in\mathbb{N}\}$? I am essentially confused about exactly what the $2i$ and $2k$ mean. Does that mean that the automaton only accepts strings where the number of $a$'s and $b$'s are multiples of $2$ and there is one occurrence of $b$ between $a$ and... | regular languages finite automata | 1 | Automaton accepting $\{a^{2i}bc^{2k} \mid i, k \in\mathbb{N}\}$ -- (regular languages finite automata)
<p>How can I produce an automaton accepting $\{a^{2i}bc^{2k} \mid i, k \in\mathbb{N}\}$? I am essentially confused about exactly what the $2i$ and $2k$ mean. Does that mean that the automaton only accepts strings wher... | habedi/stack-exchange-dataset |
35,665 | Can the effective branching factor be negative? | <p>I've implemented A* algorithm in Python, after that I calculated <strong>the effective branching factor $ B^* $</strong></p>

<p>$$ T+1=1+B^*+(B^*)^2+\dots +(B^*)^L$$</p>

<p>where $T$ is the number of expanded nodes.</p>

<p>My question is: is it possible in theory that the effective branchi... | algorithms artificial intelligence search algorithms branch and bound | 1 | Can the effective branching factor be negative? -- (algorithms artificial intelligence search algorithms branch and bound)
<p>I've implemented A* algorithm in Python, after that I calculated <strong>the effective branching factor $ B^* $</strong></p>

<p>$$ T+1=1+B^*+(B^*)^2+\dots +(B^*)^L$$</p>

<p>whe... | habedi/stack-exchange-dataset |
35,667 | What do CS students face in their school exams? | <p>To what degree does learning computer science require memorisation?</p>

<p>I know this depends on subjects and maybe things are different in each college but could someone put an example, e.g. In Xxx class, I had to answer this question or accomplished this task. I was/wasn't allowed to use books or notes.<... | books | 1 | What do CS students face in their school exams? -- (books)
<p>To what degree does learning computer science require memorisation?</p>

<p>I know this depends on subjects and maybe things are different in each college but could someone put an example, e.g. In Xxx class, I had to answer this question or accomplis... | habedi/stack-exchange-dataset |
35,687 | Shortest walk that covers $k$ nodes | <p>I have the following problem, I would like to know an efficient algorithm to solve it.</p>

<p>Suppose I have a weighted graph $G$ and a set of vertices $K$, I want to find a walk which starts at a vertex $s$ and visits at least once every vertex of $K$ such that the distance is minimized.</p>

<p>Th... | algorithms graphs np hard shortest path | 1 | Shortest walk that covers $k$ nodes -- (algorithms graphs np hard shortest path)
<p>I have the following problem, I would like to know an efficient algorithm to solve it.</p>

<p>Suppose I have a weighted graph $G$ and a set of vertices $K$, I want to find a walk which starts at a vertex $s$ and visits at least... | habedi/stack-exchange-dataset |
35,697 | Variant to the Vertex Cover Problem | <p>Suppose that we are given an undirected graph, and we know that the maximum edges covered by $k$ vertices is $n$. If we let the greedy algorithm choose these $k$ vertices for us, I am told that it is capable of covering at least $n/2$ edges. Is there a way to prove this? If so, how should it be done?</p>

<p... | algorithms graph algorithms | 1 | Variant to the Vertex Cover Problem -- (algorithms graph algorithms)
<p>Suppose that we are given an undirected graph, and we know that the maximum edges covered by $k$ vertices is $n$. If we let the greedy algorithm choose these $k$ vertices for us, I am told that it is capable of covering at least $n/2$ edges. Is the... | habedi/stack-exchange-dataset |
35,698 | Constructing non intersecting segments from distinct sets of points | <p>Given 2 sets of points in the plane, $A$ and $B$, each of size $n$,
I need to construct n line segments of the form ($a$–$b$) ($a$ in $A$, $b$ in $B$) such that none of them intersect. </p>

<p>The coordinates are comparable signed reals (no constraints here about that) and no 3 points are on the ... | algorithms computational geometry | 1 | Constructing non intersecting segments from distinct sets of points -- (algorithms computational geometry)
<p>Given 2 sets of points in the plane, $A$ and $B$, each of size $n$,
I need to construct n line segments of the form ($a$–$b$) ($a$ in $A$, $b$ in $B$) such that none of them intersect. </p>

... | habedi/stack-exchange-dataset |
35,704 | Perform an operation on an array in O(n) | <p>I'm required to perform the following operation on an array in O(n): P[1..n] is an array of positive integers. For each index 'i' in the array, I must find how many "cells" I can advance toward the beginning of the array until I reach an element whose value is greater than P[i], or reach the beginning of the array. ... | algorithms arrays | 1 | Perform an operation on an array in O(n) -- (algorithms arrays)
<p>I'm required to perform the following operation on an array in O(n): P[1..n] is an array of positive integers. For each index 'i' in the array, I must find how many "cells" I can advance toward the beginning of the array until I reach an element whose v... | habedi/stack-exchange-dataset |
35,706 | What do I need to study in order to understand and design a programming language? | <p>What do I need to read in in order to : </p>

<ol>
<li>understand the specs of an already made programming language</li>
<li>Design a programming language</li>
<li>Design a compiler and assembler for that language</li>
<li>make an architecture of a processor</li>
</ol>
 | programming languages compilers semantics interpreters syntax | 1 | What do I need to study in order to understand and design a programming language? -- (programming languages compilers semantics interpreters syntax)
<p>What do I need to read in in order to : </p>

<ol>
<li>understand the specs of an already made programming language</li>
<li>Design a programming langua... | habedi/stack-exchange-dataset |
35,711 | Size of framebuffer lookup table | <blockquote>
 <p>If the frame buffer has 8 bits per pixel and 8 bits are allocated for each of the R, G, B components, what would be the size of the
 lookup table?
 a) 24 bytes
 b) 1024 bytes
 c) 768 bytes
 d) 256 bytes </p>
</blockquote>

<p>I read about <... | memory management | 1 | Size of framebuffer lookup table -- (memory management)
<blockquote>
 <p>If the frame buffer has 8 bits per pixel and 8 bits are allocated for each of the R, G, B components, what would be the size of the
 lookup table?
 a) 24 bytes
 b) 1024 bytes
 c) 768 bytes
 d) 256... | habedi/stack-exchange-dataset |
35,720 | A Proof for NP-completeness | <p>I think the following question is a mix of the Traveling Salesman Problem and the Subset-sum Problem, which makes it really hard (for me) to solve... .</p>
<p>The problem is stated as follows:</p>
<blockquote>
<p>There are a total of <span class="math-container">$n$</span> cities.</p>
<p>The salesman... | complexity theory np complete graph algorithms | 1 | A Proof for NP-completeness -- (complexity theory np complete graph algorithms)
<p>I think the following question is a mix of the Traveling Salesman Problem and the Subset-sum Problem, which makes it really hard (for me) to solve... .</p>
<p>The problem is stated as follows:</p>
<blockquote>
<p>There are a ... | habedi/stack-exchange-dataset |
35,722 | Maximum I/O Data Transfer if DMA is used | <p>I was reading lecture notes of <a href="http://portal.unimap.edu.my/portal/page/portal30/Lecturer%20Notes/KEJURUTERAAN_KOMPUTER/Semester%201%20Sidang%20Akademik%2020102011/EKT%20423%20Operating%20System/Others/Tutorial_1_Ans.pdf" rel="nofollow">Universiti Malaysia Perlis</a> when I am came across following question:... | operating systems memory hardware | 1 | Maximum I/O Data Transfer if DMA is used -- (operating systems memory hardware)
<p>I was reading lecture notes of <a href="http://portal.unimap.edu.my/portal/page/portal30/Lecturer%20Notes/KEJURUTERAAN_KOMPUTER/Semester%201%20Sidang%20Akademik%2020102011/EKT%20423%20Operating%20System/Others/Tutorial_1_Ans.pdf" rel="no... | habedi/stack-exchange-dataset |
35,723 | Can Shortest Job First Scheduling be subject to convoy effect? | <p>Look at the below table for example :<br>
<img src="https://i.stack.imgur.com/3VAWz.png" alt="enter image description here"></p>

<p>Look at the <strong>Non-Preemptive SJF</strong> table<br>
Suppose if the <strong><em>burst time</em></strong> of process $P_1$ was a very large number compared to $7$, ... | operating systems scheduling process scheduling | 1 | Can Shortest Job First Scheduling be subject to convoy effect? -- (operating systems scheduling process scheduling)
<p>Look at the below table for example :<br>
<img src="https://i.stack.imgur.com/3VAWz.png" alt="enter image description here"></p>

<p>Look at the <strong>Non-Preemptive SJF</strong> table<br... | habedi/stack-exchange-dataset |
35,730 | Why is it that the transition function for DPDA's only works for 1 alphabet symbol, and 1 stack symbol? | <p>Why is it that the transition function for DPDA's only works for 1 alphabet symbol, and 1 stack symbol? Say f is the transition function, why does having</p>

<pre><code>f(qi, 1, 0) -> (qj, 0)
f(qi, epsilon, 0) -> (qj, 0)
</code></pre>

<p>cause nondeterminism?</p>

<p>I w... | finite automata pushdown automata nondeterminism | 1 | Why is it that the transition function for DPDA's only works for 1 alphabet symbol, and 1 stack symbol? -- (finite automata pushdown automata nondeterminism)
<p>Why is it that the transition function for DPDA's only works for 1 alphabet symbol, and 1 stack symbol? Say f is the transition function, why does having</p>&#... | habedi/stack-exchange-dataset |
35,739 | Computing FOLLOW sets for LL(1) grammar. Stuck on question | <blockquote>
 <p>Calculate the FOLLOW sets for all the non terminals:</p>
 
 <p>$S \rightarrow bEx \mid Db \mid b \mid F$</p>
 
 <p>$D \rightarrow EDc \mid Y$ </p>
 
 <p>$E \rightarrow dED \mid dDY$</p>
 
 <p>$Y \rightarrow ab \mid aDx \mid \varepsilon$</p>
</blockquote>... | formal grammars compilers parsers | 1 | Computing FOLLOW sets for LL(1) grammar. Stuck on question -- (formal grammars compilers parsers)
<blockquote>
 <p>Calculate the FOLLOW sets for all the non terminals:</p>
 
 <p>$S \rightarrow bEx \mid Db \mid b \mid F$</p>
 
 <p>$D \rightarrow EDc \mid Y$ </p>
 
 <p>$E \rightarrow dE... | habedi/stack-exchange-dataset |
35,743 | 2's complement addition with ZF/Carry/Overflow | <blockquote>
 <p>Consider addition of two numbers when CPU uses $2's$ complement form:
 $$ 1\ 1\ 0\ 0\ 0\ 0\ 1\ 1\\0\ 1\ 0\ 0\ 1\ 1\ 0\ 0\\-------\\0\ 0\ 0\
 0\ 1\ 1\ 1\ 1\\------- $$</p>
</blockquote>

<p>$$Carry\ = 1,\
Overflow = 0, \ Zero Flag = 0$$ </p>

<p><strong>My Reasonin... | computer architecture | 1 | 2's complement addition with ZF/Carry/Overflow -- (computer architecture)
<blockquote>
 <p>Consider addition of two numbers when CPU uses $2's$ complement form:
 $$ 1\ 1\ 0\ 0\ 0\ 0\ 1\ 1\\0\ 1\ 0\ 0\ 1\ 1\ 0\ 0\\-------\\0\ 0\ 0\
 0\ 1\ 1\ 1\ 1\\------- $$</p>
</blockquote>

<p>$$Carry\ = 1,\... | habedi/stack-exchange-dataset |
35,744 | What is the difference between variables and pointers? | <p>Whist reading an article outlining differences in <a href="http://blog.cleancoder.com/uncle-bob/2014/11/24/FPvsOO.html">OO and Functional programming</a> I came across function pointers. It has been a while since I completed my Computer Science degree (2003) and so I looked up pointers to refresh my memory. </p>
... | terminology programming languages | 1 | What is the difference between variables and pointers? -- (terminology programming languages)
<p>Whist reading an article outlining differences in <a href="http://blog.cleancoder.com/uncle-bob/2014/11/24/FPvsOO.html">OO and Functional programming</a> I came across function pointers. It has been a while since I complete... | habedi/stack-exchange-dataset |
35,749 | Proving Infinite Turing Machine Language (with finite subset) is Recursively Enumerable | <p>I'm trying to answer this question:</p>
<blockquote>
<p>Let <span class="math-container">$S$</span> be the strings <span class="math-container">$\langle P \rangle$</span> accepted by the Turing Machine <span class="math-container">$P$</span> with input alphabet <span class="math-container">$\{a,b\}$</span>, ... | computability turing machines semi decidability | 1 | Proving Infinite Turing Machine Language (with finite subset) is Recursively Enumerable -- (computability turing machines semi decidability)
<p>I'm trying to answer this question:</p>
<blockquote>
<p>Let <span class="math-container">$S$</span> be the strings <span class="math-container">$\langle P \rangle$</spa... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.