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 |
|---|---|---|---|---|---|---|
63,184 | How does O transform this sum like that? | <p>I'm in the process of self-studying the CLRS book. My mathematical background is poor so I'm trying to learn the maths as I go along too.</p>

<p>I don't understand the math in CLRS section 6.4 where they go from:</p>

<p>$$ \sum_{h=0}^{\lg n} \frac{n}{2^{h+1}} O(h) $$</p>

<p>to:</p>
&#x... | asymptotics landau notation | 1 | How does O transform this sum like that? -- (asymptotics landau notation)
<p>I'm in the process of self-studying the CLRS book. My mathematical background is poor so I'm trying to learn the maths as I go along too.</p>

<p>I don't understand the math in CLRS section 6.4 where they go from:</p>

<p>$$ \s... | habedi/stack-exchange-dataset |
63,189 | Prove Θ(n) + O(n^2) ≠ Θ(n^2) | <p>How would I go about proving this statement?</p>

<pre><code>Θ(n) + O(n^2) ≠ Θ(n^2)
</code></pre>

<p>I know how to prove if given a function f(n) if it's big o but I do not understand how to go about this type of problem.</p>
 | asymptotics | 1 | Prove Θ(n) + O(n^2) ≠ Θ(n^2) -- (asymptotics)
<p>How would I go about proving this statement?</p>

<pre><code>Θ(n) + O(n^2) ≠ Θ(n^2)
</code></pre>

<p>I know how to prove if given a function f(n) if it's big o but I do not understand how to go about this type of problem.</p>
 | habedi/stack-exchange-dataset |
63,195 | How come the branching factor of chess is 35? | <p>I was studying about minmax algorithms and it said the branching factor of a chess game is around average 35. Meaning a player can move about 35 legal moves per position.</p>

<p>I am not able to comprehend this.Like if I do the opening in chess I was able to count 20 possible legal moves.(1 or 2 possible mo... | artificial intelligence | 1 | How come the branching factor of chess is 35? -- (artificial intelligence)
<p>I was studying about minmax algorithms and it said the branching factor of a chess game is around average 35. Meaning a player can move about 35 legal moves per position.</p>

<p>I am not able to comprehend this.Like if I do the openi... | habedi/stack-exchange-dataset |
63,199 | Kripke Models - evaluating the meaning of $\Box\Box p$ | <p>In Kripke models the evaluation of $x \vdash \Box p$ would be that every world reachable from $x$ satisfies $p$. </p>

<p>But how would the truth of $\Box\Box p$ be evaluated in Kripke models?</p>
 | logic modal logic | 1 | Kripke Models - evaluating the meaning of $\Box\Box p$ -- (logic modal logic)
<p>In Kripke models the evaluation of $x \vdash \Box p$ would be that every world reachable from $x$ satisfies $p$. </p>

<p>But how would the truth of $\Box\Box p$ be evaluated in Kripke models?</p>
 | habedi/stack-exchange-dataset |
63,203 | Why is C's void type not analogous to the empty/bottom type? | <p>Wikipedia as well as other sources that I have found list C's <code>void</code> type as a unit type as opposed to an empty type. I find this confusing as it seems to me that <code>void</code> better fits the definition of an empty/bottom type.</p>

<ul>
<li>No values inhabit <code>void</code>, as far as ... | type theory c | 1 | Why is C's void type not analogous to the empty/bottom type? -- (type theory c)
<p>Wikipedia as well as other sources that I have found list C's <code>void</code> type as a unit type as opposed to an empty type. I find this confusing as it seems to me that <code>void</code> better fits the definition of an empty/bottom... | habedi/stack-exchange-dataset |
63,206 | Given an arbitrary language, how does one go about proving that it is recursive or otherwise? | <p>I am having problems knowing how to prove a language is recursive or not. Is there a particular general strategy is used for such a problem, or possibly some principle which is often used?</p>

<p>Thanks very much in advance.</p>
 | complexity theory formal languages computability turing machines | 1 | Given an arbitrary language, how does one go about proving that it is recursive or otherwise? -- (complexity theory formal languages computability turing machines)
<p>I am having problems knowing how to prove a language is recursive or not. Is there a particular general strategy is used for such a problem, or possibly ... | habedi/stack-exchange-dataset |
63,215 | Algorithm for recovering paired lists when elements are broken | <p>I am trying to solve an algorithmic problem. I came from <a href="http://math.stackexchange.com">http://math.stackexchange.com</a> upon an advise that this forum would be a better place to ask this.</p>

<p>I would like to hear your advice on where to search for hints. If my problem has got a name, I would... | algorithms strings | 1 | Algorithm for recovering paired lists when elements are broken -- (algorithms strings)
<p>I am trying to solve an algorithmic problem. I came from <a href="http://math.stackexchange.com">http://math.stackexchange.com</a> upon an advise that this forum would be a better place to ask this.</p>

<p>I would like t... | habedi/stack-exchange-dataset |
63,216 | The complexity of the algorithm with loops | <p>I have algorithm that contains next loops:</p>

<pre><code>for (int i = 0; i < size; ++i) {

 for (int j = i + 1; j < size; ++j) {
 //Do stuff
 }
}
</code></pre>

<p>I found that this algorithm has $O(n^2)$ complexity but I can't understand why? I.e. if $N =... | algorithm analysis runtime analysis | 1 | The complexity of the algorithm with loops -- (algorithm analysis runtime analysis)
<p>I have algorithm that contains next loops:</p>

<pre><code>for (int i = 0; i < size; ++i) {

 for (int j = i + 1; j < size; ++j) {
 //Do stuff
 }
}
</code></pre>

<p>I found ... | habedi/stack-exchange-dataset |
63,218 | How to estimate maximum n given complexity and amount of time? | <p>Say you've implemented a program that completes it's work with O(2<sup>n</sup>) time complexity, and you measure the actual running time of the program as:</p>

<ul>
<li>n<sub>1</sub>: 0.006s</li>
<li>n<sub>100,000</sub>: 16.057s</li>
</ul>

<p>Since time will grow exponentially as n incr... | algorithm analysis runtime analysis | 1 | How to estimate maximum n given complexity and amount of time? -- (algorithm analysis runtime analysis)
<p>Say you've implemented a program that completes it's work with O(2<sup>n</sup>) time complexity, and you measure the actual running time of the program as:</p>

<ul>
<li>n<sub>1</sub>: 0.006s</li>
... | habedi/stack-exchange-dataset |
63,236 | How does RAM is shared in multi core environment? | <p>I learnt that multi core processors have more than one processing units( i.e. the main executing units ALU etc.) and they are better at performance. I want to know how they share Physical memory. I'll take following example to make my question clearer - Say, There is a memory location M in physical memory and Two th... | memory management memory access threads cpu | 1 | How does RAM is shared in multi core environment? -- (memory management memory access threads cpu)
<p>I learnt that multi core processors have more than one processing units( i.e. the main executing units ALU etc.) and they are better at performance. I want to know how they share Physical memory. I'll take following ex... | habedi/stack-exchange-dataset |
63,240 | What does Sigma notation mean, in the context of computability of functions? | <p>I was reading a paper on the computability of AIXI [1] and came across the notion of $\Sigma^0_n$-computability for real-valued functions in section 2.3. </p>

<p>I'd like to read about this in more detail.
Unfortunately I couldn't find this definition anywhere else in the literature. I already checked t... | computability reference request computable analysis | 1 | What does Sigma notation mean, in the context of computability of functions? -- (computability reference request computable analysis)
<p>I was reading a paper on the computability of AIXI [1] and came across the notion of $\Sigma^0_n$-computability for real-valued functions in section 2.3. </p>

<p>I'd like to ... | habedi/stack-exchange-dataset |
63,255 | Output cycle found by DFS | <p>We can use DFS to find a cycle in a given graph. The idea is that a cycle exists if we can find back edge in the graph. First I just want to detect if a cycle exists, if so return true else false. Here is what I have got so far:</p>

<pre><code>DFS(G,s)
 for all v in V do
 color[v] <- white; p... | algorithms graphs graph traversal searching | 1 | Output cycle found by DFS -- (algorithms graphs graph traversal searching)
<p>We can use DFS to find a cycle in a given graph. The idea is that a cycle exists if we can find back edge in the graph. First I just want to detect if a cycle exists, if so return true else false. Here is what I have got so far:</p>

... | habedi/stack-exchange-dataset |
63,264 | What does tilde mean, in big-O notation? | <p>I'm reading a paper, and it says in its time complexity description that time complexity is $\tilde{O}(2^{2n})$.</p>

<p>I have searched the internet and wikipedia, but I can't find what this tilde signifies in big-O/Landau notation. In the paper itself I have also found no clue about this. What does $\tild... | landau notation | 1 | What does tilde mean, in big-O notation? -- (landau notation)
<p>I'm reading a paper, and it says in its time complexity description that time complexity is $\tilde{O}(2^{2n})$.</p>

<p>I have searched the internet and wikipedia, but I can't find what this tilde signifies in big-O/Landau notation. In the paper ... | habedi/stack-exchange-dataset |
63,269 | Find unambiguous grammar for an ambiguous grammar | <p>Hi I want to find an unambiguous grammar for a known ambiguous one, and the production is like this:</p>

<pre><code>S->bA|aB
A->a|aS|bAA
B->b|bS|aBB
</code></pre>

<p>I have found the string to prove this grammar is ambiguous: bbaaba. I wonder whether it is doable to convert the... | formal grammars ambiguity | 1 | Find unambiguous grammar for an ambiguous grammar -- (formal grammars ambiguity)
<p>Hi I want to find an unambiguous grammar for a known ambiguous one, and the production is like this:</p>

<pre><code>S->bA|aB
A->a|aS|bAA
B->b|bS|aBB
</code></pre>

<p>I have found the string to prov... | habedi/stack-exchange-dataset |
63,270 | History/Etymology- Map/[Hash]Map vs map() | <p>Forgive me/delete this question if it doesn't qualify as Computer Science:</p>

<p>I've always wondered about the relationship between Map the data structure and map() the function. I know they are two different things. Why share the name?</p>
 | data structures | 1 | History/Etymology- Map/[Hash]Map vs map() -- (data structures)
<p>Forgive me/delete this question if it doesn't qualify as Computer Science:</p>

<p>I've always wondered about the relationship between Map the data structure and map() the function. I know they are two different things. Why share the name?</p>&#x... | habedi/stack-exchange-dataset |
63,279 | Decision problems: Does a "constant" characteristic function describe a language in P? | <p>I am new to complexity theory and I have some maybe stupid questions:</p>

<p>Are "decision problems" with the characteristic functions x(t)=1 or x(t)=0 "decision problems" or not?</p>

<p>If yes: Are the corresponding formal languages members of P or not?</p>

<p>(The calculation time needed... | complexity theory np complete | 1 | Decision problems: Does a "constant" characteristic function describe a language in P? -- (complexity theory np complete)
<p>I am new to complexity theory and I have some maybe stupid questions:</p>

<p>Are "decision problems" with the characteristic functions x(t)=1 or x(t)=0 "decision problems" or not?</p>&#x... | habedi/stack-exchange-dataset |
63,284 | Minor Mistake in Computability, Complexity, and Languages? | <p>In the book <em>Computability, Complexity, and Languages</em> (2<sup>nd</sup> edition), Martin Davis writes in chapter 1 (Preliminaries), section 2 (Functions):</p>

<blockquote>
 <p>A <em>partial function on a set</em> $S$ is simply a function whose domain is a subset of $S$. An example of a <strong>pa... | mathematical foundations | 1 | Minor Mistake in Computability, Complexity, and Languages? -- (mathematical foundations)
<p>In the book <em>Computability, Complexity, and Languages</em> (2<sup>nd</sup> edition), Martin Davis writes in chapter 1 (Preliminaries), section 2 (Functions):</p>

<blockquote>
 <p>A <em>partial function on a set<... | habedi/stack-exchange-dataset |
63,294 | What is the optimal substructure for this greedy-algorithm solvable problem (Domino Piling)? | <p>On Codeforces, the first problem that comes up for the tag "greedy" is "50A: Domino Piling". Here is the problem:</p>

<blockquote>
 <p>You are given a rectangular board of M × N squares. Also you are given an unlimited number of standard domino pieces of 2 × 1 squares. You are allowed to rotate the pie... | algorithms greedy algorithms | 1 | What is the optimal substructure for this greedy-algorithm solvable problem (Domino Piling)? -- (algorithms greedy algorithms)
<p>On Codeforces, the first problem that comes up for the tag "greedy" is "50A: Domino Piling". Here is the problem:</p>

<blockquote>
 <p>You are given a rectangular board of M × ... | habedi/stack-exchange-dataset |
63,295 | How a computer ensures that a location in RAM is empty | <p>When we declare a variable, how does it get stored in a memory? How does the compiler know from within millions of memory locations which ones are currently not in use or are empty so that it can store the variable there? If it traverses each memory location the whole memory address space and checks on each location... | memory management | 1 | How a computer ensures that a location in RAM is empty -- (memory management)
<p>When we declare a variable, how does it get stored in a memory? How does the compiler know from within millions of memory locations which ones are currently not in use or are empty so that it can store the variable there? If it traverses e... | habedi/stack-exchange-dataset |
63,306 | How do I find the roots of the disconnected subgraphs of a directed graph? | <p>If I have a directed acyclic graph $G(V,E)$, which may consist of several disconnected subgraphs $G_i(V_i,E_i) \subset G(V,E)$, how do I find the root of every subgraph $G_i(V_i,E_i)$?</p>
 | algorithms graphs search algorithms | 1 | How do I find the roots of the disconnected subgraphs of a directed graph? -- (algorithms graphs search algorithms)
<p>If I have a directed acyclic graph $G(V,E)$, which may consist of several disconnected subgraphs $G_i(V_i,E_i) \subset G(V,E)$, how do I find the root of every subgraph $G_i(V_i,E_i)$?</p>
 | habedi/stack-exchange-dataset |
63,309 | Check whether set of strings is prefix-free via lexicographic sort? | <p>I have a set of strings and would like to establish whether the set has the <a href="https://en.wikipedia.org/wiki/Prefix_code" rel="nofollow noreferrer">prefix property</a>, which basically means that no string in the set is a prefix of any other string in the set. So <code>{a, b}</code> is prefix-free (has the pre... | strings sets substrings | 1 | Check whether set of strings is prefix-free via lexicographic sort? -- (strings sets substrings)
<p>I have a set of strings and would like to establish whether the set has the <a href="https://en.wikipedia.org/wiki/Prefix_code" rel="nofollow noreferrer">prefix property</a>, which basically means that no string in the s... | habedi/stack-exchange-dataset |
63,317 | Mapping graph to another graph's sub-graph | <p>How to solve the induced sub-graph isomorphism problem?</p>
 | algorithms graphs | 1 | Mapping graph to another graph's sub-graph -- (algorithms graphs)
<p>How to solve the induced sub-graph isomorphism problem?</p>
 | habedi/stack-exchange-dataset |
63,327 | Is every undecidable language reducible to any other undecidable language? | <p>For the undecidable languages I have seen so far , I am able to give a reduction from one language to other . Is it the case that every undecidable language is reducible to every other undecidable language?</p>

<p>If not can you prove that there exists 2 undecidable languages A and B such that A is not redu... | computability turing machines reductions undecidability | 1 | Is every undecidable language reducible to any other undecidable language? -- (computability turing machines reductions undecidability)
<p>For the undecidable languages I have seen so far , I am able to give a reduction from one language to other . Is it the case that every undecidable language is reducible to every ot... | habedi/stack-exchange-dataset |
63,353 | A* algorithm how to choose $h(n)$, a heuristic estimation of the cost of node n | <p>I'm trying to understand the A$^*$ search algorithm. I read in <a href="https://en.wikipedia.org/wiki/A*_search_algorithm#Pseudocode" rel="nofollow">wikipedia</a> that A$^*$ chooses nodes based on their cost, calculated as $f(n)=g(n)+h(n)$, where $h(n)$ is a heuristic estimation of the cost to reach the target from ... | algorithms graphs search algorithms | 1 | A* algorithm how to choose $h(n)$, a heuristic estimation of the cost of node n -- (algorithms graphs search algorithms)
<p>I'm trying to understand the A$^*$ search algorithm. I read in <a href="https://en.wikipedia.org/wiki/A*_search_algorithm#Pseudocode" rel="nofollow">wikipedia</a> that A$^*$ chooses nodes based on... | habedi/stack-exchange-dataset |
63,359 | How to solve this graph problem | <p>If we are given an undirected graph and we want to find if the graph can be broken down to two subsets of vertices at maximum and not more than that. The vertices in each set are such that each vertex has edge with all other vertices . A single vertex can also be a part of the subsets formed.</p>

<p>Example... | algorithms algorithm analysis graph algorithms | 1 | How to solve this graph problem -- (algorithms algorithm analysis graph algorithms)
<p>If we are given an undirected graph and we want to find if the graph can be broken down to two subsets of vertices at maximum and not more than that. The vertices in each set are such that each vertex has edge with all other vertices... | habedi/stack-exchange-dataset |
63,361 | Algorithm Time complexity analysis for algorithm having two different time complexities | <p>I'm implementing an algorithm that analyze several properties on large set of integers, the time complexity is bound to $N$ (set length) and $M$ (bits to represent the numbers). I'm having some trouble to figure out how to express its time complexity because I don't know how to handle next situation:</p>

<p... | algorithm analysis asymptotics | 1 | Algorithm Time complexity analysis for algorithm having two different time complexities -- (algorithm analysis asymptotics)
<p>I'm implementing an algorithm that analyze several properties on large set of integers, the time complexity is bound to $N$ (set length) and $M$ (bits to represent the numbers). I'm having some... | habedi/stack-exchange-dataset |
63,363 | What are common formal techniques for proving functional code correct? | <p>I want to provide proofs for parts of a Haskell program I'm writing as part of my thesis. So far however, I failed to find a good reference work. </p>

<p><em>Graham Hutton's</em> introductory book <em>Programming in Haskell</em> (<a href="https://books.google.de/books?id=1xHPDAAAQBAJ&printsec=frontcover... | reference request proof techniques functional programming books software verification | 1 | What are common formal techniques for proving functional code correct? -- (reference request proof techniques functional programming books software verification)
<p>I want to provide proofs for parts of a Haskell program I'm writing as part of my thesis. So far however, I failed to find a good reference work. </p>
... | habedi/stack-exchange-dataset |
63,374 | Why neural nets are split into layers? | <p>Why is every artificial neural network layered? Why isn't each node just a separate process?</p>
 | neural networks | 1 | Why neural nets are split into layers? -- (neural networks)
<p>Why is every artificial neural network layered? Why isn't each node just a separate process?</p>
 | habedi/stack-exchange-dataset |
63,383 | How do I approach inductive design problems with no information or context given? | <p>As a starting point for our course in Artificial Intelligence, we are being taught induction. We received a number of homework assignments where we have to show our inductive approach for a given problem.</p>

<p>An example of such a problem: "Sort an array of N numbers".</p>

<p>Reading through the ... | sorting induction towers of hanoi | 1 | How do I approach inductive design problems with no information or context given? -- (sorting induction towers of hanoi)
<p>As a starting point for our course in Artificial Intelligence, we are being taught induction. We received a number of homework assignments where we have to show our inductive approach for a given ... | habedi/stack-exchange-dataset |
63,386 | Show this function is partially computable | <p>Let B(x) be a computable predicate. Show that 
\begin{equation}
G_B(r)=
\begin{cases}
1 \;\;\;\;\;\text{ if there are at least r numbers n such that B(k) = 1 } \\
\uparrow \;\;\;\;\; \text{ otherwise}
\end{cases}
\end{equation}
I want to write a program with just these four instructi... | computability computation models | 1 | Show this function is partially computable -- (computability computation models)
<p>Let B(x) be a computable predicate. Show that 
\begin{equation}
G_B(r)=
\begin{cases}
1 \;\;\;\;\;\text{ if there are at least r numbers n such that B(k) = 1 } \\
\uparrow \;\;\;\;\; \text{ otherwise}
\end{cases... | habedi/stack-exchange-dataset |
63,391 | Proof of equality with destructuring let...in | <p>I have some expression (<code>f n</code> in the example below) returning a tuple. I would like to prove that <code>f n</code> is equal to <code>let (x, y) := f n in (x, y)</code>, which seems like it should be easy. <strong>What tactic should I use?</strong></p>

<pre><code>Definition f (n : nat) : nat * n... | coq | 1 | Proof of equality with destructuring let...in -- (coq)
<p>I have some expression (<code>f n</code> in the example below) returning a tuple. I would like to prove that <code>f n</code> is equal to <code>let (x, y) := f n in (x, y)</code>, which seems like it should be easy. <strong>What tactic should I use?</strong></... | habedi/stack-exchange-dataset |
63,403 | Is the halting problem decidable for pure programs on an ideal computer? | <p>It's fairly simple to understand why the halting problem is undecidable for impure programs (i.e., ones that have I/O and/or states dependent on the machine-global state); but intuitively, it seems that a pure program's halting on an ideal computer would be decidable through e.g. static analysis.</p>

<p>Is ... | halting problem static analysis | 1 | Is the halting problem decidable for pure programs on an ideal computer? -- (halting problem static analysis)
<p>It's fairly simple to understand why the halting problem is undecidable for impure programs (i.e., ones that have I/O and/or states dependent on the machine-global state); but intuitively, it seems that a pu... | habedi/stack-exchange-dataset |
63,413 | I/O cost to traverse a tree stored in preorder form | <p>Let <code>T</code> be a binary tree that is stored in the disk following the preorder layout. </p>

<p>For example if this is $T$:</p>

<p><a href="https://i.stack.imgur.com/xZRPA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xZRPA.png" alt="enter image description here"></a></p>... | algorithm analysis data structures binary trees graph traversal | 1 | I/O cost to traverse a tree stored in preorder form -- (algorithm analysis data structures binary trees graph traversal)
<p>Let <code>T</code> be a binary tree that is stored in the disk following the preorder layout. </p>

<p>For example if this is $T$:</p>

<p><a href="https://i.stack.imgur.com/xZRPA.... | habedi/stack-exchange-dataset |
63,414 | Relationship between Coloring a graph and its complement | <p>Let $G = (V, E)$ be a graph and $G^*$ its edge complement (that is, $G^* = (V, E^*)$, where an edge $\{u, v\} \in E^* \Leftrightarrow \{u, v\} \not \in E$).</p>

<p>What is the relationship between a coloring in $G$ and a coloring in $G^*$ ?</p>

<p>I was expecting something like</p>

<p>"If ... | graphs colorings | 1 | Relationship between Coloring a graph and its complement -- (graphs colorings)
<p>Let $G = (V, E)$ be a graph and $G^*$ its edge complement (that is, $G^* = (V, E^*)$, where an edge $\{u, v\} \in E^* \Leftrightarrow \{u, v\} \not \in E$).</p>

<p>What is the relationship between a coloring in $G$ and a coloring... | habedi/stack-exchange-dataset |
63,418 | Is the language of TMs that accept finite languages in $\mathbf{0}'$? | <p>In <a href="https://cs.stackexchange.com/q/49000/2242">this</a> question it is asked, "Is the language of TMs that accept finite languages Turing-recognizable?".
It turns out this language $L=\{ \langle M \rangle \mid |L(M)| < \infty \}$ is not.
I ask this: We know that the halting problem is Turing-reduc... | formal languages computability turing machines undecidability | 1 | Is the language of TMs that accept finite languages in $\mathbf{0}'$? -- (formal languages computability turing machines undecidability)
<p>In <a href="https://cs.stackexchange.com/q/49000/2242">this</a> question it is asked, "Is the language of TMs that accept finite languages Turing-recognizable?".
It turns out t... | habedi/stack-exchange-dataset |
63,422 | Complexity classes pertaining to listing all solutions? | <p>I was reading a question over at Stack Overflow asking whether it was <strong>NP</strong>-hard to list all simple cycles in a graph containing a particular node and it occurred to me that I couldn't think of any existing complexity class that was well-suited for talking about problems of the form "list all solutions... | complexity theory reference request complexity classes enumeration | 1 | Complexity classes pertaining to listing all solutions? -- (complexity theory reference request complexity classes enumeration)
<p>I was reading a question over at Stack Overflow asking whether it was <strong>NP</strong>-hard to list all simple cycles in a graph containing a particular node and it occurred to me that I... | habedi/stack-exchange-dataset |
63,428 | Is there a way to test "Turing completeness"? | <p>I asked my algorithms teacher today the very same question that is stated in the title, but he seemed a bit unsure, either on the question or on the concept, so I thought I'd try here too.</p>

<p>Is there a minimal test that could determine whether a language or instruction set is Turing compete, or does a ... | computability computation models turing completeness | 1 | Is there a way to test "Turing completeness"? -- (computability computation models turing completeness)
<p>I asked my algorithms teacher today the very same question that is stated in the title, but he seemed a bit unsure, either on the question or on the concept, so I thought I'd try here too.</p>

<p>Is there... | habedi/stack-exchange-dataset |
63,430 | Comparison of Decision Trees: RTED vs MLE | <p>I read two papers discussing how to compare between decision trees. One of them is RTED (that is specifically for trees and sub-case is decision trees) can be found here (RTED: A Robust Algorithm for the Tree Edit Distance)<a href="http://vldb.org/pvldb/vol5/p334_mateuszpawlik_vldb2012.pdf" rel="nofollow">here</a>:<... | algorithms trees | 1 | Comparison of Decision Trees: RTED vs MLE -- (algorithms trees)
<p>I read two papers discussing how to compare between decision trees. One of them is RTED (that is specifically for trees and sub-case is decision trees) can be found here (RTED: A Robust Algorithm for the Tree Edit Distance)<a href="http://vldb.org/pvldb... | habedi/stack-exchange-dataset |
63,439 | Adding Big-O and little-o notation to get a little-o | <p>Lets suppose that there exists a comparison-based algorithm that turns an arbitrary array to a state $A$ in $o(n\log k)$, and there is another comparison-based algorithm that turns an array in state $A$ to completely sorted in $O(n\log (n/k))$. $n$ is the size of the array, while $k$ is another non-constant paramete... | proof techniques landau notation lower bounds | 1 | Adding Big-O and little-o notation to get a little-o -- (proof techniques landau notation lower bounds)
<p>Lets suppose that there exists a comparison-based algorithm that turns an arbitrary array to a state $A$ in $o(n\log k)$, and there is another comparison-based algorithm that turns an array in state $A$ to complet... | habedi/stack-exchange-dataset |
63,464 | How to make a language homoiconic | <p>According to <a href="https://brandonbyars.com/2008/02/12/understanding-syntactic-macros/" rel="noreferrer">this article</a> the following line of Lisp code prints "Hello world" to standard output.</p>

<pre><code>(format t "hello, world")
</code></pre>

<p>Lisp, which is a <a href="https://en.wi... | programming languages functional programming | 1 | How to make a language homoiconic -- (programming languages functional programming)
<p>According to <a href="https://brandonbyars.com/2008/02/12/understanding-syntactic-macros/" rel="noreferrer">this article</a> the following line of Lisp code prints "Hello world" to standard output.</p>

<pre><code>(format t "... | habedi/stack-exchange-dataset |
63,466 | How do you prove Sigma Star is regular | <p>I noticed in another answer on this forum </p>

<blockquote>
 <p>Note that the languages ∅, {ϵ} and Σ* are regular.</p>
</blockquote>

<p>How do you prove Sigma Star is regular.</p>
 | formal languages regular languages | 1 | How do you prove Sigma Star is regular -- (formal languages regular languages)
<p>I noticed in another answer on this forum </p>

<blockquote>
 <p>Note that the languages ∅, {ϵ} and Σ* are regular.</p>
</blockquote>

<p>How do you prove Sigma Star is regular.</p>
 | habedi/stack-exchange-dataset |
63,477 | How would P2P Kriegspiel be designed? | <p><a href="https://en.wikipedia.org/wiki/Kriegspiel_%28chess%29" rel="nofollow">Kriegspiel chess</a> is a variant of chess in which each player is not aware of where the opponent's pieces are. In a human match, a trusted intermediary relays piece losses, legality of moves etc. This is, of course possible on a computer... | correctness proof authentication peer to peer | 1 | How would P2P Kriegspiel be designed? -- (correctness proof authentication peer to peer)
<p><a href="https://en.wikipedia.org/wiki/Kriegspiel_%28chess%29" rel="nofollow">Kriegspiel chess</a> is a variant of chess in which each player is not aware of where the opponent's pieces are. In a human match, a trusted intermedi... | habedi/stack-exchange-dataset |
63,492 | What is the quickest way to allocate a set of points to a fixed number groups based on Euclidean distances from a point in each group? | <p>Example, if i have certain geographic points in an array A=[a,b,c,d...n] and have 10 points distributed in the solution space B= [1,2,3...10], how can I allocate each member of A to the nearest point in B in the quickest way.</p>
 | algorithms code generation | 1 | What is the quickest way to allocate a set of points to a fixed number groups based on Euclidean distances from a point in each group? -- (algorithms code generation)
<p>Example, if i have certain geographic points in an array A=[a,b,c,d...n] and have 10 points distributed in the solution space B= [1,2,3...10], how can... | habedi/stack-exchange-dataset |
63,509 | What is a problem, a task, and a solution? | <p>I am attending algorithms and data structures course in my University and my professor gave me an interesting question the other day. He told me to think about it.</p>

<p><strong>What is a problem, a task, and a solution?</strong></p>

<p>It seems to me like it's more of a philosophical question. Al... | algorithms terminology | 1 | What is a problem, a task, and a solution? -- (algorithms terminology)
<p>I am attending algorithms and data structures course in my University and my professor gave me an interesting question the other day. He told me to think about it.</p>

<p><strong>What is a problem, a task, and a solution?</strong></p>&#x... | habedi/stack-exchange-dataset |
63,512 | What does this definition of a Primary key mean? | <p>My text book gives the following definition of a primary key in a relational database, which I don't entirely understand. Help would be greatly appreciated. </p>

<blockquote>
 <p>Let $R$ be a relation. Then the primary key for $R$ is a subset of the
 set of attributes of $R$, say $K$, satisfying t... | database theory | 1 | What does this definition of a Primary key mean? -- (database theory)
<p>My text book gives the following definition of a primary key in a relational database, which I don't entirely understand. Help would be greatly appreciated. </p>

<blockquote>
 <p>Let $R$ be a relation. Then the primary key for $R$ is... | habedi/stack-exchange-dataset |
63,522 | What is the amount of programs for which we can solve the halting problem? | <p>The halting problem is undecidable of course.
This implies that there is at least one program for which we cannot decide whether it halts or not, because theoretically, if all we know is that the halting problem is undecidable, it could still be that there is a program that can decide for every program except it... | computability halting problem | 1 | What is the amount of programs for which we can solve the halting problem? -- (computability halting problem)
<p>The halting problem is undecidable of course.
This implies that there is at least one program for which we cannot decide whether it halts or not, because theoretically, if all we know is that the halting... | habedi/stack-exchange-dataset |
63,539 | Measuring Complexity of Boolean Satisfiability Problem | <p>How exactly is the complexity of a SAT solver measured? My main concern is that, for $N$ variables, you can have, e.g., an OR of $O(2^N)$ AND terms, which would take at least $O(2^N)$ time to process. If the formula can contain duplicate sub-expressions, e.g., $(A \land B) \lor (A \land B)$, then the formula's maxim... | time complexity satisfiability boolean algebra | 1 | Measuring Complexity of Boolean Satisfiability Problem -- (time complexity satisfiability boolean algebra)
<p>How exactly is the complexity of a SAT solver measured? My main concern is that, for $N$ variables, you can have, e.g., an OR of $O(2^N)$ AND terms, which would take at least $O(2^N)$ time to process. If the fo... | habedi/stack-exchange-dataset |
63,541 | Difference Between Residual Neural Net and Recurrent Neural Net? | <p>What is the difference between a <strong>Residual</strong> Neural Net and a <strong>Recurrent</strong> Neural Net?</p>

<p>As I understand,</p>

<p><a href="https://arxiv.org/pdf/1512.03385v1.pdf" rel="nofollow">Residual Neural Networks</a> are very deep networks that implement 'shortcut' connections... | neural networks | 1 | Difference Between Residual Neural Net and Recurrent Neural Net? -- (neural networks)
<p>What is the difference between a <strong>Residual</strong> Neural Net and a <strong>Recurrent</strong> Neural Net?</p>

<p>As I understand,</p>

<p><a href="https://arxiv.org/pdf/1512.03385v1.pdf" rel="nofollow">Res... | habedi/stack-exchange-dataset |
63,546 | Is the given language DCFL? | <p>$a^ib^jc^k | (i = j)$ then k is even?</p>

<p>I can write it as
$a^ib^ic^k$ where k is even</p>

<p>OR</p>

<p>$a^ib^jc^k where (i != j)$</p>

<p>Both are DCFL and union of DCFL may be DCFL, but I think because of OR operator it gives a sense of parallelism and hence NCFL.</p>
... | context free finite automata nondeterminism | 1 | Is the given language DCFL? -- (context free finite automata nondeterminism)
<p>$a^ib^jc^k | (i = j)$ then k is even?</p>

<p>I can write it as
$a^ib^ic^k$ where k is even</p>

<p>OR</p>

<p>$a^ib^jc^k where (i != j)$</p>

<p>Both are DCFL and union of DCFL may be DCFL, but I think b... | habedi/stack-exchange-dataset |
63,550 | What concept is for a name referring to different types at different points in execution? | <p>In programming language theory, which concept means that a name can refer to values of different types at different points of execution of a program,</p>

<ul>
<li>dynamic typing,</li>
<li>implicit i.e. inferred typing, defined as opposed to explicit i.e. manifest typing,</li>
<li>something else?... | programming languages typing | 1 | What concept is for a name referring to different types at different points in execution? -- (programming languages typing)
<p>In programming language theory, which concept means that a name can refer to values of different types at different points of execution of a program,</p>

<ul>
<li>dynamic typing,</... | habedi/stack-exchange-dataset |
63,557 | Is {a^i b^j c^k | i≤j or (k=j≤i)} context sensitive? | <p>$$L = \{a^i b^j c^k \mid i \le j \text{ or } (j \le i \text{ and } j = k)\}$$</p>

<p>I think the given language is CSL as i can break this language like this </p>

<p>$$L = \{a^i b^j c^k \mid i \le j \text{ and } j = k\}
 \cup \{a^i b^j c^k \mid j \le i \text{ and } j = k\}
 \cup \{a^i b^j c... | formal languages context sensitive | 1 | Is {a^i b^j c^k | i≤j or (k=j≤i)} context sensitive? -- (formal languages context sensitive)
<p>$$L = \{a^i b^j c^k \mid i \le j \text{ or } (j \le i \text{ and } j = k)\}$$</p>

<p>I think the given language is CSL as i can break this language like this </p>

<p>$$L = \{a^i b^j c^k \mid i \le j \text{ ... | habedi/stack-exchange-dataset |
63,564 | How does the Galil's rule work on Boyer-Moore algorithm? | <p>I would like to know how Boyer-Moore text searching algorithm with Galil's rule works,. I tried to search for but I couldn't understand the information I found, for example <a href="https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm#The_Galil_Rule" rel="nofollow">this Wikipedia page</a>.
A... | algorithms algorithm analysis search algorithms strings exact string matching | 1 | How does the Galil's rule work on Boyer-Moore algorithm? -- (algorithms algorithm analysis search algorithms strings exact string matching)
<p>I would like to know how Boyer-Moore text searching algorithm with Galil's rule works,. I tried to search for but I couldn't understand the information I found, for example <a h... | habedi/stack-exchange-dataset |
63,569 | relation between $\forall$ and implication in intuitionistic logic using curry-howard and propositions as types | <p>I am currently trying to wrap my head around intuitionistic logic and its interpretation using the curry-howard isomorphism and propositions as types. </p>

<p>I came about this explained relation between $\forall$ and $\rightarrow$:</p>

<blockquote>
 <p>A function type $s \rightarrow t$ is act... | logic curry howard | 1 | relation between $\forall$ and implication in intuitionistic logic using curry-howard and propositions as types -- (logic curry howard)
<p>I am currently trying to wrap my head around intuitionistic logic and its interpretation using the curry-howard isomorphism and propositions as types. </p>

<p>I came about ... | habedi/stack-exchange-dataset |
63,584 | decidability of artificial intelligence | <p>Not sure whether this is the correct place to post the question. some of my terms might not accurate.</p>

<p>currently AI is used for classification, inference, and so forth, is AI problem decidable? for example, given a dataset, prior/constraints and neural network, whether it can recognize a pattern (prop... | turing machines undecidability artificial intelligence halting problem | 1 | decidability of artificial intelligence -- (turing machines undecidability artificial intelligence halting problem)
<p>Not sure whether this is the correct place to post the question. some of my terms might not accurate.</p>

<p>currently AI is used for classification, inference, and so forth, is AI problem dec... | habedi/stack-exchange-dataset |
63,585 | Can a shortest-path tree be a also maximum spanning tree? | <p>If we were to find the shortest-path tree rooted at some vertex in a weighted graph G, is it possible that the resulting tree is also a maximum-weight spanning tree of G? Please give an example!</p>

<p>I tried every combination I could come up with using connected graphs with cycles on them (so that there i... | graphs trees shortest path spanning trees | 1 | Can a shortest-path tree be a also maximum spanning tree? -- (graphs trees shortest path spanning trees)
<p>If we were to find the shortest-path tree rooted at some vertex in a weighted graph G, is it possible that the resulting tree is also a maximum-weight spanning tree of G? Please give an example!</p>

<p>I... | habedi/stack-exchange-dataset |
63,586 | machine learning classification with financial instrument/time series data | <p>I am new to machine learning and have started brainstorming some model ideas that involve financial instrument/time series data. I was thinking it might be useful to use a classification algorithm to predict if an instrument was in fact up or down y% (TRUE/FALSE) after n days, based on i.e. a combination of technica... | machine learning classification time series analysis | 1 | machine learning classification with financial instrument/time series data -- (machine learning classification time series analysis)
<p>I am new to machine learning and have started brainstorming some model ideas that involve financial instrument/time series data. I was thinking it might be useful to use a classificati... | habedi/stack-exchange-dataset |
63,591 | I do not understand why finding the minimum of elements take O(n) time | <p>I know that sorting the array take O(logn) time. But why finding the minimum of elements take O(n) time, which is more expensive? If I sort the array, I simply output the first element and this would be my minimum.</p>
 | algorithms | 1 | I do not understand why finding the minimum of elements take O(n) time -- (algorithms)
<p>I know that sorting the array take O(logn) time. But why finding the minimum of elements take O(n) time, which is more expensive? If I sort the array, I simply output the first element and this would be my minimum.</p>
 | habedi/stack-exchange-dataset |
63,597 | Show that $T(n) = 2T(\lfloor n/2\rfloor) + n$ is $\Omega(n\log n)$ using substitution | <p>I have to solve this using the <strong>substitution method</strong>. </p>

<p><strong>Floor</strong> functions <strong>cannot be skipped</strong>.</p>

<hr>

<p>IH: Assume that $T(k) \geq ck\log(k) $ for all $k \leq n$, where c is a constant.</p>

<p>IS: Must prove $T(k) \geq ck\log... | recurrence relation induction divide and conquer | 1 | Show that $T(n) = 2T(\lfloor n/2\rfloor) + n$ is $\Omega(n\log n)$ using substitution -- (recurrence relation induction divide and conquer)
<p>I have to solve this using the <strong>substitution method</strong>. </p>

<p><strong>Floor</strong> functions <strong>cannot be skipped</strong>.</p>

<hr>
... | habedi/stack-exchange-dataset |
63,600 | Understanding state table for turing machine | <p><a href="https://i.stack.imgur.com/SidyL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SidyL.png" alt="enter image description here"></a></p>

<p>I'm having trouble understanding state tables for turing machines where the state table shown in the above image is supposed to show the chang... | turing machines | 1 | Understanding state table for turing machine -- (turing machines)
<p><a href="https://i.stack.imgur.com/SidyL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SidyL.png" alt="enter image description here"></a></p>

<p>I'm having trouble understanding state tables for turing machines where the ... | habedi/stack-exchange-dataset |
63,605 | Algorithm for checking unambiguity in the derivation of a string | <p>It is known that given a Context Free Grammar $G$, checking that it is ambiguous or not is undecidable. But, if I have a string $s \in L(G)$, does there exist an algorithm to check whether $s$ particularly can be derived unambiguously in $G$?</p>
 | context free | 1 | Algorithm for checking unambiguity in the derivation of a string -- (context free)
<p>It is known that given a Context Free Grammar $G$, checking that it is ambiguous or not is undecidable. But, if I have a string $s \in L(G)$, does there exist an algorithm to check whether $s$ particularly can be derived unambiguously... | habedi/stack-exchange-dataset |
63,626 | Complexity of algorithm to find number of elements > element index i in an array | <p>The question is:</p>

<p>Given an array of size N, arr, create another array whose index i = number of elements in sub-array(arr, i+1, N-1) that are greater than arr[i].</p>

<p>Eg. if input array is, 
5 3 9 8 2 6 
output array is 
3 3 0 0 1 0</p>

<p>O(N^2) is simple just two for... | algorithms time complexity arrays | 1 | Complexity of algorithm to find number of elements > element index i in an array -- (algorithms time complexity arrays)
<p>The question is:</p>

<p>Given an array of size N, arr, create another array whose index i = number of elements in sub-array(arr, i+1, N-1) that are greater than arr[i].</p>

<p>Eg.... | habedi/stack-exchange-dataset |
63,646 | Converting context-free grammar to chomsky normal form | <p>I'm trying to prove that the following CFG can be converted to a CNF:</p>

<pre><code>S -> aAB
A -> aAa
A -> bb
B -> a
</code></pre>

<p>Here below is how I've managed so far:</p>

<h3>Step 1: add a new start state</h3>

<pre><code>S0 -> S
S -> aA... | context free formal grammars proof techniques chomsky hierarchy | 1 | Converting context-free grammar to chomsky normal form -- (context free formal grammars proof techniques chomsky hierarchy)
<p>I'm trying to prove that the following CFG can be converted to a CNF:</p>

<pre><code>S -> aAB
A -> aAa
A -> bb
B -> a
</code></pre>

<p>Here below i... | habedi/stack-exchange-dataset |
63,661 | Does there exist a Reed-Solomon-like code over decimal symbols? | <p>A Reed-Solomon error-correcting code consisting of N symbols is guaranteed to detect up to N single-symbol replacements in an arbitrarily long input plus the ECC itself, and is also guaranteed to correct up to floor(N/2) single-symbol replacements in the same.</p>

<p>I can't claim to understand the math beh... | error correcting codes | 1 | Does there exist a Reed-Solomon-like code over decimal symbols? -- (error correcting codes)
<p>A Reed-Solomon error-correcting code consisting of N symbols is guaranteed to detect up to N single-symbol replacements in an arbitrarily long input plus the ECC itself, and is also guaranteed to correct up to floor(N/2) sing... | habedi/stack-exchange-dataset |
63,663 | Lower bound of a summation with an exponential | <p>For the following (related to a binary tree complexity question):</p>

<p>$$f(n) = \sum_{h=0}^{\lg{}n} h2^h$$</p>

<p>Is there any way to express this only in terms of $n$? Or approximate it?</p>

<hr>

<p>Put in another way, I figure at worst for an upper bound, we could guess at it ... | time complexity asymptotics binary trees | 1 | Lower bound of a summation with an exponential -- (time complexity asymptotics binary trees)
<p>For the following (related to a binary tree complexity question):</p>

<p>$$f(n) = \sum_{h=0}^{\lg{}n} h2^h$$</p>

<p>Is there any way to express this only in terms of $n$? Or approximate it?</p>

<hr... | habedi/stack-exchange-dataset |
63,666 | Trying to understand this Quicksort Correctness proof | <p>This proof is a proof by induction, and goes as follows:</p>

<p>P(n) is the assertion that "Quicksort correctly sorts every input array of length n." </p>

<p>Base case: every input array of length 1 is already sorted (P(1) holds)</p>

<p>Inductive step: fix n => 2. Fix some input array of l... | correctness proof induction quicksort | 1 | Trying to understand this Quicksort Correctness proof -- (correctness proof induction quicksort)
<p>This proof is a proof by induction, and goes as follows:</p>

<p>P(n) is the assertion that "Quicksort correctly sorts every input array of length n." </p>

<p>Base case: every input array of length 1 is ... | habedi/stack-exchange-dataset |
63,670 | Analyzing the time complexity of nested loops | <p>So I've been given a piece of pseudo code that involves nested loops. The answer to this question is Θ(n^5) but I do not understand why it is so.</p>

<p>What is the time complexity of this code? </p>

<pre><code>for i = 1 to n 
 for j = 1 to n*n 
 for k = 1 to j 
 ... | algorithm analysis runtime analysis loops | 1 | Analyzing the time complexity of nested loops -- (algorithm analysis runtime analysis loops)
<p>So I've been given a piece of pseudo code that involves nested loops. The answer to this question is Θ(n^5) but I do not understand why it is so.</p>

<p>What is the time complexity of this code? </p>

<pre>... | habedi/stack-exchange-dataset |
63,679 | Modal Logic - □ distribution over → | <p>In the modal logic K does □ distribution over →?</p>

<p>For example, would the following be correct?</p>

□(p → q) ≡ □p → □q
 | logic modal logic | 1 | Modal Logic - □ distribution over → -- (logic modal logic)
<p>In the modal logic K does □ distribution over →?</p>

<p>For example, would the following be correct?</p>

□(p → q) ≡ □p → □q
 | habedi/stack-exchange-dataset |
63,681 | Concatenating polyhedra at their region of contact | <p>Given two polyhedra(with triangulated faces), P1 and P2. I want to create a polyhedron P, which is the result of joining the two at their region of contact. With <em>join</em> I do not mean union but physically, it is more like welding P1 and P2, so if there is say a cylinder(P1) and a cube(P2) aligned on same axis ... | algorithms computational geometry | 1 | Concatenating polyhedra at their region of contact -- (algorithms computational geometry)
<p>Given two polyhedra(with triangulated faces), P1 and P2. I want to create a polyhedron P, which is the result of joining the two at their region of contact. With <em>join</em> I do not mean union but physically, it is more like... | habedi/stack-exchange-dataset |
63,682 | Deriving the average number of inversions across all permutations | <p>In the answer by <a href="https://cs.stackexchange.com/users/98/raphael">Raphael</a> to the question "<a href="https://cs.stackexchange.com/questions/23593/is-there-a-system-behind-the-magic-of-algorithm-analysis">Is there a system behind the magic of algorithm analysis?</a>", there is an equation:</p>

<p>$... | combinatorics permutations | 1 | Deriving the average number of inversions across all permutations -- (combinatorics permutations)
<p>In the answer by <a href="https://cs.stackexchange.com/users/98/raphael">Raphael</a> to the question "<a href="https://cs.stackexchange.com/questions/23593/is-there-a-system-behind-the-magic-of-algorithm-analysis">Is th... | habedi/stack-exchange-dataset |
63,693 | Are depth-first/breadth-first considered special cases of best-first? | <p>In literature in general, are DFS and BFS considered to be special cases of best-first search?</p>

<p>Suppose the cost function is:</p>

<p>$f(n) = g(n) + h(n)$</p>

<p>Is it correct to reason that if and $g(n) = depth(n)$, then</p>

<p>If $\forall_n h(n) = 0$, we have a breadth-firs... | algorithms graphs search algorithms heuristics | 1 | Are depth-first/breadth-first considered special cases of best-first? -- (algorithms graphs search algorithms heuristics)
<p>In literature in general, are DFS and BFS considered to be special cases of best-first search?</p>

<p>Suppose the cost function is:</p>

<p>$f(n) = g(n) + h(n)$</p>

<p>I... | habedi/stack-exchange-dataset |
63,697 | Minimize number of circles to cover set of points | <p>I'd like to minimize the number of circles $C$ to cover a set of points $P$ in 2D.</p>

<p>There is no fixed radius however each circle must contain exactly $N$ points. The circles may overlap. A point may be covered by multiple circles. All coordinates are floats.</p>

<p>Problem size: $|P| \leq 100... | algorithms optimization computational geometry | 1 | Minimize number of circles to cover set of points -- (algorithms optimization computational geometry)
<p>I'd like to minimize the number of circles $C$ to cover a set of points $P$ in 2D.</p>

<p>There is no fixed radius however each circle must contain exactly $N$ points. The circles may overlap. A point may b... | habedi/stack-exchange-dataset |
63,700 | Can partial sorting help with lookup cost in arrays? | <p>Looking something up in an unsorted list is a task with time complexity $O(n)$. However, if the list is sorted, the time complexity is $O(\log(n))$. That means it is sometimes worthwhile to sort an array. However, that is a trade-off as a sorting algorithm has a time complexity of $O(n\log(n))$.</p>

<p>As f... | algorithms complexity theory time complexity sorting | 1 | Can partial sorting help with lookup cost in arrays? -- (algorithms complexity theory time complexity sorting)
<p>Looking something up in an unsorted list is a task with time complexity $O(n)$. However, if the list is sorted, the time complexity is $O(\log(n))$. That means it is sometimes worthwhile to sort an array. H... | habedi/stack-exchange-dataset |
63,704 | Find long connected similar subsequences in two given sequences | <p>I'm looking for pointers to algorithms which will find long <strong>connected similar</strong> subsequences which two given sequences have in common. For example, in case of two strings:</p>

<pre><code>abcaabbaabUVWXYZ
UVWXeYZababababab
</code></pre>

<p>I'm interested in:</p>

<pre>... | algorithms optimization strings subsequences | 1 | Find long connected similar subsequences in two given sequences -- (algorithms optimization strings subsequences)
<p>I'm looking for pointers to algorithms which will find long <strong>connected similar</strong> subsequences which two given sequences have in common. For example, in case of two strings:</p>

<pr... | habedi/stack-exchange-dataset |
63,705 | How many of the 65536 possible shorts over Z2 have no two consecutive symbols the same? | <p>Probability-related Info theory question that I can't figure out. Thanks in advance!</p>
 | information theory | 1 | How many of the 65536 possible shorts over Z2 have no two consecutive symbols the same? -- (information theory)
<p>Probability-related Info theory question that I can't figure out. Thanks in advance!</p>
 | habedi/stack-exchange-dataset |
63,716 | Proof of correctness of divide and conquer clique algorithm | <p>I have the following divide and conquer algorithm that finds a clique in an undirected graph $G = (V, E)$:</p>

<pre><code>CLIQUE(G):

1) Number the vertices V as 1,2,3...,n where n=|V|

2) If n = 1, return V

3) Divide V in v1 = {1,2,...,[n/2]} and v2 = {[n/2]+1,...,n}

4) Be... | algorithm analysis correctness proof divide and conquer | 1 | Proof of correctness of divide and conquer clique algorithm -- (algorithm analysis correctness proof divide and conquer)
<p>I have the following divide and conquer algorithm that finds a clique in an undirected graph $G = (V, E)$:</p>

<pre><code>CLIQUE(G):

1) Number the vertices V as 1,2,3...,n where ... | habedi/stack-exchange-dataset |
63,717 | Is the set of pairs of TMs at least one of which accepts the empty word semi-deciable? | <p>L = { < M1,M2 > | M1,M2 are TM's and Ɛ ∈ L(M1) ∪ L(M2) }</p>

<p>Where Ɛ = Epsilon </p>

<p><strong>I know that this language is undecidable, but why it is semidecidable too.</strong></p>

<p><strong>What i have tried is =></strong></p>

<p>Using Rice's Theorem, part 2 </p>
&#... | computability undecidability semi decidability | 1 | Is the set of pairs of TMs at least one of which accepts the empty word semi-deciable? -- (computability undecidability semi decidability)
<p>L = { < M1,M2 > | M1,M2 are TM's and Ɛ ∈ L(M1) ∪ L(M2) }</p>

<p>Where Ɛ = Epsilon </p>

<p><strong>I know that this language is undecidable, but why it is se... | habedi/stack-exchange-dataset |
63,730 | How to satisfy bounded waiting in case of deadlock? | <p>I have a doubt regarding bounded waiting.</p>

<p>Deadlock implies no Progress because the processes take indefinite time to decide who will enter the critical section .</p>

<p>But, Does deadlock implies no bounded waiting ?</p>

<p>I think No because bounded waiting is per process and deadl... | operating systems deadlocks | 1 | How to satisfy bounded waiting in case of deadlock? -- (operating systems deadlocks)
<p>I have a doubt regarding bounded waiting.</p>

<p>Deadlock implies no Progress because the processes take indefinite time to decide who will enter the critical section .</p>

<p>But, Does deadlock implies no bounded ... | habedi/stack-exchange-dataset |
63,736 | Is this a hypergraph? | <p>Here is the problem is want to solve: </p>

<p>I want to connect nodes with directed labelled edges, but this two nodes are potentially themselves graphs, hypergraphs or the current structure I don't have a name for.</p>

<p>Here is a simple example with a graph $(v_1,e_1,v_2)$ where nodes $v_1$ and ... | graphs data structures terminology | 1 | Is this a hypergraph? -- (graphs data structures terminology)
<p>Here is the problem is want to solve: </p>

<p>I want to connect nodes with directed labelled edges, but this two nodes are potentially themselves graphs, hypergraphs or the current structure I don't have a name for.</p>

<p>Here is a simp... | habedi/stack-exchange-dataset |
63,751 | Does an array count as a primitive operation when it is used as an argument in a function call? | <p>Say I have
<code>return A[n-1] + Sum(A, n - 2)</code>.
I counted the following primitive operations:</p>

<pre><code>return A[n-2] + Sum(A, n - 2)
 1 2 3 4 5 6 7
</code></pre>

<p>I know accessing a certain index in A counts as 1 primitive operation, but I am not sure about... | algorithm analysis | 1 | Does an array count as a primitive operation when it is used as an argument in a function call? -- (algorithm analysis)
<p>Say I have
<code>return A[n-1] + Sum(A, n - 2)</code>.
I counted the following primitive operations:</p>

<pre><code>return A[n-2] + Sum(A, n - 2)
 1 2 3 4 5 6 7
... | habedi/stack-exchange-dataset |
63,752 | Amortized time cost of insertion into an Array list | <p>A dynamically resizing array list will resize when the number of elements reaches a power of two. So, after n elements inserted, we've resized at sizes 1, 2, 4, ... , n. This also means we've copied over into the newly resized array 1, 2, 4, ... , n number of copies. What then is the sum of this sequence? To answer ... | algorithm analysis runtime analysis amortized analysis | 1 | Amortized time cost of insertion into an Array list -- (algorithm analysis runtime analysis amortized analysis)
<p>A dynamically resizing array list will resize when the number of elements reaches a power of two. So, after n elements inserted, we've resized at sizes 1, 2, 4, ... , n. This also means we've copied over i... | habedi/stack-exchange-dataset |
63,760 | Describing the language formed by a particular grammar | <ul>
<li><strong>G → G B ⏐ G N ⏐ ε</strong></li>
<li><strong>B → ( E )</strong></li>
<li><strong>E → E ( E ) ⏐ ε</strong></li>
<li><strong>N → ( L ]</strong></li>
<li><strong>L → L E ⏐ L (⏐ ε</strong></li>
</ul>

<p>For this grammar, the prompt asks to describe in the language that ... | formal languages formal grammars | 1 | Describing the language formed by a particular grammar -- (formal languages formal grammars)
<ul>
<li><strong>G → G B ⏐ G N ⏐ ε</strong></li>
<li><strong>B → ( E )</strong></li>
<li><strong>E → E ( E ) ⏐ ε</strong></li>
<li><strong>N → ( L ]</strong></li>
<li><strong>L → L E ⏐ L (⏐ ε</strong></l... | habedi/stack-exchange-dataset |
63,765 | having issue with numbers in Polymorphic Lambda Calculus | <p>It is said that Church Numbers are encoded as following </p>

<pre><code> c0 = λX. λs:X->X. λz:X. z;
 c1 = λX. λs:X->X. λz:X. s z;
 c2 = λX. λs:X->X. λz:X. s (s z);
 c3 = λX. λs:X->X. λz:X. s (s (s z));
</code></pre>

<p>The church numbers are terms, right? but the... | lambda calculus | 1 | having issue with numbers in Polymorphic Lambda Calculus -- (lambda calculus)
<p>It is said that Church Numbers are encoded as following </p>

<pre><code> c0 = λX. λs:X->X. λz:X. z;
 c1 = λX. λs:X->X. λz:X. s z;
 c2 = λX. λs:X->X. λz:X. s (s z);
 c3 = λX. λs:X->X. λz:X. s (s (s z... | habedi/stack-exchange-dataset |
63,769 | Proving that $A \vee (\neg A \wedge B) \equiv A \vee B$ | <p>I'm reading a book at the moment about logic gates and Boolean simplification. There is a part which I can't seem to follow.</p>

<p>I can easily work out that $A \vee (\neg A \wedge B) \equiv A \vee B$ using a truth table as it's easy to see. </p>

<p>However, I can't seem to turn $A \vee (\neg A \w... | logic arithmetic boolean algebra | 1 | Proving that $A \vee (\neg A \wedge B) \equiv A \vee B$ -- (logic arithmetic boolean algebra)
<p>I'm reading a book at the moment about logic gates and Boolean simplification. There is a part which I can't seem to follow.</p>

<p>I can easily work out that $A \vee (\neg A \wedge B) \equiv A \vee B$ using a trut... | habedi/stack-exchange-dataset |
63,777 | Why is Clique NP-complete while k-Clique is in P for all k? | <p>I just stumbled upon this question here <a href="https://cs.stackexchange.com/questions/7420/why-is-the-clique-problem-np-complete">Why is the clique problem NP-complete?</a>
 and I am confused by the given answer. 
The question about about whether $k$-clique is NP-hard for a fixed $k$ and the answer is no. ... | complexity theory np hard clique | 1 | Why is Clique NP-complete while k-Clique is in P for all k? -- (complexity theory np hard clique)
<p>I just stumbled upon this question here <a href="https://cs.stackexchange.com/questions/7420/why-is-the-clique-problem-np-complete">Why is the clique problem NP-complete?</a>
 and I am confused by the given answer. ... | habedi/stack-exchange-dataset |
63,781 | Relation between witness and problem statement | <p>Are there any known upper/lower bounds on the size of a witness of some np-complete/hard problem, or more precisely the relation between the problem size and the witness size. 
For example, I'm interested in subset sum, set cover, SAT, hamiltonian cycles. If there is something known for other problems, I'd also ... | complexity theory np complete | 1 | Relation between witness and problem statement -- (complexity theory np complete)
<p>Are there any known upper/lower bounds on the size of a witness of some np-complete/hard problem, or more precisely the relation between the problem size and the witness size. 
For example, I'm interested in subset sum, set cover, ... | habedi/stack-exchange-dataset |
63,784 | Why doesn't greedy work for Clique? | <p>In reference to <a href="http://codeforces.com/problemset/problem/114/B" rel="nofollow">this problem</a> (equivalently, findind a maximal clique in an undirected graph), I believe greedy approach should work (i.e. removal of people who have maximal qualms with others.). Though I cannot prove that this would always w... | algorithms graphs clique | 1 | Why doesn't greedy work for Clique? -- (algorithms graphs clique)
<p>In reference to <a href="http://codeforces.com/problemset/problem/114/B" rel="nofollow">this problem</a> (equivalently, findind a maximal clique in an undirected graph), I believe greedy approach should work (i.e. removal of people who have maximal qu... | habedi/stack-exchange-dataset |
63,790 | Intuition behind the condition |xy| ≤ p in pumping lemma for regular languages | <p>When I take a look at the proofs for <a href="https://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages" rel="noreferrer">pumping lemma</a>, I have a feeling that I am often missing the intuition behind the condition |xy| ≤ p.</p>

<p>What exactly is the reason behind this condition? All the literatu... | formal languages regular languages pumping lemma | 1 | Intuition behind the condition |xy| ≤ p in pumping lemma for regular languages -- (formal languages regular languages pumping lemma)
<p>When I take a look at the proofs for <a href="https://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages" rel="noreferrer">pumping lemma</a>, I have a feeling that I am often mi... | habedi/stack-exchange-dataset |
63,793 | Regular language with pumping lemma | <p>I have that language $S=\{a^n b^m c^m\mid n,m \geq 0\}$.
How can I prove with the pumping lemma that it isn't regular? Can I use the concatenation closure and say that it's the language $L_1 = \{a^n\mid n\geq0\}$ and $L_2 =\{b^m c^m\mid m \geq0\}$ prove that $L_2$ isnt regular so $L_1 L_2 = S$ is not regular too... | formal languages regular languages pumping lemma | 1 | Regular language with pumping lemma -- (formal languages regular languages pumping lemma)
<p>I have that language $S=\{a^n b^m c^m\mid n,m \geq 0\}$.
How can I prove with the pumping lemma that it isn't regular? Can I use the concatenation closure and say that it's the language $L_1 = \{a^n\mid n\geq0\}$ and $L_2 =... | habedi/stack-exchange-dataset |
63,801 | Is bounded waiting satisfied in this 2 process solution? | <p>Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes:</p>

<pre><code>/* P1 */
while (true) {
 wants1 = true;
 while (wants2 == true);
 /* Critical Section */
 wants1 = false;
}
/... | concurrency synchronization deadlocks | 1 | Is bounded waiting satisfied in this 2 process solution? -- (concurrency synchronization deadlocks)
<p>Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes:</p>

<pre><code>/* P1 */
while (true) {
 wants1 = true... | habedi/stack-exchange-dataset |
63,809 | Is converting boolean formulas to sum-of-products a hard problem? | <p>My reasoning is as follows.</p>

<ol>
<li>Every boolean formula can be expressed as a sum-of-products.</li>
<li>Every sum-of-produts is a list of minterms.</li>
<li>For each minterm, there is 1 combination of inputs that satisfy the formula.</li>
</ol>

<p>So if I have the sum-of-prod... | complexity theory satisfiability normal forms | 1 | Is converting boolean formulas to sum-of-products a hard problem? -- (complexity theory satisfiability normal forms)
<p>My reasoning is as follows.</p>

<ol>
<li>Every boolean formula can be expressed as a sum-of-products.</li>
<li>Every sum-of-produts is a list of minterms.</li>
<li>For each minter... | habedi/stack-exchange-dataset |
63,818 | Find Mapping Node in a Graph | <p>Given two large directed graphs (may have loops and lonely nodes) A and B. They are structurally similar.</p>

<p>If we give a node in Graph A, how to find the corresponding one in Graph B?</p>

<p>Finally, we need to find all the node mappings.</p>

<p>Of course, there can be more than one p... | algorithms graphs graph isomorphism network topology | 1 | Find Mapping Node in a Graph -- (algorithms graphs graph isomorphism network topology)
<p>Given two large directed graphs (may have loops and lonely nodes) A and B. They are structurally similar.</p>

<p>If we give a node in Graph A, how to find the corresponding one in Graph B?</p>

<p>Finally, we need... | habedi/stack-exchange-dataset |
63,830 | Approximation Algorithm for the Unique Coverage Problem | <p>I was reading about the $\mathcal{O}(\frac{1}{\log n})$ approximation algorithm for the Unique Coverage Problem from <a href="http://www.cs.umd.edu/~hajiagha/NetDsgn11/scribe-14-09-2011.pdf" rel="nofollow">these</a> notes.</p>

<p>The gist of the algorithm is as follows:</p>

<blockquote>
 <ul>&... | algorithms approximation | 1 | Approximation Algorithm for the Unique Coverage Problem -- (algorithms approximation)
<p>I was reading about the $\mathcal{O}(\frac{1}{\log n})$ approximation algorithm for the Unique Coverage Problem from <a href="http://www.cs.umd.edu/~hajiagha/NetDsgn11/scribe-14-09-2011.pdf" rel="nofollow">these</a> notes.</p>
... | habedi/stack-exchange-dataset |
63,839 | Where does the CPU get its first instructions from? | <p>In order for the BIOS code to matter, it must be evaluated by the processor. However, the processor itself needs to do work to actually get access to the BIOS code, since the CPU only performs instructions that are given, something must give the instructions to the CPU (since I can't imagine a way for instructions t... | computer architecture cpu | 1 | Where does the CPU get its first instructions from? -- (computer architecture cpu)
<p>In order for the BIOS code to matter, it must be evaluated by the processor. However, the processor itself needs to do work to actually get access to the BIOS code, since the CPU only performs instructions that are given, something mu... | habedi/stack-exchange-dataset |
63,847 | White-space and comment by lexical analyzer | <p>Lexical Analyzer mostly deletes comments and white-spaces. One example where I think Lexical Analyzer might not be discarding white-spaces is in Python language, as indentation has a important role in python. But I can't think of practical example where comments are/should be kept by Lexical Analyzer? Is there any s... | compilers parsers lexical analysis | 1 | White-space and comment by lexical analyzer -- (compilers parsers lexical analysis)
<p>Lexical Analyzer mostly deletes comments and white-spaces. One example where I think Lexical Analyzer might not be discarding white-spaces is in Python language, as indentation has a important role in python. But I can't think of pra... | habedi/stack-exchange-dataset |
63,848 | Proof of Diameter of a network topology | <p>How do I prove that diameter of undirected Ring Topology is n/2?</p>
 | graphs computer networks network topology | 1 | Proof of Diameter of a network topology -- (graphs computer networks network topology)
<p>How do I prove that diameter of undirected Ring Topology is n/2?</p>
 | habedi/stack-exchange-dataset |
63,851 | Regular expression at least 2 out of 3 consecutive characters should be 1 | <p>How can I build a regular expression that, using only the concatenate, union and star operations, over the alphabet {0,1}, describes the language "Every three consecutive characters contain at least two 1, and the input has length at least 3"? For instance 110011, 0101 and 11 should be refused. I was thinking on usi... | regular languages automata finite automata regular expressions | 1 | Regular expression at least 2 out of 3 consecutive characters should be 1 -- (regular languages automata finite automata regular expressions)
<p>How can I build a regular expression that, using only the concatenate, union and star operations, over the alphabet {0,1}, describes the language "Every three consecutive char... | habedi/stack-exchange-dataset |
63,857 | Disproving well-quasi-order by providing an infinite anti-chain | <p>I am currently studying the theory behind Well-Quasi-Orders. However I am having some issues in understanding how an infinite anti-chain can be produced to disprove the claim that a partial order $P$ is a w.q.o.</p>

<p>In particular I am wondering whether it is logically sound to present as proof not ... | graphs partial order | 1 | Disproving well-quasi-order by providing an infinite anti-chain -- (graphs partial order)
<p>I am currently studying the theory behind Well-Quasi-Orders. However I am having some issues in understanding how an infinite anti-chain can be produced to disprove the claim that a partial order $P$ is a w.q.o.</p>

... | habedi/stack-exchange-dataset |
63,859 | Intuition behind the Hadamard gate | <p>I'm trying to teach myself about quantum computing, and I have a decent-ish understanding of linear algebra. </p>

<p>I got through the NOT gate, which wasn't too bad, but then I got to the Hadamard gate. And I got stuck. Mainly because while I "understand" the manipulations, I don't understand what they rea... | logic quantum computing | 1 | Intuition behind the Hadamard gate -- (logic quantum computing)
<p>I'm trying to teach myself about quantum computing, and I have a decent-ish understanding of linear algebra. </p>

<p>I got through the NOT gate, which wasn't too bad, but then I got to the Hadamard gate. And I got stuck. Mainly because while I ... | habedi/stack-exchange-dataset |
63,866 | What is the name of this quantum gate? | <p>As I was watching a video about single qubit quantum gates, I came across the following gate:
$$\begin{bmatrix}e^{i\sigma}&0\\0&e^{i\theta}\end{bmatrix}$$ The video didn't mention the name of the gate. It gave only the matrix and the following information:</p>

<ul>
<li>$|0\rangle \rightarrow... | logic quantum computing | 1 | What is the name of this quantum gate? -- (logic quantum computing)
<p>As I was watching a video about single qubit quantum gates, I came across the following gate:
$$\begin{bmatrix}e^{i\sigma}&0\\0&e^{i\theta}\end{bmatrix}$$ The video didn't mention the name of the gate. It gave only the matrix and the fol... | habedi/stack-exchange-dataset |
63,870 | Spacial complexity of an $O(2^N)$ time-complexity algorithm | <p>For the following code sample:</p>

<pre><code>int f(int n) {
 if (n <= 0) {
 return 1;
 }
 return f(n - 1) + f(n - 1)
}
</code></pre>

<p>I understand that the time complexity is $O(2^N)$. However, what I don't understand is how the space complexity is $O(N... | algorithms asymptotics | 1 | Spacial complexity of an $O(2^N)$ time-complexity algorithm -- (algorithms asymptotics)
<p>For the following code sample:</p>

<pre><code>int f(int n) {
 if (n <= 0) {
 return 1;
 }
 return f(n - 1) + f(n - 1)
}
</code></pre>

<p>I understand that the time comp... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.