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 |
|---|---|---|---|---|---|---|
117,613 | Is $n^{1/\log \log n} = O(1)$? | <blockquote>
 <p>Is <span class="math-container">$n^{1/\log \log n} = O(1)$</span> ?</p>
</blockquote>

<p>Suppose that <span class="math-container">$n^{1/\log \log n} = c$</span> where <span class="math-container">$c$</span> is constant.</p>

<p>Taking logs of both sides,</p>

<p><span... | asymptotics | 1 | Is $n^{1/\log \log n} = O(1)$? -- (asymptotics)
<blockquote>
 <p>Is <span class="math-container">$n^{1/\log \log n} = O(1)$</span> ?</p>
</blockquote>

<p>Suppose that <span class="math-container">$n^{1/\log \log n} = c$</span> where <span class="math-container">$c$</span> is constant.</p>

<p>... | habedi/stack-exchange-dataset |
117,614 | Does White never lose in Chess if Chess is solved? | <p>If the machine has enough memory and speed as to compute all states of the Chess game in a reasonable time, can a player with the white pieces - operated by a machine - lose a game?</p>
 | space complexity search problem board games search | 1 | Does White never lose in Chess if Chess is solved? -- (space complexity search problem board games search)
<p>If the machine has enough memory and speed as to compute all states of the Chess game in a reasonable time, can a player with the white pieces - operated by a machine - lose a game?</p>
 | habedi/stack-exchange-dataset |
117,619 | $O(k)$ Algorithm to find the first $k$ pairs of Magic numbers $a$ and $b$ such that $\sum_{i=1}^{a-1} i = \sum_{k=a+1}^b k $, with restrictions | <p>Provide an <span class="math-container">$O(k)$</span> algorithm to find <span class="math-container">$k$</span>- magic pairs of positive integers a and b of type signed int where a magic pair is defined as <span class="math-container">$\sum_{i=1}^{a-1} i = \sum_{k=a+1}^b k $</span>. You can't use the summation formu... | algorithms discrete mathematics | 1 | $O(k)$ Algorithm to find the first $k$ pairs of Magic numbers $a$ and $b$ such that $\sum_{i=1}^{a-1} i = \sum_{k=a+1}^b k $, with restrictions -- (algorithms discrete mathematics)
<p>Provide an <span class="math-container">$O(k)$</span> algorithm to find <span class="math-container">$k$</span>- magic pairs of positive... | habedi/stack-exchange-dataset |
117,623 | VC dimension of the class of polynomial classifiers of degree $n$ | <p>I came across <a href="https://i.stack.imgur.com/V7fzw.png" rel="nofollow noreferrer">this statement</a> on page 85 of the book <a href="https://www.cs.huji.ac.il/~shais/UnderstandingMachineLearning/understanding-machine-learning-theory-algorithms.pdf" rel="nofollow noreferrer">"understanding machine learning: from ... | learning theory vc dimension | 1 | VC dimension of the class of polynomial classifiers of degree $n$ -- (learning theory vc dimension)
<p>I came across <a href="https://i.stack.imgur.com/V7fzw.png" rel="nofollow noreferrer">this statement</a> on page 85 of the book <a href="https://www.cs.huji.ac.il/~shais/UnderstandingMachineLearning/understanding-mach... | habedi/stack-exchange-dataset |
117,634 | What algorithm to use for this problem? | <p>I was recently faced with a hackerrank interview test where I couldn't solve the following problem correctly. I would not want to name the exact problem for privacy purposes, but I can tell that it was nowhere in Google with this name.</p>

<p><strong>Problem</strong></p>

<p>We want to organize an e... | algorithms optimization search algorithms | 1 | What algorithm to use for this problem? -- (algorithms optimization search algorithms)
<p>I was recently faced with a hackerrank interview test where I couldn't solve the following problem correctly. I would not want to name the exact problem for privacy purposes, but I can tell that it was nowhere in Google with this ... | habedi/stack-exchange-dataset |
117,647 | In Big-O notation, what does it mean for T(n) to be upper bounded by something | <p>I do not have much experience in mathematics but I would really like to grasp Big-O notation on its mathematical level. I already read <a href="https://cs.stackexchange.com/questions/88577/what-does-the-big-o-complexity-of-a-function-mean">What does the "big O complexity" of a function mean?</a> from refer... | algorithm analysis asymptotics runtime analysis | 1 | In Big-O notation, what does it mean for T(n) to be upper bounded by something -- (algorithm analysis asymptotics runtime analysis)
<p>I do not have much experience in mathematics but I would really like to grasp Big-O notation on its mathematical level. I already read <a href="https://cs.stackexchange.com/questions/88... | habedi/stack-exchange-dataset |
117,649 | Maximum value of arbitrage | <p>I'm trying to solve this from The Algorithm Design Manual:</p>

<blockquote>
 <p>6-23. Arbitrage is the use of discrepancies in currency-exchange rates to make a profit. For example, there may be a small window of time during which 1 U.S. dollar buys 0.75 British pounds, 1 British pound buys 2 Australia... | algorithms graphs shortest path weighted graphs | 1 | Maximum value of arbitrage -- (algorithms graphs shortest path weighted graphs)
<p>I'm trying to solve this from The Algorithm Design Manual:</p>

<blockquote>
 <p>6-23. Arbitrage is the use of discrepancies in currency-exchange rates to make a profit. For example, there may be a small window of time durin... | habedi/stack-exchange-dataset |
117,655 | Useless production | <p>Kindly consider the following productions. How can I identify a useless production? </p>

<pre><code>S->aS|A|C

A->a

B->aa

C->aCb
</code></pre>

<p>Somebody please guide me.
Zulfi.</p>
 | formal grammars | 1 | Useless production -- (formal grammars)
<p>Kindly consider the following productions. How can I identify a useless production? </p>

<pre><code>S->aS|A|C

A->a

B->aa

C->aCb
</code></pre>

<p>Somebody please guide me.
Zulfi.</p>
 | habedi/stack-exchange-dataset |
117,658 | How to prove Exact cover problem is NP Complete using Vertex Cover problem? | <p>Using reduction theorem in NP, we want to prove that Exact cover is NPC by reducing it from Vertex Cover Problem. It is easy to derive it from SAT, but we can't find a solution yet to derive it from Vertex Cover.</p>
 | algorithms complexity theory np complete nondeterminism p vs np | 1 | How to prove Exact cover problem is NP Complete using Vertex Cover problem? -- (algorithms complexity theory np complete nondeterminism p vs np)
<p>Using reduction theorem in NP, we want to prove that Exact cover is NPC by reducing it from Vertex Cover Problem. It is easy to derive it from SAT, but we can't find a solu... | habedi/stack-exchange-dataset |
117,661 | How to prove that this language is not regular? | <p>Given a language <span class="math-container">$L$</span> over the alphabet { <code>0</code>, <code>1</code>, <code>[</code>, <code>,</code>, <code>]</code> } where if <span class="math-container">$x \in L$</span> then <span class="math-container">$x$</span> is of the form <span class="math-container">$[x_0, \dots, x... | formal languages regular languages | 1 | How to prove that this language is not regular? -- (formal languages regular languages)
<p>Given a language <span class="math-container">$L$</span> over the alphabet { <code>0</code>, <code>1</code>, <code>[</code>, <code>,</code>, <code>]</code> } where if <span class="math-container">$x \in L$</span> then <span class... | habedi/stack-exchange-dataset |
117,667 | Min-plus matrix multiplication implementation | <p>I had a look at <a href="https://en.wikipedia.org/wiki/Topological_sorting" rel="nofollow noreferrer">topological sorting</a> where they mention a possible parallel algorithm that relies on matrix multiplication, but using min-plus matrix multiplication:</p>

<blockquote>
 <p>One method for doing this i... | algorithms mathematical programming matrix | 1 | Min-plus matrix multiplication implementation -- (algorithms mathematical programming matrix)
<p>I had a look at <a href="https://en.wikipedia.org/wiki/Topological_sorting" rel="nofollow noreferrer">topological sorting</a> where they mention a possible parallel algorithm that relies on matrix multiplication, but using ... | habedi/stack-exchange-dataset |
117,679 | Why can't we prove decidability of $L= \{ \langle M \rangle : M$ accepts $ \epsilon \}$ with a configurations graph? | <p>Since every deterministic Turing Machine can be translated to a graph of configurations such that <span class="math-container">$M$</span> accepts a word <span class="math-container">$w$</span> iff there is a path from the initial configuration that matches <span class="math-container">$w$</span> to an accept configu... | turing machines computability undecidability | 1 | Why can't we prove decidability of $L= \{ \langle M \rangle : M$ accepts $ \epsilon \}$ with a configurations graph? -- (turing machines computability undecidability)
<p>Since every deterministic Turing Machine can be translated to a graph of configurations such that <span class="math-container">$M$</span> accepts a wo... | habedi/stack-exchange-dataset |
117,681 | Simplify the asymptotic expressions $O(n^2 + n) + \Omega (n^2 + n \log n)$ | <p>How can it be shown that the expression <span class="math-container">$O(n^2 + n) + \Omega (n^2 + n \log n)$</span> simplifies to <span class="math-container">$\Omega (n^2)$</span>? Why is it not <span class="math-container">$\Theta(n^2)$</span>? </p>
 | asymptotics | 1 | Simplify the asymptotic expressions $O(n^2 + n) + \Omega (n^2 + n \log n)$ -- (asymptotics)
<p>How can it be shown that the expression <span class="math-container">$O(n^2 + n) + \Omega (n^2 + n \log n)$</span> simplifies to <span class="math-container">$\Omega (n^2)$</span>? Why is it not <span class="math-container">$... | habedi/stack-exchange-dataset |
117,706 | Test if there exists an integer k to add to one sequence to make it a subsequence of another sequence | <p>Suppose that sequence <span class="math-container">$A$</span> contains <span class="math-container">$n$</span> integers <span class="math-container">$a_1,a_2,a_3,\ldots,a_n$</span> and sequence <span class="math-container">$B$</span> contains <span class="math-container">$m$</span> integers <span class="math-contain... | algorithms integers subsequences | 1 | Test if there exists an integer k to add to one sequence to make it a subsequence of another sequence -- (algorithms integers subsequences)
<p>Suppose that sequence <span class="math-container">$A$</span> contains <span class="math-container">$n$</span> integers <span class="math-container">$a_1,a_2,a_3,\ldots,a_n$</sp... | habedi/stack-exchange-dataset |
117,717 | Kolmogorov Complexity, struggle with equation | <p>I am working on understanding Kolmogorov Complexity. I've been struggling with the following exercise for quite some time now and would appreciate any inputs.</p>

<p>Show that there exists a constant <span class="math-container">$c$</span>, such that for each <span class="math-container">$n \in \mathbb{N} -... | kolmogorov complexity | 1 | Kolmogorov Complexity, struggle with equation -- (kolmogorov complexity)
<p>I am working on understanding Kolmogorov Complexity. I've been struggling with the following exercise for quite some time now and would appreciate any inputs.</p>

<p>Show that there exists a constant <span class="math-container">$c$</s... | habedi/stack-exchange-dataset |
117,733 | Can every regular expression be written as sum of products? | <p>I was trying to prove that <a href="https://en.wikipedia.org/wiki/Parikh%27s_theorem" rel="nofollow noreferrer">Parikh Image</a> of every regular language is semi-linear. Even though it is true for CFL, but this question was about regular languages. 
To prove this, I decided to proceed as follows:</p>

<... | formal languages automata regular expressions | 1 | Can every regular expression be written as sum of products? -- (formal languages automata regular expressions)
<p>I was trying to prove that <a href="https://en.wikipedia.org/wiki/Parikh%27s_theorem" rel="nofollow noreferrer">Parikh Image</a> of every regular language is semi-linear. Even though it is true for CFL, but... | habedi/stack-exchange-dataset |
117,735 | Is the constant pi (not Raspberry) ever used in general computer science? | <p>Is the constant pi (not Raspberry) ever used in general computer science? If so, how so or when is it applicable?</p>
 | computer architecture computer networks computer algebra | 1 | Is the constant pi (not Raspberry) ever used in general computer science? -- (computer architecture computer networks computer algebra)
<p>Is the constant pi (not Raspberry) ever used in general computer science? If so, how so or when is it applicable?</p>
 | habedi/stack-exchange-dataset |
117,748 | Space Complexity of Bottom-Up Merge Sort | <p>What is the space complexity of Bottom-up merge sort? 
It uses iteration rather than recursion so it will not use stack. But will an auxiliary array be used for the merge operation? 
Please explain.
Thank you. </p>
 | algorithms sorting mergesort | 1 | Space Complexity of Bottom-Up Merge Sort -- (algorithms sorting mergesort)
<p>What is the space complexity of Bottom-up merge sort? 
It uses iteration rather than recursion so it will not use stack. But will an auxiliary array be used for the merge operation? 
Please explain.
Thank you. </p>
 | habedi/stack-exchange-dataset |
117,758 | Are all subsets of NP-complete languages also NP-complete? | <p>Is the following assertion true or false?</p>

<blockquote>
 <p>If the language <span class="math-container">$L$</span> is NP-complete and <span class="math-container">$Q ⊆ L$</span>, then <span class="math-container">$Q$</span> is NP-complete.</p>
</blockquote>

<p>I know for example that <... | np complete | 1 | Are all subsets of NP-complete languages also NP-complete? -- (np complete)
<p>Is the following assertion true or false?</p>

<blockquote>
 <p>If the language <span class="math-container">$L$</span> is NP-complete and <span class="math-container">$Q ⊆ L$</span>, then <span class="math-container">$Q$</span>... | habedi/stack-exchange-dataset |
117,765 | Does there exist a subset of substrings for reconstructing another string? | <p>I am looking for a high performance algorithm to check whether I can reconstruct a given string using a given set of substrings. More details: </p>

<p>Let's say our strings are over the alphabet <span class="math-container">$\Sigma$</span>.</p>

<p><strong>Inputs</strong>:</p>

<ul>
<li>... | algorithms strings substrings | 1 | Does there exist a subset of substrings for reconstructing another string? -- (algorithms strings substrings)
<p>I am looking for a high performance algorithm to check whether I can reconstruct a given string using a given set of substrings. More details: </p>

<p>Let's say our strings are over the alphabet <sp... | habedi/stack-exchange-dataset |
117,804 | TM decidable or undecidable problem | <p>Problem:</p>

<blockquote>
 <p>Given a TM <span class="math-container">$M$</span> on the alphabet <span class="math-container">$\{0,1\}$</span>, determine if there is some input on which <span class="math-container">$M$</span> executes for at least 5 steps.</p>
</blockquote>

<p>Is this pro... | turing machines undecidability decision problem | 1 | TM decidable or undecidable problem -- (turing machines undecidability decision problem)
<p>Problem:</p>

<blockquote>
 <p>Given a TM <span class="math-container">$M$</span> on the alphabet <span class="math-container">$\{0,1\}$</span>, determine if there is some input on which <span class="math-container... | habedi/stack-exchange-dataset |
117,808 | How does a CPU differentiate between 1-operand instructions and 2-operand instructions? | <p>Suppose that we have 5 different instruction categories (1 OP, 2 OP, 0 OP, branch, and sub-routine instructions), how does a CPU manage to know which category is which whenever it reads an instruction from IR register using the least number of bits for each category? For instance, PDP-11 uses 4 bits (15 → 9) for two... | computer architecture | 1 | How does a CPU differentiate between 1-operand instructions and 2-operand instructions? -- (computer architecture)
<p>Suppose that we have 5 different instruction categories (1 OP, 2 OP, 0 OP, branch, and sub-routine instructions), how does a CPU manage to know which category is which whenever it reads an instruction f... | habedi/stack-exchange-dataset |
117,828 | Run-Time environments | <p>I was reading about Run-Time Environments.<br>
In the Dragon book (2nd ed.) I came across the following presentation: </p>

<blockquote>
 <p>[To implement abstractions, the] compiler <code>creates and manages a run-time environment in which it assumes its target programs are being executed.</code> ... | terminology compilers | 1 | Run-Time environments -- (terminology compilers)
<p>I was reading about Run-Time Environments.<br>
In the Dragon book (2nd ed.) I came across the following presentation: </p>

<blockquote>
 <p>[To implement abstractions, the] compiler <code>creates and manages a run-time environment in which it assume... | habedi/stack-exchange-dataset |
117,830 | Is there a well-known algorithm for arranging inputs according to their category? | <p><strong>Background:</strong> </p>

<p>(I’m a complete beginner in computer science in general, so I do apologise if my question is not formulated in a sensible way. E.g. I have avoided technicalities in formulating my problem, but perhaps this causes issues. I'm willing to edit accordingly if so). </p>
&... | algorithms sorting clustering | 1 | Is there a well-known algorithm for arranging inputs according to their category? -- (algorithms sorting clustering)
<p><strong>Background:</strong> </p>

<p>(I’m a complete beginner in computer science in general, so I do apologise if my question is not formulated in a sensible way. E.g. I have avoided technic... | habedi/stack-exchange-dataset |
117,832 | Prove G have a single MSP | <p>We have undirected connective, weighted graph <span class="math-container">$G = (V,E)$</span>.
we also know that for every <span class="math-container">$e,e'$</span> in <span class="math-container">$E$</span>, <span class="math-container">$w(e)≠w(e')$</span>.
Prove that <span class="math-container">$G$</span... | graphs trees | 1 | Prove G have a single MSP -- (graphs trees)
<p>We have undirected connective, weighted graph <span class="math-container">$G = (V,E)$</span>.
we also know that for every <span class="math-container">$e,e'$</span> in <span class="math-container">$E$</span>, <span class="math-container">$w(e)≠w(e')$</span>.
Prove... | habedi/stack-exchange-dataset |
117,835 | (0+ 11*0) + (0 +11*0)(1 +01*0)* (1 +01*0) =1*0(1 +01*0)* | <p>I needed help with the following question which belongs to Arden's theorem as I am having a hard time solving it. Please find the question below</p>

<p>Prove: 
<span class="math-container">$$(0+ 11^*0) + (0 +11^*0)(1 +01^*0)^* (1 +01^*0) = 1^*0(1 +01^*0)^*$$</span></p>
 | automata | 1 | (0+ 11*0) + (0 +11*0)(1 +01*0)* (1 +01*0) =1*0(1 +01*0)* -- (automata)
<p>I needed help with the following question which belongs to Arden's theorem as I am having a hard time solving it. Please find the question below</p>

<p>Prove: 
<span class="math-container">$$(0+ 11^*0) + (0 +11^*0)(1 +01^*0)^* (1 +01... | habedi/stack-exchange-dataset |
117,838 | Regular expression containing lambda | <p>What is the meaning of lambda here: 
<span class="math-container">$$(b+c)^*(a+\lambda)(b+c)^*(a+\lambda)(b+c)^*(a+\lambda)(b+c)^*$$</span>.</p>

<p>I know that lambda is used in the context of NFA? </p>

<p>Let's suppose we break down the expression to:<span class="math-container">$$(b+c)^*(a+\la... | finite automata regular expressions | 1 | Regular expression containing lambda -- (finite automata regular expressions)
<p>What is the meaning of lambda here: 
<span class="math-container">$$(b+c)^*(a+\lambda)(b+c)^*(a+\lambda)(b+c)^*(a+\lambda)(b+c)^*$$</span>.</p>

<p>I know that lambda is used in the context of NFA? </p>

<p>Let's suppos... | habedi/stack-exchange-dataset |
117,839 | NFA/DFA for $ L= \{a^n b^n a | n\ge0\}$ | <p><a href="https://i.stack.imgur.com/YePs3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YePs3.jpg" alt="enter image description here"></a>I have made two DFA’s for <span class="math-container">$ L= \{a^n b^n a | n\ge0\}$</span>.</p>

<p>First one has several states. The second one is acce... | finite automata | 1 | NFA/DFA for $ L= \{a^n b^n a | n\ge0\}$ -- (finite automata)
<p><a href="https://i.stack.imgur.com/YePs3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YePs3.jpg" alt="enter image description here"></a>I have made two DFA’s for <span class="math-container">$ L= \{a^n b^n a | n\ge0\}$</span>.</p>
... | habedi/stack-exchange-dataset |
117,843 | Give a grammar for a language on Σ={a,b,c} that accepts all strings containing exactly one a | <p>I have created the following solution but its left recursive:
S--> a|bSc|cSb|Sbc
Also it is not accepting:
"ab" or "cba" or "abb" or abc.</p>

<p>Somebody please guide me.</p>

<p>Zulfi.</p>
 | regular languages formal grammars | 1 | Give a grammar for a language on Σ={a,b,c} that accepts all strings containing exactly one a -- (regular languages formal grammars)
<p>I have created the following solution but its left recursive:
S--> a|bSc|cSb|Sbc
Also it is not accepting:
"ab" or "cba" or "abb" or abc.</p>

<p>Somebody please gui... | habedi/stack-exchange-dataset |
117,856 | Are "logarithm types" a thing? | <p>I'm attempting to formalize some thoughts I've had about paths into data structures. For example, a path into a list of <code>T</code>s might be a pair of an index with a path into a <code>T</code>; a path into a pair <code>(A, B)</code> would be the tagged union of a path into <code>A</code> or a path into <code>B<... | type theory | 1 | Are "logarithm types" a thing? -- (type theory)
<p>I'm attempting to formalize some thoughts I've had about paths into data structures. For example, a path into a list of <code>T</code>s might be a pair of an index with a path into a <code>T</code>; a path into a pair <code>(A, B)</code> would be the tagged union of a ... | habedi/stack-exchange-dataset |
117,857 | Is the problem of deciding whether two programs have the same semantics decidable? | <p>If I have program and I want to check whether other programs have the exact same semantics or not, could I always build a machine that could make that decision?</p>

<p>This is a question relevant to information security as metamorphic malware will perform transformations on its own code which will make it l... | undecidability decision problem semantics | 1 | Is the problem of deciding whether two programs have the same semantics decidable? -- (undecidability decision problem semantics)
<p>If I have program and I want to check whether other programs have the exact same semantics or not, could I always build a machine that could make that decision?</p>

<p>This is a ... | habedi/stack-exchange-dataset |
117,859 | Paging - access less than a page of memory | <p>I'm having a bit of trouble understanding how less than a page of memory can be used.</p>

<p>From what I understand, memory is given out in page size chunks - say pages are 4096 bytes, and 4 bytes are requested in a program via <code>malloc</code>, can less than a size of a page be allocated? Or is the rest... | operating systems memory management virtual memory paging | 1 | Paging - access less than a page of memory -- (operating systems memory management virtual memory paging)
<p>I'm having a bit of trouble understanding how less than a page of memory can be used.</p>

<p>From what I understand, memory is given out in page size chunks - say pages are 4096 bytes, and 4 bytes are r... | habedi/stack-exchange-dataset |
117,865 | Predicting the outcome of sporting events with multiplicative scoring | <p>In the Olympic format for sport climbing, eight athletes compete in three rounds of climbing. Their final score is the multiplication of their rankings in each round. For example, an athlete who comes 1st in the first round, 5th in the second round, and 7th in the third will have a final score of <span class="math-c... | combinatorics probabilistic algorithms | 1 | Predicting the outcome of sporting events with multiplicative scoring -- (combinatorics probabilistic algorithms)
<p>In the Olympic format for sport climbing, eight athletes compete in three rounds of climbing. Their final score is the multiplication of their rankings in each round. For example, an athlete who comes 1s... | habedi/stack-exchange-dataset |
117,871 | Grover's algorithm on probabilistic classical machines | <p>As a starting point for this question, I came across <a href="https://quantumcomputing.stackexchange.com/questions/3832/query-regarding-bqp-belonging-to-pp">this question</a>, which AIUI is citing a construction showing how to simulate quantum circuits with a <span class="math-container">$PP$</span> algorithm, i.e. ... | algorithms complexity classes probabilistic algorithms | 1 | Grover's algorithm on probabilistic classical machines -- (algorithms complexity classes probabilistic algorithms)
<p>As a starting point for this question, I came across <a href="https://quantumcomputing.stackexchange.com/questions/3832/query-regarding-bqp-belonging-to-pp">this question</a>, which AIUI is citing a con... | habedi/stack-exchange-dataset |
117,877 | How many registers does a computer *need*? | <p>I read about <a href="https://cs.stackexchange.com/questions/22589/why-does-a-processor-have-32-registers">Why does a processor have 32 registers?</a>, and others. Currently I am messing around with an OS in JavaScript, and wondering how many registers -- or more specifically, how many temporary variable slots -- yo... | computer architecture operating systems cpu | 1 | How many registers does a computer *need*? -- (computer architecture operating systems cpu)
<p>I read about <a href="https://cs.stackexchange.com/questions/22589/why-does-a-processor-have-32-registers">Why does a processor have 32 registers?</a>, and others. Currently I am messing around with an OS in JavaScript, and w... | habedi/stack-exchange-dataset |
117,880 | What happens with register usage in deeply nested functions calls (in theory)? | <p>I am far from being able to construct a meaningful test for this using <a href="https://godbolt.org/" rel="nofollow noreferrer">godbolt</a> or some C compilation tool. But basically I am wondering what it would look like to have deeply nested function calls, where each function had let's say a dozen temporary variab... | optimization computer architecture compilers cpu | 1 | What happens with register usage in deeply nested functions calls (in theory)? -- (optimization computer architecture compilers cpu)
<p>I am far from being able to construct a meaningful test for this using <a href="https://godbolt.org/" rel="nofollow noreferrer">godbolt</a> or some C compilation tool. But basically I ... | habedi/stack-exchange-dataset |
117,889 | Clarification about conclusion of $Θ(nlogn)$? | <p><a href="https://i.stack.imgur.com/EzfGg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EzfGg.png" alt="enter image description here"></a></p>

<ol>
<li><p>Why the first part of formula is equal to <span class="math-container">$2 * 2^2 + ... + 2^{log(n)} = 2^2 + 2^3 +...+ 2^{log(n)}... | algorithms heaps | 1 | Clarification about conclusion of $Θ(nlogn)$? -- (algorithms heaps)
<p><a href="https://i.stack.imgur.com/EzfGg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EzfGg.png" alt="enter image description here"></a></p>

<ol>
<li><p>Why the first part of formula is equal to <span class="math-c... | habedi/stack-exchange-dataset |
117,892 | Proving set of finite languages vs all languages over finite alphabet to be countable / uncountable | <p>I came across following facts:</p>

<blockquote>
 <ol>
 <li>Set of finite languages over a finite alphabet is countable.</li>
 <li>Set of languages over finite alphabet is uncountable.<br>
 I believe proof of this will be similar to below fact number 3. </li>
 <li>Set of languages o... | formal languages discrete mathematics sets uncountability | 1 | Proving set of finite languages vs all languages over finite alphabet to be countable / uncountable -- (formal languages discrete mathematics sets uncountability)
<p>I came across following facts:</p>

<blockquote>
 <ol>
 <li>Set of finite languages over a finite alphabet is countable.</li>
 <li>... | habedi/stack-exchange-dataset |
117,894 | Hamiltonian cycle, verifying and finding | <p>If we have an algorithm that in polynomial time says if a graph G has an hamiltonian cycle, can we have an algorithm that in polynomial time find an hamiltonian cycle?</p>

<p>My attempt is to delete an edge of graph G and have G', after run the algorithm on G' to know if it has an hamiltonian cycle if not i... | complexity theory reductions hamiltonian path | 1 | Hamiltonian cycle, verifying and finding -- (complexity theory reductions hamiltonian path)
<p>If we have an algorithm that in polynomial time says if a graph G has an hamiltonian cycle, can we have an algorithm that in polynomial time find an hamiltonian cycle?</p>

<p>My attempt is to delete an edge of graph ... | habedi/stack-exchange-dataset |
117,905 | How to simplify context free grammars? | <p>How to simplify this context-free grammar? 
<span class="math-container">$$
S \to ACD \\ A \to a \\ B \to \varepsilon \\ C \to ED \mid \varepsilon \\ D \to BC \mid b \\E \to b
$$</span></p>

<p>Can the simplification result in this CFG?</p>

<p><span class="math-container">$$
S \to AC... | context free formal grammars | 1 | How to simplify context free grammars? -- (context free formal grammars)
<p>How to simplify this context-free grammar? 
<span class="math-container">$$
S \to ACD \\ A \to a \\ B \to \varepsilon \\ C \to ED \mid \varepsilon \\ D \to BC \mid b \\E \to b
$$</span></p>

<p>Can the simplification result ... | habedi/stack-exchange-dataset |
117,906 | Can nfa consume more than one letter at a time | <p>If I have a NFA/DFA and I expect inputs of 00, 01, 10, 11 can I read input in groups of 2 binary digits at a time.</p>

<p>like the example shown</p>

<p><a href="https://i.stack.imgur.com/NKpG6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NKpG6.jpg" alt="enter image description... | automata finite automata | 1 | Can nfa consume more than one letter at a time -- (automata finite automata)
<p>If I have a NFA/DFA and I expect inputs of 00, 01, 10, 11 can I read input in groups of 2 binary digits at a time.</p>

<p>like the example shown</p>

<p><a href="https://i.stack.imgur.com/NKpG6.jpg" rel="nofollow noreferrer... | habedi/stack-exchange-dataset |
117,932 | Smallest $s$-component in mincut | <p>Suppose there is a directed graph <span class="math-container">$G=(V,E)$</span>, with source <span class="math-container">$s$</span> and sink <span class="math-container">$t$</span>, and I compute the max flow on it. Then I know that I can find a min-cut <span class="math-container">$(A,B)$</span>, by letting <span ... | network flow minimum cuts | 1 | Smallest $s$-component in mincut -- (network flow minimum cuts)
<p>Suppose there is a directed graph <span class="math-container">$G=(V,E)$</span>, with source <span class="math-container">$s$</span> and sink <span class="math-container">$t$</span>, and I compute the max flow on it. Then I know that I can find a min-cu... | habedi/stack-exchange-dataset |
117,938 | Big-O notation for the given function whose runtime complexity grows faster than the input | <p>I struggle to determine the runtime complexity of a function I thought of while trying to solve <a href="https://leetcode.com/problems/ugly-number-ii/" rel="nofollow noreferrer">this LeetCode quiz</a>. The quiz itself goes like this:</p>

<p><em>Write a program to find the n-th ugly number. Ugly numbers are ... | asymptotics big o notation | 1 | Big-O notation for the given function whose runtime complexity grows faster than the input -- (asymptotics big o notation)
<p>I struggle to determine the runtime complexity of a function I thought of while trying to solve <a href="https://leetcode.com/problems/ugly-number-ii/" rel="nofollow noreferrer">this LeetCode qu... | habedi/stack-exchange-dataset |
117,949 | Stack Permutation Algorithm | <p>I was recently designing a Forth stack machine. I have an atomic instruction which rotates the top N elements.</p>

<p>For example if the top of the stack is on the left, then say the N=3 rotate instruction would do the following:</p>

<pre><code>A B C D -> C A B D
</code></pre>

<p>A ... | algorithms permutations stacks | 1 | Stack Permutation Algorithm -- (algorithms permutations stacks)
<p>I was recently designing a Forth stack machine. I have an atomic instruction which rotates the top N elements.</p>

<p>For example if the top of the stack is on the left, then say the N=3 rotate instruction would do the following:</p>

<... | habedi/stack-exchange-dataset |
117,952 | Is dynamic programming restricted to optimization problems? | <p>The usual criteria used to decide if a problem can be solved using dynamic programming is (1) if it has optimal sub-problems and (2) if it has overlapping sub-problems. Does the word "optimal" mean that DP can only be used to solve optimization problems? Otherwise, it would make more sense to write (1) as "if it can... | dynamic programming | 1 | Is dynamic programming restricted to optimization problems? -- (dynamic programming)
<p>The usual criteria used to decide if a problem can be solved using dynamic programming is (1) if it has optimal sub-problems and (2) if it has overlapping sub-problems. Does the word "optimal" mean that DP can only be used to solve ... | habedi/stack-exchange-dataset |
117,972 | How to devise an algorithm to generate a random but valid train track layout? | <p>I am wondering if I have quantity C of curved tracks and quantity S of straight tracks, how I could devise an algorithm, (computer assisted or not), to design a "random" layout using all of those tracks, such that the following rules are satisfied:</p>

<p>1) The tracks, when all connected, form a closed (co... | computational geometry artificial intelligence randomized algorithms | 1 | How to devise an algorithm to generate a random but valid train track layout? -- (computational geometry artificial intelligence randomized algorithms)
<p>I am wondering if I have quantity C of curved tracks and quantity S of straight tracks, how I could devise an algorithm, (computer assisted or not), to design a "ran... | habedi/stack-exchange-dataset |
117,980 | Splitting a node in B+ tree with odd number of keys | <p><a href="https://stackoverflow.com/questions/6314790/splitting-a-node-in-b-tree">This</a> and several other resources suggest to <em>"Always a node that gets the middle key from bottom splits, should drop one item for a new middle key"</em>.</p>

<p>To illustrate with an example. </p>

<p><strong>For... | data structures balanced search trees b tree | 1 | Splitting a node in B+ tree with odd number of keys -- (data structures balanced search trees b tree)
<p><a href="https://stackoverflow.com/questions/6314790/splitting-a-node-in-b-tree">This</a> and several other resources suggest to <em>"Always a node that gets the middle key from bottom splits, should drop one item f... | habedi/stack-exchange-dataset |
117,989 | Hausdorff distance between two binary images according to distance maps | <p>I want to compute the <a href="https://en.wikipedia.org/wiki/Hausdorff_distance" rel="nofollow noreferrer">Hausdorff distance</a> between two (very large) binary images X and Y, which is:</p>

<p><span class="math-container">$$H(X,Y) = \max\left\{\,h(X,Y), h(Y,X)\right\}\!$$</span></p>

<p>with</p>&#... | algorithms image processing | 1 | Hausdorff distance between two binary images according to distance maps -- (algorithms image processing)
<p>I want to compute the <a href="https://en.wikipedia.org/wiki/Hausdorff_distance" rel="nofollow noreferrer">Hausdorff distance</a> between two (very large) binary images X and Y, which is:</p>

<p><span cl... | habedi/stack-exchange-dataset |
117,990 | What category does questions like "Given n points on 2D plane find ..." belong to | <p>Not after a specific answer, do following questions belong to same set of problem types?</p>

<p>Given n points in on 2D plane, find 4 or 5 , or m subset of points with less total distant to each other than all other points.</p>

<p>Or</p>

<p>Given n points in on 2D plane, count the number o... | terminology | 1 | What category does questions like "Given n points on 2D plane find ..." belong to -- (terminology)
<p>Not after a specific answer, do following questions belong to same set of problem types?</p>

<p>Given n points in on 2D plane, find 4 or 5 , or m subset of points with less total distant to each other than all... | habedi/stack-exchange-dataset |
118,002 | Assuming P != NP, what is the cardinality of the set of NP-Hard languages? | <p>If P=NP, then every non-trivial language is NP-Hard, so clearly there are uncountably many NP-Hard languages. However it's less clear to me what the cardinality of this set is assuming P != NP. </p>
 | complexity theory time complexity | 1 | Assuming P != NP, what is the cardinality of the set of NP-Hard languages? -- (complexity theory time complexity)
<p>If P=NP, then every non-trivial language is NP-Hard, so clearly there are uncountably many NP-Hard languages. However it's less clear to me what the cardinality of this set is assuming P != NP. </p>
 | habedi/stack-exchange-dataset |
118,003 | Need clarification regarding certificates of coNP problems | <p><strong>NOTE</strong>: this is <strong>not</strong> an attempt to prove <span class="math-container">$NP \neq coNP$</span></p>

<p>There is one thing I have never been able to completely digest about the certificates of problems in <span class="math-container">$coNP$</span> and I would very much appreciate a... | proof techniques co np | 1 | Need clarification regarding certificates of coNP problems -- (proof techniques co np)
<p><strong>NOTE</strong>: this is <strong>not</strong> an attempt to prove <span class="math-container">$NP \neq coNP$</span></p>

<p>There is one thing I have never been able to completely digest about the certificates of pr... | habedi/stack-exchange-dataset |
118,007 | Determine aproximation factor in a greedy algorithm | <blockquote>
 <p>Suppose we have n food dishes associated to a cost c, and we have i guests such that each one of them has a certain number of preferences.
 We want to choose a menu such that we minimize the cost and such that at least one preference for each guest is satisfied.</p>
</blockquote>

... | algorithms linear programming greedy algorithms knapsack problems | 1 | Determine aproximation factor in a greedy algorithm -- (algorithms linear programming greedy algorithms knapsack problems)
<blockquote>
 <p>Suppose we have n food dishes associated to a cost c, and we have i guests such that each one of them has a certain number of preferences.
 We want to choose a menu such ... | habedi/stack-exchange-dataset |
118,019 | Prove that $\text{EF p}$ can't be written in LTL | <p>Why can't we somehow represent it's negation in LTL and go from there? I think maybe because it has (effectively) two existential quantifiers, so negating it does not work. But how do I prove it? </p>
 | linear temporal logic temporal logic | 1 | Prove that $\text{EF p}$ can't be written in LTL -- (linear temporal logic temporal logic)
<p>Why can't we somehow represent it's negation in LTL and go from there? I think maybe because it has (effectively) two existential quantifiers, so negating it does not work. But how do I prove it? </p>
 | habedi/stack-exchange-dataset |
118,028 | Prove the equivalence of regular expressions | <p>I have a question relating to regular expressions that I'm a bit confused about, If someone can help me out, that would be very much appreciated.</p>

<p>Suppose there exists regular expressions R, S and T.</p>

<p>Then is <strong>R*</strong> ≡ <strong>R* R*</strong>?</p>

<p>I know the way t... | regular languages regular expressions | 1 | Prove the equivalence of regular expressions -- (regular languages regular expressions)
<p>I have a question relating to regular expressions that I'm a bit confused about, If someone can help me out, that would be very much appreciated.</p>

<p>Suppose there exists regular expressions R, S and T.</p>

<... | habedi/stack-exchange-dataset |
118,032 | Minimum XOR for queries | <p>I was asked the following question in an interview.</p>

<p>Given an array <span class="math-container">$A$</span> with <span class="math-container">$n$</span> integers and an array <span class="math-container">$B$</span> with <span class="math-container">$m$</span> integers. For each integer <span class="ma... | algorithms optimization sorting bit manipulation xor | 1 | Minimum XOR for queries -- (algorithms optimization sorting bit manipulation xor)
<p>I was asked the following question in an interview.</p>

<p>Given an array <span class="math-container">$A$</span> with <span class="math-container">$n$</span> integers and an array <span class="math-container">$B$</span> with ... | habedi/stack-exchange-dataset |
118,037 | If A and B are NP-complete, then A ∪ B need not be NP-complete | <p>I am studying the proof of this exercise (<a href="https://www.cs.princeton.edu/courses/archive/spring06/cos345/precept/precept6.pdf" rel="nofollow noreferrer">link</a>)</p>

<blockquote>
 <p>There exist N P-complete languages A and B such that A ∪ B is not N P-complete. Example:</p>
 
 <p><sp... | turing machines np complete np nondeterminism | 1 | If A and B are NP-complete, then A ∪ B need not be NP-complete -- (turing machines np complete np nondeterminism)
<p>I am studying the proof of this exercise (<a href="https://www.cs.princeton.edu/courses/archive/spring06/cos345/precept/precept6.pdf" rel="nofollow noreferrer">link</a>)</p>

<blockquote>
 <... | habedi/stack-exchange-dataset |
118,039 | Using decision oracle to solve optimization problem of maximum polyomino tiling | <p>So, this problem is a kind of variant of polyomino packing which has been discussed frequently elsewhere, but I haven't been able to find anything on my particular problem. Suppose we have a list of polyominos <span class="math-container">$p_1, p_2, ..., p_n$</span> (not necessarily distinct), and we want to find a ... | algorithms np complete np | 1 | Using decision oracle to solve optimization problem of maximum polyomino tiling -- (algorithms np complete np)
<p>So, this problem is a kind of variant of polyomino packing which has been discussed frequently elsewhere, but I haven't been able to find anything on my particular problem. Suppose we have a list of polyomi... | habedi/stack-exchange-dataset |
118,042 | Largest number of unique values in sets | <p>Let's say I have 100 sets of values, and each set contains roughly 100,000 values. From these sets, I want to find the 10 sets that collectively have the largest number of unique values.</p>

<p>The brute force method of just checking all combinations is a combinatorial nightmare. I also thought about doin... | sets | 1 | Largest number of unique values in sets -- (sets)
<p>Let's say I have 100 sets of values, and each set contains roughly 100,000 values. From these sets, I want to find the 10 sets that collectively have the largest number of unique values.</p>

<p>The brute force method of just checking all combinations is a c... | habedi/stack-exchange-dataset |
118,044 | Design a Turing machine that accepts L={ww^r | w:(0,1)*}? | <p>Can anyone help :( </p>

<p>L = {ww^r | w element of (0,1)*}</p>

<p>Would it be like in :pseudo code, check if the string is equal to itself in reverse? </p>
 | turing machines | 1 | Design a Turing machine that accepts L={ww^r | w:(0,1)*}? -- (turing machines)
<p>Can anyone help :( </p>

<p>L = {ww^r | w element of (0,1)*}</p>

<p>Would it be like in :pseudo code, check if the string is equal to itself in reverse? </p>
 | habedi/stack-exchange-dataset |
118,049 | why is the NL solution PATH negated unsufficient to prove unreachability | <p>I'm currently reading into complexity classes and one think will not fit into my head.
We are investigating NLogSpace with the Path/reachability problem.
There is a nondeterministic LogSpace algorithm which can solve reachability, but its inversion does not prove nonreachability because "it could miss a path... | complexity theory | 1 | why is the NL solution PATH negated unsufficient to prove unreachability -- (complexity theory)
<p>I'm currently reading into complexity classes and one think will not fit into my head.
We are investigating NLogSpace with the Path/reachability problem.
There is a nondeterministic LogSpace algorithm which can so... | habedi/stack-exchange-dataset |
118,050 | Selecting elements from two arrays to get a target sum | <p>Let <span class="math-container">$A$</span> and <span class="math-container">$B$</span> be two arrays of size <span class="math-container">$n$</span> with positive integer values. Let <span class="math-container">$k$</span> be a given positive integer. </p>

<p>Design an algorithm to solve the following prob... | algorithms dynamic programming arrays greedy algorithms | 1 | Selecting elements from two arrays to get a target sum -- (algorithms dynamic programming arrays greedy algorithms)
<p>Let <span class="math-container">$A$</span> and <span class="math-container">$B$</span> be two arrays of size <span class="math-container">$n$</span> with positive integer values. Let <span class="math... | habedi/stack-exchange-dataset |
118,053 | Pairwise hash functions that are independent from each other | <p>Is there there a way to build a collection of universal hash functions <span class="math-container">$H=\{h| h:U\to D \}$</span> where the values of two hash functions are independent one from another? i.e., <span class="math-container">$\Pr_{h_1,h_2\in H}(h_1(x)=y \land h_2(z)=w )=|D|^{-2}$</span> for each <span cl... | hash hash tables | 1 | Pairwise hash functions that are independent from each other -- (hash hash tables)
<p>Is there there a way to build a collection of universal hash functions <span class="math-container">$H=\{h| h:U\to D \}$</span> where the values of two hash functions are independent one from another? i.e., <span class="math-container... | habedi/stack-exchange-dataset |
118,054 | How to prove that Exact Cover is NP-complete using SAT? | <p>I found this solution online <a href="https://www.cs.usfca.edu/~galles/cs411/lecture/lecture18.pdf" rel="nofollow noreferrer">here</a>, but I do not understand the logic behind transforming the instance of SAT to an instance of Exact Cover. </p>

<p>Here's the solution from the link (where C is the clause(s... | np complete | 1 | How to prove that Exact Cover is NP-complete using SAT? -- (np complete)
<p>I found this solution online <a href="https://www.cs.usfca.edu/~galles/cs411/lecture/lecture18.pdf" rel="nofollow noreferrer">here</a>, but I do not understand the logic behind transforming the instance of SAT to an instance of Exact Cover. </... | habedi/stack-exchange-dataset |
118,060 | Upper (or lower) envelope of some linear functions | <p>Given some single variable linear functions <span class="math-container">$y_1=m_1x+b_1$</span>, <span class="math-container">$y_2=m_2x+b_2$</span>, <span class="math-container">$\ldots$</span>, <span class="math-container">$y_n=m_nx+b_n$</span>, the upper envelope is the function <span class="math-container">$f(x)= ... | algorithms time complexity computational geometry | 1 | Upper (or lower) envelope of some linear functions -- (algorithms time complexity computational geometry)
<p>Given some single variable linear functions <span class="math-container">$y_1=m_1x+b_1$</span>, <span class="math-container">$y_2=m_2x+b_2$</span>, <span class="math-container">$\ldots$</span>, <span class="math... | habedi/stack-exchange-dataset |
118,064 | How to prove the set of powers of 2 in ternary representation to be non-regular using pumping lemma? | <p>Given the set of natural numbers, <span class="math-container">$S = \{2^i|i\in\mathbb{N}\}$</span> let <span class="math-container">$L$</span> be the language defined as the ternary representation of all numbers in <span class="math-container">$S$</span>. How can you prove that this is not a regular language using t... | formal languages regular languages pumping lemma | 1 | How to prove the set of powers of 2 in ternary representation to be non-regular using pumping lemma? -- (formal languages regular languages pumping lemma)
<p>Given the set of natural numbers, <span class="math-container">$S = \{2^i|i\in\mathbb{N}\}$</span> let <span class="math-container">$L$</span> be the language def... | habedi/stack-exchange-dataset |
118,080 | When does a semaphore issue a wait and when does it issue a signal? | <p>In my textbook, <i>Operating Systems: Internals and Design Principles (9th Edition)</i> by William Stallings in chapter 5, it explains how semaphores work: </p>

<blockquote>
The fundamental principle is this: Two or more processes can cooperate
by means of simple signals, such that a process can be ... | operating systems process scheduling mutual exclusion semaphore | 1 | When does a semaphore issue a wait and when does it issue a signal? -- (operating systems process scheduling mutual exclusion semaphore)
<p>In my textbook, <i>Operating Systems: Internals and Design Principles (9th Edition)</i> by William Stallings in chapter 5, it explains how semaphores work: </p>

<blockquot... | habedi/stack-exchange-dataset |
118,088 | Why do we need to take the derivative of the activation function in backwards propagation? | <p>I was reading this article here: <a href="https://towardsdatascience.com/how-does-back-propagation-in-artificial-neural-networks-work-c7cad873ea7" rel="nofollow noreferrer">https://towardsdatascience.com/how-does-back-propagation-in-artificial-neural-networks-work-c7cad873ea7</a>.</p>

<p>When he gets to the... | machine learning neural networks | 1 | Why do we need to take the derivative of the activation function in backwards propagation? -- (machine learning neural networks)
<p>I was reading this article here: <a href="https://towardsdatascience.com/how-does-back-propagation-in-artificial-neural-networks-work-c7cad873ea7" rel="nofollow noreferrer">https://towards... | habedi/stack-exchange-dataset |
118,092 | Some questions about the Computability of Turing Machines | <p>I'm learning for a test and I have some important questions about Computability of deterministic and non deterministic Turing Machines.</p>

<p>Consider we have the partial functions <span class="math-container">$f,g,h,t: \mathbb{N} \rightarrow \mathbb{N}$</span> with <span class="math-container">$f$</span> ... | turing machines church turing thesis | 1 | Some questions about the Computability of Turing Machines -- (turing machines church turing thesis)
<p>I'm learning for a test and I have some important questions about Computability of deterministic and non deterministic Turing Machines.</p>

<p>Consider we have the partial functions <span class="math-containe... | habedi/stack-exchange-dataset |
118,094 | Network Flow - Minimum flow in a network | <p>I have a directed graph <strong>G=(V,E)</strong> with a source <strong>s</strong><span class="math-container">$\in V$</span> and a sink <strong>t</strong><span class="math-container">$\in V$</span>. There is a minimum capacity (lower bound) <strong>l <span class="math-container">$_{e}$</span></strong> for each edge ... | algorithms graphs network flow | 1 | Network Flow - Minimum flow in a network -- (algorithms graphs network flow)
<p>I have a directed graph <strong>G=(V,E)</strong> with a source <strong>s</strong><span class="math-container">$\in V$</span> and a sink <strong>t</strong><span class="math-container">$\in V$</span>. There is a minimum capacity (lower bound)... | habedi/stack-exchange-dataset |
118,100 | Removing vertices from a labelled graph | <p>Let <span class="math-container">$G$</span> be an undirected graph with each vertex labeled with an integer. Is there an algorithm to remove a subset of vertices such that in the resulting graph with deleted vertices no vertices with different integer labels are connected with an edge, but also among all groups of v... | graphs | 1 | Removing vertices from a labelled graph -- (graphs)
<p>Let <span class="math-container">$G$</span> be an undirected graph with each vertex labeled with an integer. Is there an algorithm to remove a subset of vertices such that in the resulting graph with deleted vertices no vertices with different integer labels are co... | habedi/stack-exchange-dataset |
118,115 | Finding a vertex coverage that is also an independent set | <p>Given a graph <span class="math-container">$G$</span> and integer <span class="math-container">$k$</span>, find a vertex coverage set of size <span class="math-container">$k$</span> that is also an independent set. I need to either prove this problem is np-complete or find a polynomial solution. Any idea?</p>
 | algorithms complexity theory graphs np complete | 1 | Finding a vertex coverage that is also an independent set -- (algorithms complexity theory graphs np complete)
<p>Given a graph <span class="math-container">$G$</span> and integer <span class="math-container">$k$</span>, find a vertex coverage set of size <span class="math-container">$k$</span> that is also an independ... | habedi/stack-exchange-dataset |
118,119 | Grammar is LL(1) or not? | <p>S -> AS | b</p>

<p>A -> SA | a</p>

<p>I get FIRST of S = {a,b} for S->AS
and FIRST of S = {b} for S->b</p>

<p>Hence FIRST(AS) ∩ FIRST (b) is not a disjoint 
This is not LL(1)</p>

<p>But I checked this site <a href="http://smlweb.cpsc.ucalgary.ca/start.html" rel="nofollow n... | compilers parsers | 1 | Grammar is LL(1) or not? -- (compilers parsers)
<p>S -> AS | b</p>

<p>A -> SA | a</p>

<p>I get FIRST of S = {a,b} for S->AS
and FIRST of S = {b} for S->b</p>

<p>Hence FIRST(AS) ∩ FIRST (b) is not a disjoint 
This is not LL(1)</p>

<p>But I checked this site <a href="http://sml... | habedi/stack-exchange-dataset |
118,121 | Why is IDA$^*$ faster than A$^*$? Why does IDA$^*$ visit more nodes than A$^*$? | <p>I used IDA<span class="math-container">$^*$</span> for optimally solving the 8-puzzle and my friends used A<span class="math-container">$^*$</span> for it too (with same manhattan distance heuristic).</p>

<p>I calculated the average running time and number of nodes of my algorithm for 20 examples and my fri... | algorithms search algorithms artificial intelligence | 1 | Why is IDA$^*$ faster than A$^*$? Why does IDA$^*$ visit more nodes than A$^*$? -- (algorithms search algorithms artificial intelligence)
<p>I used IDA<span class="math-container">$^*$</span> for optimally solving the 8-puzzle and my friends used A<span class="math-container">$^*$</span> for it too (with same manhattan... | habedi/stack-exchange-dataset |
118,131 | Which sort algorithm to choose given two specific arrays? | <p><strong>Interview question:</strong></p>

<p>Given array A which contains only odd numbers and array B which contains only even numbers, explain
which sort algorithm would you choose. </p>

<p>I said merge sort. I thought that given two lists both of which are sorted (which I assumed) I can just ... | algorithms sorting arrays | 1 | Which sort algorithm to choose given two specific arrays? -- (algorithms sorting arrays)
<p><strong>Interview question:</strong></p>

<p>Given array A which contains only odd numbers and array B which contains only even numbers, explain
which sort algorithm would you choose. </p>

<p>I said merge so... | habedi/stack-exchange-dataset |
118,148 | NP Complete Clique Variation | <p>I have the following problem I am trying to prove NP Complete.</p>

<p>Tutors have two jobs- grading exams and homework help. Suppose we have a set of <span class="math-container">$n$</span> tutors. Each of them can tutor any amount of <span class="math-container">$m$</span> classes.</p>

<p>The tuto... | algorithms graphs np complete | 1 | NP Complete Clique Variation -- (algorithms graphs np complete)
<p>I have the following problem I am trying to prove NP Complete.</p>

<p>Tutors have two jobs- grading exams and homework help. Suppose we have a set of <span class="math-container">$n$</span> tutors. Each of them can tutor any amount of <span cla... | habedi/stack-exchange-dataset |
118,150 | Minimum edge weight k-exact cover with triangle inequality | <p>Suppose you have a weighted graph <span class="math-container">$G = (V, E \subseteq V^2, w \in E \to \mathbb{R}^+)$</span>, where <span class="math-container">$w$</span> satisfies the triangle inequality <span class="math-container">$w(x, y) + w(y, z) \ge w(x, z)$</span>. Suppose <span class="math-container">$k \in... | algorithms graphs approximation weighted graphs | 1 | Minimum edge weight k-exact cover with triangle inequality -- (algorithms graphs approximation weighted graphs)
<p>Suppose you have a weighted graph <span class="math-container">$G = (V, E \subseteq V^2, w \in E \to \mathbb{R}^+)$</span>, where <span class="math-container">$w$</span> satisfies the triangle inequality ... | habedi/stack-exchange-dataset |
118,155 | Can someone pelase give a counter example of it? If a problem is in NP then there is no known polynomial time algorithm to solve it | <p>Is there any known polynomial time algorithm to solve a problem which that problem is in NP. I was told is False but can't think of any counter example now. </p>
 | np complete np proof assistants | 1 | Can someone pelase give a counter example of it? If a problem is in NP then there is no known polynomial time algorithm to solve it -- (np complete np proof assistants)
<p>Is there any known polynomial time algorithm to solve a problem which that problem is in NP. I was told is False but can't think of any counter exa... | habedi/stack-exchange-dataset |
118,169 | Dynamic length of union of segments (1d Klee's measure problem) | <p>Finding the length of union of segments (1-dimensional Klee's measure problem) is a well-known algorithmic problem. Given a set of <span class="math-container">$n$</span> intervals on the real line, the task is to find the length of their union. There is a simple <span class="math-container">$O(n \log n)$</span> sol... | algorithms computational geometry | 1 | Dynamic length of union of segments (1d Klee's measure problem) -- (algorithms computational geometry)
<p>Finding the length of union of segments (1-dimensional Klee's measure problem) is a well-known algorithmic problem. Given a set of <span class="math-container">$n$</span> intervals on the real line, the task is to ... | habedi/stack-exchange-dataset |
118,174 | Regular expression for strings not starting with 10 | <p>How can I construct a regular expression for the language over <span class="math-container">$\{0,1\}$</span> which is the complement of the language represented by the regular expression <span class="math-container">$10(0+1)^*$</span>?</p>
 | regular languages regular expressions | 1 | Regular expression for strings not starting with 10 -- (regular languages regular expressions)
<p>How can I construct a regular expression for the language over <span class="math-container">$\{0,1\}$</span> which is the complement of the language represented by the regular expression <span class="math-container">$10(0+... | habedi/stack-exchange-dataset |
118,181 | Creating a Deterministic Push-Down Automaton for the Union of two languages | <blockquote>
 <p>Suppose, we have <span class="math-container">$L_1:=\{w\in\{a,b\}^*\mid \#_a(w) \equiv 0 \mod 4\}$</span> and <span class="math-container">$L_2:=\{w\in\{a,b\}^*\mid abaab \text{ is a substring of } w\}$</span>. Now we want to create a Deterministic Push-Down Automaton for <span class="math-contain... | context free pushdown automata | 1 | Creating a Deterministic Push-Down Automaton for the Union of two languages -- (context free pushdown automata)
<blockquote>
 <p>Suppose, we have <span class="math-container">$L_1:=\{w\in\{a,b\}^*\mid \#_a(w) \equiv 0 \mod 4\}$</span> and <span class="math-container">$L_2:=\{w\in\{a,b\}^*\mid abaab \text{ is a sub... | habedi/stack-exchange-dataset |
118,184 | Knapsack with a fixed number of weights | <p>Consider a special case of the <a href="https://en.wikipedia.org/wiki/Knapsack_problem" rel="nofollow noreferrer">knapsack problem</a> in which all weights are integers, and the number of different weights is fixed. For example, the weight of every item is either 1k or 2k or 4k. There is one unit of each item.</p>&#... | greedy algorithms knapsack problems | 1 | Knapsack with a fixed number of weights -- (greedy algorithms knapsack problems)
<p>Consider a special case of the <a href="https://en.wikipedia.org/wiki/Knapsack_problem" rel="nofollow noreferrer">knapsack problem</a> in which all weights are integers, and the number of different weights is fixed. For example, the wei... | habedi/stack-exchange-dataset |
118,190 | doubt in pipelining | <p>I am not from cse but trying to learn computer architecture on my own. Please clarify the following.</p>

<blockquote>
 <ol>
 <li>In case of pipelining, each stage or subcomponent or subtask is assumed to be done in 1 CPU clock cycle time. Why is it so?</li>
 </ol>
</blockquote>

<... | computer architecture operating systems | 1 | doubt in pipelining -- (computer architecture operating systems)
<p>I am not from cse but trying to learn computer architecture on my own. Please clarify the following.</p>

<blockquote>
 <ol>
 <li>In case of pipelining, each stage or subcomponent or subtask is assumed to be done in 1 CPU clock cycle ... | habedi/stack-exchange-dataset |
118,199 | Why is $T(n)=3T(n/4) + n\log n$ solvable with Master Method but $T(n)=2T(n/2) + n\log n$ is not? | <p>I am having difficulties in understanding why the recurrence</p>

<p><span class="math-container">$$T(n)=3T(n/4) + n\log n$$</span></p>

<p>is solvable with Master Method but </p>

<p><span class="math-container">$$T(n)=2T(n/2) + n\log n$$</span></p>

<p>isn't?</p>

<p>Despite... | algorithm analysis asymptotics runtime analysis recurrence relation | 1 | Why is $T(n)=3T(n/4) + n\log n$ solvable with Master Method but $T(n)=2T(n/2) + n\log n$ is not? -- (algorithm analysis asymptotics runtime analysis recurrence relation)
<p>I am having difficulties in understanding why the recurrence</p>

<p><span class="math-container">$$T(n)=3T(n/4) + n\log n$$</span></p>
... | habedi/stack-exchange-dataset |
118,201 | Algorithm for idempotent algebra | <p>A boolean algebra expression can be converted into an idempotent algebra using
<span class="math-container">$$\bar a \equiv 1-a, \qquad a \vee b \equiv a+b -ab, \qquad a \wedge b \equiv a \otimes b$$</span></p>

<p>where <span class="math-container">$\otimes$</span> is the idempotent product (no powers).... | complexity theory np complete boolean algebra oracles | 1 | Algorithm for idempotent algebra -- (complexity theory np complete boolean algebra oracles)
<p>A boolean algebra expression can be converted into an idempotent algebra using
<span class="math-container">$$\bar a \equiv 1-a, \qquad a \vee b \equiv a+b -ab, \qquad a \wedge b \equiv a \otimes b$$</span></p>

<... | habedi/stack-exchange-dataset |
118,202 | Is checking if the length of a C program that can generate a string is less than a given number decidable? | <p>I was given this question:</p>

<p>Komplexity(S) is the length of the smallest C program that generates the string S as an output. Is the question "Komplexity(S) < K" decidable?</p>

<p>With respect to decidability, I only know about the Halting Problem and just learned about Rice's Theorem while ... | computability undecidability halting problem | 1 | Is checking if the length of a C program that can generate a string is less than a given number decidable? -- (computability undecidability halting problem)
<p>I was given this question:</p>

<p>Komplexity(S) is the length of the smallest C program that generates the string S as an output. Is the question "Komp... | habedi/stack-exchange-dataset |
118,207 | Finding maximal cardinal independent set given oracle | <p>The problem is given an oracle <span class="math-container">$O(G, k)$</span> that would say if graph G contains IS of size k devise an algorithm for finding independent set of max cardinality that makes poly number of calls to the oracle. My attempt has been that first finding the maximal possible size and then try ... | algorithms graphs np search problem | 1 | Finding maximal cardinal independent set given oracle -- (algorithms graphs np search problem)
<p>The problem is given an oracle <span class="math-container">$O(G, k)$</span> that would say if graph G contains IS of size k devise an algorithm for finding independent set of max cardinality that makes poly number of call... | habedi/stack-exchange-dataset |
118,209 | Converting connected graph to disconnected graph by removing minimum vertices | <p>How to find the minimum number of vertices that need to be removed from a graph so it makes a disconnected graph?</p>
 | algorithms graphs | 1 | Converting connected graph to disconnected graph by removing minimum vertices -- (algorithms graphs)
<p>How to find the minimum number of vertices that need to be removed from a graph so it makes a disconnected graph?</p>
 | habedi/stack-exchange-dataset |
118,215 | Convert ambiguous grammar to unambiguous and SLR(1) | <p>I have the following ambiguous operator grammar:</p>

<pre><code>E->E+E*E | E-E*E
E->E+E | E-E | E+E | E*E | E/E
E->(E) | x
</code></pre>

<p>I must convert it to an <strong>unambiguous</strong> one which is also <strong>SLR(1)</strong>. 
The following rules regarding precede... | formal grammars parsers ambiguity | 1 | Convert ambiguous grammar to unambiguous and SLR(1) -- (formal grammars parsers ambiguity)
<p>I have the following ambiguous operator grammar:</p>

<pre><code>E->E+E*E | E-E*E
E->E+E | E-E | E+E | E*E | E/E
E->(E) | x
</code></pre>

<p>I must convert it to an <strong>unambiguous</st... | habedi/stack-exchange-dataset |
118,216 | CTL formula for "for every computation it is always possible to return to the initial state" | <p>In the book 'Principles of Model Checking' by Christel Baier and Joost-Pieter Katoen they state that the CTL formula for " for every computation it is always possible to return to the initial state" as 'AGEF start'. I was wondering whether the formula 'AGF start' would also be a valid one ? Is this correct ?</p>&#x... | computation tree logic | 1 | CTL formula for "for every computation it is always possible to return to the initial state" -- (computation tree logic)
<p>In the book 'Principles of Model Checking' by Christel Baier and Joost-Pieter Katoen they state that the CTL formula for " for every computation it is always possible to return to the initial stat... | habedi/stack-exchange-dataset |
118,225 | Path with least max-weight, in an undirected connected graph | <p>The problem we were given, states that we have graph, where vertices are cities, and edges are roads. Each edge has a weight equal to the kilometers of the corresponding road. We want to get from city <span class="math-container">$A$</span> to city <span class="math-container">$B$</span>, with a car that can last up... | algorithms graphs | 1 | Path with least max-weight, in an undirected connected graph -- (algorithms graphs)
<p>The problem we were given, states that we have graph, where vertices are cities, and edges are roads. Each edge has a weight equal to the kilometers of the corresponding road. We want to get from city <span class="math-container">$A$... | habedi/stack-exchange-dataset |
118,231 | Given a set of sets, what is the largest common intersection between them? | <p>Given a set of sets: <span class="math-container">$S = \{~\{1, 2, 3\}, \{2, 3, 4\}, \{1, 3, 4\}~\}$</span>, I would like to find the largest common subset of <span class="math-container">$S$</span>. If <span class="math-container">$S$</span> does not have a subset across all elements of <span class="math-container">... | algorithms sets | 1 | Given a set of sets, what is the largest common intersection between them? -- (algorithms sets)
<p>Given a set of sets: <span class="math-container">$S = \{~\{1, 2, 3\}, \{2, 3, 4\}, \{1, 3, 4\}~\}$</span>, I would like to find the largest common subset of <span class="math-container">$S$</span>. If <span class="math-c... | habedi/stack-exchange-dataset |
118,232 | How to make single cycle processor pipelined? | <p>I was asked that <em>how can one make a single cycle processor pipelined</em> on a CS course without any specifications regarding the design.</p>

<p>I suppose, that I should answer that what should be changed on architecture level.</p>

<p>I am familiar with the meaning of pipelining.</p>

<... | cpu cpu pipelines | 1 | How to make single cycle processor pipelined? -- (cpu cpu pipelines)
<p>I was asked that <em>how can one make a single cycle processor pipelined</em> on a CS course without any specifications regarding the design.</p>

<p>I suppose, that I should answer that what should be changed on architecture level.</p>
... | habedi/stack-exchange-dataset |
118,242 | Proof that $(L_{all})^C$ is not recursively enumerable | <p><strong>The problem:</strong></p>

<p>We have the language <span class="math-container">$L_{all} = \{\operatorname{Kod}(M) | M \text{ is a turing machine and } L(M) = \Sigma ^*\}$</span></p>

<p>Hence, <span class="math-container">$L_{all}$</span> is the set of all encoded Turing machines (the <span ... | complexity theory turing machines | 1 | Proof that $(L_{all})^C$ is not recursively enumerable -- (complexity theory turing machines)
<p><strong>The problem:</strong></p>

<p>We have the language <span class="math-container">$L_{all} = \{\operatorname{Kod}(M) | M \text{ is a turing machine and } L(M) = \Sigma ^*\}$</span></p>

<p>Hence, <span... | habedi/stack-exchange-dataset |
118,252 | Prove the Droid Trader Problem is NP-complete | <p>This question is from chapter 8, exercise 35, of Algorithm Design by Kleinberg and Tardos.</p>
<blockquote>
<p>A player in the game controls a spaceship and is trying to make money
buying and selling droids on different planets. There are <span class="math-container">$n$</span>
different types of dro... | complexity theory np complete reductions | 1 | Prove the Droid Trader Problem is NP-complete -- (complexity theory np complete reductions)
<p>This question is from chapter 8, exercise 35, of Algorithm Design by Kleinberg and Tardos.</p>
<blockquote>
<p>A player in the game controls a spaceship and is trying to make money
buying and selling droids on dif... | habedi/stack-exchange-dataset |
118,257 | Converting DFA to RE with Arden's Rule | <p>So I've searched around and found the algorithm to do so: <a href="https://cs.stackexchange.com/questions/2016/how-to-convert-finite-automata-to-regular-expressions?newreg=57b7b61a9a734a09b16159449a2476f2">How to convert finite automata to regular expressions?</a> and I decided to test out the second-level response,... | algorithms formal languages finite automata regular expressions | 1 | Converting DFA to RE with Arden's Rule -- (algorithms formal languages finite automata regular expressions)
<p>So I've searched around and found the algorithm to do so: <a href="https://cs.stackexchange.com/questions/2016/how-to-convert-finite-automata-to-regular-expressions?newreg=57b7b61a9a734a09b16159449a2476f2">How... | habedi/stack-exchange-dataset |
118,275 | Does any algorithm loops at some point? | <p>Given that any implementable algorithm has a finite number of internal states, and given that any state is determined by the previous one, does that implies that any algorithm loops at some point?
If I run the algorithm until the number of state transitions is greater than the number of internal states, by the <... | algorithms turing machines finite automata loops | 1 | Does any algorithm loops at some point? -- (algorithms turing machines finite automata loops)
<p>Given that any implementable algorithm has a finite number of internal states, and given that any state is determined by the previous one, does that implies that any algorithm loops at some point?
If I run the algorithm... | habedi/stack-exchange-dataset |
118,277 | Time complexity for calculating the $LPS$ array (failure function) in KMP algorithm preprocessing | <p>I'm studying the Knuth Morris Pratt pattern searching algorithm from <a href="https://www.geeksforgeeks.org/kmp-algorithm-for-pattern-searching/" rel="nofollow noreferrer">here</a>. I want to know the order of computing the <span class="math-container">$lps$</span> array in this algorithm - that is the array of long... | substrings string matching | 1 | Time complexity for calculating the $LPS$ array (failure function) in KMP algorithm preprocessing -- (substrings string matching)
<p>I'm studying the Knuth Morris Pratt pattern searching algorithm from <a href="https://www.geeksforgeeks.org/kmp-algorithm-for-pattern-searching/" rel="nofollow noreferrer">here</a>. I wan... | habedi/stack-exchange-dataset |
118,289 | Voronoi Cell and Voronoi Diagram | <p>Consider a set R of n red points and B of n blue points in the plane. Let x∈R and y∈B be the shortest edge xy. Let P = R ∪ B. Let Vor(P) be the Voronoi diagram of P. Let V(x) be the Voronoi cell of x and V(y) be the Voronoi cell of y. Prove or disprove that V(x) and V(y) share an edge in Vor(P ).</p>

<p>Her... | algorithms computational geometry discrete mathematics voronoi diagrams | 1 | Voronoi Cell and Voronoi Diagram -- (algorithms computational geometry discrete mathematics voronoi diagrams)
<p>Consider a set R of n red points and B of n blue points in the plane. Let x∈R and y∈B be the shortest edge xy. Let P = R ∪ B. Let Vor(P) be the Voronoi diagram of P. Let V(x) be the Voronoi cell of x and V(y... | habedi/stack-exchange-dataset |
118,301 | Smoothed analysis of the Partition problem | <p>I am studying <a href="https://en.wikipedia.org/wiki/Smoothed_analysis" rel="nofollow noreferrer">smoothed analysis</a> and trying to apply it to the Partition decision problem: given <span class="math-container">$n$</span> real numbers with a sum of <span class="math-container">$2 S$</span>, decide whether there ex... | runtime analysis partitions | 1 | Smoothed analysis of the Partition problem -- (runtime analysis partitions)
<p>I am studying <a href="https://en.wikipedia.org/wiki/Smoothed_analysis" rel="nofollow noreferrer">smoothed analysis</a> and trying to apply it to the Partition decision problem: given <span class="math-container">$n$</span> real numbers with... | habedi/stack-exchange-dataset |
118,318 | How to divide an unsorted list in linear time where every element in the first part is smaller than every element in the second list | <p>How to divide an unsorted list into two equal parts in linear time, where every element in the first part is smaller than every element in the second part</p>

<p>I tried to use QuickSort but in can result in <span class="math-container">$O(n^2)$</span> worst-case time complexity.</p>
 | algorithms algorithm analysis data structures time complexity | 1 | How to divide an unsorted list in linear time where every element in the first part is smaller than every element in the second list -- (algorithms algorithm analysis data structures time complexity)
<p>How to divide an unsorted list into two equal parts in linear time, where every element in the first part is smaller ... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.