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 |
|---|---|---|---|---|---|---|
48,570 | Non-integer $a$ in Master method | <p>According to CLRS the master method requires the recurrence to be of form $T(n) = aT(n/b) + f(n)$ where $a \ge 1 $ and $b > 1$ are constants and $f(n)$ is asymptotically positive.</p>

<p>This makes it sound like even $a \not\in \mathbb{Z}_+$ is a legitimate value of $a$ as long as $a \ge 1$.</p>

... | master theorem | 1 | Non-integer $a$ in Master method -- (master theorem)
<p>According to CLRS the master method requires the recurrence to be of form $T(n) = aT(n/b) + f(n)$ where $a \ge 1 $ and $b > 1$ are constants and $f(n)$ is asymptotically positive.</p>

<p>This makes it sound like even $a \not\in \mathbb{Z}_+$ is a legit... | habedi/stack-exchange-dataset |
48,574 | Programming language where every expression makes sense | <p>Per recommendation I am reposting this from <a href="https://stackoverflow.com/q/33257996/781723">Stack Overflow</a>.</p>

<p>Recently I have been thinking about following issue.</p>

<p>Consider the code for a standard "Hello world!" program:</p>

<pre><code>main()
{
 printf("Hell... | programming languages computation models | 1 | Programming language where every expression makes sense -- (programming languages computation models)
<p>Per recommendation I am reposting this from <a href="https://stackoverflow.com/q/33257996/781723">Stack Overflow</a>.</p>

<p>Recently I have been thinking about following issue.</p>

<p>Consider the... | habedi/stack-exchange-dataset |
48,576 | number of subsets where GCD equals to X | <p>The original statement for this problem can be found <a href="https://github.com/pranavkundra/IEEE-Xtreme-8.0/blob/master/Questions/Play%20with%20GCD.pdf" rel="nofollow">here</a> </p>

<p>This is a question from IEEExtream 2014. There is an array of integers given. Input is X, so output is the number of subs... | algorithms discrete mathematics number theory counting | 1 | number of subsets where GCD equals to X -- (algorithms discrete mathematics number theory counting)
<p>The original statement for this problem can be found <a href="https://github.com/pranavkundra/IEEE-Xtreme-8.0/blob/master/Questions/Play%20with%20GCD.pdf" rel="nofollow">here</a> </p>

<p>This is a question fr... | habedi/stack-exchange-dataset |
48,579 | What this subnetting restriction means | <p>I was reading Data Communication book by Forouzan in which there is a one restriction put on CIDR subnetting by Internet authorities:</p>

<blockquote>
 <p>First IP address in the block should be evenly divisible by the number of addresses. For example, below, the first address, when converted to a deci... | computer networks arithmetic | 1 | What this subnetting restriction means -- (computer networks arithmetic)
<p>I was reading Data Communication book by Forouzan in which there is a one restriction put on CIDR subnetting by Internet authorities:</p>

<blockquote>
 <p>First IP address in the block should be evenly divisible by the number of a... | habedi/stack-exchange-dataset |
48,581 | What does x-bit binary number means? | <p>What does x-bit binary number mean?
for example:</p>

<p>if <strong>x = 8</strong></p>

<p>is <strong>8-bit</strong> means:
any number consists of <strong>8</strong> bits, like : <strong>10101110</strong></p>

<p>or it has another meaning??</p>
 | memory management | 1 | What does x-bit binary number means? -- (memory management)
<p>What does x-bit binary number mean?
for example:</p>

<p>if <strong>x = 8</strong></p>

<p>is <strong>8-bit</strong> means:
any number consists of <strong>8</strong> bits, like : <strong>10101110</strong></p>

<p>or it has an... | habedi/stack-exchange-dataset |
48,585 | Which calculus is based on first-order functions and is Turing complete? | <p><strong>Which calculus is based on <a href="https://en.wikipedia.org/wiki/Higher-order_function" rel="nofollow">first-order functions</a> and is Turing complete?</strong></p>

<p>I know of calculi which are Turing complete, but based on higher-order functions:</p>

<ul>
<li>Lambda calculus</li>&#... | lambda calculus turing completeness | 1 | Which calculus is based on first-order functions and is Turing complete? -- (lambda calculus turing completeness)
<p><strong>Which calculus is based on <a href="https://en.wikipedia.org/wiki/Higher-order_function" rel="nofollow">first-order functions</a> and is Turing complete?</strong></p>

<p>I know of calcul... | habedi/stack-exchange-dataset |
48,592 | Regular language subsets | <p>If $L_{1} \subseteq L_{2}$ and $ L_{2}$ is regular, does it follow that $L_{1}$ is necessarily regular? I don't understand this question, is there any proof to show this or is there an assumption we make?</p>
 | regular languages regular expressions sets | 1 | Regular language subsets -- (regular languages regular expressions sets)
<p>If $L_{1} \subseteq L_{2}$ and $ L_{2}$ is regular, does it follow that $L_{1}$ is necessarily regular? I don't understand this question, is there any proof to show this or is there an assumption we make?</p>
 | habedi/stack-exchange-dataset |
48,598 | Minimum Spanning Tree over Vertices Proof | <p>This is the problem: </p>

<p>$d_{T}(v)$ denotes the degree of a vertex in a spanning tree $T$ and $w: V \rightarrow R^+$ is a weight function defined on vertices.</p>

<p>The goal is an algorithm that finds a spanning tree which minimizes the value $\sum_{v \in V}{d_{T}(v)*w(v)}$.</p>

<p>My... | algorithms algorithm analysis spanning trees | 1 | Minimum Spanning Tree over Vertices Proof -- (algorithms algorithm analysis spanning trees)
<p>This is the problem: </p>

<p>$d_{T}(v)$ denotes the degree of a vertex in a spanning tree $T$ and $w: V \rightarrow R^+$ is a weight function defined on vertices.</p>

<p>The goal is an algorithm that finds a... | habedi/stack-exchange-dataset |
48,607 | Can normal physics laws be simulated in Digital physics? | <p><a href="http://www.physics.org/article-questions.asp?id=18" rel="nofollow">Physics</a> is defined as the study of an object {matter or energy} with its interaction with other objects: </p>

<blockquote>
 <p>Physics is the study of matter, energy, and the interaction between them. </p>
</blockquote>... | computability turing machines physics | 1 | Can normal physics laws be simulated in Digital physics? -- (computability turing machines physics)
<p><a href="http://www.physics.org/article-questions.asp?id=18" rel="nofollow">Physics</a> is defined as the study of an object {matter or energy} with its interaction with other objects: </p>

<blockquote>
 ... | habedi/stack-exchange-dataset |
48,622 | Is there an algorithm for converting Turing machines into equivalent Lambda expressions? | <p>We know that Turing machines and Lambda Calculus are equivalent in power. And There are proofs for that, I'm sure.</p>

<p>But is there an algorithm, a systematic way for us to convert a Turing machine into a Lambda Calculus expression? Is it impossible to have such algorithm? (meaning does it go down to und... | turing machines lambda calculus turing completeness church turing thesis | 1 | Is there an algorithm for converting Turing machines into equivalent Lambda expressions? -- (turing machines lambda calculus turing completeness church turing thesis)
<p>We know that Turing machines and Lambda Calculus are equivalent in power. And There are proofs for that, I'm sure.</p>

<p>But is there an alg... | habedi/stack-exchange-dataset |
48,625 | Kosaraju's Algorithm-Strongly connected components | <p>In Kosaraju's Algorithm, using first dfs (traversing on reverse graph) we calculate finishing time of nodes, and then traverse (actual graph) in reverse order of finishing times.
why not without reversing graph, using first dfs (traversing on actual graph) we calculate finishing time of nodes, and then traverse ... | algorithms graphs | 1 | Kosaraju's Algorithm-Strongly connected components -- (algorithms graphs)
<p>In Kosaraju's Algorithm, using first dfs (traversing on reverse graph) we calculate finishing time of nodes, and then traverse (actual graph) in reverse order of finishing times.
why not without reversing graph, using first dfs (traversing... | habedi/stack-exchange-dataset |
48,637 | Prove REGULAR_TM is undecidable | <p>I am studying the proof of the following theorem:</p>

<p>Given the language</p>

<p>$\mathit{REGULAR}_\mathit{TM} = \{\langle M \rangle | M $ is a turing machine and $\mathit{Accept}(M)$ is regular$\}$</p>

<p>$\mathit{REGULAR}_\mathit{TM}$ is undecidable.</p>

<hr>

<p>The p... | computability turing machines undecidability | 1 | Prove REGULAR_TM is undecidable -- (computability turing machines undecidability)
<p>I am studying the proof of the following theorem:</p>

<p>Given the language</p>

<p>$\mathit{REGULAR}_\mathit{TM} = \{\langle M \rangle | M $ is a turing machine and $\mathit{Accept}(M)$ is regular$\}$</p>

<p>... | habedi/stack-exchange-dataset |
48,649 | Complexity of union-find with path-compression, without rank | <p>Wikipedia says union by rank without path compression gives an amortized time complexity of $O(\log n)$, and that both union by rank and path compression gives an amortized time complexity of $O(\alpha(n))$ (where $\alpha$ is the inverse of the Ackerman function). However, it does not mention the running time of pa... | complexity theory time complexity union find | 1 | Complexity of union-find with path-compression, without rank -- (complexity theory time complexity union find)
<p>Wikipedia says union by rank without path compression gives an amortized time complexity of $O(\log n)$, and that both union by rank and path compression gives an amortized time complexity of $O(\alpha(n))$... | habedi/stack-exchange-dataset |
48,650 | Mutex-/semaphore-/locking-algorithm using atomic reads/writes with data-propagation delays | <p>Is there a mutual exclusion or semaphore or locking algorithm that only relies on atomic reads and atomic writes of shared memory and can tolerate a delay in propagation of the written data between processes? I.e. if process A writes to shared memory, process B might not see the change for a while (but process A wil... | algorithms mutual exclusion | 1 | Mutex-/semaphore-/locking-algorithm using atomic reads/writes with data-propagation delays -- (algorithms mutual exclusion)
<p>Is there a mutual exclusion or semaphore or locking algorithm that only relies on atomic reads and atomic writes of shared memory and can tolerate a delay in propagation of the written data bet... | habedi/stack-exchange-dataset |
48,654 | Minimum number of rounds to notify a hierarchy of people with DP | <p>I'm trying to figure out a problem reported in Kleinberg (ch 6 no.16). I know that there are <a href="https://cs.stackexchange.com/questions/30570/finding-the-minimum-number-of-calls-in-a-tree">solutions</a> based on ordering, anyway i'd like to understand if another way exists.</p>

<p>Basically, we have a ... | dynamic programming | 1 | Minimum number of rounds to notify a hierarchy of people with DP -- (dynamic programming)
<p>I'm trying to figure out a problem reported in Kleinberg (ch 6 no.16). I know that there are <a href="https://cs.stackexchange.com/questions/30570/finding-the-minimum-number-of-calls-in-a-tree">solutions</a> based on ordering, ... | habedi/stack-exchange-dataset |
48,656 | How to find all shortest paths between two nodes in a weighted undirected graph? | <p>How to find all shortest paths between node 1 and N in a weighted undirected graph? There can be multiple edges between two nodes.</p>
<p>I want to find all nodes that can be on a shortest path. For example:</p>
<blockquote>
<p>10 11</p>
<p>1 2 1</p>
<p>1 3 1</p>
<p>3 4 2</p>
<p>4 5 1</p>... | graphs shortest path | 1 | How to find all shortest paths between two nodes in a weighted undirected graph? -- (graphs shortest path)
<p>How to find all shortest paths between node 1 and N in a weighted undirected graph? There can be multiple edges between two nodes.</p>
<p>I want to find all nodes that can be on a shortest path. For example... | habedi/stack-exchange-dataset |
48,659 | Proving that a language of Turing machine descriptions is/is not Turing recognizable | <p>How to approach to solve this question and the likes of it?</p>

<blockquote>
 <p>Let $L$ be the set of strings $\langle M\rangle$ such that $M$ accepts all strings of even length and does not accept any strings of odd length.</p>
 
 <p>a) Is $L$ Turing-recognizable? Prove your answer.<br>
... | computability semi decidability | 1 | Proving that a language of Turing machine descriptions is/is not Turing recognizable -- (computability semi decidability)
<p>How to approach to solve this question and the likes of it?</p>

<blockquote>
 <p>Let $L$ be the set of strings $\langle M\rangle$ such that $M$ accepts all strings of even length an... | habedi/stack-exchange-dataset |
48,660 | Minimum number of processes for the deadlock? | <blockquote>
<p>A system has 6 identical resources and <span class="math-container">$N$</span> processes competing for
them. Each process can request at most two requests. Which one of the
following values of <span class="math-container">$N$</span> could lead to a deadlock?</p>
<ol>
<li>1</li>
<... | operating systems synchronization deadlocks resource allocation | 1 | Minimum number of processes for the deadlock? -- (operating systems synchronization deadlocks resource allocation)
<blockquote>
<p>A system has 6 identical resources and <span class="math-container">$N$</span> processes competing for
them. Each process can request at most two requests. Which one of the
foll... | habedi/stack-exchange-dataset |
48,693 | Question about proof of Kannan's Theorem | <p>The wikipedia page (<a href="https://en.wikipedia.org/wiki/Karp%E2%80%93Lipton_theorem#Application_to_circuit_lower_bounds_.E2.80.93_Kannan.27s_theorem" rel="nofollow">here</a>) assumes the existence of some $L \in \Sigma_4 - SIZE(n^k)$. How can one show that such a language exists? </p>

<p>This is related ... | complexity theory | 1 | Question about proof of Kannan's Theorem -- (complexity theory)
<p>The wikipedia page (<a href="https://en.wikipedia.org/wiki/Karp%E2%80%93Lipton_theorem#Application_to_circuit_lower_bounds_.E2.80.93_Kannan.27s_theorem" rel="nofollow">here</a>) assumes the existence of some $L \in \Sigma_4 - SIZE(n^k)$. How can one sho... | habedi/stack-exchange-dataset |
48,698 | Logical equivalence and equality | <p>Let be $F=(A\land B)$ and $G=\neg(\neg A \lor \neg B)$. Which of the following statements are correct</p>

<p>$F=G, F\equiv G, \neg F=\neg G, \neg F\equiv\neg G$?</p>

<p>Is there a difference?</p>
 | equality | 1 | Logical equivalence and equality -- (equality)
<p>Let be $F=(A\land B)$ and $G=\neg(\neg A \lor \neg B)$. Which of the following statements are correct</p>

<p>$F=G, F\equiv G, \neg F=\neg G, \neg F\equiv\neg G$?</p>

<p>Is there a difference?</p>
 | habedi/stack-exchange-dataset |
48,701 | Question about "Type checking a multithreaded functional language with session types" by Vasconcelos et al | <p>I have been reading the paper[<a href="http://di.fc.ul.pt/~vv/papers/vasconcelos.gay.ravara_typechecking-session-types.pdf" rel="nofollow noreferrer">1</a>] in the title. But there are some parts of it that are unclear to me, more specifically the way you typecheck a lambda. I have attached the typing rules below as... | type checking | 1 | Question about "Type checking a multithreaded functional language with session types" by Vasconcelos et al -- (type checking)
<p>I have been reading the paper[<a href="http://di.fc.ul.pt/~vv/papers/vasconcelos.gay.ravara_typechecking-session-types.pdf" rel="nofollow noreferrer">1</a>] in the title. But there are some p... | habedi/stack-exchange-dataset |
48,707 | Complement of a Language which is set of Turing Machine descriptions | <p>If $L$ is the set of strings $\langle M\rangle$ such that $M$ accepts all strings of even length and does not accept any strings of odd length.</p>

<p>What will be $\overline L$ ?</p>

<p>a) set of strings $\langle M\rangle$ such that $M$ accepts all strings of even length as well as any strings of... | formal languages terminology closure properties | 1 | Complement of a Language which is set of Turing Machine descriptions -- (formal languages terminology closure properties)
<p>If $L$ is the set of strings $\langle M\rangle$ such that $M$ accepts all strings of even length and does not accept any strings of odd length.</p>

<p>What will be $\overline L$ ?</p>&#... | habedi/stack-exchange-dataset |
48,730 | Which addressing modes permits relocation without any change whatsoever in the code? | <p>An exercise problem stated that :</p>

<p>Which of the following addressing modes permits relocation without any change whatsoever in the code?</p>

<ol>
<li>Indirect addressing</li>
<li>Indexed addressing</li>
<li>Base register addressing</li>
<li>PC relative addressing</li>
</ol... | computer architecture operating systems | 1 | Which addressing modes permits relocation without any change whatsoever in the code? -- (computer architecture operating systems)
<p>An exercise problem stated that :</p>

<p>Which of the following addressing modes permits relocation without any change whatsoever in the code?</p>

<ol>
<li>Indirect ... | habedi/stack-exchange-dataset |
48,734 | Is language regular? | <p>Suppose we have language $a^{\binom{n}{k}} n,k \in N$ is this language regular ? If it is not, I should use pummping-lemma? It it is regular, I will use proof by induction ?</p>
 | regular languages | 1 | Is language regular? -- (regular languages)
<p>Suppose we have language $a^{\binom{n}{k}} n,k \in N$ is this language regular ? If it is not, I should use pummping-lemma? It it is regular, I will use proof by induction ?</p>
 | habedi/stack-exchange-dataset |
48,743 | Modified Clique Problem | <p>We know CLIQUE and HALF-CLIQUE problems are NP-complete. Now consider the class of graphs (let's call it $\mathcal{G}_{2K}$) where a graph $G=(V,E)$ is a member of $\mathcal{G}_{2K}$ iff $G$ has two <em>SEPARATE</em> cliques $K_1$ and $K_2$ of size $\dfrac{N}{2}$ (where $|V| = N$). My speculation is that $\mathcal{G... | np complete clique | 1 | Modified Clique Problem -- (np complete clique)
<p>We know CLIQUE and HALF-CLIQUE problems are NP-complete. Now consider the class of graphs (let's call it $\mathcal{G}_{2K}$) where a graph $G=(V,E)$ is a member of $\mathcal{G}_{2K}$ iff $G$ has two <em>SEPARATE</em> cliques $K_1$ and $K_2$ of size $\dfrac{N}{2}$ (wher... | habedi/stack-exchange-dataset |
48,744 | Algorithm to decide whether two vertices are ancestors/descendants of each other | <p>Is there an algorithm that performs the following:</p>

<p><strong>Input:</strong> A directed graph and two vertices within that graph<br>
<strong>Output:</strong> Whether one of the two vertices is the ancestor of the other</p>

<p>For example, in this graph:</p>

<p><a href="https://i.s... | graphs | 1 | Algorithm to decide whether two vertices are ancestors/descendants of each other -- (graphs)
<p>Is there an algorithm that performs the following:</p>

<p><strong>Input:</strong> A directed graph and two vertices within that graph<br>
<strong>Output:</strong> Whether one of the two vertices is the ancestor ... | habedi/stack-exchange-dataset |
48,746 | In the Curry-Howard isomorphism as applied to Hindley-Milner types, what proposition corresponds to a -> [a]? | <p>(Using Haskell syntax, since the question is inspired by Haskell, but it applies to general Hindley-Milner polymorphic type systems, such as SML or Elm).</p>

<p>If I have a type signature <code>f :: a -> [a]</code>, what is the logical proposition encoded by that type signature?</p>

<p>I know th... | programming languages type theory functional programming curry howard | 1 | In the Curry-Howard isomorphism as applied to Hindley-Milner types, what proposition corresponds to a -> [a]? -- (programming languages type theory functional programming curry howard)
<p>(Using Haskell syntax, since the question is inspired by Haskell, but it applies to general Hindley-Milner polymorphic type systems,... | habedi/stack-exchange-dataset |
48,758 | Why doesn't decision tree work in case find minimum | <p>When we would like to prove lower bound comparison algorirthm, we often use decision tree, for example sorting by comparisons.<br>
So let's consider find minimum in array $a[1..n]$ by comparison. Lower bound for that problem is commonly known - $n-1$ comparisons. </p>

<p><strong>However, how to use d... | lower bounds | 1 | Why doesn't decision tree work in case find minimum -- (lower bounds)
<p>When we would like to prove lower bound comparison algorirthm, we often use decision tree, for example sorting by comparisons.<br>
So let's consider find minimum in array $a[1..n]$ by comparison. Lower bound for that problem is commonly know... | habedi/stack-exchange-dataset |
48,775 | NP-hardness of covering with rectangular pieces (Google Hash Code 2015 Test Round) | <p>The Google Hash Code 2015 Test Round (<a href="https://docs.google.com/file/d/0B8xe9y1rGAQXV1hXOXVtUk40Mm8/edit?pli=1">problem statement</a>) asked about the following problem:</p>

<ul>
<li>input: a grid $M$ with some marked squares, a threshold $T \in \mathbb{N}$, a maximal area $A \in \mathbb{N}$</li>... | complexity theory reductions np hard | 1 | NP-hardness of covering with rectangular pieces (Google Hash Code 2015 Test Round) -- (complexity theory reductions np hard)
<p>The Google Hash Code 2015 Test Round (<a href="https://docs.google.com/file/d/0B8xe9y1rGAQXV1hXOXVtUk40Mm8/edit?pli=1">problem statement</a>) asked about the following problem:</p>

<u... | habedi/stack-exchange-dataset |
48,776 | Converting maximization to minimization in aproximation algorithms | <p>Suppose algorithm <em>A</em> is given for a maximization problem and we are asked to show that it is a 1/2-approximation algorithm. </p>

<p>As you know it is enough to show</p>

<p>Sol >= 1/2 OPT</p>

<p>What I need to know is, is it true to assume this problem as a minimization one and prov... | algorithms optimization approximation | 1 | Converting maximization to minimization in aproximation algorithms -- (algorithms optimization approximation)
<p>Suppose algorithm <em>A</em> is given for a maximization problem and we are asked to show that it is a 1/2-approximation algorithm. </p>

<p>As you know it is enough to show</p>

<p>Sol >= 1/... | habedi/stack-exchange-dataset |
48,777 | Is the language of TMs that decide some language Turing-recognizable? | <p>Is the language </p>

<p>$\qquad L=\{ \langle \text{M} \rangle \; | \; \text{M is a Turing machine that decides some language} \}$ </p>

<p>a Turing-recognizable language? I think it's not, as, even if I am able to tell somehow that a Turing machine halts for some input there are still infinite stri... | computability turing machines semi decidability | 1 | Is the language of TMs that decide some language Turing-recognizable? -- (computability turing machines semi decidability)
<p>Is the language </p>

<p>$\qquad L=\{ \langle \text{M} \rangle \; | \; \text{M is a Turing machine that decides some language} \}$ </p>

<p>a Turing-recognizable language? I thin... | habedi/stack-exchange-dataset |
48,796 | Plow a 2D polygonal area | <p>I have a problem that is similar to this that I am trying to solve:
"Given a randomly-shaped field, what is the best (fastest I guess) way to plow it? Every part of the field must be plowed, plowing outside the area is not a problem, and turning around is slower than going straight."<br>
Basically, I'm in th... | algorithms optimization computational geometry | 1 | Plow a 2D polygonal area -- (algorithms optimization computational geometry)
<p>I have a problem that is similar to this that I am trying to solve:
"Given a randomly-shaped field, what is the best (fastest I guess) way to plow it? Every part of the field must be plowed, plowing outside the area is not a problem, an... | habedi/stack-exchange-dataset |
48,807 | Do one way function exist? | <p>I was recently going through the Wiki page <a href="https://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_science" rel="nofollow noreferrer">List of unsolved Problems in Computer Science</a>.</p>

<p>There was a problem which I do not understand</p>

<blockquote>
 <p>Do one-way fun... | cryptography one way functions | 1 | Do one way function exist? -- (cryptography one way functions)
<p>I was recently going through the Wiki page <a href="https://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_science" rel="nofollow noreferrer">List of unsolved Problems in Computer Science</a>.</p>

<p>There was a problem which I do n... | habedi/stack-exchange-dataset |
48,811 | Why are states called locations in Timed Automata? | <p>I started reading about <a href="https://en.wikipedia.org/wiki/Timed_automaton" rel="nofollow">timed automata</a> lately. In the definition, they have <em>locations</em> instead of <em>states</em> as in <a href="https://en.wikipedia.org/wiki/Automata_theory" rel="nofollow">automata theory</a>. Can anyone explain why... | terminology automata | 1 | Why are states called locations in Timed Automata? -- (terminology automata)
<p>I started reading about <a href="https://en.wikipedia.org/wiki/Timed_automaton" rel="nofollow">timed automata</a> lately. In the definition, they have <em>locations</em> instead of <em>states</em> as in <a href="https://en.wikipedia.org/wik... | habedi/stack-exchange-dataset |
48,815 | Why do we use Insertion Sort in the Bucket Sort? | <p>Bucket sort is a linear-time sort. </p>

<ol>
<li>Why do we use insertion sort in it? We know that insertion sort takes $O(n^2)$ time.</li>
<li>Why can we not use any linear sort inside it?</li>
<li>As we see, when in each bucket we use insertion sort $O(n^2)$. How is bucket sort's total complexi... | algorithms algorithm analysis runtime analysis sorting | 1 | Why do we use Insertion Sort in the Bucket Sort? -- (algorithms algorithm analysis runtime analysis sorting)
<p>Bucket sort is a linear-time sort. </p>

<ol>
<li>Why do we use insertion sort in it? We know that insertion sort takes $O(n^2)$ time.</li>
<li>Why can we not use any linear sort inside it?</l... | habedi/stack-exchange-dataset |
48,817 | Sorting an unordered pile of items into drawers with minimal drawer movements | <p>A while ago, I was doing my laundry late at night. When I brought my laundry back to my dorm, I started to put it away.</p>

<p>My wardrobe is set up as follows:</p>

<ul>
<li>My drawers are categorized by the type of clothing they hold, and I'm very particular about that; this means I can't put... | algorithms optimization sorting randomized algorithms | 1 | Sorting an unordered pile of items into drawers with minimal drawer movements -- (algorithms optimization sorting randomized algorithms)
<p>A while ago, I was doing my laundry late at night. When I brought my laundry back to my dorm, I started to put it away.</p>

<p>My wardrobe is set up as follows:</p>
&... | habedi/stack-exchange-dataset |
48,821 | Is showing two different derivations enough to prove that a CFG is ambiguous? | <p>I'm wondering, is showing two different ways to derive the same word enough proof to show that a context-free grammar is ambiguous?</p>

<p>For example:</p>

<p><br><strong>O</strong> = start symbol
<br><strong>Non-terminal</strong> = {O}
<br><strong>Terminal</strong> = {r, s}
<br><strong... | context free formal grammars ambiguity | 1 | Is showing two different derivations enough to prove that a CFG is ambiguous? -- (context free formal grammars ambiguity)
<p>I'm wondering, is showing two different ways to derive the same word enough proof to show that a context-free grammar is ambiguous?</p>

<p>For example:</p>

<p><br><strong>O</str... | habedi/stack-exchange-dataset |
48,825 | Finding a target vector through applications of a binary operator | <p>Let $\mathbb{X} = \mathbb{N} \cap [0, 255]$. I am given three vectors in $\mathbb{X}^3$ which I will denote by $v_i = [x_i, y_i, z_i]^T$ for $i \in \{1, 2, 3\}$. Now we have a binary operator $\bigoplus$ defined by $w = u \bigoplus v = \lfloor0.9 \cdot u\rfloor + \lfloor0.1 \cdot v\rfloor$, where $u$ and $v$ are in ... | algorithms search algorithms | 1 | Finding a target vector through applications of a binary operator -- (algorithms search algorithms)
<p>Let $\mathbb{X} = \mathbb{N} \cap [0, 255]$. I am given three vectors in $\mathbb{X}^3$ which I will denote by $v_i = [x_i, y_i, z_i]^T$ for $i \in \{1, 2, 3\}$. Now we have a binary operator $\bigoplus$ defined by $w... | habedi/stack-exchange-dataset |
48,830 | Proving that picking odd-numbered symbols can create the universal set from a non-regular language | <p>Let's define the following operations: </p>

<p>$odd(string) = $ odd characters of $string$, $even(string) = $ even characters of $string$</p>

<p>Now say we have some language $L$, we will then define the following languages:</p>

<p>$odd(L) = \{odd(w): w \in L\}$, $even(L) = \{even(w): w \i... | formal languages regular languages proof techniques | 1 | Proving that picking odd-numbered symbols can create the universal set from a non-regular language -- (formal languages regular languages proof techniques)
<p>Let's define the following operations: </p>

<p>$odd(string) = $ odd characters of $string$, $even(string) = $ even characters of $string$</p>

<... | habedi/stack-exchange-dataset |
48,834 | Applying a multi qubit quantum gate to specific qubits | <p>A controlled not gate matrix looks like this:</p>

<p>$$\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0 \\
\end{bmatrix}$$</p>

<p>That works great when you only have two qubits and you want to use th... | quantum computing | 1 | Applying a multi qubit quantum gate to specific qubits -- (quantum computing)
<p>A controlled not gate matrix looks like this:</p>

<p>$$\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0 \\
\end{bmatrix}$$</p>
... | habedi/stack-exchange-dataset |
48,836 | How do I sort these elements in O(n) time? | <p>So let's say I have an array of elements where each of the values can range from 0 to $n^2-1$. I'm trying to make an algorithm to sort this array in O(n) running time and I was thinking of using radix sort. The run time of radix sort is O(d(n+N)) or O(dn) if n is really large. So how can I modify radix sort so that ... | algorithm analysis runtime analysis sorting arrays radix sort | 1 | How do I sort these elements in O(n) time? -- (algorithm analysis runtime analysis sorting arrays radix sort)
<p>So let's say I have an array of elements where each of the values can range from 0 to $n^2-1$. I'm trying to make an algorithm to sort this array in O(n) running time and I was thinking of using radix sort. ... | habedi/stack-exchange-dataset |
48,848 | Choosing a random bit from a bitmap | <p>Since, I don't have strong algorithmic background my question may sound a litlle odd. Please correct me, if so.</p>

<p>I have quite a large bitmap (~100 Million bits) (e.g. <code>100100101001010001001...010010</code>). The bitmap is just an example, it doesn't have to start with <code>1</code> or end with <... | algorithms randomized algorithms sampling | 1 | Choosing a random bit from a bitmap -- (algorithms randomized algorithms sampling)
<p>Since, I don't have strong algorithmic background my question may sound a litlle odd. Please correct me, if so.</p>

<p>I have quite a large bitmap (~100 Million bits) (e.g. <code>100100101001010001001...010010</code>). The bi... | habedi/stack-exchange-dataset |
48,859 | Basic requirements for Integrality gap examples | <p>I have the following question about giving a series of examples of range spaces for my Hitting Set problem that establish a lower bound for the integrality gap (IG). </p>

<p>IG is the supremum of ratio of the optimum for natural integer linear programming (ILP) formulation of Hitting Set to the optimum for ... | algorithms complexity theory integer programming | 1 | Basic requirements for Integrality gap examples -- (algorithms complexity theory integer programming)
<p>I have the following question about giving a series of examples of range spaces for my Hitting Set problem that establish a lower bound for the integrality gap (IG). </p>

<p>IG is the supremum of ratio of t... | habedi/stack-exchange-dataset |
48,860 | How rule 110 would be proven to be universal if the tag system did not exist? | <p>I was reading about Cellular Automata and I read in <a href="https://cs.stackexchange.com/a/4780/41414">this question</a> that
Matthew Cook proved that rule 110 is universal, and that his proof relied upon showing how rule 110 can simulate a <a href="https://en.wikipedia.org/wiki/Tag_system" rel="nofollow norefe... | computability reference request proof techniques turing completeness cellular automata | 1 | How rule 110 would be proven to be universal if the tag system did not exist? -- (computability reference request proof techniques turing completeness cellular automata)
<p>I was reading about Cellular Automata and I read in <a href="https://cs.stackexchange.com/a/4780/41414">this question</a> that
Matthew Cook pro... | habedi/stack-exchange-dataset |
48,861 | Balance factor changes after local rotations in AVL tree | <p>I try to understand balance factors change after local rotations in AVL trees.
Given the <code>rotate_left</code> operation:</p>

<pre><code> x y'
 / \ / \
a y => x' c
 / \ / \
 b c a b
</code></pre>

<p>and $b(x)$, $b(y)$ - balanc... | algorithm analysis data structures search trees balanced search trees | 1 | Balance factor changes after local rotations in AVL tree -- (algorithm analysis data structures search trees balanced search trees)
<p>I try to understand balance factors change after local rotations in AVL trees.
Given the <code>rotate_left</code> operation:</p>

<pre><code> x y'
 / \ ... | habedi/stack-exchange-dataset |
48,862 | Image Comparison tuned to Human Perception | <p>Say I have two systems that take the same drawing commands and starts drawing on their respective platforms (i.e. HTML Canvas). After this is done, I want to save and compare these two images to ensure that they are perceptually the same, even though the shapes and colors may be very slightly off (non-perceptible di... | algorithms image processing computer vision graphics | 1 | Image Comparison tuned to Human Perception -- (algorithms image processing computer vision graphics)
<p>Say I have two systems that take the same drawing commands and starts drawing on their respective platforms (i.e. HTML Canvas). After this is done, I want to save and compare these two images to ensure that they are ... | habedi/stack-exchange-dataset |
48,866 | Item lookaheads versus dot lookaheads for $LR(k)$ with $k \gt 1$? | <p>I was reading "Parsing Techniques: A Practical Guide, Second Edition" by Grune and Jacobs, which details a bunch of different parsing algorithms. In the section on $LR(2)$ parsing, they mention that unlike $LR(1)$ items, which just have an item lookahead (the token that should appear after the completed $LR(1)$ item... | compilers parsers lr k | 1 | Item lookaheads versus dot lookaheads for $LR(k)$ with $k \gt 1$? -- (compilers parsers lr k)
<p>I was reading "Parsing Techniques: A Practical Guide, Second Edition" by Grune and Jacobs, which details a bunch of different parsing algorithms. In the section on $LR(2)$ parsing, they mention that unlike $LR(1)$ items, wh... | habedi/stack-exchange-dataset |
48,901 | Can big-step semantics express evaluation order? | <p>Can you express evaluation order using big-step semantics? </p>

<p>For example, in a simple language consisting of only <code>if t then t else t</code> and <code>true</code> and <code>false</code>, we can decide to only step a <code>if then else</code> to one of its branches if its branches are already valu... | programming languages type theory | 1 | Can big-step semantics express evaluation order? -- (programming languages type theory)
<p>Can you express evaluation order using big-step semantics? </p>

<p>For example, in a simple language consisting of only <code>if t then t else t</code> and <code>true</code> and <code>false</code>, we can decide to only ... | habedi/stack-exchange-dataset |
48,908 | Schaefer's dichotomy theorem and reformulating 3-literal clauses | <p>Does Schaefer's dichotomy theorem establish that a general 3-sat clause cannot be transformed into an equivalent set of 2-sat/Hornsat/affine clauses (using auxiliary variables) or just that this would be very unlikely in that it would imply P = NP? I ask because I know that there are some types of problems involvin... | complexity theory np complete satisfiability p vs np 2 sat | 1 | Schaefer's dichotomy theorem and reformulating 3-literal clauses -- (complexity theory np complete satisfiability p vs np 2 sat)
<p>Does Schaefer's dichotomy theorem establish that a general 3-sat clause cannot be transformed into an equivalent set of 2-sat/Hornsat/affine clauses (using auxiliary variables) or just tha... | habedi/stack-exchange-dataset |
48,931 | Exploring and interpolating a function using machine-learning? | <p>Which general machine-learning methods are there that try to <strong>"learn" or interpolate a smooth multivariate function</strong> and which get to actually <strong>choose the points</strong> at which the function is evaluated during the learning process (exploration)?</p>

<p>The idea would be that each fu... | machine learning artificial intelligence | 1 | Exploring and interpolating a function using machine-learning? -- (machine learning artificial intelligence)
<p>Which general machine-learning methods are there that try to <strong>"learn" or interpolate a smooth multivariate function</strong> and which get to actually <strong>choose the points</strong> at which the fu... | habedi/stack-exchange-dataset |
48,937 | A variant of the vertex cover problem on trees | <p>Consider the following variation on the vertex cover problem: given a tree on $n$ vertices, we are asked to calculate minimum size of a multiset $S$ such for each edge $(u,v)$ in the tree at least one of the following holds:</p>

<ul>
<li>$u\in S$,</li>
<li>$v\in S$,</li>
<li>there are ... | algorithms graphs dynamic programming | 1 | A variant of the vertex cover problem on trees -- (algorithms graphs dynamic programming)
<p>Consider the following variation on the vertex cover problem: given a tree on $n$ vertices, we are asked to calculate minimum size of a multiset $S$ such for each edge $(u,v)$ in the tree at least one of the following... | habedi/stack-exchange-dataset |
48,945 | [Graph Problem algorithm] | <p>I am new here . Please forgive me if there is anything wrong in that I am going to write .
So , my question is about one problem given in last round of codeforces , pretty easy to handle it , but I do not understand the other players` solutions .</p>

<p>THE PROBLEM :</p>

<p>We have a convex pol... | graphs combinatorics | 1 | [Graph Problem algorithm] -- (graphs combinatorics)
<p>I am new here . Please forgive me if there is anything wrong in that I am going to write .
So , my question is about one problem given in last round of codeforces , pretty easy to handle it , but I do not understand the other players` solutions .</p>

<... | habedi/stack-exchange-dataset |
48,949 | How to impose Euclidean distance constraint in a constraint satisfaction problem without quadratic constraints? | <p>Best reference I could find is <a href="https://web.stanford.edu/class/ee392o/EE392o-yinyu-ye.pdf" rel="nofollow">this one</a>. However, I could not quite understand this one since there is no numerical example.</p>

<h2>What I am trying to achieve with one sentence</h2>

<p>How can I answer the foll... | graphs weighted graphs modelling constraint programming | 1 | How to impose Euclidean distance constraint in a constraint satisfaction problem without quadratic constraints? -- (graphs weighted graphs modelling constraint programming)
<p>Best reference I could find is <a href="https://web.stanford.edu/class/ee392o/EE392o-yinyu-ye.pdf" rel="nofollow">this one</a>. However, I could... | habedi/stack-exchange-dataset |
48,955 | Upper bound on the number of triangles in a planar graph | <p>For any $n \geq 4$, I was able to prove that every Apollonian network has $3n - 8$ triangles. An Apollonian network is a planar graph defined by recursively subdividing a triangle by three smaller triangles (adding a new vertex inside the face and connecting it to all three vertices). Now I am trying to prove a simi... | graphs mathematical analysis planar graphs | 1 | Upper bound on the number of triangles in a planar graph -- (graphs mathematical analysis planar graphs)
<p>For any $n \geq 4$, I was able to prove that every Apollonian network has $3n - 8$ triangles. An Apollonian network is a planar graph defined by recursively subdividing a triangle by three smaller triangles (addi... | habedi/stack-exchange-dataset |
48,956 | Is the language $\{a^{n^2-1} | n \in \mathbb{N}\}$ context free? and how to prove it? | <p>Is the language $\{a^{n^2-1} | n \in \mathbb{N}\}$ context free? and how to prove it?
I think it is, but I could not find a way to prove it by using push down automaton or any other way.</p>
 | formal languages context free formal grammars | 1 | Is the language $\{a^{n^2-1} | n \in \mathbb{N}\}$ context free? and how to prove it? -- (formal languages context free formal grammars)
<p>Is the language $\{a^{n^2-1} | n \in \mathbb{N}\}$ context free? and how to prove it?
I think it is, but I could not find a way to prove it by using push down automaton or any ... | habedi/stack-exchange-dataset |
48,963 | Optimizing NFL draft picks | <p>I have a little problem I have been trying to solve for a hobby after a friend got me interested in fantasy football: given a list of players, positions for those players, projected points, salary, and a salary cap, build the highest projected scoring NFL team that fits the salary cap. I am interested in finding an ... | algorithms optimization knapsack problems program optimization | 1 | Optimizing NFL draft picks -- (algorithms optimization knapsack problems program optimization)
<p>I have a little problem I have been trying to solve for a hobby after a friend got me interested in fantasy football: given a list of players, positions for those players, projected points, salary, and a salary cap, build ... | habedi/stack-exchange-dataset |
48,970 | Does proving a problem is in P typically mean it will eventually be practically solvable? | <p>I'm currently reading Introduction to the Theory of Computation by Michael Sipser and in his section on time complexity, he tries to justify why theoretical computer scientists divide problems into P and NP.</p>

<p>First he says:</p>

<blockquote>
 <p>$P$ roughly corresponds to the class of pro... | algorithms complexity theory terminology efficiency | 1 | Does proving a problem is in P typically mean it will eventually be practically solvable? -- (algorithms complexity theory terminology efficiency)
<p>I'm currently reading Introduction to the Theory of Computation by Michael Sipser and in his section on time complexity, he tries to justify why theoretical computer scie... | habedi/stack-exchange-dataset |
48,977 | When to use Djikstra or Bellman-Kallaba algorithm? | <p>This the answer that was accepted for <a href="https://cs.stackexchange.com/questions/48511/how-to-solve-an-arrangement-problem-at-the-archive-nationale-of-france-using-gra">the arrangement problem of a library</a>:</p>

<blockquote>
 <p>we have books with heights $H_n,$ $1 \le n \le N$ and widths $W_n,... | algorithms graphs | 1 | When to use Djikstra or Bellman-Kallaba algorithm? -- (algorithms graphs)
<p>This the answer that was accepted for <a href="https://cs.stackexchange.com/questions/48511/how-to-solve-an-arrangement-problem-at-the-archive-nationale-of-france-using-gra">the arrangement problem of a library</a>:</p>

<blockquote>&#... | habedi/stack-exchange-dataset |
48,980 | Using dynamic programming to maximize work done | <p>Say that there are $n$ days and there is $x_1, x_2, ...,x_n$ amount of data to process on each day. Your computer can process $s_1$ amount of work on the first day since rebooting your computer, $s_2$ work on the second day since a reboot, up to $s_n$. On each consecutive the day the amount of work your computer can... | algorithms optimization dynamic programming scheduling | 1 | Using dynamic programming to maximize work done -- (algorithms optimization dynamic programming scheduling)
<p>Say that there are $n$ days and there is $x_1, x_2, ...,x_n$ amount of data to process on each day. Your computer can process $s_1$ amount of work on the first day since rebooting your computer, $s_2$ work on ... | habedi/stack-exchange-dataset |
48,991 | How to prove the linear context free languages are closed under gsm mapping? | <p>I'm stuck on the following question:</p>

<p><strong>How to prove the linear context free languages are closed under gsm mapping?</strong></p>
 | formal languages context free closure properties | 1 | How to prove the linear context free languages are closed under gsm mapping? -- (formal languages context free closure properties)
<p>I'm stuck on the following question:</p>

<p><strong>How to prove the linear context free languages are closed under gsm mapping?</strong></p>
 | habedi/stack-exchange-dataset |
49,000 | Is the language TMs that accept finite languages Turing-recognizable? | <p>I know that $L=\{ \langle M \rangle \mid |L(M)| < \infty \}$ is not decidable (by Rice's theorem or using reduction, I followed it from <a href="https://cs.stackexchange.com/questions/24439/can-you-recognize-or-decide-if-a-turing-machine-has-an-infinite-sized-language">$L$ not being decidable</a> ). But is $L$ r... | computability turing machines semi decidability | 1 | Is the language TMs that accept finite languages Turing-recognizable? -- (computability turing machines semi decidability)
<p>I know that $L=\{ \langle M \rangle \mid |L(M)| < \infty \}$ is not decidable (by Rice's theorem or using reduction, I followed it from <a href="https://cs.stackexchange.com/questions/24439/c... | habedi/stack-exchange-dataset |
49,006 | How does one compute the probability of a false-based Monte Carlo algorithm being correct rigorously? | <p>Recall that a false-biased Monte Carlo (MC) algorithm is always correct when it returns false for some decision problem i.e. it has a one sided error and its always correct on NO instances.</p>

<p>Assume that we have a false-biased MC algorithm. In this case when it says NO its always correct. This means th... | algorithms algorithm analysis randomized algorithms | 1 | How does one compute the probability of a false-based Monte Carlo algorithm being correct rigorously? -- (algorithms algorithm analysis randomized algorithms)
<p>Recall that a false-biased Monte Carlo (MC) algorithm is always correct when it returns false for some decision problem i.e. it has a one sided error and its ... | habedi/stack-exchange-dataset |
49,009 | Quick Sort: Randomized Pivot vs Median of 3/'Ninther' Pivot vs Uniform Shuffle of Input | <p>Is the jury still out on this or do we now know which of the above mentioned ways of randomizing Quick Sort is the most optimum as far as average case running time (averaged over all possible input arrays, with all permutations of the numbers being equally likely) is concerned?</p>

<p>Or perhaps, has a case... | algorithms sorting efficiency | 1 | Quick Sort: Randomized Pivot vs Median of 3/'Ninther' Pivot vs Uniform Shuffle of Input -- (algorithms sorting efficiency)
<p>Is the jury still out on this or do we now know which of the above mentioned ways of randomizing Quick Sort is the most optimum as far as average case running time (averaged over all possible in... | habedi/stack-exchange-dataset |
49,010 | run time analysis of a for loop | <p>I am trying to prepare for a test comping up on run-time analysis. I have been hit with a for loop that is throwing me a bit. I am hoping someone can help me. </p>

<p>the loop is</p>

<pre><code>for(j=1; j< n; j=j*2)
</code></pre>

<p>J is increasing at an increasing rate so it wil... | algorithm analysis runtime analysis loops | 1 | run time analysis of a for loop -- (algorithm analysis runtime analysis loops)
<p>I am trying to prepare for a test comping up on run-time analysis. I have been hit with a for loop that is throwing me a bit. I am hoping someone can help me. </p>

<p>the loop is</p>

<pre><code>for(j=1; j< n; j=j*2... | habedi/stack-exchange-dataset |
49,017 | Correctness of Freivald algorithm for checking matrix multiplication, why is the probability of checking $AB \neq C$ at least 1/2? | <p>I am going to consider Freivald's algorithm in the field mod 2. So in this algorithm we want to check wether 
$$AB = C$$
and be correct with high probability. </p>

<p>The algorithm choose a random $r$ n-bit vector and if 
$$A(Br) = Cr$$
then outputs YES, otherwise outputs no.</p>

<... | algorithms randomized algorithms correctness proof matrices | 1 | Correctness of Freivald algorithm for checking matrix multiplication, why is the probability of checking $AB \neq C$ at least 1/2? -- (algorithms randomized algorithms correctness proof matrices)
<p>I am going to consider Freivald's algorithm in the field mod 2. So in this algorithm we want to check wether 
$$AB = ... | habedi/stack-exchange-dataset |
49,018 | Shortest path in a dynamic tree with vertex updates | <p>There is a tree with $n$ nodes. All edges are of equal weights. The vertices of the tree can be of two types: 0 or 1. There are two types of queries: </p>

<ul>
<li>Set(X): change the given vertex X from type 0 to type 1, </li>
<li>Dist(X): find the shortest path from X to a node of type 1 and return... | algorithms graphs trees | 1 | Shortest path in a dynamic tree with vertex updates -- (algorithms graphs trees)
<p>There is a tree with $n$ nodes. All edges are of equal weights. The vertices of the tree can be of two types: 0 or 1. There are two types of queries: </p>

<ul>
<li>Set(X): change the given vertex X from type 0 to type 1, </... | habedi/stack-exchange-dataset |
49,027 | Balanced allocation-Hash table- overflow probability | <p>My question is related to this: 
<a href="https://cs.stackexchange.com/questions/48461/hash-table-in-practice">Hash-Table in Practice</a></p>

<hr>

<p>In [1] page 7, it is said that if we throw $n$ balls into $k$ bins, then each bin contains at most $\frac{n}{k}+O(\sqrt[2]{(\frac{n}{k})\log k}+... | algorithm analysis data structures probability theory hash tables | 1 | Balanced allocation-Hash table- overflow probability -- (algorithm analysis data structures probability theory hash tables)
<p>My question is related to this: 
<a href="https://cs.stackexchange.com/questions/48461/hash-table-in-practice">Hash-Table in Practice</a></p>

<hr>

<p>In [1] page 7, it is ... | habedi/stack-exchange-dataset |
49,039 | Lower bound for comparison algorithm - checking whether permutation is odd or even | <p>I consider problem: proving lower bound for comparison algorithm that check whether permutation is odd or even.<br>
I know that this bound is $\Omega(n\lg n)$. </p>

<p>Could you give me a clue ?</p>
 | algorithms algorithm analysis permutations | 1 | Lower bound for comparison algorithm - checking whether permutation is odd or even -- (algorithms algorithm analysis permutations)
<p>I consider problem: proving lower bound for comparison algorithm that check whether permutation is odd or even.<br>
I know that this bound is $\Omega(n\lg n)$. </p>

<p>Co... | habedi/stack-exchange-dataset |
49,046 | Kleene plus in Thompson's construction | <p><strong>Is there a direct way to represent Kleene plus(+) using Thompson's construction algorithm?</strong></p>
<p>When I studied Thompson's construction I learned how to transform concatenation, union and kleene star of regular expresions directly into a NFA.</p>
<p>In wikipedia(and other websites) I found... | automata finite automata regular expressions | 1 | Kleene plus in Thompson's construction -- (automata finite automata regular expressions)
<p><strong>Is there a direct way to represent Kleene plus(+) using Thompson's construction algorithm?</strong></p>
<p>When I studied Thompson's construction I learned how to transform concatenation, union and kleene star of re... | habedi/stack-exchange-dataset |
49,048 | Why is there no deterministic algorithm for determining the majority vote of a recursive 3 branch tree without inspecting all the leafs? | <p>Say that we have nodes in a tree and it has a branching factor of 3. At the leaves we have a binary value 1 or 0 (which can be viewed as "votes"). Each parent computes the majority of its children and assigns itself that value ("vote").</p>

<p>What I want to show is that in the worst case, a deterministic a... | algorithms algorithm analysis | 1 | Why is there no deterministic algorithm for determining the majority vote of a recursive 3 branch tree without inspecting all the leafs? -- (algorithms algorithm analysis)
<p>Say that we have nodes in a tree and it has a branching factor of 3. At the leaves we have a binary value 1 or 0 (which can be viewed as "votes")... | habedi/stack-exchange-dataset |
49,056 | Data structures as algorithms themselves | <p>Can data structures be thought of as algorithms themselves?</p>

<p>For example, I could implement a stack data structure that has certain non-functional characteristics.</p>

<p>Is the separation between data structures and algorithms formally defined?</p>
 | algorithms terminology data structures | 1 | Data structures as algorithms themselves -- (algorithms terminology data structures)
<p>Can data structures be thought of as algorithms themselves?</p>

<p>For example, I could implement a stack data structure that has certain non-functional characteristics.</p>

<p>Is the separation between data struct... | habedi/stack-exchange-dataset |
49,061 | Running time of amstrong algorithm | <p>I have a problem how to find best, worst, average case in armstrong number algorithm?</p>

<p>Here the pseudo-code :</p>

<pre><code>Declaration:
 n : integer
 Sum : integer
 Temp : integer
 Rem : integer
Algorithm:
 Input(n)
 Temp <-- n&#... | algorithms algorithm analysis time complexity runtime analysis | 1 | Running time of amstrong algorithm -- (algorithms algorithm analysis time complexity runtime analysis)
<p>I have a problem how to find best, worst, average case in armstrong number algorithm?</p>

<p>Here the pseudo-code :</p>

<pre><code>Declaration:
 n : integer
 Sum : integer
 ... | habedi/stack-exchange-dataset |
49,062 | Space complexity of directed and undirected graph | <p>I have started reading graph theory from <a href="https://mitpress.mit.edu/books/introduction-algorithms" rel="nofollow">Introduction to Algorithm</a>. The author starts by saying that if the graph is dense then:</p>

<p>$$|E|\text{ close to }|V|^2$$ else if the graph is sparse then:</p>

<p>$$|E|\te... | graphs data structures space analysis | 1 | Space complexity of directed and undirected graph -- (graphs data structures space analysis)
<p>I have started reading graph theory from <a href="https://mitpress.mit.edu/books/introduction-algorithms" rel="nofollow">Introduction to Algorithm</a>. The author starts by saying that if the graph is dense then:</p>
&#x... | habedi/stack-exchange-dataset |
49,070 | Given a moving ball in a grid, which squares does the ball reach? | <p>You are given an m x n grid. A dimensionless ball is placed at the centre of one of the grid squares and starts moving in one of 4 directions: north-east, north-west, south-east, or south-west. The ball continues moving until it reaches the edge of the board at which point, it bounces back in accordance with the law... | algorithms computational geometry | 1 | Given a moving ball in a grid, which squares does the ball reach? -- (algorithms computational geometry)
<p>You are given an m x n grid. A dimensionless ball is placed at the centre of one of the grid squares and starts moving in one of 4 directions: north-east, north-west, south-east, or south-west. The ball continues... | habedi/stack-exchange-dataset |
49,071 | How to denote the space complexity in terms of output | <p>Normally the space complexity of an Algorithm $A$ is denoted $\textrm{SPACE}(A)$, which means how much space is needed by the computation itself. I would however like to also describe how much storage an algorithm needs, i.e. if I have a Turing Machine with three tapes, one for the input, one for the computation, an... | complexity theory space complexity notation | 1 | How to denote the space complexity in terms of output -- (complexity theory space complexity notation)
<p>Normally the space complexity of an Algorithm $A$ is denoted $\textrm{SPACE}(A)$, which means how much space is needed by the computation itself. I would however like to also describe how much storage an algorithm ... | habedi/stack-exchange-dataset |
49,073 | Partitions of a directed graph - common prey and common enemy partitions | <p>Let $D=(V,E)$ be a finite directed graph with no isolated nodes(from every node there is at least one edge entering and one exiting). For $v \in V$ define the following sets: $$v^+= \left\{w \in V|(v,w)\in E \right\}, v^-= \left\{w \in V|(w,v)\in E \right\}$$</p>

<p>For some $S \subseteq V$ we have, $S^+= \... | graphs partitions | 1 | Partitions of a directed graph - common prey and common enemy partitions -- (graphs partitions)
<p>Let $D=(V,E)$ be a finite directed graph with no isolated nodes(from every node there is at least one edge entering and one exiting). For $v \in V$ define the following sets: $$v^+= \left\{w \in V|(v,w)\in E \right\}, v^-... | habedi/stack-exchange-dataset |
49,079 | Naive Bayes where Feature Space is LDA Output | <p>I understand that the output for Latent Dirichlet Allocation is a distribution over K topics.</p>

<p>Suppose I have a Dx(K+1) matrix, where rows are documents and columns are the topic distribution + one column for class. For example, each row represents one movie review. The first K columns represent the t... | machine learning | 1 | Naive Bayes where Feature Space is LDA Output -- (machine learning)
<p>I understand that the output for Latent Dirichlet Allocation is a distribution over K topics.</p>

<p>Suppose I have a Dx(K+1) matrix, where rows are documents and columns are the topic distribution + one column for class. For example, each ... | habedi/stack-exchange-dataset |
49,091 | Formal construction of PDA intersecting a DFA | <p>Given the PDA $P = (Q_P,\Sigma,\Gamma_P,\delta_P,F_P)$
and the DFA $D = (Q_D, \Sigma, \delta_D,q_D,F_D)$</p>

<p>What is the 6-tuple definition of the PDA such that: $L(P') = L(P) \cap L(D)$</p>

<p>I don't understand what the intersection of these two FAs represent, and my only guess at what the... | formal languages finite automata closure properties pushdown automata | 1 | Formal construction of PDA intersecting a DFA -- (formal languages finite automata closure properties pushdown automata)
<p>Given the PDA $P = (Q_P,\Sigma,\Gamma_P,\delta_P,F_P)$
and the DFA $D = (Q_D, \Sigma, \delta_D,q_D,F_D)$</p>

<p>What is the 6-tuple definition of the PDA such that: $L(P') = L(P) \cap... | habedi/stack-exchange-dataset |
49,097 | What NP-complete problem to reduce to k-Edge-Colorability to prove its NP-hardness? | <p>What known NP-complete problem would one reduce to $k$-Edge-Colorability to prove that the latter is NP-hard?</p>
 | complexity theory graphs reductions np hard | 1 | What NP-complete problem to reduce to k-Edge-Colorability to prove its NP-hardness? -- (complexity theory graphs reductions np hard)
<p>What known NP-complete problem would one reduce to $k$-Edge-Colorability to prove that the latter is NP-hard?</p>
 | habedi/stack-exchange-dataset |
49,102 | Bit-parallelism and NFA simulation | <p>In several papers I have read that Bit-parallel pattern matching is an NFA-simulation.</p>

<p>My questions are:</p>

<p>1- Is it true in general? Or, is there any restrictions?</p>

<p>2- As any regular expression can be converted to NFA, how Bit-parallelism is able to handle some regex like... | automata finite automata pattern recognition matching dfa | 1 | Bit-parallelism and NFA simulation -- (automata finite automata pattern recognition matching dfa)
<p>In several papers I have read that Bit-parallel pattern matching is an NFA-simulation.</p>

<p>My questions are:</p>

<p>1- Is it true in general? Or, is there any restrictions?</p>

<p>2- As any... | habedi/stack-exchange-dataset |
49,106 | $\mathbf{NC_2}$ is closed under log-space reduction | <p>I actually have to prove the following :</p>

<p>$\mathbf{NL} \subseteq \mathbf{NC_2}$ </p>

<p>I have the following approach :</p>

<ol>
<li><p>I will prove that $\mathbf{PATH} = \{〈D, s, t〉 | \text{D is a directed graph with a path from vertex s to t}\} \in \mathbf{NC_2}$.</p></li>
... | complexity theory reductions closure properties complexity classes | 1 | $\mathbf{NC_2}$ is closed under log-space reduction -- (complexity theory reductions closure properties complexity classes)
<p>I actually have to prove the following :</p>

<p>$\mathbf{NL} \subseteq \mathbf{NC_2}$ </p>

<p>I have the following approach :</p>

<ol>
<li><p>I will prove that $\... | habedi/stack-exchange-dataset |
49,109 | Can we show that non-determinism adds no power, for some specific running time? | <p>$NP = \cup_{k \in \mathbb{N}} NTIME(n^k)$</p>

<p>$P = \cup_{k \in \mathbb{N}} TIME(n^k)$</p>

<p>Can we show that $NTIME(n^k) = TIME(n^k)$ for a specific $k$?</p>

<p>For how large of a $k$ can we show the above statement to be true?</p>
 | complexity theory time complexity polynomial time nondeterminism | 1 | Can we show that non-determinism adds no power, for some specific running time? -- (complexity theory time complexity polynomial time nondeterminism)
<p>$NP = \cup_{k \in \mathbb{N}} NTIME(n^k)$</p>

<p>$P = \cup_{k \in \mathbb{N}} TIME(n^k)$</p>

<p>Can we show that $NTIME(n^k) = TIME(n^k)$ for a speci... | habedi/stack-exchange-dataset |
49,111 | Union of right congruence relations | <p>Since we started talking about relations on languages and so on i keep on struggling with this subject. </p>

<p>So now iam faced with two questions where i really dont know how to start. </p>

<ol>
<li><blockquote>
 <p>First of all, the natural relation of a language $L \subseteq \Sigma^*$ ... | formal languages | 1 | Union of right congruence relations -- (formal languages)
<p>Since we started talking about relations on languages and so on i keep on struggling with this subject. </p>

<p>So now iam faced with two questions where i really dont know how to start. </p>

<ol>
<li><blockquote>
 <p>First of all, ... | habedi/stack-exchange-dataset |
49,120 | Context-free Grammar To Generate $L=\{a^nb^k | 1 =< n =< 2k } | <p>I need to write a context-free grammar for this Language : </p>

<pre><code>$\L = {a^nb^k | 1 =< n <= 2k}
</code></pre>

<p>Please help me solve this problem!
Thanks.</p>
 | formal languages context free automata formal grammars | 1 | Context-free Grammar To Generate $L=\{a^nb^k | 1 =< n =< 2k } -- (formal languages context free automata formal grammars)
<p>I need to write a context-free grammar for this Language : </p>

<pre><code>$\L = {a^nb^k | 1 =< n <= 2k}
</code></pre>

<p>Please help me solve this problem!
Thanks... | habedi/stack-exchange-dataset |
49,131 | AND operator of many functions | <p>Suppose we have a set of functions $f_i: \mathbb Z \rightarrow \{0,1\}, i=1, \dots,n $, with the following property:</p>

<p>For each $i =1,\dots ,n$, there exists an $x\in \mathbb Z$ such that $f_i(x)=0$ and $f_j(x)=1$ for each $j\in \{1,\dots,i-1,i+1,\dots,n\}$. Also, there exists an $x \in \mathbb Z$ such... | complexity theory time complexity | 1 | AND operator of many functions -- (complexity theory time complexity)
<p>Suppose we have a set of functions $f_i: \mathbb Z \rightarrow \{0,1\}, i=1, \dots,n $, with the following property:</p>

<p>For each $i =1,\dots ,n$, there exists an $x\in \mathbb Z$ such that $f_i(x)=0$ and $f_j(x)=1$ for each $j\in \{1,... | habedi/stack-exchange-dataset |
49,132 | How to understand the mathematical constraint of potentials? | <p>Good evening!
I am studying scheduling problems and I have some difficulties understanding constraints of potentials:</p>

<p>Let be $t_j$ the time when a task $j$ starts, and $t_i$ the time when a task $i$ starts. I'm assuming that $a_{ij}$ is the length of the task $i$ but I'm not sure. Why is a "const... | scheduling notation | 1 | How to understand the mathematical constraint of potentials? -- (scheduling notation)
<p>Good evening!
I am studying scheduling problems and I have some difficulties understanding constraints of potentials:</p>

<p>Let be $t_j$ the time when a task $j$ starts, and $t_i$ the time when a task $i$ starts. I'm ... | habedi/stack-exchange-dataset |
49,137 | Subset-sum variation, multiple sums | <p>Subset-sum problem is NP-complete. I presume so is the problem of determining, given a positive integer $p$, whether in a set of positive integers $\{x_1,x_2,...,x_n\}$ there is a subset which sums to one of the numbers $\{p-1,p,p+1\}$. Am I correct?</p>

<p>I've been struggling to reduce standard Subset-sum... | complexity theory reductions np hard | 1 | Subset-sum variation, multiple sums -- (complexity theory reductions np hard)
<p>Subset-sum problem is NP-complete. I presume so is the problem of determining, given a positive integer $p$, whether in a set of positive integers $\{x_1,x_2,...,x_n\}$ there is a subset which sums to one of the numbers $\{p-1,p,p+1\}$. Am... | habedi/stack-exchange-dataset |
49,140 | Maximum Spanning Tree vs Maximum Product Spanning Tree | <p>So I'm kind of wondering if I'm correct on something relating to an algorithms class. Let's say I want to, for whatever reason, find the maximum spanning tree of a graph such that the edge weight is at maximum instead of minimum.</p>

<p>In addition, let's say I want to find a spanning tree with the maximum ... | graphs spanning trees minimum spanning tree | 1 | Maximum Spanning Tree vs Maximum Product Spanning Tree -- (graphs spanning trees minimum spanning tree)
<p>So I'm kind of wondering if I'm correct on something relating to an algorithms class. Let's say I want to, for whatever reason, find the maximum spanning tree of a graph such that the edge weight is at maximum ins... | habedi/stack-exchange-dataset |
49,152 | Can you solve 2-sat problem when truth assignments of some variables are determined | <p>I am trying to find a assignment to satisfy a 2-sat statement. Problem is some of the clauses are <code>0 or x</code> or <code>1 or x</code>. I think the <code>1 or x</code> clauses have no effect on the solution, but the <code>0 or x</code> clauses determine the value for x. As I have clauses like <code>~x or y</co... | 2 sat | 1 | Can you solve 2-sat problem when truth assignments of some variables are determined -- (2 sat)
<p>I am trying to find a assignment to satisfy a 2-sat statement. Problem is some of the clauses are <code>0 or x</code> or <code>1 or x</code>. I think the <code>1 or x</code> clauses have no effect on the solution, but the ... | habedi/stack-exchange-dataset |
49,153 | Assignment based on ranked preference | <p>Assume that there are <code>n</code> students, who have to be evenly assigned to <code>m</code> groups. For every student, a preference ranking of of the <code>m</code> groups is given.</p>

<p>I partially order assignment by pointwise preference, i.e. one is better or equal to another if for every student, ... | optimization combinatorics matching voting | 1 | Assignment based on ranked preference -- (optimization combinatorics matching voting)
<p>Assume that there are <code>n</code> students, who have to be evenly assigned to <code>m</code> groups. For every student, a preference ranking of of the <code>m</code> groups is given.</p>

<p>I partially order assignment ... | habedi/stack-exchange-dataset |
49,163 | Can a Turing machine have infinite states? | <p>Does it make sense for a Turing machine to have infinite number of states ? I had previously asked a question <a href="https://cs.stackexchange.com/questions/48381/can-input-to-a-turing-machine-be-of-infinite-length">Can Turing machines have infinite length input</a>. From which I came to know about Type-2 Turing ma... | turing machines computation models | 1 | Can a Turing machine have infinite states? -- (turing machines computation models)
<p>Does it make sense for a Turing machine to have infinite number of states ? I had previously asked a question <a href="https://cs.stackexchange.com/questions/48381/can-input-to-a-turing-machine-be-of-infinite-length">Can Turing machin... | habedi/stack-exchange-dataset |
49,176 | fastest counting of nested loops | <p>I need to find out the fastest way to count nested loops. I am adding 3 numbers , the final number is wanted result. For better explanation here is example</p>

<pre><code> read number 1
 read number 2
 read final number 3
</code></pre>

<p>There are 17 ways how to achieve 500 with ... | algorithms counting | 1 | fastest counting of nested loops -- (algorithms counting)
<p>I need to find out the fastest way to count nested loops. I am adding 3 numbers , the final number is wanted result. For better explanation here is example</p>

<pre><code> read number 1
 read number 2
 read final number 3
</code></p... | habedi/stack-exchange-dataset |
49,188 | What data-structure is best suited for escape analysis? | <p>I'm making a compiler using LLVM and LLVM's shadow-stack. I thought I might easy the load of the GC by using escape analysis and allocate some variables on the stack. Can I use my typed AST for this algorithm, or must I use a graph data-structure?</p>
 | compilers | 1 | What data-structure is best suited for escape analysis? -- (compilers)
<p>I'm making a compiler using LLVM and LLVM's shadow-stack. I thought I might easy the load of the GC by using escape analysis and allocate some variables on the stack. Can I use my typed AST for this algorithm, or must I use a graph data-structure... | habedi/stack-exchange-dataset |
49,192 | Time complexity of a Divide and Conquer | <p>I have Master theorem for finding complexities but the problem is Master theorem says</p>

<p>For a recurrence of form
$T(n) = aT(n/b) + f(n)$ where $a \geq 1$ and $b > 1$,
there are following three cases:</p>

<ul>
<li><p>if $f(n) = Θ(n^c)$ where $c < \log_ba$, then $T(n) = Θ(n\log... | recurrence relation master theorem | 1 | Time complexity of a Divide and Conquer -- (recurrence relation master theorem)
<p>I have Master theorem for finding complexities but the problem is Master theorem says</p>

<p>For a recurrence of form
$T(n) = aT(n/b) + f(n)$ where $a \geq 1$ and $b > 1$,
there are following three cases:</p>

... | habedi/stack-exchange-dataset |
49,193 | Sorting array with two elements - in place and minimal number of comparisons, lower bound | <p>Algorithm must be in place.<br>
I would like to find lower bound for comparison algorithm. Algorithm will sort array with only two elements - without loss of generality let assume that there are only $1s$ and $0s$. </p>

<p>Decision tree give us lower bound $\log(n+1)$. It is to weak, because we know l... | complexity theory time complexity sorting arrays lower bounds | 1 | Sorting array with two elements - in place and minimal number of comparisons, lower bound -- (complexity theory time complexity sorting arrays lower bounds)
<p>Algorithm must be in place.<br>
I would like to find lower bound for comparison algorithm. Algorithm will sort array with only two elements - without loss o... | habedi/stack-exchange-dataset |
49,213 | Implementing primitive recursive functions in a programming language | <p>I started studying Design Concepts in Programming Languages by Turbak, Gifford and Sheldon. In the first chapter, they define a language called POSTFIX, similar to a postfix calculator's input language. This one also has a conditional command and a subroutine-like struct. So, it seemed like it could implement a loop... | programming languages primitive recursion | 1 | Implementing primitive recursive functions in a programming language -- (programming languages primitive recursion)
<p>I started studying Design Concepts in Programming Languages by Turbak, Gifford and Sheldon. In the first chapter, they define a language called POSTFIX, similar to a postfix calculator's input language... | habedi/stack-exchange-dataset |
49,219 | Optimal prefix code: full binary tree existence | <p>I'm ok following the passages generally used to prove this theorem, like in this <a href="https://cs.stackexchange.com/questions/31965/not-understand-exchanging-argument-proof-for-optimal-prefix-code">question</a> concerning the same subject. Anyway i've the unpleasant feeling that the proof lacks something to be co... | proof techniques check my answer | 1 | Optimal prefix code: full binary tree existence -- (proof techniques check my answer)
<p>I'm ok following the passages generally used to prove this theorem, like in this <a href="https://cs.stackexchange.com/questions/31965/not-understand-exchanging-argument-proof-for-optimal-prefix-code">question</a> concerning the sa... | habedi/stack-exchange-dataset |
49,220 | Term for an approximation that becomes better as the problem grows | <p>For a certain maximization problem, a "constant-factor approximation algorithm" is an algorithm that returns a solution with value at least $F\cdot \textrm{Max}$, where $F<1$ is some constant and $\textrm{Max}$ is the exact maximal value.</p>

<p>What term describes an algorithm in which the approximation... | terminology time complexity approximation | 1 | Term for an approximation that becomes better as the problem grows -- (terminology time complexity approximation)
<p>For a certain maximization problem, a "constant-factor approximation algorithm" is an algorithm that returns a solution with value at least $F\cdot \textrm{Max}$, where $F<1$ is some constant and $\te... | habedi/stack-exchange-dataset |
49,234 | space complexity of DFA intersection problem | <p>the DFA-intersection computation problem, given two DFAs specified on the input, compute the intersection DFA, or the decision problem to determine its emptiness, turns out to have wider/ deeper significance in computational complexity theory.[1][2] it is O(n<sup>2</sup>) time with no better lower bounds known, and ... | reference request complexity classes space complexity lower bounds dfa | 1 | space complexity of DFA intersection problem -- (reference request complexity classes space complexity lower bounds dfa)
<p>the DFA-intersection computation problem, given two DFAs specified on the input, compute the intersection DFA, or the decision problem to determine its emptiness, turns out to have wider/ deeper s... | habedi/stack-exchange-dataset |
49,243 | Is there a generalization of Huffman Coding to Arithmetic coding? | <p>In trying to understand the relationships between Huffman Coding, Arithmetic Coding, and Range Coding, I began to think of the shortcomings of Huffman coding to be related to the problem of <a href="https://hbfs.wordpress.com/2011/11/01/fractional-bits-part-i/" rel="noreferrer">fractional bit-packing</a>.</p>
&#... | information theory data compression coding theory entropy huffman coding | 1 | Is there a generalization of Huffman Coding to Arithmetic coding? -- (information theory data compression coding theory entropy huffman coding)
<p>In trying to understand the relationships between Huffman Coding, Arithmetic Coding, and Range Coding, I began to think of the shortcomings of Huffman coding to be related t... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.