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 |
|---|---|---|---|---|---|---|
108,454 | Is there a sorting algorithm of order $n + k \log{k}$? | <p>I'm given an integer vector which is said to contain many duplicate values (total of k distinct integers), for example </p>

<pre><code>[1, 4, 2, 5, 5, 3, 4, 2, 2, 5]
(n = 10, k = 5)
</code></pre>

<p>and am asked to find a sorting algorithm that averages <span class="math-container">$O(n + k... | algorithms sorting quicksort | 1 | Is there a sorting algorithm of order $n + k \log{k}$? -- (algorithms sorting quicksort)
<p>I'm given an integer vector which is said to contain many duplicate values (total of k distinct integers), for example </p>

<pre><code>[1, 4, 2, 5, 5, 3, 4, 2, 2, 5]
(n = 10, k = 5)
</code></pre>

<p>and... | habedi/stack-exchange-dataset |
108,456 | Complexity of Merge Sort that splits in a random position | <p>I got a question that I don't fully understand:
Given a new algorithm to merge sort (AKA mergesort2) that instead of splitting the list in the middle it splits the list in a random number between <span class="math-container">$1$</span> and <span class="math-container">$n-1$</span>.
Also, we know the probabil... | complexity theory time complexity mergesort | 1 | Complexity of Merge Sort that splits in a random position -- (complexity theory time complexity mergesort)
<p>I got a question that I don't fully understand:
Given a new algorithm to merge sort (AKA mergesort2) that instead of splitting the list in the middle it splits the list in a random number between <span clas... | habedi/stack-exchange-dataset |
108,462 | Merging and Unmerging Sets of Trees Efficiently | <p><strong>Background</strong></p>

<p>Given multiple trees, I'd like to merge all of the them and be able to efficiently unmerge arbitrary trees in the set. For example, here are some JSON trees:</p>

<p>Tree 1:</p>

<pre><code>{
 a: {
 b: 1
 },
 c: [{}],
 d: 3
}&... | algorithms trees | 1 | Merging and Unmerging Sets of Trees Efficiently -- (algorithms trees)
<p><strong>Background</strong></p>

<p>Given multiple trees, I'd like to merge all of the them and be able to efficiently unmerge arbitrary trees in the set. For example, here are some JSON trees:</p>

<p>Tree 1:</p>

<pre><co... | habedi/stack-exchange-dataset |
108,465 | How to count in linear time worst-case? | <p><a href="https://cs.stackexchange.com/q/108454/68251">This question</a> and <a href="https://cs.stackexchange.com/q/65248/68251">this question</a> got me thinking a little bit. For sorting an array of length <span class="math-container">$n$</span> with <span class="math-container">$k$</span> unique elements in <span... | algorithms search trees hash tables | 1 | How to count in linear time worst-case? -- (algorithms search trees hash tables)
<p><a href="https://cs.stackexchange.com/q/108454/68251">This question</a> and <a href="https://cs.stackexchange.com/q/65248/68251">this question</a> got me thinking a little bit. For sorting an array of length <span class="math-container"... | habedi/stack-exchange-dataset |
108,488 | What is the time complexity of this method? | <p>On CodingBat.com there's a problem that asks for the length of the longest sequence of repeating characters within a string:</p>

<p>(<a href="https://codingbat.com/prob/p179479" rel="nofollow noreferrer">https://codingbat.com/prob/p179479</a>)</p>

<hr>

<p>Given a string, return the length ... | time complexity | 1 | What is the time complexity of this method? -- (time complexity)
<p>On CodingBat.com there's a problem that asks for the length of the longest sequence of repeating characters within a string:</p>

<p>(<a href="https://codingbat.com/prob/p179479" rel="nofollow noreferrer">https://codingbat.com/prob/p179479</a>)... | habedi/stack-exchange-dataset |
108,491 | How many ways to express N as sum of 2, 3 and 5? | <p>I've learnt about problems about express N as sum of 2, 3, 5. For examples, if N = 7:</p>

<ul>
<li><p>N = 5 + 2</p></li>
<li><p>N = 2 + 5</p></li>
<li><p>N = 2 + 2 + 3</p></li>
<li><p>N = 2 + 3 + 2</p></li>
<li><p>N = 3 + 2 + 2</p></li>
</ul>

<p>But most of I found on the In... | dynamic programming counting | 1 | How many ways to express N as sum of 2, 3 and 5? -- (dynamic programming counting)
<p>I've learnt about problems about express N as sum of 2, 3, 5. For examples, if N = 7:</p>

<ul>
<li><p>N = 5 + 2</p></li>
<li><p>N = 2 + 5</p></li>
<li><p>N = 2 + 2 + 3</p></li>
<li><p>N = 2 + 3 + 2</p></li>&#x... | habedi/stack-exchange-dataset |
108,493 | Logic of multiple variables in ILP | <p>Is there a better way to represent an AND of <span class="math-container">$n$</span> variables together other than creating <span class="math-container">$O(n)$</span> new variables and constraints?</p>
 | logic binary trees linear programming boolean algebra integer programming | 1 | Logic of multiple variables in ILP -- (logic binary trees linear programming boolean algebra integer programming)
<p>Is there a better way to represent an AND of <span class="math-container">$n$</span> variables together other than creating <span class="math-container">$O(n)$</span> new variables and constraints?</p>&#... | habedi/stack-exchange-dataset |
108,496 | Contradiction proof for inequality of P and NP? | <p>I'm trying to argue that N is not equal NP using hierarchy theorems. This is my argument, but when I showed it to our teacher and after deduction, he said that this is problematic where I can't find a compelling reason to accept.</p>

<blockquote>
 <p>We start off by assuming that <span class="math-cont... | complexity theory time complexity p vs np | 1 | Contradiction proof for inequality of P and NP? -- (complexity theory time complexity p vs np)
<p>I'm trying to argue that N is not equal NP using hierarchy theorems. This is my argument, but when I showed it to our teacher and after deduction, he said that this is problematic where I can't find a compelling reason to ... | habedi/stack-exchange-dataset |
108,507 | Vertex Cover of size at most $\log n$ | <p>Consider the following language:
<span class="math-container">$$
L = \{ G | G \text{ has a VC of size at most } \log n \}
$$</span></p>

<p>Does <span class="math-container">$L\in P$</span> or <span class="math-container">$L\in NPC$</span>?</p>
 | complexity theory vertex cover | 1 | Vertex Cover of size at most $\log n$ -- (complexity theory vertex cover)
<p>Consider the following language:
<span class="math-container">$$
L = \{ G | G \text{ has a VC of size at most } \log n \}
$$</span></p>

<p>Does <span class="math-container">$L\in P$</span> or <span class="math-container">$... | habedi/stack-exchange-dataset |
108,513 | for two languages in $NP$ does one of them karp reducible to another? | <p><span class="math-container">$\forall A, B \in NP \implies A<_m^{poly}B. \lor B<_m^{poly} A.$</span> </p>

<p>I want to know is there any work around this theorem? or is it correct?</p>
 | reductions np | 1 | for two languages in $NP$ does one of them karp reducible to another? -- (reductions np)
<p><span class="math-container">$\forall A, B \in NP \implies A<_m^{poly}B. \lor B<_m^{poly} A.$</span> </p>

<p>I want to know is there any work around this theorem? or is it correct?</p>
 | habedi/stack-exchange-dataset |
108,516 | Turing machine - compare two words | <p>I have a simple turing machine with single tape.
I need to compare two words <code><w1>$<w2>$</code> and write output.
Language is all letters and numbers.</p>

<p>I did comparation with the {a,b} language but there are more characters.</p>

<p>Is only solution do it one by one in... | turing machines comparison | 1 | Turing machine - compare two words -- (turing machines comparison)
<p>I have a simple turing machine with single tape.
I need to compare two words <code><w1>$<w2>$</code> and write output.
Language is all letters and numbers.</p>

<p>I did comparation with the {a,b} language but there are mo... | habedi/stack-exchange-dataset |
108,521 | How does sum of first $k$ integers equal $k(k+1)/2$ | <p>According to <a href="https://youtu.be/9TlHvipP5yA?t=484" rel="nofollow noreferrer">this video</a>, he explains 
<span class="math-container">$$p = k(k+1) / 2$$</span>
Where <span class="math-container">$p$</span> is the sum of the first <span class="math-container">$k$</span> natural numbers. I understand <... | mathematical analysis | 1 | How does sum of first $k$ integers equal $k(k+1)/2$ -- (mathematical analysis)
<p>According to <a href="https://youtu.be/9TlHvipP5yA?t=484" rel="nofollow noreferrer">this video</a>, he explains 
<span class="math-container">$$p = k(k+1) / 2$$</span>
Where <span class="math-container">$p$</span> is the sum of th... | habedi/stack-exchange-dataset |
108,541 | Circular Doubly Linked List find length with single pointer | <p>I have pointer to circular doubly linked list with random values of 0 or 1.<br>
Example: <code>[{prev,0,next},{prev,0,next},{prev,1,next},{prev,0,next}...]</code><br>
I have a single pointer to the first item of the list. 
I need to find the length of the list <strong>without to create any additional poi... | algorithms complexity theory data structures | 1 | Circular Doubly Linked List find length with single pointer -- (algorithms complexity theory data structures)
<p>I have pointer to circular doubly linked list with random values of 0 or 1.<br>
Example: <code>[{prev,0,next},{prev,0,next},{prev,1,next},{prev,0,next}...]</code><br>
I have a single pointer to the f... | habedi/stack-exchange-dataset |
108,545 | Why isn't DIV necessarily in P? | <p>In my formal languages class, we discussed DIV, defined as following:</p>

<p><span class="math-container">$\mathrm{DIV} = \{\langle a,b\rangle : \text{$a, b \in N$ and $a$ has a divisor $d$ for some $1 < d \leq b$ }\}$</span></p>

<p>(<span class="math-container">$\langle\cdot\rangle$</span> mean... | complexity theory formal languages time complexity | 1 | Why isn't DIV necessarily in P? -- (complexity theory formal languages time complexity)
<p>In my formal languages class, we discussed DIV, defined as following:</p>

<p><span class="math-container">$\mathrm{DIV} = \{\langle a,b\rangle : \text{$a, b \in N$ and $a$ has a divisor $d$ for some $1 < d \leq b$ }\}... | habedi/stack-exchange-dataset |
108,550 | How post correspondence problem is undecidable? | <p>An undecidable problem is a problem that cannot have any algorithm to solve it. </p>

<p>Post correspondence problem can be solved using a brute force approach. Then how can it be an undecidable problem? </p>
 | undecidability | 1 | How post correspondence problem is undecidable? -- (undecidability)
<p>An undecidable problem is a problem that cannot have any algorithm to solve it. </p>

<p>Post correspondence problem can be solved using a brute force approach. Then how can it be an undecidable problem? </p>
 | habedi/stack-exchange-dataset |
108,555 | are they any implications if i reduce a sha256 result into 248 bits? | <p>i am working a prototype using some cryptographic properties.
the question is simple but perhaps deep enough for me to decide :</p>

<p>sha256 is a strong hash function, but i have space for 248 bits only.
my guess is if i remove any 8 bits the resulting mySHA248 will keep
all good properties wit... | hash | 1 | are they any implications if i reduce a sha256 result into 248 bits? -- (hash)
<p>i am working a prototype using some cryptographic properties.
the question is simple but perhaps deep enough for me to decide :</p>

<p>sha256 is a strong hash function, but i have space for 248 bits only.
my guess is if i... | habedi/stack-exchange-dataset |
108,556 | Efficient method for generating the smoothing function | <p>The smoothing function of a boolean function with respect to one of its variables is the disjunction of its cofactors. For example given a Boolean function F(a,b,c) the cofactors with respect to a are F(0,b,c) and F(1,b,c), the smoothing function with respect to a therefore is G(b,c) = F(0,b,c) + F(1,b,c). </p>
... | logic digital circuits | 1 | Efficient method for generating the smoothing function -- (logic digital circuits)
<p>The smoothing function of a boolean function with respect to one of its variables is the disjunction of its cofactors. For example given a Boolean function F(a,b,c) the cofactors with respect to a are F(0,b,c) and F(1,b,c), the smooth... | habedi/stack-exchange-dataset |
108,582 | Correctness of the Betweenness centrality formula | <blockquote>
<p><a href="https://en.wikipedia.org/wiki/Betweenness_centrality" rel="nofollow noreferrer">Betweenness centrality</a> is defined as the number of shortest paths that go through a node in the graph.The formula is:</p>
<p><span class="math-container">$$\sum_{s \neq v \neq t} \frac{\sigma_{st}(v)}{\s... | graphs social networks network analysis | 1 | Correctness of the Betweenness centrality formula -- (graphs social networks network analysis)
<blockquote>
<p><a href="https://en.wikipedia.org/wiki/Betweenness_centrality" rel="nofollow noreferrer">Betweenness centrality</a> is defined as the number of shortest paths that go through a node in the graph.The formul... | habedi/stack-exchange-dataset |
108,598 | Why was primality test thought to be NP? | <p>To check if <span class="math-container">$n$</span> is prime, one only need to try dividing <span class="math-container">$n$</span> by numbers up to <span class="math-container">$\sqrt{n}$</span>, meaning that the complexity would be <span class="math-container">$O(\sqrt{n})$</span>. In my opinion, <span class="math... | complexity theory time complexity np | 1 | Why was primality test thought to be NP? -- (complexity theory time complexity np)
<p>To check if <span class="math-container">$n$</span> is prime, one only need to try dividing <span class="math-container">$n$</span> by numbers up to <span class="math-container">$\sqrt{n}$</span>, meaning that the complexity would be ... | habedi/stack-exchange-dataset |
108,599 | Modeling equality in an ILP | <p>Lets say we have integer variables <span class="math-container">$a \in\mathbb{Z}^n$</span> and <span class="math-container">$M \in\{0,1\}^{n\times L}$</span>. I am promised <span class="math-container">$a_i \leq L$</span>, for some fixed constant <span class="math-container">$L$</span>. I want to model the constr... | logic boolean algebra integer programming | 1 | Modeling equality in an ILP -- (logic boolean algebra integer programming)
<p>Lets say we have integer variables <span class="math-container">$a \in\mathbb{Z}^n$</span> and <span class="math-container">$M \in\{0,1\}^{n\times L}$</span>. I am promised <span class="math-container">$a_i \leq L$</span>, for some fixed co... | habedi/stack-exchange-dataset |
108,604 | Dynamic programming - maximize sum of functions subject to constraints | <p>Let <span class="math-container">$\{f_i\}_{i=1}^{k}:[0,k]\to\mathbb{Z}$</span>. </p>

<p><strong>The problem: Maximize the sum <span class="math-container">$\sum_{i=1}^{k}f_i(x_i)$</span> subject to the the constraint <span class="math-container">$\sum_{i=1}^{k}x_i\le k$</span></strong></p>

<p>I thi... | algorithms optimization dynamic programming | 1 | Dynamic programming - maximize sum of functions subject to constraints -- (algorithms optimization dynamic programming)
<p>Let <span class="math-container">$\{f_i\}_{i=1}^{k}:[0,k]\to\mathbb{Z}$</span>. </p>

<p><strong>The problem: Maximize the sum <span class="math-container">$\sum_{i=1}^{k}f_i(x_i)$</span> s... | habedi/stack-exchange-dataset |
108,605 | How to generate all possible test cases of length $n$ for comparison sorts | <p>Comparison sorts only care about the relative order of elements, not their exact values. So if the relative order of two arrays are the same, a comparison sort algorithm will act the same way on those two arrays.</p>

<p>For example, [0, 3, 1, 9, 1] is the same as [-3, 12, 7, 13, 7], since their relative ord... | algorithms | 1 | How to generate all possible test cases of length $n$ for comparison sorts -- (algorithms)
<p>Comparison sorts only care about the relative order of elements, not their exact values. So if the relative order of two arrays are the same, a comparison sort algorithm will act the same way on those two arrays.</p>

... | habedi/stack-exchange-dataset |
108,615 | What does $\tilde{O}_P(N^\alpha)$ mean? | <p>What does <span class="math-container">$\tilde{O}_P(N^\alpha)$</span> mean? It appears in an estimation error mention in <a href="https://arxiv.org/abs/1903.10047" rel="nofollow noreferrer">this paper</a>, in the second paragraph on page 3.</p>

<hr>

<p>What does big O subscript P mean in a probabil... | algorithms complexity theory error estimation | 1 | What does $\tilde{O}_P(N^\alpha)$ mean? -- (algorithms complexity theory error estimation)
<p>What does <span class="math-container">$\tilde{O}_P(N^\alpha)$</span> mean? It appears in an estimation error mention in <a href="https://arxiv.org/abs/1903.10047" rel="nofollow noreferrer">this paper</a>, in the second paragr... | habedi/stack-exchange-dataset |
108,617 | Loop Invariant Code Motion - am I missing something? | <p>I've been implementing LICM for a project, and came upon a strange observation.</p>

<p>Let's say we have a loop</p>

<pre><code>int i = 10;
while (i > 0) {
 a = 2;
 i--;
}
</code></pre>

<p>One can easily see that <code>a = 2</code> is invariant. What we do next ... | optimization loop invariants | 1 | Loop Invariant Code Motion - am I missing something? -- (optimization loop invariants)
<p>I've been implementing LICM for a project, and came upon a strange observation.</p>

<p>Let's say we have a loop</p>

<pre><code>int i = 10;
while (i > 0) {
 a = 2;
 i--;
}
</code></pre... | habedi/stack-exchange-dataset |
108,624 | Comparing different asymptotic notations | <p>Suppose we have 3 algorithms complexity times at the worst case: </p>

<ul>
<li>A = <span class="math-container">$O(nlogn)$</span></li>
<li>B = <span class="math-container">$O(n\sqrt{n})$</span></li>
<li>C = <span class="math-container">$\Theta(n)$</span></li>
</ul>

<p>In my opinion,... | complexity theory time complexity asymptotics big o notation | 1 | Comparing different asymptotic notations -- (complexity theory time complexity asymptotics big o notation)
<p>Suppose we have 3 algorithms complexity times at the worst case: </p>

<ul>
<li>A = <span class="math-container">$O(nlogn)$</span></li>
<li>B = <span class="math-container">$O(n\sqrt{n})$</span>... | habedi/stack-exchange-dataset |
108,625 | Draw a Turing machine that decides the language of all words over the alphabet {a, b} that have an odd number of a’s and an odd number of b’s | <p>Does the question mean draw a Turing machine that takes input with any number of a's and any number of b's (eg. aaabbb, ab, abababab, etc.). The turing machine should only then accept or reject the input and should not be stuck in loop?</p>

<p>Example of a drawing to answer the question:
<a href="https:... | turing machines | 1 | Draw a Turing machine that decides the language of all words over the alphabet {a, b} that have an odd number of a’s and an odd number of b’s -- (turing machines)
<p>Does the question mean draw a Turing machine that takes input with any number of a's and any number of b's (eg. aaabbb, ab, abababab, etc.). The turing ma... | habedi/stack-exchange-dataset |
108,627 | Give a computation of the expression to normal form (Lambda calculus) | <p>Past exam question: </p>

<p><a href="https://i.stack.imgur.com/YyT2C.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YyT2C.jpg" alt="enter image description here"></a> </p>

<p>What my understanding of B-reduction is : Find all occurrences of the parameter in the output, and repla... | computability lambda calculus | 1 | Give a computation of the expression to normal form (Lambda calculus) -- (computability lambda calculus)
<p>Past exam question: </p>

<p><a href="https://i.stack.imgur.com/YyT2C.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YyT2C.jpg" alt="enter image description here"></a> </p>

<p... | habedi/stack-exchange-dataset |
108,628 | What does it mean when saying "we want $\Lambda$ to be $\tilde{O}(1)$ as a function of $M$"? | <p>What does it mean when saying "we want <span class="math-container">$\Lambda$</span> to be <span class="math-container">$\tilde{O}(1)$</span> as a function of <span class="math-container">$M$</span>"? (it appears on the top of page 12 of <a href="https://arxiv.org/pdf/1903.10047.pdf" rel="nofollow noreferrer">this p... | complexity theory algorithm analysis error estimation | 1 | What does it mean when saying "we want $\Lambda$ to be $\tilde{O}(1)$ as a function of $M$"? -- (complexity theory algorithm analysis error estimation)
<p>What does it mean when saying "we want <span class="math-container">$\Lambda$</span> to be <span class="math-container">$\tilde{O}(1)$</span> as a function of <span ... | habedi/stack-exchange-dataset |
108,635 | Pseudo-Proof of Constrained Sudoku is co-np | <h2>The definition of CO-NP</h2>

<blockquote>
 <p>A decision problem <strong>X</strong> is a member of <strong>co-NP</strong> if and only if its
 complement <strong>X</strong> is in the complexity class <strong>NP</strong>. In other words,
 <strong>co-NP</strong> is the class of problems for whi... | algorithms sudoku | 1 | Pseudo-Proof of Constrained Sudoku is co-np -- (algorithms sudoku)
<h2>The definition of CO-NP</h2>

<blockquote>
 <p>A decision problem <strong>X</strong> is a member of <strong>co-NP</strong> if and only if its
 complement <strong>X</strong> is in the complexity class <strong>NP</strong>. In other w... | habedi/stack-exchange-dataset |
108,639 | How can I understand a hint for finding the lowest height of the last bulb in a Garland? | <p><strong>Disclaimer</strong> 
This is not from an ongoing contest, this is from my course on edx of ITMO.
Also this is a paid courses so the direct link to the problem is not useful unless you also register this course.</p>

<p><strong>Problem description</strong>
A garland consists of light bulbs... | algorithms binary search | 1 | How can I understand a hint for finding the lowest height of the last bulb in a Garland? -- (algorithms binary search)
<p><strong>Disclaimer</strong> 
This is not from an ongoing contest, this is from my course on edx of ITMO.
Also this is a paid courses so the direct link to the problem is not useful unless yo... | habedi/stack-exchange-dataset |
108,642 | Finding an element in array, whose index number and element value same | <p>Given a sorted array of distinct integer <span class="math-container">$A[1,2.....n]$</span> the tightest upper bound to check the existence of any index <span class="math-container">$I$</span>, for which <span class="math-container">$A[I]=I$</span> is equal to _______________ ?</p>

<hr>

<p>I though... | algorithms | 1 | Finding an element in array, whose index number and element value same -- (algorithms)
<p>Given a sorted array of distinct integer <span class="math-container">$A[1,2.....n]$</span> the tightest upper bound to check the existence of any index <span class="math-container">$I$</span>, for which <span class="math-containe... | habedi/stack-exchange-dataset |
108,653 | CFG for L {a^nb^m | n <= m+3} | <p>I need a Context Free Grammar for this language. I could come up with this solution:</p>

<pre><code>S -> AB
A -> aA | ε
B -> bbbB | ε
</code></pre>

<p>But, this grammar is clearly wrong, since the number of a's can still exceed the number of b's. How do I draw a link between th... | context free | 1 | CFG for L {a^nb^m | n <= m+3} -- (context free)
<p>I need a Context Free Grammar for this language. I could come up with this solution:</p>

<pre><code>S -> AB
A -> aA | ε
B -> bbbB | ε
</code></pre>

<p>But, this grammar is clearly wrong, since the number of a's can still exceed th... | habedi/stack-exchange-dataset |
108,662 | Language to Generate Powers of 2 Using a Language Containing Decimal Numbers | <p>For this question, I have the alphabet <span class="math-container">$\Sigma=\{0,1,2,3,4,5,6,7,8,9\}$</span>. I also have the language <span class="math-container">$L$</span> over <span class="math-container">$\Sigma$</span> described as the language such that the strings <span class="math-container">$w$</span> conta... | formal languages | 1 | Language to Generate Powers of 2 Using a Language Containing Decimal Numbers -- (formal languages)
<p>For this question, I have the alphabet <span class="math-container">$\Sigma=\{0,1,2,3,4,5,6,7,8,9\}$</span>. I also have the language <span class="math-container">$L$</span> over <span class="math-container">$\Sigma$</... | habedi/stack-exchange-dataset |
108,664 | League and Divisions problem (np-hard) | <p>There is a <em>League</em>. And there are <em>Divisions</em>, that are the disjoint subsets of this <em>League</em>. There are <strong>n</strong> teams (unique locations are given, let's assume it's <strong>x</strong> and <strong>y</strong> for simplicity reasons). Every team must belong to exactly one <em>Division<... | algorithms complexity theory graphs optimization traveling salesman | 1 | League and Divisions problem (np-hard) -- (algorithms complexity theory graphs optimization traveling salesman)
<p>There is a <em>League</em>. And there are <em>Divisions</em>, that are the disjoint subsets of this <em>League</em>. There are <strong>n</strong> teams (unique locations are given, let's assume it's <stron... | habedi/stack-exchange-dataset |
108,677 | Is spectral radius of a graph related to its radius? | <p>I am searching for algorithms to estimate the radius of a graph, and I found out that there are papers about the spectral radius of a graph. As far as I know, the radius of a graph is <span class="math-container">$\min_{v \in V} ecc(v)$</span> where <span class="math-container">$ecc(v)$</span> is the depth of a tree... | graphs | 1 | Is spectral radius of a graph related to its radius? -- (graphs)
<p>I am searching for algorithms to estimate the radius of a graph, and I found out that there are papers about the spectral radius of a graph. As far as I know, the radius of a graph is <span class="math-container">$\min_{v \in V} ecc(v)$</span> where <s... | habedi/stack-exchange-dataset |
108,685 | Describe in words how a NTM can simulate a DTM | <p>I have this assignment </p>

<ol>
<li>Describe in words how a DTM can simulate a NTM </li>
<li>Describe in wordshow a NTM can simulate a DTM</li>
</ol>

<hr>

<p>I'm working on this request and I'm crushing with the comparison.</p>

<p>1-I understand that every NTM can be ... | turing machines nondeterminism | 1 | Describe in words how a NTM can simulate a DTM -- (turing machines nondeterminism)
<p>I have this assignment </p>

<ol>
<li>Describe in words how a DTM can simulate a NTM </li>
<li>Describe in wordshow a NTM can simulate a DTM</li>
</ol>

<hr>

<p>I'm working on this request and I'm ... | habedi/stack-exchange-dataset |
108,690 | Pumping lemma occurrence of c > d | <p>I'm trying to prove a language is not regular through using pumping lemma, but can't seem to come up with any way of doing it. </p>

<p>The alphabet is:</p>

<p><span class="math-container">$$ \Sigma = \{c, d\} $$</span></p>

<p>The language is:</p>

<p><span class="math-container">$$... | computability finite automata pumping lemma | 1 | Pumping lemma occurrence of c > d -- (computability finite automata pumping lemma)
<p>I'm trying to prove a language is not regular through using pumping lemma, but can't seem to come up with any way of doing it. </p>

<p>The alphabet is:</p>

<p><span class="math-container">$$ \Sigma = \{c, d\} $$</spa... | habedi/stack-exchange-dataset |
108,696 | is a while loop always an indefinite loop? | <p>Building on <a href="https://www.inf.unibz.it/~calvanese/teaching/04-05-ip/lecture-notes/uni06/node4.html" rel="nofollow noreferrer">this</a> example and others found elsewhere we have two types of loops, definite and indefinite:</p>

<p>definite being a loop that has its number of iterations known before it... | loops | 1 | is a while loop always an indefinite loop? -- (loops)
<p>Building on <a href="https://www.inf.unibz.it/~calvanese/teaching/04-05-ip/lecture-notes/uni06/node4.html" rel="nofollow noreferrer">this</a> example and others found elsewhere we have two types of loops, definite and indefinite:</p>

<p>definite being a ... | habedi/stack-exchange-dataset |
108,698 | Efficient search for solving a Jigsaw Puzzle? | <p>I believe that solving a Jigsaw puzzle is in general NP-complete based on the two questions linked below. However, I'd like to implement a heuristic algorithm that works well in practice.</p>

<p>Let's assume the puzzle pieces are encoded as 4-vectors of integers representing the four sides. A negative integ... | search problem board games | 1 | Efficient search for solving a Jigsaw Puzzle? -- (search problem board games)
<p>I believe that solving a Jigsaw puzzle is in general NP-complete based on the two questions linked below. However, I'd like to implement a heuristic algorithm that works well in practice.</p>

<p>Let's assume the puzzle pieces are ... | habedi/stack-exchange-dataset |
108,707 | Recursive definition for the length of a string? | <p>I found a couple of answers online but I don't quite understand why the answer is right:</p>

<ol>
<li><p>The length of a string is:<br>
If a string has no characters, then its length is 0.<br>
Otherwise, the length of the string is 1 + length of the tail</p></li>
<li><p></p></li>
</ol>&#... | recursion discrete mathematics induction | 1 | Recursive definition for the length of a string? -- (recursion discrete mathematics induction)
<p>I found a couple of answers online but I don't quite understand why the answer is right:</p>

<ol>
<li><p>The length of a string is:<br>
If a string has no characters, then its length is 0.<br>
Otherwis... | habedi/stack-exchange-dataset |
108,712 | The barbers paradox first order logic formalization | <p>I tried to look on the site and while I found some similar questions, I did not find the first order logic formalization of the following sentence (the basic barber's paradox), so I wanted to ask if I got the right first order logic formalization of it, and I am sure others will benefit from this thread as well.</p>... | logic artificial intelligence first order logic | 1 | The barbers paradox first order logic formalization -- (logic artificial intelligence first order logic)
<p>I tried to look on the site and while I found some similar questions, I did not find the first order logic formalization of the following sentence (the basic barber's paradox), so I wanted to ask if I got the rig... | habedi/stack-exchange-dataset |
108,741 | Is the SK2 calculus a complete basis, where K2 is the flipped K combinator? | <p>Specifically, if I defined a new <span class="math-container">$K_2$</span> as
<span class="math-container">$$K_2 = \lambda x. (\lambda y. y)$$</span>
instead of
<span class="math-container">$$K = \lambda x. (\lambda y. x)$$</span>
would the <span class="math-container">$\{S, K_2,I\}$</span>-calculus... | lambda calculus combinatory logic | 1 | Is the SK2 calculus a complete basis, where K2 is the flipped K combinator? -- (lambda calculus combinatory logic)
<p>Specifically, if I defined a new <span class="math-container">$K_2$</span> as
<span class="math-container">$$K_2 = \lambda x. (\lambda y. y)$$</span>
instead of
<span class="math-container">... | habedi/stack-exchange-dataset |
108,745 | Is there a path of length $k$ between given vertex to a subset of vertices in a connected directed graph | <p>I am trying to find an efficient algorithm that on input
<span class="math-container">$ (G,s,A,k) $</span> returns true iff <span class="math-container">$G$</span> is a connected directed graph, <span class="math-container">$s$</span> is a vertex in <span class="math-container">$G$</span>, <span class="math-cont... | algorithms graphs | 1 | Is there a path of length $k$ between given vertex to a subset of vertices in a connected directed graph -- (algorithms graphs)
<p>I am trying to find an efficient algorithm that on input
<span class="math-container">$ (G,s,A,k) $</span> returns true iff <span class="math-container">$G$</span> is a connected direct... | habedi/stack-exchange-dataset |
108,747 | Kth smallest element in an arra | <p>What would be an efficient method to find the kth smallest element in an array with worst case time complexity being <span class="math-container">$ O(n) $</span>?</p>
 | sorting arrays search | 1 | Kth smallest element in an arra -- (sorting arrays search)
<p>What would be an efficient method to find the kth smallest element in an array with worst case time complexity being <span class="math-container">$ O(n) $</span>?</p>
 | habedi/stack-exchange-dataset |
108,757 | Does this article imply that Turing-Computability is not the same as "effectively computable"? | <p>I've stumbled across <a href="https://www.quantamagazine.org/finally-a-problem-that-only-quantum-computers-will-ever-be-able-to-solve-20180621/" rel="nofollow noreferrer">this article</a>. It says that there is a problem that only Quantum Computers can solve.
In my understanding, this should mean, intuitively, t... | turing machines quantum computing church turing thesis | 1 | Does this article imply that Turing-Computability is not the same as "effectively computable"? -- (turing machines quantum computing church turing thesis)
<p>I've stumbled across <a href="https://www.quantamagazine.org/finally-a-problem-that-only-quantum-computers-will-ever-be-able-to-solve-20180621/" rel="nofollow nor... | habedi/stack-exchange-dataset |
108,758 | MAXSAT approximation | <p>We have been studying a 1/2-approximation for MAXSAT which runs in expected polynomial time, by randomly assigning True/False to each variable and repeating until we reach an assignment with at least half of clauses satisfied.</p>

<p>I don't understand why the algorithm needs to be so complicated. Why does ... | satisfiability approximation | 1 | MAXSAT approximation -- (satisfiability approximation)
<p>We have been studying a 1/2-approximation for MAXSAT which runs in expected polynomial time, by randomly assigning True/False to each variable and repeating until we reach an assignment with at least half of clauses satisfied.</p>

<p>I don't understand ... | habedi/stack-exchange-dataset |
108,797 | Multiple choices for a single case in the recursive formula of a Dynamic Programming algorithm | <p>I am developing a Dynamic Programming algorithm for a problem in scheduling. In the recursive formula, I have three cases: (1) <span class="math-container">$t_{i-1} = int$</span> (2) <span class="math-container">$t_{i-1} = app \quad \& \quad r(j) \leq p $</span> and (3) <span class="math-container">$t_{i-1} = a... | dynamic programming recursion | 1 | Multiple choices for a single case in the recursive formula of a Dynamic Programming algorithm -- (dynamic programming recursion)
<p>I am developing a Dynamic Programming algorithm for a problem in scheduling. In the recursive formula, I have three cases: (1) <span class="math-container">$t_{i-1} = int$</span> (2) <spa... | habedi/stack-exchange-dataset |
108,800 | Big O: Analyzing the time complexity of an $O(n \log n)$-algorithm | <p>For homework, the task is to verify the time complexity of quicksort. User Nick suggested <a href="https://www.quora.com/How-do-I-know-the-number-of-comparisons-in-a-sorting-algorithm" rel="nofollow noreferrer">on quora</a> that one could check the number of comparisons made when doubling the input size. If the comp... | time complexity quicksort | 1 | Big O: Analyzing the time complexity of an $O(n \log n)$-algorithm -- (time complexity quicksort)
<p>For homework, the task is to verify the time complexity of quicksort. User Nick suggested <a href="https://www.quora.com/How-do-I-know-the-number-of-comparisons-in-a-sorting-algorithm" rel="nofollow noreferrer">on quora... | habedi/stack-exchange-dataset |
108,801 | Is maximum-leaves spanning tree np-complete? | <p>How can we show that a maximum-leaves spanning tree is NP-complete? what other np-complete problem we can use as our reduction base?</p>

<p>(maximum-leaves spanning tree: does G have a spanning tree with at least K leaves? )</p>
 | np complete reductions spanning trees | 1 | Is maximum-leaves spanning tree np-complete? -- (np complete reductions spanning trees)
<p>How can we show that a maximum-leaves spanning tree is NP-complete? what other np-complete problem we can use as our reduction base?</p>

<p>(maximum-leaves spanning tree: does G have a spanning tree with at least K leave... | habedi/stack-exchange-dataset |
108,802 | Case where anti-dependency doesn't need pipeline stalling | <p>While exploring the various types of data hazards in a pipeline, I came across a statement in my book which said that anti-dependency mayn't lead to cycle stalling.</p>

<p>But i couldnt find at example for the same. Can anyone help me with it please?</p>

<p>Thanks in advance!</p>
 | computer architecture cpu pipelines | 1 | Case where anti-dependency doesn't need pipeline stalling -- (computer architecture cpu pipelines)
<p>While exploring the various types of data hazards in a pipeline, I came across a statement in my book which said that anti-dependency mayn't lead to cycle stalling.</p>

<p>But i couldnt find at example for the... | habedi/stack-exchange-dataset |
108,805 | PERT Chart exercise - is there enough information to solve? | <p>I'm posting this here as my question is from a computer science textbook. It is not a homework question as I am self-studying and I have the answers available.</p>

<p>In the exercise below, I can't see how I'm supposed to know which activity to place on which arrow. I can't tell if there is insufficient inf... | network analysis | 1 | PERT Chart exercise - is there enough information to solve? -- (network analysis)
<p>I'm posting this here as my question is from a computer science textbook. It is not a homework question as I am self-studying and I have the answers available.</p>

<p>In the exercise below, I can't see how I'm supposed to know... | habedi/stack-exchange-dataset |
108,811 | Is there an algorithm to overapproximate a context free grammar by a regular expression? | <p>I understand that a context-free grammar is strictly powerful than a regular expression in that a context free grammar can represent any regular language, but not all context free languages can be represented by a regular expression. However, an over-approximation of context-free languages is possible with regular e... | regular languages context free regular expressions approximation | 1 | Is there an algorithm to overapproximate a context free grammar by a regular expression? -- (regular languages context free regular expressions approximation)
<p>I understand that a context-free grammar is strictly powerful than a regular expression in that a context free grammar can represent any regular language, but... | habedi/stack-exchange-dataset |
108,817 | Why "Choice Points" introduce non-determinism in a program? | <p>I'm studying the didactic programming language <strong>Oz</strong>, following the book "Concepts, Techniques, and Models of Computer Programming".</p>

<p>In the book, the nondeterminism is introduced through the concept of <strong>choice</strong>, as it's explained <a href="https://en.wikipedia.org/wiki/Non... | programming languages nondeterminism | 1 | Why "Choice Points" introduce non-determinism in a program? -- (programming languages nondeterminism)
<p>I'm studying the didactic programming language <strong>Oz</strong>, following the book "Concepts, Techniques, and Models of Computer Programming".</p>

<p>In the book, the nondeterminism is introduced throug... | habedi/stack-exchange-dataset |
108,820 | Given 5 curves, find the maximum total you can get for each possible level | <h1>Problem</h1>

<h2>Constraints</h2>

<ol>
<li><p>I have a collection of curves, <span class="math-container">$C$</span>. It is a two dimensional array. The inner array contains rational numbers, where the next is greater or equal to the previous.</p>

<p><span class="math-container">$$C_{... | algorithms time complexity | 1 | Given 5 curves, find the maximum total you can get for each possible level -- (algorithms time complexity)
<h1>Problem</h1>

<h2>Constraints</h2>

<ol>
<li><p>I have a collection of curves, <span class="math-container">$C$</span>. It is a two dimensional array. The inner array contains rational numb... | habedi/stack-exchange-dataset |
108,821 | Which binary search trees have constant time rebalancing time at min/max? | <p>Given that I'm already at either the min or the max node of a binary search tree, which balanced variant would require only constant time bottom-up rebalancing after an update (add new min/max, or remove current)?</p>
 | data structures binary search trees | 1 | Which binary search trees have constant time rebalancing time at min/max? -- (data structures binary search trees)
<p>Given that I'm already at either the min or the max node of a binary search tree, which balanced variant would require only constant time bottom-up rebalancing after an update (add new min/max, or remov... | habedi/stack-exchange-dataset |
108,827 | How to create disjoint sets out of an adjacency list | <p>I'm not a computer scientist, so please bear with me if I'm misusing some terminology.</p>

<p>What I'm trying to do is to find the different components of an undirected graph.</p>

<p>I have an array of pairs that represent the edges of my graph, like so:
<code>[[1,3],[4,2],[2,1],[5,6],[100,20],... | algorithms graphs | 1 | How to create disjoint sets out of an adjacency list -- (algorithms graphs)
<p>I'm not a computer scientist, so please bear with me if I'm misusing some terminology.</p>

<p>What I'm trying to do is to find the different components of an undirected graph.</p>

<p>I have an array of pairs that represent ... | habedi/stack-exchange-dataset |
108,833 | ε-NFA to DFA - initial state with only epsilon transitions | <p>I am having trouble discovering how to convert a ε-NFA to DFA (image below) when all transitions in the initial state are epsilon transitions. I already know how to convert ε-NFA to DFA (common cases), but this case I never saw before.</p>

<p>Thank you guys! </p>

<p><a href="https://i.stack.imgur.... | finite automata | 1 | ε-NFA to DFA - initial state with only epsilon transitions -- (finite automata)
<p>I am having trouble discovering how to convert a ε-NFA to DFA (image below) when all transitions in the initial state are epsilon transitions. I already know how to convert ε-NFA to DFA (common cases), but this case I never saw before.</... | habedi/stack-exchange-dataset |
108,851 | About a symmetric rank decomposition of a SYM◦SYM circuit's truth table matrix | <p><a href="https://arxiv.org/pdf/1401.2444.pdf" rel="nofollow noreferrer">New algorithms and lower bounds for circuits with linear threshold gates.</a><br>
Ryan Williams. Submitted, 2013.</p>

<p>I study this paper and have difficulty with understanding the proof of Lemma 2.2 in section 2.<br>
My quest... | complexity theory | 1 | About a symmetric rank decomposition of a SYM◦SYM circuit's truth table matrix -- (complexity theory)
<p><a href="https://arxiv.org/pdf/1401.2444.pdf" rel="nofollow noreferrer">New algorithms and lower bounds for circuits with linear threshold gates.</a><br>
Ryan Williams. Submitted, 2013.</p>

<p>I study t... | habedi/stack-exchange-dataset |
108,859 | Bin packing first-fit problem in $O(n \log n)$ time | <blockquote>
 <p>Suppose we have <span class="math-container">$n$</span> objects with weights <span class="math-container">$w_i \in (0,1]$</span> and we must
 insert them into bins with the constraint that every bin must contain
 objects which weight less than <span class="math-container">$1 \, kg$</span... | time complexity binary trees hash tables | 1 | Bin packing first-fit problem in $O(n \log n)$ time -- (time complexity binary trees hash tables)
<blockquote>
 <p>Suppose we have <span class="math-container">$n$</span> objects with weights <span class="math-container">$w_i \in (0,1]$</span> and we must
 insert them into bins with the constraint that every ... | habedi/stack-exchange-dataset |
108,871 | Given a directed acyclic graph (DAG) - what can you say about each case? | <p>Suppose <span class="math-container">$G$</span> is a DAG with <span class="math-container">$n$</span> vertices, and <span class="math-container">$v$</span> is a vertex of <span class="math-container">$G$</span>. What can we say regarding <span class="math-container">$v$</span> if the following holds:</p>

<p... | graphs | 1 | Given a directed acyclic graph (DAG) - what can you say about each case? -- (graphs)
<p>Suppose <span class="math-container">$G$</span> is a DAG with <span class="math-container">$n$</span> vertices, and <span class="math-container">$v$</span> is a vertex of <span class="math-container">$G$</span>. What can we say rega... | habedi/stack-exchange-dataset |
108,877 | Comparison-based lower-bound for finding duplicates in an array of $n$ numbers | <blockquote>
 <p><strong>Decision Problem</strong>: Given <span class="math-container">$n$</span> real numbers, give an algorithm that outputs "1" iff there are at least two numbers that are identical and outputs "0" otherwise.
 (Assume that comparison between any two numbers works in <span class="math-contai... | algorithms lower bounds | 1 | Comparison-based lower-bound for finding duplicates in an array of $n$ numbers -- (algorithms lower bounds)
<blockquote>
 <p><strong>Decision Problem</strong>: Given <span class="math-container">$n$</span> real numbers, give an algorithm that outputs "1" iff there are at least two numbers that are identical and ou... | habedi/stack-exchange-dataset |
108,889 | Constructing hitting sets for randomized algorithms | <p>Suppose A(<span class="math-container">$\cdot$</span>,<span class="math-container">$\cdot$</span>) is an efficient randomized algorithm and L is a language such that </p>

<p><span class="math-container">$\text{If }x \in L, \text{Pr}_r[(A(x,r) = 1)] = 1$</span> and if <span class="math-container">$x \notin L... | complexity theory probability theory randomized algorithms | 1 | Constructing hitting sets for randomized algorithms -- (complexity theory probability theory randomized algorithms)
<p>Suppose A(<span class="math-container">$\cdot$</span>,<span class="math-container">$\cdot$</span>) is an efficient randomized algorithm and L is a language such that </p>

<p><span class="math-... | habedi/stack-exchange-dataset |
108,890 | Proving that there exists a distance $d$-dominating set of size $O(n/\delta)$ | <p>Let <span class="math-container">$d > 1$</span>, and consider a graph <span class="math-container">$G = (V,E)$</span> on <span class="math-container">$n$</span> vertices. A <em>distance <span class="math-container">$d$</span>-dominating set</em> of <span class="math-container">$G$</span> is a set <span class="mat... | algorithms graphs asymptotics upper bound | 1 | Proving that there exists a distance $d$-dominating set of size $O(n/\delta)$ -- (algorithms graphs asymptotics upper bound)
<p>Let <span class="math-container">$d > 1$</span>, and consider a graph <span class="math-container">$G = (V,E)$</span> on <span class="math-container">$n$</span> vertices. A <em>distance <sp... | habedi/stack-exchange-dataset |
108,899 | Algorithms for 2-colouring a 2 x N matrix | <p>Our task is to color a given <span class="math-container">$2 \times N$</span> matrix with two colours red (R) and blue (B) such that no two adjacent cells are blue. For red, there are no restrictions.</p>

<p>An example of all possible solutions for <span class="math-container">$N = 2$</span> is as follows:<... | algorithms dynamic programming matrices colorings | 1 | Algorithms for 2-colouring a 2 x N matrix -- (algorithms dynamic programming matrices colorings)
<p>Our task is to color a given <span class="math-container">$2 \times N$</span> matrix with two colours red (R) and blue (B) such that no two adjacent cells are blue. For red, there are no restrictions.</p>

<p>An ... | habedi/stack-exchange-dataset |
108,911 | Multi-prompt delimited continuations in terms of single-prompt delimited continuations | <p>Let's call the two languages in question (untyped lambda calculus with single or multiple prompt delimited continuations) L_delim and L_prompt.</p>

<blockquote>
 <p>Is it possible to express multi-prompt delimited continuations in terms of single-prompt delimited continuations</p>
</blockquote>
... | lambda calculus continuations | 1 | Multi-prompt delimited continuations in terms of single-prompt delimited continuations -- (lambda calculus continuations)
<p>Let's call the two languages in question (untyped lambda calculus with single or multiple prompt delimited continuations) L_delim and L_prompt.</p>

<blockquote>
 <p>Is it possible t... | habedi/stack-exchange-dataset |
108,914 | Prime Implicants in Boolean Function | <p>A Boolean function <span class="math-container">$F(X_1, X_2, X_3, X_4, X_5, X_6)$</span> of six
variables is defined as <span class="math-container">$F = 1$</span>, when three or more input variables are at logic 1. otherwise 0.
How many essential prime implicants does F have? </p>

<hr>

<p>... | boolean algebra digital circuits | 1 | Prime Implicants in Boolean Function -- (boolean algebra digital circuits)
<p>A Boolean function <span class="math-container">$F(X_1, X_2, X_3, X_4, X_5, X_6)$</span> of six
variables is defined as <span class="math-container">$F = 1$</span>, when three or more input variables are at logic 1. otherwise 0.
How m... | habedi/stack-exchange-dataset |
108,923 | Prove the probability of which a hash function is collision-free | <p>Suppose <span class="math-container">$H = \{h_1, ..., h_T\}$</span> be a family of pairwise independent hash functions mapping <span class="math-container">$\{0, 1\}^n$</span> to <span class="math-container">$\{0, 1\}^{n/2}$</span>. Let <span class="math-container">$M = \frac{2^{n/4}}{10}$</span> and let <span class... | turing machines probability theory discrete mathematics randomized algorithms hash | 1 | Prove the probability of which a hash function is collision-free -- (turing machines probability theory discrete mathematics randomized algorithms hash)
<p>Suppose <span class="math-container">$H = \{h_1, ..., h_T\}$</span> be a family of pairwise independent hash functions mapping <span class="math-container">$\{0, 1\... | habedi/stack-exchange-dataset |
108,933 | Data points as outcomes of a random experiment | <p>It is well known that </p>

<p><strong>Random variable is a function from sample space of a random experiment to <span class="math-container">$\mathbb{R}$</span></strong>.</p>

<p>Consider the following sentences from <a href="https://www.deeplearningbook.org/contents/ml.html#pf1a" rel="nofollow nore... | machine learning probability theory | 1 | Data points as outcomes of a random experiment -- (machine learning probability theory)
<p>It is well known that </p>

<p><strong>Random variable is a function from sample space of a random experiment to <span class="math-container">$\mathbb{R}$</span></strong>.</p>

<p>Consider the following sentences ... | habedi/stack-exchange-dataset |
108,948 | Is purely functional programming in some situations less efficient than imperative programming? | <p>I am used to implementing algorithms in imperative languages. Many of the algorithms I have implemented use hash maps, hash sets, mutable arrays, heaps, doubly linked lists, etc. I understand that some of the data types don't exist in functional languages. For example, it may be hard to implement hash data structure... | algorithms runtime analysis functional programming imperative programming | 1 | Is purely functional programming in some situations less efficient than imperative programming? -- (algorithms runtime analysis functional programming imperative programming)
<p>I am used to implementing algorithms in imperative languages. Many of the algorithms I have implemented use hash maps, hash sets, mutable arra... | habedi/stack-exchange-dataset |
108,949 | All superlinear runtime algorithms are asymptotically equivalent to convex function? | <p>Is it true that every algorithm with runtime complexity of <span class="math-container">$T(n)=\Omega(n)$</span> satisfies that <span class="math-container">$T(n)=\Theta(f(n))$</span> for some convex function <span class="math-container">$f$</span>?</p>

<p>All the examples that I could think of satisfy the a... | complexity theory algorithm analysis time complexity asymptotics runtime analysis | 1 | All superlinear runtime algorithms are asymptotically equivalent to convex function? -- (complexity theory algorithm analysis time complexity asymptotics runtime analysis)
<p>Is it true that every algorithm with runtime complexity of <span class="math-container">$T(n)=\Omega(n)$</span> satisfies that <span class="math-... | habedi/stack-exchange-dataset |
108,950 | A question about decidable and undecidable problems | <p>Maybe this question is not very smart but I really wanna learn this thing. also, I need someone who is familiar with printing 42 problem and zero program problem.</p>

<p>This is the context:</p>

<blockquote>
 <p>Consider the problem of determining whether a number belongs to a set. This
 ... | undecidability decision problem | 1 | A question about decidable and undecidable problems -- (undecidability decision problem)
<p>Maybe this question is not very smart but I really wanna learn this thing. also, I need someone who is familiar with printing 42 problem and zero program problem.</p>

<p>This is the context:</p>

<blockquote>&#x... | habedi/stack-exchange-dataset |
108,953 | Functional dependencies , minimizing SUU->V | <p>Can SUU->V or any functional dependency that contains two or more times each attribute be simplified to the same dependency with one attribute? So SUU->V becomes SU->V or STTT->Q becomes ST->Q ?</p>
 | database theory functional dependencies | 1 | Functional dependencies , minimizing SUU->V -- (database theory functional dependencies)
<p>Can SUU->V or any functional dependency that contains two or more times each attribute be simplified to the same dependency with one attribute? So SUU->V becomes SU->V or STTT->Q becomes ST->Q ?</p>
 | habedi/stack-exchange-dataset |
108,958 | The origin of list data structure | <p>Does anyone know when the list data structure was mentioned in computer programming/algorithms? Who gave birth to this list concept?</p>
 | algorithms data structures linked lists lists | 1 | The origin of list data structure -- (algorithms data structures linked lists lists)
<p>Does anyone know when the list data structure was mentioned in computer programming/algorithms? Who gave birth to this list concept?</p>
 | habedi/stack-exchange-dataset |
108,968 | Can this "double pop" Heapsort variation speed up sorting on average? | <p>For classic Heapsort (in this example using a maxheap), only the root node is extracted (popped) at each iteration and the last element in the heap is swapped into its place and then the tree is "re-heapified". This to me seems somewhat inefficient. We have more knowledge from the maxheap, namely, that the root no... | optimization sorting | 1 | Can this "double pop" Heapsort variation speed up sorting on average? -- (optimization sorting)
<p>For classic Heapsort (in this example using a maxheap), only the root node is extracted (popped) at each iteration and the last element in the heap is swapped into its place and then the tree is "re-heapified". This to m... | habedi/stack-exchange-dataset |
108,974 | Name for value which may only be -1, 0 or 1? | <p>Is there a name for a value which may only be -1, 0 or 1?</p>

<p>Is there a name for a function which creates such a value from arbitrary numbers?</p>

<p>It would be implemented like this:</p>

<p>T Function( T value ) {
 return ( value < 0 ) ? -1 : ( value > 0 ) ? 1 :0;
}</p>&#... | terminology | 1 | Name for value which may only be -1, 0 or 1? -- (terminology)
<p>Is there a name for a value which may only be -1, 0 or 1?</p>

<p>Is there a name for a function which creates such a value from arbitrary numbers?</p>

<p>It would be implemented like this:</p>

<p>T Function( T value ) {
 re... | habedi/stack-exchange-dataset |
108,979 | How precise to be when describing a Turing machine? | <p>I'm kind of new to the theory of computation and I was working on this problem:</p>

<blockquote>
 <p>We say that a Turing machine <span class="math-container">$M$</span> <strong>uses</strong> <span class="math-container">$k$</span> squares of tape for an input string <span class="math-container">$w$</s... | turing machines computability | 1 | How precise to be when describing a Turing machine? -- (turing machines computability)
<p>I'm kind of new to the theory of computation and I was working on this problem:</p>

<blockquote>
 <p>We say that a Turing machine <span class="math-container">$M$</span> <strong>uses</strong> <span class="math-contai... | habedi/stack-exchange-dataset |
108,983 | Why is the blank symbol not considered part of the input alphabet of a Turing machine? | <p><a href="https://en.wikipedia.org/wiki/Turing_machine#Formal_definition" rel="noreferrer">Definitions of Turing machines</a> are always explicit about the blank symbol not being part of the input alphabet.</p>

<p>I wonder what goes wrong when you <em>would</em> make it part of the input alphabet, because ef... | turing machines | 1 | Why is the blank symbol not considered part of the input alphabet of a Turing machine? -- (turing machines)
<p><a href="https://en.wikipedia.org/wiki/Turing_machine#Formal_definition" rel="noreferrer">Definitions of Turing machines</a> are always explicit about the blank symbol not being part of the input alphabet.</p>... | habedi/stack-exchange-dataset |
108,985 | DFA multiple accepting states to Regular expression | <p>I am trying to find the regular expression that defines this DFA, I am finding this particular case difficult since it has multiple accepting states.</p>

<p>If I understand this DFA correctly, it recognises:</p>

<p>empty strings or strings with any number of <code>b</code> => <code>b*</code></p>&#x... | finite automata regular expressions | 1 | DFA multiple accepting states to Regular expression -- (finite automata regular expressions)
<p>I am trying to find the regular expression that defines this DFA, I am finding this particular case difficult since it has multiple accepting states.</p>

<p>If I understand this DFA correctly, it recognises:</p>
... | habedi/stack-exchange-dataset |
108,986 | Why are both caller-save registers and callee save registers needed? | <p>I am having a difficult time understanding callee and caller-save registers. I get that caller-save registers are those which are needed after function call and hence caller saves them in caller prologue and restored in caller epilogue. Callee-save are those who are used by callee and are saved in callee prologue an... | programming languages functional programming | 1 | Why are both caller-save registers and callee save registers needed? -- (programming languages functional programming)
<p>I am having a difficult time understanding callee and caller-save registers. I get that caller-save registers are those which are needed after function call and hence caller saves them in caller pro... | habedi/stack-exchange-dataset |
108,990 | Add type checking/inference to my programming language | <p>I am currently creating my own compiled programming language, and I have come to a point where I would like to start working on the type system and introduce some type checking. Ideally I would like to introduce type inference.</p>

<p>Right now I'm using the Visitor pattern to traverse the AST produced by t... | compilers type checking type inference | 1 | Add type checking/inference to my programming language -- (compilers type checking type inference)
<p>I am currently creating my own compiled programming language, and I have come to a point where I would like to start working on the type system and introduce some type checking. Ideally I would like to introduce type i... | habedi/stack-exchange-dataset |
108,996 | Why does Feistel encryption algorithm encode half block every time? | <p>Why does Feistel encryption algorithm encode half block every time? What would happen if the entire block is encrypted in each step?</p>
 | cryptography encryption | 1 | Why does Feistel encryption algorithm encode half block every time? -- (cryptography encryption)
<p>Why does Feistel encryption algorithm encode half block every time? What would happen if the entire block is encrypted in each step?</p>
 | habedi/stack-exchange-dataset |
109,016 | Is it possible to compute how many iterations this algorithm will take? | <p>I want to know exactly how many iterations it would take this algorithm to terminate. In other words, is there a closed-form solution for the number of iterations? (For my input values, it is always guaranteed to terminate.)</p>

<p>Let <span class="math-container">$x$</span>, <span class="math-container">$y... | algorithms complexity theory algorithm analysis | 1 | Is it possible to compute how many iterations this algorithm will take? -- (algorithms complexity theory algorithm analysis)
<p>I want to know exactly how many iterations it would take this algorithm to terminate. In other words, is there a closed-form solution for the number of iterations? (For my input values, it is ... | habedi/stack-exchange-dataset |
109,022 | In which situation do we choose randomized binary search instead of the normal binary search? | <p>Both randomized and normal binary search takes O(log n) time complexity but why does the randomized version exist? In other words what is the advantage of randomized binary search even if it has same time complexity like that of the original binary search ?</p>
 | algorithms search algorithms binary search searching | 1 | In which situation do we choose randomized binary search instead of the normal binary search? -- (algorithms search algorithms binary search searching)
<p>Both randomized and normal binary search takes O(log n) time complexity but why does the randomized version exist? In other words what is the advantage of randomized... | habedi/stack-exchange-dataset |
109,029 | Given a family of hash functions in table form, how can I know whether it's universal? | <p>I've been given the following two families of hash functions:</p>

<p>H</p>

<p><a href="https://i.stack.imgur.com/muWU7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/muWU7.png" alt=""></a></p>

<p>and </p>

<p>G</p>

<p><a href="https://i.stack.imgur.com/... | hash hashing | 1 | Given a family of hash functions in table form, how can I know whether it's universal? -- (hash hashing)
<p>I've been given the following two families of hash functions:</p>

<p>H</p>

<p><a href="https://i.stack.imgur.com/muWU7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/muWU7.pn... | habedi/stack-exchange-dataset |
109,031 | Complexity class for NP with access to a DP oracle | <p>Consider the following decision problem:</p>
<blockquote>
<p><strong>Given</strong>: Two (3CNF-)formulas <span class="math-container">$\varphi_1$</span>, <span class="math-container">$\varphi_2$</span> on a shared set <span class="math-container">$X\cup Y$</span> of variables (<span class="math-container">$X... | complexity theory oracle machines | 1 | Complexity class for NP with access to a DP oracle -- (complexity theory oracle machines)
<p>Consider the following decision problem:</p>
<blockquote>
<p><strong>Given</strong>: Two (3CNF-)formulas <span class="math-container">$\varphi_1$</span>, <span class="math-container">$\varphi_2$</span> on a shared set <... | habedi/stack-exchange-dataset |
109,043 | Compact Shared Reduced Binary Decision Diagrams with negated identifiers | <p>Consider a BDD implementation in which each bdd in the system has a unique positive integer identifying it (thanks to canonicity and as common implementation designs follow, by utilizing a hashmap). I was thinking of assigning a negative integer to a bdd in order to represent its negation. So say bdd id -3 will be b... | bdd | 1 | Compact Shared Reduced Binary Decision Diagrams with negated identifiers -- (bdd)
<p>Consider a BDD implementation in which each bdd in the system has a unique positive integer identifying it (thanks to canonicity and as common implementation designs follow, by utilizing a hashmap). I was thinking of assigning a negati... | habedi/stack-exchange-dataset |
109,052 | What should I call algorithms with non-linear non-constant time? | <p>I am writing a paper in which I want to refer to a group of algorithms. Some of these algorithms are of complexity <code>O(NlogN)</code>, and some of the are more complex (e.g polynomial-time) and I want to refer to them all in one term. Is there any common term to use in such a situation?</p>

<p><code>line... | complexity theory time complexity terminology runtime analysis big o notation | 1 | What should I call algorithms with non-linear non-constant time? -- (complexity theory time complexity terminology runtime analysis big o notation)
<p>I am writing a paper in which I want to refer to a group of algorithms. Some of these algorithms are of complexity <code>O(NlogN)</code>, and some of the are more comple... | habedi/stack-exchange-dataset |
109,059 | Why is the period of Mersenne Twister prng $2^{19937}-1$ and not $2^{19968}$? | <p>For the Mersenne Twister prng, <a href="https://en.wikipedia.org/wiki/Mersenne_Twister#Pseudocode" rel="nofollow noreferrer">wikipedia</a>, I feel the period exponent should be the size of the MT array,
<span class="math-container">$32\cdot 624 = 19968$</span>.</p>

<p>How come the exponent is 19937 inst... | pseudo random generators random number generator | 1 | Why is the period of Mersenne Twister prng $2^{19937}-1$ and not $2^{19968}$? -- (pseudo random generators random number generator)
<p>For the Mersenne Twister prng, <a href="https://en.wikipedia.org/wiki/Mersenne_Twister#Pseudocode" rel="nofollow noreferrer">wikipedia</a>, I feel the period exponent should be the size... | habedi/stack-exchange-dataset |
109,061 | Formulating the master theorem with Little-O- and Little-Omega notation | <p>In a lecture of Algorithms of Data Structures (based on Cormen et al.), we defined the master theorem like this:</p>

<blockquote>
 <p>Let <span class="math-container">$a \geq 1$</span> and <span class="math-container">$b \gt 1$</span> be constants, and let <span class="math-container">$T : \mathbb{N} \... | algorithms time complexity asymptotics master theorem | 1 | Formulating the master theorem with Little-O- and Little-Omega notation -- (algorithms time complexity asymptotics master theorem)
<p>In a lecture of Algorithms of Data Structures (based on Cormen et al.), we defined the master theorem like this:</p>

<blockquote>
 <p>Let <span class="math-container">$a \g... | habedi/stack-exchange-dataset |
109,069 | Algorithm to assign producers to consumers with respect to connections | <p>I am trying to analyze supply chains in a game and have come across this problem:</p>

<p>First, an informal description: I have producers and consumers. Each producer produces a certain amount of goods, each consumer requieres a certain amount of goods. Each producer is connected to some consumers (these co... | bipartite matching assignment problem bipartite graph | 1 | Algorithm to assign producers to consumers with respect to connections -- (bipartite matching assignment problem bipartite graph)
<p>I am trying to analyze supply chains in a game and have come across this problem:</p>

<p>First, an informal description: I have producers and consumers. Each producer produces a ... | habedi/stack-exchange-dataset |
109,076 | Worst Case Scenario for Quicksort algorithm with pivot element n/2 | <p>What would the worst case array look like if I decide to always take the element on the position <span class="math-container">$\frac{n}{2}$</span> as the pivot element?
I know that if I choose the left or rightmost element as pivot ,the worst case occurs if:</p>

<ol>
<li>Array is already sorted in s... | algorithms runtime analysis quicksort | 1 | Worst Case Scenario for Quicksort algorithm with pivot element n/2 -- (algorithms runtime analysis quicksort)
<p>What would the worst case array look like if I decide to always take the element on the position <span class="math-container">$\frac{n}{2}$</span> as the pivot element?
I know that if I choose the left o... | habedi/stack-exchange-dataset |
109,079 | Self-balancing binary search tree optimized for insertion | <p>I've written a "quiz" that prompts the user for comparisons between two items of subjective value, and once the position of all of the items is determined, displays an ordered list from most valuable to least. The number of items is fixed. The current implementation can be seen at <a href="https://dfdx.us/core-val... | sorting binary trees | 1 | Self-balancing binary search tree optimized for insertion -- (sorting binary trees)
<p>I've written a "quiz" that prompts the user for comparisons between two items of subjective value, and once the position of all of the items is determined, displays an ordered list from most valuable to least. The number of items is... | habedi/stack-exchange-dataset |
109,083 | How to calculate the number of invalid strings given a constraint system on alphabet, word blacklist, and string length | <p>If I have the following system, I am wondering how to calculate the number of valid strings it contains.</p>

<p>The system is something like this, which can have arbitrary variations.</p>

<ul>
<li>Only consists of an alphabet <span class="math-container">$\Sigma$</span>.</li>
<li>It can't s... | algorithms discrete mathematics constraint satisfaction | 1 | How to calculate the number of invalid strings given a constraint system on alphabet, word blacklist, and string length -- (algorithms discrete mathematics constraint satisfaction)
<p>If I have the following system, I am wondering how to calculate the number of valid strings it contains.</p>

<p>The system is s... | habedi/stack-exchange-dataset |
109,084 | On the time complexity of finding independent sets in hypergraphs | <p>I am interested in the complexity of the following problems:</p>
<blockquote>
<p>(a) Finding an independent set of a fixed size in an arbitrary hypergraph</p>
<p>(b) Finding an independent set of maximum size in an arbitrary hypergraph</p>
</blockquote>
<p>It is well known that the analogues of (... | graphs time complexity | 1 | On the time complexity of finding independent sets in hypergraphs -- (graphs time complexity)
<p>I am interested in the complexity of the following problems:</p>
<blockquote>
<p>(a) Finding an independent set of a fixed size in an arbitrary hypergraph</p>
<p>(b) Finding an independent set of maximum size in... | habedi/stack-exchange-dataset |
109,094 | Do the minimum spanning trees of a graph have the same number of edges with a given weight? | <p>I'm asking about the answer here:</p>

<p><a href="https://cs.stackexchange.com/questions/2204/do-the-minimum-spanning-trees-of-a-weighted-graph-have-the-same-number-of-edges/2211#2211">Do the minimum spanning trees of a weighted graph have the same number of edges with a given weight?</a></p>

<p>I ... | graphs correctness proof minimum spanning tree spanning trees | 1 | Do the minimum spanning trees of a graph have the same number of edges with a given weight? -- (graphs correctness proof minimum spanning tree spanning trees)
<p>I'm asking about the answer here:</p>

<p><a href="https://cs.stackexchange.com/questions/2204/do-the-minimum-spanning-trees-of-a-weighted-graph-have-... | habedi/stack-exchange-dataset |
109,099 | The power of relativised proofs | <p>I've been trying to understand why, for instance, even though there are oracles <span class="math-container">$A$</span> for which <span class="math-container">$P^A \neq NP^A$</span>, we still don't know if <span class="math-container">$P=NP$</span>.</p>

<p>As I understand it, it's because it's easy to const... | oracle machines relativization | 1 | The power of relativised proofs -- (oracle machines relativization)
<p>I've been trying to understand why, for instance, even though there are oracles <span class="math-container">$A$</span> for which <span class="math-container">$P^A \neq NP^A$</span>, we still don't know if <span class="math-container">$P=NP$</span>.... | habedi/stack-exchange-dataset |
109,102 | shortest path tree algorithm | <p>Suppose we are given a directed weighted graph <span class="math-container">$G=(V,E)$</span>, a source vertex <span class="math-container">$s$</span> and the value of the cheapest path <span class="math-container">$\delta(s,v)$</span> for every <span class="math-container">$v \in V$</span>.</p>

<p>I want to... | graphs shortest path | 1 | shortest path tree algorithm -- (graphs shortest path)
<p>Suppose we are given a directed weighted graph <span class="math-container">$G=(V,E)$</span>, a source vertex <span class="math-container">$s$</span> and the value of the cheapest path <span class="math-container">$\delta(s,v)$</span> for every <span class="math... | habedi/stack-exchange-dataset |
109,104 | What is an approximation factor for the Greedy Motif Search algorithm? | <p>What is approximation factor for the Greedy <a href="https://en.wikipedia.org/wiki/Planted_motif_search" rel="nofollow noreferrer">Motif Search</a> algorithm?<br>
I couldn't find an answer to my question except for the fact that the algorithm has a unknown aproximation factor. I'm not a native speaker and there ... | algorithms approximation greedy algorithms bioinformatics | 1 | What is an approximation factor for the Greedy Motif Search algorithm? -- (algorithms approximation greedy algorithms bioinformatics)
<p>What is approximation factor for the Greedy <a href="https://en.wikipedia.org/wiki/Planted_motif_search" rel="nofollow noreferrer">Motif Search</a> algorithm?<br>
I couldn't find ... | habedi/stack-exchange-dataset |
109,109 | Is an undirected graph consisting only two connected vertices cyclic? | <p>I have two questions:</p>
<ol>
<li><p>Does acyclic/cyclic classification only apply to directed graphs?</p>
</li>
<li><p>If not, does the following undirected graph have any cycle?</p>
<p>A --- B</p>
</li>
</ol>
 | graphs | 1 | Is an undirected graph consisting only two connected vertices cyclic? -- (graphs)
<p>I have two questions:</p>
<ol>
<li><p>Does acyclic/cyclic classification only apply to directed graphs?</p>
</li>
<li><p>If not, does the following undirected graph have any cycle?</p>
<p>A --- B</p>
</li>
<... | habedi/stack-exchange-dataset |
109,115 | Space-efficient representation of potentially very large arbitrary-precision rationals? | <p>I'd like to know if there are good techniques for faithfully and (reasonably) representing rational numbers with forms similar to:</p>

<ol>
<li>2/3</li>
<li>1/10</li>
<li>4 * 10 ^ 1,000,000,000,000</li>
</ol>

<p>I know arbitrary precision rationals can be represented by pairs of arb... | algorithms number formats | 1 | Space-efficient representation of potentially very large arbitrary-precision rationals? -- (algorithms number formats)
<p>I'd like to know if there are good techniques for faithfully and (reasonably) representing rational numbers with forms similar to:</p>

<ol>
<li>2/3</li>
<li>1/10</li>
<li>4 * 10... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.