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
84,638
Lexical analysis and reserved words
<p>My book says lexical analysis detects reserved words.</p>&#xA;&#xA;<p>How can lexical analysis detect whether we are using reserved words in incorrect places ?</p>&#xA;&#xA;<p>For eg :- while(a>0) and int while = 5. </p>&#xA;&#xA;<p>How can lexical anaylsis differentiate the usage of while in both the above examples...
compilers lexical analysis
1
Lexical analysis and reserved words -- (compilers lexical analysis) <p>My book says lexical analysis detects reserved words.</p>&#xA;&#xA;<p>How can lexical analysis detect whether we are using reserved words in incorrect places ?</p>&#xA;&#xA;<p>For eg :- while(a>0) and int while = 5. </p>&#xA;&#xA;<p>How can lexical ...
habedi/stack-exchange-dataset
84,641
Formal names of nested functions
<p>I have a nested function as follow:</p>&#xA;&#xA;<pre><code>def make_adder(n):&#xA; def add(x):&#xA; return x + n&#xA; return add&#xA;&gt;&gt;&gt; plus_3 = make_adder(3)&#xA;&gt;&gt;&gt; plus_5 = make_adder(5)&#xA;&gt;&gt;&gt; plus_3(4) 7&#xA;&gt;&gt;&gt; plus_5(4) 9&#xA;</code></pre>&#xA;&#xA;<p>What's...
terminology reference request programming languages
1
Formal names of nested functions -- (terminology reference request programming languages) <p>I have a nested function as follow:</p>&#xA;&#xA;<pre><code>def make_adder(n):&#xA; def add(x):&#xA; return x + n&#xA; return add&#xA;&gt;&gt;&gt; plus_3 = make_adder(3)&#xA;&gt;&gt;&gt; plus_5 = make_adder(5)&#xA;...
habedi/stack-exchange-dataset
84,642
Some questions regarding an approximation algorithm for Cardinality Maximum Cut Problem in Vazirani's textbook!
<p>In Vazrani's textbook, page 22, the following exercise:</p>&#xA;&#xA;<blockquote>&#xA; <p>2.1 Given a n undirected graph G=(V,E), the cardinality maximum cut problem asks for a partition of V into sets S and G\S so that the number of edges running between these sets is maximized. Consider the following greedy algor...
approximation
1
Some questions regarding an approximation algorithm for Cardinality Maximum Cut Problem in Vazirani's textbook! -- (approximation) <p>In Vazrani's textbook, page 22, the following exercise:</p>&#xA;&#xA;<blockquote>&#xA; <p>2.1 Given a n undirected graph G=(V,E), the cardinality maximum cut problem asks for a partitio...
habedi/stack-exchange-dataset
84,643
How to prove that matrix multiplication of two 2x2 matrices can't be done in less than 7 multiplications?
<p>In Strassen's matrix multiplication, we state one strange ( at least to me) fact that matrix multiplication of two 2 x 2 takes 7 multiplication. </p>&#xA;&#xA;<p><strong>Question :</strong> How to prove that it is impossible to multiply two 2 x 2 matrices in 6 multiplications?</p>&#xA;&#xA;<p>Please note that matric...
algorithms complexity theory lower bounds
1
How to prove that matrix multiplication of two 2x2 matrices can't be done in less than 7 multiplications? -- (algorithms complexity theory lower bounds) <p>In Strassen's matrix multiplication, we state one strange ( at least to me) fact that matrix multiplication of two 2 x 2 takes 7 multiplication. </p>&#xA;&#xA;<p><s...
habedi/stack-exchange-dataset
84,649
Element wise product sum of two arrays
<p>I have two arrays, namely $a$ and $b$. Both have the same length $n$. I have to find the maximum value of $\sum a_i b_j$, in which every element can be used at most one time. My algorithm for solving this problem is:</p>&#xA;&#xA;<ol>&#xA;<li>Sort both $a$ and $b$ in non increasing order.</li>&#xA;<li>Pick the value...
optimization proof techniques correctness proof greedy algorithms
1
Element wise product sum of two arrays -- (optimization proof techniques correctness proof greedy algorithms) <p>I have two arrays, namely $a$ and $b$. Both have the same length $n$. I have to find the maximum value of $\sum a_i b_j$, in which every element can be used at most one time. My algorithm for solving this pr...
habedi/stack-exchange-dataset
84,657
Confusion about Definition of DPDA and $\epsilon$-move
<p><a href="https://i.stack.imgur.com/BwHgn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BwHgn.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>The DPDA definition is from sipser's book, and it mentions that the following PDA can convert to DPDA.</p>&#xA;&#xA;<p><a href="https://i.stac...
automata pushdown automata
1
Confusion about Definition of DPDA and $\epsilon$-move -- (automata pushdown automata) <p><a href="https://i.stack.imgur.com/BwHgn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BwHgn.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>The DPDA definition is from sipser's book, and it menti...
habedi/stack-exchange-dataset
84,668
How to explain/understand brackets of applicative functor [[f u1... un]]?
<p>I am reading article about Applicative Abstract Categorial Grammars <a href="http://okmij.org/ftp/gengo/applicative-symantics/AACG.pdf" rel="nofollow noreferrer">http://okmij.org/ftp/gengo/applicative-symantics/AACG.pdf</a> and this article uses brackets [[...]] for action on terms inside applicative functors. These...
formal grammars lambda calculus functional programming category theory haskell
1
How to explain/understand brackets of applicative functor [[f u1... un]]? -- (formal grammars lambda calculus functional programming category theory haskell) <p>I am reading article about Applicative Abstract Categorial Grammars <a href="http://okmij.org/ftp/gengo/applicative-symantics/AACG.pdf" rel="nofollow noreferre...
habedi/stack-exchange-dataset
84,669
Pumping lemma with multiple of prime number + a constant
<p>Given the language&#xA;$$L = \big\{ 0^{m} 1 0^{2m+k} \mid m \text{ prime and } k \ge 1 \big\} $$&#xA;show that $L$ is not context free by giving a counterexample of the <a href="https://en.wikipedia.org/wiki/Pumping_lemma_for_context-free_languages" rel="nofollow noreferrer">context free pumping lemma</a>. It may be...
formal languages pumping lemma
1
Pumping lemma with multiple of prime number + a constant -- (formal languages pumping lemma) <p>Given the language&#xA;$$L = \big\{ 0^{m} 1 0^{2m+k} \mid m \text{ prime and } k \ge 1 \big\} $$&#xA;show that $L$ is not context free by giving a counterexample of the <a href="https://en.wikipedia.org/wiki/Pumping_lemma_fo...
habedi/stack-exchange-dataset
84,673
Why doesn't descriptive complexity theory solve P = NP?
<p>According to the Wikipedia page on <a href="https://en.wikipedia.org/wiki/Descriptive_complexity_theory" rel="nofollow noreferrer">Descriptive complexity theory</a>:</p>&#xA;&#xA;<blockquote>&#xA; <p>In the presence of linear order, first-order logic with a least fixed point operator gives P, the problems solvable ...
complexity theory p vs np descriptive complexity
1
Why doesn't descriptive complexity theory solve P = NP? -- (complexity theory p vs np descriptive complexity) <p>According to the Wikipedia page on <a href="https://en.wikipedia.org/wiki/Descriptive_complexity_theory" rel="nofollow noreferrer">Descriptive complexity theory</a>:</p>&#xA;&#xA;<blockquote>&#xA; <p>In the...
habedi/stack-exchange-dataset
84,679
Algorithm Question: Stacking bricks of different colours?
<p>I have a bunch of coloured bricks. There are X different colours, and a random number of each colour. How do I stack them up into Y columns so that a) no row has two bricks of the same colour and b) the height of the <em>largest</em> column is minimised?</p>&#xA;&#xA;<p>There is an obvious lower bound of highest num...
algorithms optimization
1
Algorithm Question: Stacking bricks of different colours? -- (algorithms optimization) <p>I have a bunch of coloured bricks. There are X different colours, and a random number of each colour. How do I stack them up into Y columns so that a) no row has two bricks of the same colour and b) the height of the <em>largest</...
habedi/stack-exchange-dataset
84,683
Is there really a $ O(1/n) $ algorithm?
<p>What kind of algorithm can have $O(1/n)$ complexity, where $n$ is a natural number?</p>&#xA;&#xA;<p>Or, is there any algorithm that the time it takes decreases when the data input increases?</p>&#xA;
algorithms algorithm analysis runtime analysis
1
Is there really a $ O(1/n) $ algorithm? -- (algorithms algorithm analysis runtime analysis) <p>What kind of algorithm can have $O(1/n)$ complexity, where $n$ is a natural number?</p>&#xA;&#xA;<p>Or, is there any algorithm that the time it takes decreases when the data input increases?</p>&#xA;
habedi/stack-exchange-dataset
84,686
Expected Linear time Minimum Spanning Tree algorithm
<p>I am trying to understand the proposed "Randomized Linear-Time Algorithm to Find MST".</p>&#xA;&#xA;<p>My findings:&#xA;I have read and search almost every available resource( <a href="http://cs.brown.edu/research/pubs/pdfs/1995/Karger-1995-RLT.pdf" rel="nofollow noreferrer">main paper</a>, <a href="https://en.wikip...
randomness minimum spanning tree
1
Expected Linear time Minimum Spanning Tree algorithm -- (randomness minimum spanning tree) <p>I am trying to understand the proposed "Randomized Linear-Time Algorithm to Find MST".</p>&#xA;&#xA;<p>My findings:&#xA;I have read and search almost every available resource( <a href="http://cs.brown.edu/research/pubs/pdfs/19...
habedi/stack-exchange-dataset
84,688
An infinite decidable language that is a subset of $\overline { A_{TM}}$
<p>What is an example of an <strong>infinite decidable</strong> language $L$, such that $L \subseteq \overline { A_{TM}}$ (which is known to be not Turing Recognizable)?</p>&#xA;&#xA;<p><em>And of coures some evidence that L is indeed decidable and a subet as required</em></p>&#xA;
computability turing machines undecidability
1
An infinite decidable language that is a subset of $\overline { A_{TM}}$ -- (computability turing machines undecidability) <p>What is an example of an <strong>infinite decidable</strong> language $L$, such that $L \subseteq \overline { A_{TM}}$ (which is known to be not Turing Recognizable)?</p>&#xA;&#xA;<p><em>And of ...
habedi/stack-exchange-dataset
84,694
Remove duplicates of first elements of pairs
<p>A list of pairs is given using Python. I want to remove duplicate occurrences of the first element of the pair leaving only one occurrence of each first element paired with the highest second element it comes with. I am looking for an efficient solution that returns the pairs sorted.</p>&#xA;&#xA;<pre><code>&gt;&gt;...
algorithms lists
1
Remove duplicates of first elements of pairs -- (algorithms lists) <p>A list of pairs is given using Python. I want to remove duplicate occurrences of the first element of the pair leaving only one occurrence of each first element paired with the highest second element it comes with. I am looking for an efficient solut...
habedi/stack-exchange-dataset
84,697
Which "entity" is working at more deeper level than Characters of a program?
<p>It is commonly told that, while we write a program, we input with our language (A, B, C, D etc), whom computer translates into machine language into machine language made up of Zero (0) or switch off and One (1) or switch on, a.k.a. ASCII code. </p>&#xA;&#xA;<p>Letter ... ASCII Code .... Binary</p>&#xA;&#xA;<p>A ....
programming languages software engineering user interface
1
Which "entity" is working at more deeper level than Characters of a program? -- (programming languages software engineering user interface) <p>It is commonly told that, while we write a program, we input with our language (A, B, C, D etc), whom computer translates into machine language into machine language made up of ...
habedi/stack-exchange-dataset
84,712
Konig's Theorem for Min Weight Vertex Cover?
<p>Koning's theorem states that the cardinality of the maximum matching in a bipartite graph is equal to the size of its minimum vertex cover.</p>&#xA;&#xA;<p><a href="https://en.wikipedia.org/wiki/K%C5%91nig%27s_theorem_(graph_theory)" rel="noreferrer">Wikipedia</a> states that there is an equivalent version of the th...
weighted graphs bipartite matching
1
Konig's Theorem for Min Weight Vertex Cover? -- (weighted graphs bipartite matching) <p>Koning's theorem states that the cardinality of the maximum matching in a bipartite graph is equal to the size of its minimum vertex cover.</p>&#xA;&#xA;<p><a href="https://en.wikipedia.org/wiki/K%C5%91nig%27s_theorem_(graph_theory)...
habedi/stack-exchange-dataset
84,713
Construct an equivalent NFA for the given regular grammar
<blockquote>&#xA; <p>Given is the regular grammar <code>G = ({A,B}, {a,b}, P, A)</code> with the rules</p>&#xA;&#xA;<pre><code>P : A → aB, a, ε (where ε is the empty word)&#xA; B → bA, b&#xA;</code></pre>&#xA; &#xA; <p>For this regular grammar, create an equivalent NFA.</p>&#xA;</blockquote>&#xA;&#xA;<p>A regular...
formal languages regular languages automata finite automata formal grammars
1
Construct an equivalent NFA for the given regular grammar -- (formal languages regular languages automata finite automata formal grammars) <blockquote>&#xA; <p>Given is the regular grammar <code>G = ({A,B}, {a,b}, P, A)</code> with the rules</p>&#xA;&#xA;<pre><code>P : A → aB, a, ε (where ε is the empty word)&#xA; ...
habedi/stack-exchange-dataset
84,721
Y combinator, function composition
<p>I am trying to understand Y combinators. Could you please explain why the following are equivalent</p>&#xA;&#xA;<pre><code>(Y (f ∘ g)) &#xA;(f (Y (g ∘ f)))&#xA;</code></pre>&#xA;&#xA;<p>(Y is a fixed point combination)</p>&#xA;
lambda calculus functional programming combinatory logic
1
Y combinator, function composition -- (lambda calculus functional programming combinatory logic) <p>I am trying to understand Y combinators. Could you please explain why the following are equivalent</p>&#xA;&#xA;<pre><code>(Y (f ∘ g)) &#xA;(f (Y (g ∘ f)))&#xA;</code></pre>&#xA;&#xA;<p>(Y is a fixed point combination)...
habedi/stack-exchange-dataset
84,723
Why don't we use quick sort on a linked list?
<p>Quick sort algorithm can be divided into following steps</p>&#xA;&#xA;<ol>&#xA;<li><p>Identify pivot.</p></li>&#xA;<li><p>Partition the linked list based on pivot.</p></li>&#xA;<li><p>Divide the linked list recursively into 2 parts.</p></li>&#xA;</ol>&#xA;&#xA;<p>Now, if I always choose last element as pivot, then i...
algorithms algorithm analysis sorting quicksort
1
Why don't we use quick sort on a linked list? -- (algorithms algorithm analysis sorting quicksort) <p>Quick sort algorithm can be divided into following steps</p>&#xA;&#xA;<ol>&#xA;<li><p>Identify pivot.</p></li>&#xA;<li><p>Partition the linked list based on pivot.</p></li>&#xA;<li><p>Divide the linked list recursively...
habedi/stack-exchange-dataset
84,733
Closure of a CFL under specific operation
<p>Consider the following operation on language <span class="math-container">$L$</span>:</p>&#xA;<p><span class="math-container">$\mathrm{inv}(L) = \{ xy^Rz \mid x,y,z\in \Sigma^*, xyz\in L \}$</span></p>&#xA;<p>I understand that if <span class="math-container">$L$</span> is regular, then <span class="math-container">$...
context free computation models closure properties pushdown automata nondeterminism
1
Closure of a CFL under specific operation -- (context free computation models closure properties pushdown automata nondeterminism) <p>Consider the following operation on language <span class="math-container">$L$</span>:</p>&#xA;<p><span class="math-container">$\mathrm{inv}(L) = \{ xy^Rz \mid x,y,z\in \Sigma^*, xyz\in L...
habedi/stack-exchange-dataset
84,743
For a cycle with $n$ vertices, how many distinct chords are possible?
<p><em>Note:</em> This is almost certainly an elementary problem with a well known solution. Therefore pointers to existing references will be accepted as good answers.</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Question:</strong> Given a cycle with exactly $n$ vertices, how many distinct <a href="https://en.wikipedia....
graphs combinatorics
1
For a cycle with $n$ vertices, how many distinct chords are possible? -- (graphs combinatorics) <p><em>Note:</em> This is almost certainly an elementary problem with a well known solution. Therefore pointers to existing references will be accepted as good answers.</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Question:</s...
habedi/stack-exchange-dataset
84,744
Whether the algorithm is polynomial or not with input size which is not polynomial
<blockquote>&#xA; <p>A problem may require memory space which is not polynomial with respect to the input size but may still have polynomial run time.</p>&#xA;</blockquote>&#xA;&#xA;<p>Is this true or false? and why? any idea? </p>&#xA;
algorithms polynomial time pseudo polynomial
1
Whether the algorithm is polynomial or not with input size which is not polynomial -- (algorithms polynomial time pseudo polynomial) <blockquote>&#xA; <p>A problem may require memory space which is not polynomial with respect to the input size but may still have polynomial run time.</p>&#xA;</blockquote>&#xA;&#xA;<p>I...
habedi/stack-exchange-dataset
84,746
Whether the 2 minimum spanning tree of same graph contains the lowest edges in common?
<blockquote>&#xA; <p>If two minimum spanning trees on the same graph only have 2 edges in common, then those two edges must be the lowest costs edges in the graph.</p>&#xA;</blockquote>&#xA;&#xA;<p>True/false? and why?</p>&#xA;&#xA;<p>Because according to me if there is a only edge which connects 2 subgraphs then that...
minimum spanning tree
1
Whether the 2 minimum spanning tree of same graph contains the lowest edges in common? -- (minimum spanning tree) <blockquote>&#xA; <p>If two minimum spanning trees on the same graph only have 2 edges in common, then those two edges must be the lowest costs edges in the graph.</p>&#xA;</blockquote>&#xA;&#xA;<p>True/fa...
habedi/stack-exchange-dataset
84,755
Stable matching problem is greedy or Dynamic?
<p>Is the stable matching problem greedy or Dynamic ? Please anyone can give a strong explanation as i tried to find it on the net but it isn't available.</p>&#xA;
dynamic programming greedy algorithms matching
1
Stable matching problem is greedy or Dynamic? -- (dynamic programming greedy algorithms matching) <p>Is the stable matching problem greedy or Dynamic ? Please anyone can give a strong explanation as i tried to find it on the net but it isn't available.</p>&#xA;
habedi/stack-exchange-dataset
84,777
What is the meaning of a prefix-free language?
<p>Tried a bunch of resources to read about it, still don't really get it.</p>&#xA;&#xA;<p>This is what Wikipedia says</p>&#xA;&#xA;<blockquote>&#xA; <p>A prefix code is a type of code system (typically a variable-length code) distinguished by its possession of the "prefix property", which requires that there is no wh...
regular languages
1
What is the meaning of a prefix-free language? -- (regular languages) <p>Tried a bunch of resources to read about it, still don't really get it.</p>&#xA;&#xA;<p>This is what Wikipedia says</p>&#xA;&#xA;<blockquote>&#xA; <p>A prefix code is a type of code system (typically a variable-length code) distinguished by its p...
habedi/stack-exchange-dataset
84,779
On $UP$, $NP$, $\oplus P$ and $PP$?
<p>We know $UP\subseteq NP\subseteq PP$.</p>&#xA;&#xA;<blockquote>&#xA; <p>Is $UP^{\oplus P}\subseteq NP^{\oplus P}\subseteq PP^{\oplus P}$?</p>&#xA;</blockquote>&#xA;&#xA;<p>I think the first $UP^{\oplus P}\subseteq NP^{\oplus P}$ is straightforward since whatever queries an $UP$ machine can do we know an $NP$ machin...
complexity theory reference request complexity classes nondeterminism oracle machines
1
On $UP$, $NP$, $\oplus P$ and $PP$? -- (complexity theory reference request complexity classes nondeterminism oracle machines) <p>We know $UP\subseteq NP\subseteq PP$.</p>&#xA;&#xA;<blockquote>&#xA; <p>Is $UP^{\oplus P}\subseteq NP^{\oplus P}\subseteq PP^{\oplus P}$?</p>&#xA;</blockquote>&#xA;&#xA;<p>I think the first...
habedi/stack-exchange-dataset
84,792
is it possible to do a DFA for these languages?
<p>I have just started learning Automata Theory, so far I only know about regular languages, FSM (NFAs and DFAs) and regular grammars, but I come across a question like this:</p>&#xA;&#xA;<p>"Given the next languages, design their respective DFAs"</p>&#xA;&#xA;<p>$L := \{a^nb^m |\ n&gt;m\ ∧ n-m = odd\}$</p>&#xA;&#xA;<p...
regular languages pumping lemma
1
is it possible to do a DFA for these languages? -- (regular languages pumping lemma) <p>I have just started learning Automata Theory, so far I only know about regular languages, FSM (NFAs and DFAs) and regular grammars, but I come across a question like this:</p>&#xA;&#xA;<p>"Given the next languages, design their resp...
habedi/stack-exchange-dataset
84,795
For each $i$, find minimal $j>i$ such that $A[j]>A[i]$
<p>I have the following problem:</p>&#xA;<blockquote>&#xA;<p>Given an array <span class="math-container">$A$</span>, I need to construct an array <span class="math-container">$B$</span> such that <span class="math-container">$B[i]$</span> is the minimum <span class="math-container">$j&gt;i$</span> such that <span class...
algorithms time complexity arrays
1
For each $i$, find minimal $j>i$ such that $A[j]>A[i]$ -- (algorithms time complexity arrays) <p>I have the following problem:</p>&#xA;<blockquote>&#xA;<p>Given an array <span class="math-container">$A$</span>, I need to construct an array <span class="math-container">$B$</span> such that <span class="math-container">$...
habedi/stack-exchange-dataset
84,799
How does SETH implies ETH?
<p>I know that ETH states that 3-SAT is not solvable in $2^{o(n)}$ time, the best known bound for 3-SAT is around $O(2^{.38n})$. Whereas, SETH states that there is no universal $\delta$ such that for every positive integer $k$, a $k$-SAT problem is solvable in $O(2^{\delta n})$ time.</p>&#xA;&#xA;<p>It is not clear to ...
complexity theory time complexity
1
How does SETH implies ETH? -- (complexity theory time complexity) <p>I know that ETH states that 3-SAT is not solvable in $2^{o(n)}$ time, the best known bound for 3-SAT is around $O(2^{.38n})$. Whereas, SETH states that there is no universal $\delta$ such that for every positive integer $k$, a $k$-SAT problem is solva...
habedi/stack-exchange-dataset
84,800
Is there an polynomial time algorithm to find that sum of square-roots is less than an integer?
<p><strong>Given:</strong> A list of $n$ integers $x_1,x_2,\dots,x_n$ and an integer $k$.</p>&#xA;&#xA;<p><strong>Determine:</strong> Is $\sqrt x_1 + \sqrt x_2 \cdots \sqrt x_n \le k$?</p>&#xA;&#xA;<p><strong>Question:</strong> Is there any polynomial time algorithm for the above problem? If yes, give an algorithm; oth...
algorithms complexity theory time complexity
1
Is there an polynomial time algorithm to find that sum of square-roots is less than an integer? -- (algorithms complexity theory time complexity) <p><strong>Given:</strong> A list of $n$ integers $x_1,x_2,\dots,x_n$ and an integer $k$.</p>&#xA;&#xA;<p><strong>Determine:</strong> Is $\sqrt x_1 + \sqrt x_2 \cdots \sqrt x...
habedi/stack-exchange-dataset
84,807
Prove correctness of this (context-free) grammar
<p>I created a context free grammar for the language which has words where twice as many <code>a</code> than <code>b</code> occur.</p>&#xA;&#xA;<p>So as example, the language would accept the words <code>baaaab</code> and <code>bbbaaaaaa</code>, <code>aab</code>, etc.</p>&#xA;&#xA;<p>The context free grammar is</p>&#xA...
regular languages automata context free formal grammars
1
Prove correctness of this (context-free) grammar -- (regular languages automata context free formal grammars) <p>I created a context free grammar for the language which has words where twice as many <code>a</code> than <code>b</code> occur.</p>&#xA;&#xA;<p>So as example, the language would accept the words <code>baaaab...
habedi/stack-exchange-dataset
84,813
Infinite union of regular language
<p>Deciding if the infinite union of a set of regular languages is regular is undecidable.</p>&#xA;&#xA;<p>By closure property of regular languages, regular language is not closed under infinite union so is the above problem undecidable?</p>&#xA;
computability regular languages
1
Infinite union of regular language -- (computability regular languages) <p>Deciding if the infinite union of a set of regular languages is regular is undecidable.</p>&#xA;&#xA;<p>By closure property of regular languages, regular language is not closed under infinite union so is the above problem undecidable?</p>&#xA;
habedi/stack-exchange-dataset
84,824
Find Length of longest substring with all 1's in a binary string with k queries
<p>Given a string of size n consisting of 0s and/or 1s.you have to perform <strong>k</strong> queries and there are <strong>two</strong> types of queries possible.</p>&#xA;&#xA;<ol>&#xA;<li>"1"(without quotes): Print length of the longest substring with all '1'.</li>&#xA;<li>"2 X"(without quotes): where X is an Integer...
algorithms complexity theory data structures time complexity c++
1
Find Length of longest substring with all 1's in a binary string with k queries -- (algorithms complexity theory data structures time complexity c++) <p>Given a string of size n consisting of 0s and/or 1s.you have to perform <strong>k</strong> queries and there are <strong>two</strong> types of queries possible.</p>&#x...
habedi/stack-exchange-dataset
84,838
Reduction of graph chromatic number to hypergraph 2-colorability
<p>I'm following this paper titled "Coverings and colorings of hypergraphs" by Lovasz 1973, which is referenced in Garey and Johnson's Computers and Intractability, for the Set Splitting Problem. In this paper, the author tries to reduce graph chromatic number to hypergraph 2-colorability (same as set splitting). </p>&...
complexity theory graphs np complete
1
Reduction of graph chromatic number to hypergraph 2-colorability -- (complexity theory graphs np complete) <p>I'm following this paper titled "Coverings and colorings of hypergraphs" by Lovasz 1973, which is referenced in Garey and Johnson's Computers and Intractability, for the Set Splitting Problem. In this paper, th...
habedi/stack-exchange-dataset
84,840
Predicate calculus- meaning of the word "any"
<p>In the following 2 statements -</p>&#xA;&#xA;<pre><code>1. Anyone who eats any pumpkin is a nutrition fanatic. &#xA;&amp;forall x ((&amp;exist y (PUMPKIN(y) &amp;and EAT(x,y))) &amp;rarr FANATIC(x))&#xA;&#xA;2. Anyone who buys any pumpkin either carves it or eats it. &#xA;&amp;forall x &amp;forall y (PUMPKIN(y) &amp...
first order logic
1
Predicate calculus- meaning of the word "any" -- (first order logic) <p>In the following 2 statements -</p>&#xA;&#xA;<pre><code>1. Anyone who eats any pumpkin is a nutrition fanatic. &#xA;&amp;forall x ((&amp;exist y (PUMPKIN(y) &amp;and EAT(x,y))) &amp;rarr FANATIC(x))&#xA;&#xA;2. Anyone who buys any pumpkin either ca...
habedi/stack-exchange-dataset
84,856
What is the exact algorithm to find maximum clique of a given unit disk graph?
<p>A unit disk graph is an intersection graph $G = (V,E)$, such that given $n$ disks on the plane with identical radius. Each disk $d_u$ corresponds to a vertex $u \in V$, and there is an edge $uv \in E$ if, and only if $d_u$ and $d_v$ intersects.</p>&#xA;&#xA;<p>In 1990, <a href="https://www.sciencedirect.com/science/...
graphs computational geometry clique
1
What is the exact algorithm to find maximum clique of a given unit disk graph? -- (graphs computational geometry clique) <p>A unit disk graph is an intersection graph $G = (V,E)$, such that given $n$ disks on the plane with identical radius. Each disk $d_u$ corresponds to a vertex $u \in V$, and there is an edge $uv \i...
habedi/stack-exchange-dataset
84,860
If the virtual address space can be larger than the physical address space, how are the address mappings stored in memory?
<p>Let's say we are working with a system that has 40 physical address bits. The total physical address space (assuming byte-addressable memory) is $2^{40}$ bytes, or 1 TiB. And if virtual addresses are 48 bits in length, that means there are more addresses available to virtual memory than there are locations in physic...
memory management virtual memory memory access
1
If the virtual address space can be larger than the physical address space, how are the address mappings stored in memory? -- (memory management virtual memory memory access) <p>Let's say we are working with a system that has 40 physical address bits. The total physical address space (assuming byte-addressable memory) ...
habedi/stack-exchange-dataset
84,869
Prove that an infinite set is semidecidible
<p>I have been asked to prove that: </p>&#xA;&#xA;<p>Being <em>C</em> an infinite set. Prove that <em>C</em> is semidecidable if and only if exists a total computable function that is injective and whose image is <em>C</em>.</p>&#xA;&#xA;<p>I've read the wikipedia articles of <a href="https://en.wikipedia.org/wiki/Comp...
turing machines semi decidability
1
Prove that an infinite set is semidecidible -- (turing machines semi decidability) <p>I have been asked to prove that: </p>&#xA;&#xA;<p>Being <em>C</em> an infinite set. Prove that <em>C</em> is semidecidable if and only if exists a total computable function that is injective and whose image is <em>C</em>.</p>&#xA;&#xA...
habedi/stack-exchange-dataset
84,880
Why the $\textbf{PCP}(\log n, 1)$ construction of completeness $c$ and soundness $s$ for an $NP$ language $L$ implies $s/c$ inapproximability for $L$?
<p>In the introductory chapter of $\textbf{PCP}$ in Arora and Barak, I read the proof that why a $\textbf{PCP}(\log n, 1)$ of completeness 1 and soundness 1/2 for an $NPC$ language $L$ will imply that there exists a $\rho$ for which $\rho$-approximation algorithm for MAX-3-SAT does not exist unless $P = NP$. But in the...
complexity theory
1
Why the $\textbf{PCP}(\log n, 1)$ construction of completeness $c$ and soundness $s$ for an $NP$ language $L$ implies $s/c$ inapproximability for $L$? -- (complexity theory) <p>In the introductory chapter of $\textbf{PCP}$ in Arora and Barak, I read the proof that why a $\textbf{PCP}(\log n, 1)$ of completeness 1 and s...
habedi/stack-exchange-dataset
84,892
Hardness of checking maximal magnitude of a sum of a subset of vectors
<p>The problem I wish to solve is the following:</p>&#xA;&#xA;<p>Given a set $V \subset \mathbb{Z}^2$ find the set $S \subset V$ such that $|\sum_{v \in S} v|$ is maximal.</p>&#xA;&#xA;<p>By simply enumerating subsets we can solve this problem in $O(2^n)$. This problem feels a lot like the euclidian traveling salesmen ...
algorithms complexity theory np hard np
1
Hardness of checking maximal magnitude of a sum of a subset of vectors -- (algorithms complexity theory np hard np) <p>The problem I wish to solve is the following:</p>&#xA;&#xA;<p>Given a set $V \subset \mathbb{Z}^2$ find the set $S \subset V$ such that $|\sum_{v \in S} v|$ is maximal.</p>&#xA;&#xA;<p>By simply enumer...
habedi/stack-exchange-dataset
84,896
How to find a regular expression
<p>I know how to find a regular expression when given a FA. But how do I find a regular expression given just a language and its rules?</p>&#xA;&#xA;<p>For example, for the language $L \subset \{ a,b\}^* $ which accepts all words that contain exactly one $aa$. How do I find a regular expression in this case?</p>&#xA;&#...
regular languages automata finite automata regular expressions
1
How to find a regular expression -- (regular languages automata finite automata regular expressions) <p>I know how to find a regular expression when given a FA. But how do I find a regular expression given just a language and its rules?</p>&#xA;&#xA;<p>For example, for the language $L \subset \{ a,b\}^* $ which accepts...
habedi/stack-exchange-dataset
84,897
NP-hardness of existence of spanning tree with given maximal degree
<p>I am trying to solve the following exercise:</p>&#xA;<blockquote>&#xA;<p>Let <span class="math-container">$G = (V,E)$</span> be a graph. Show that the following two problems are NP-hard:</p>&#xA;<ol>&#xA;<li><p><span class="math-container">$G$</span> has a spanning tree where every node has at most <span class="math...
graphs np hard minimum spanning tree
1
NP-hardness of existence of spanning tree with given maximal degree -- (graphs np hard minimum spanning tree) <p>I am trying to solve the following exercise:</p>&#xA;<blockquote>&#xA;<p>Let <span class="math-container">$G = (V,E)$</span> be a graph. Show that the following two problems are NP-hard:</p>&#xA;<ol>&#xA;<li...
habedi/stack-exchange-dataset
84,899
Max() in Domain Relational Calculus
<p>I was looking through my notes on domain relational calculus, and noticed an interesting result in a question about finding the <em>most expensive</em> pizza(s), given a pizza table with schema $\text{pizza}(\underline{id}, size)$. The first idea that came to me was: </p>&#xA;&#xA;<p>$$\{id1\ |\ \exists size1, \fora...
logic database theory first order logic relational algebra
1
Max() in Domain Relational Calculus -- (logic database theory first order logic relational algebra) <p>I was looking through my notes on domain relational calculus, and noticed an interesting result in a question about finding the <em>most expensive</em> pizza(s), given a pizza table with schema $\text{pizza}(\underlin...
habedi/stack-exchange-dataset
84,903
How can the intersection of CFLs and REGs be CFL if REG is a proper subset of CFL?
<p>Intersection of CFL and regular is always CFL. But according to Chomsky hierarchy diagram, regular languages lie <strong>completely inside CFL</strong>. So, as regular set is completely inside CFL set, their intersection should be regular right ? </p>&#xA;&#xA;<p>Am I interpreting Chomsky diagram wrongly ?</p>&#xA;
formal languages regular languages context free chomsky hierarchy
1
How can the intersection of CFLs and REGs be CFL if REG is a proper subset of CFL? -- (formal languages regular languages context free chomsky hierarchy) <p>Intersection of CFL and regular is always CFL. But according to Chomsky hierarchy diagram, regular languages lie <strong>completely inside CFL</strong>. So, as re...
habedi/stack-exchange-dataset
84,915
4-digit 5's complement of a negative number
<p>Let $n = -13, \ k = -24$</p>&#xA;&#xA;<p>How do I find the 4-digit 5's complement of each number? What would be the result of $n + k$ in complement representation?</p>&#xA;&#xA;<p>I understand how to calculate $n$-digit, 2's complement. I convert it to base 2, invert and add one.</p>&#xA;&#xA;<p>Also, with positive ...
base conversion numeral representations
1
4-digit 5's complement of a negative number -- (base conversion numeral representations) <p>Let $n = -13, \ k = -24$</p>&#xA;&#xA;<p>How do I find the 4-digit 5's complement of each number? What would be the result of $n + k$ in complement representation?</p>&#xA;&#xA;<p>I understand how to calculate $n$-digit, 2's com...
habedi/stack-exchange-dataset
84,916
Existence of Real-Time Multiprocessor Schedule
<p>Does an algorithm exist to check for the existence of a Real-Time Multiprocessor Schedule for aperiodic hard tasks(all of which have the same Release time)?</p>&#xA;&#xA;<p>Assumptions:</p>&#xA;&#xA;<ul>&#xA;<li>The processors are Uniform parallel machines</li>&#xA;<li>Job preemption is permitted</li>&#xA;<li>Job mi...
algorithms operating systems scheduling process scheduling
1
Existence of Real-Time Multiprocessor Schedule -- (algorithms operating systems scheduling process scheduling) <p>Does an algorithm exist to check for the existence of a Real-Time Multiprocessor Schedule for aperiodic hard tasks(all of which have the same Release time)?</p>&#xA;&#xA;<p>Assumptions:</p>&#xA;&#xA;<ul>&#x...
habedi/stack-exchange-dataset
84,920
Mother vertex of a graph
<p>I am trying to find all mother vertex in a directed graph. </p>&#xA;&#xA;<p>A mother vertex in a directed graph G = (V,E) is a vertex v such that all other vertices in G can be reached by a path from v.</p>&#xA;&#xA;<p>My Approach:</p>&#xA;&#xA;<p>Do DFS on each vertex and check if all the vertex are reached on each...
algorithms graphs graph traversal
1
Mother vertex of a graph -- (algorithms graphs graph traversal) <p>I am trying to find all mother vertex in a directed graph. </p>&#xA;&#xA;<p>A mother vertex in a directed graph G = (V,E) is a vertex v such that all other vertices in G can be reached by a path from v.</p>&#xA;&#xA;<p>My Approach:</p>&#xA;&#xA;<p>Do DF...
habedi/stack-exchange-dataset
84,928
Tokenization Problem
<p>Yes, this is a quiz question. It's from a self-paced course, but the answer just isn't correct to me no matter how I look at it. There isn't really an active community to consult. </p>&#xA;&#xA;<p>My Regular Expression experience is profoundly in JavaScript and I'm concerned that it poisoned my thinking of Regular E...
regular languages regular expressions compilers parsers
1
Tokenization Problem -- (regular languages regular expressions compilers parsers) <p>Yes, this is a quiz question. It's from a self-paced course, but the answer just isn't correct to me no matter how I look at it. There isn't really an active community to consult. </p>&#xA;&#xA;<p>My Regular Expression experience is pr...
habedi/stack-exchange-dataset
84,930
When represented as a function, why is the input of a decision problem a natural number?
<p>Our professor explained that all programs can be thought of as the set of natural numbers, while decision problems can be thought of as the set or rational numbers. </p>&#xA;&#xA;<p>Our notes say a decision problem can be represented as a function which takes a natural number as input and maps it to either 0 or 1.&#...
complexity theory
1
When represented as a function, why is the input of a decision problem a natural number? -- (complexity theory) <p>Our professor explained that all programs can be thought of as the set of natural numbers, while decision problems can be thought of as the set or rational numbers. </p>&#xA;&#xA;<p>Our notes say a decisio...
habedi/stack-exchange-dataset
84,938
Virtual Memory - Non-contiguous Memory Allocation
<p>I'm studying for my operating systems final, and one question that my professor asked that I can't seem to find the answer to is the following:</p>&#xA;&#xA;<p>"Why does virtual memory use non-contiguous memory allocation?"</p>&#xA;&#xA;<p>The textbook only talks about virtual memory in the context of non-contiguous...
operating systems memory management virtual memory
1
Virtual Memory - Non-contiguous Memory Allocation -- (operating systems memory management virtual memory) <p>I'm studying for my operating systems final, and one question that my professor asked that I can't seem to find the answer to is the following:</p>&#xA;&#xA;<p>"Why does virtual memory use non-contiguous memory ...
habedi/stack-exchange-dataset
84,945
The bounded halting problem is decidable. Why doesn't this conflict with Rice's theorem?
<p>One statement of Rice's theorem is given on page 35 of "Computational Complexity: a Modern Approach" (Arora-Barak):</p>&#xA;&#xA;<p>A partial function from $\{0,1\}^*$ to $\{0,1\}^*$ is a function that is not necessarily defined on all its inputs. We say that a TM $M$ computes a partial function $f$ if for every $x$...
computability turing machines undecidability rice theorem
1
The bounded halting problem is decidable. Why doesn't this conflict with Rice's theorem? -- (computability turing machines undecidability rice theorem) <p>One statement of Rice's theorem is given on page 35 of "Computational Complexity: a Modern Approach" (Arora-Barak):</p>&#xA;&#xA;<p>A partial function from $\{0,1\}^...
habedi/stack-exchange-dataset
84,969
Tight bound on the number of intersections between a line and a triangulation
<p>I'm interested in the maximum number of intersections that a line and a triangulation on $n$ points could have. More specifically, given $n$, we are interested in the worst-case (maximum) number of intersections that any line could have with any triangulation on any point set.</p>&#xA;&#xA;<p>There is an upper bound...
computational geometry lower bounds upper bound
1
Tight bound on the number of intersections between a line and a triangulation -- (computational geometry lower bounds upper bound) <p>I'm interested in the maximum number of intersections that a line and a triangulation on $n$ points could have. More specifically, given $n$, we are interested in the worst-case (maximum...
habedi/stack-exchange-dataset
84,970
The difference between compiler and interpreter
<p>I am reading <a href="https://docs.python.org/3.6/library/dis.html" rel="nofollow noreferrer">dis</a>, It reads:</p>&#xA;<blockquote>&#xA;<p>The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/opcode.h a...
programming languages compilers
1
The difference between compiler and interpreter -- (programming languages compilers) <p>I am reading <a href="https://docs.python.org/3.6/library/dis.html" rel="nofollow noreferrer">dis</a>, It reads:</p>&#xA;<blockquote>&#xA;<p>The dis module supports the analysis of CPython bytecode by disassembling it. The CPython b...
habedi/stack-exchange-dataset
84,975
About the 'trick' for finding the diameter of an graph in $O(n^2)$
<p>The diameter of an undirected, unweighted graph can be found in $O(n^3)$ with e.g. the Floyd–Warshall algorithm. However, <a href="https://cs.stackexchange.com/a/213/23092">there is an idea how to improve the runtime</a>:</p>&#xA;&#xA;<ol>&#xA;<li>Pick a vertex $v$</li>&#xA;<li>Find $u$ such that $d(v,u)$ is maximum...
algorithms graphs time complexity graph traversal
1
About the 'trick' for finding the diameter of an graph in $O(n^2)$ -- (algorithms graphs time complexity graph traversal) <p>The diameter of an undirected, unweighted graph can be found in $O(n^3)$ with e.g. the Floyd–Warshall algorithm. However, <a href="https://cs.stackexchange.com/a/213/23092">there is an idea how t...
habedi/stack-exchange-dataset
84,977
A O(n) algorithm for a point set triangulation
<p>I'm currently stuck at the following task:</p>&#xA;&#xA;<p>Consider a point set $S = \{ p_1, p_2, ..., p_n \}$ in the plane in general position (i.e., no three points of $S$ are collinear). The points of $S$ have pairwise different $y$-coordinates and are sorted in increasing order of them, i.e., $y(p_i) &lt; y(p_j)...
algorithms computational geometry
1
A O(n) algorithm for a point set triangulation -- (algorithms computational geometry) <p>I'm currently stuck at the following task:</p>&#xA;&#xA;<p>Consider a point set $S = \{ p_1, p_2, ..., p_n \}$ in the plane in general position (i.e., no three points of $S$ are collinear). The points of $S$ have pairwise different...
habedi/stack-exchange-dataset
84,989
Understanding a boolean expression in λ-calculus
<p><em>(NOTE: This is not a homework question at at all. Rather, this was something that I thought that I understood (at least on the surface), but now appear to have no clue about, and am not currently finding any resources helpful. I know that we typically like to see what people have tried, but I am honestly disco...
lambda calculus term rewriting
1
Understanding a boolean expression in λ-calculus -- (lambda calculus term rewriting) <p><em>(NOTE: This is not a homework question at at all. Rather, this was something that I thought that I understood (at least on the surface), but now appear to have no clue about, and am not currently finding any resources helpful. ...
habedi/stack-exchange-dataset
84,996
Which of the following sequences could not be the sequences of nodes examined in a binary search tree?
<p>Suppose that we have numbers between $1$ and $1000$ in a binary search tree and want to search for the number $363$. Which of the following sequences could not be the sequences of nodes examined</p>&#xA;&#xA;<pre><code>a) 924,220,911,244,898,258,362,363$&#xA;&#xA;b) 925,202,911,240,912,245,363&#xA;&#xA;c) 2,399,387,...
data structures binary search trees
1
Which of the following sequences could not be the sequences of nodes examined in a binary search tree? -- (data structures binary search trees) <p>Suppose that we have numbers between $1$ and $1000$ in a binary search tree and want to search for the number $363$. Which of the following sequences could not be the sequen...
habedi/stack-exchange-dataset
84,998
General term for map/fmap
<p>The general term for folds is a catamorphism. The general term for unfold is an Anamorphism. Is there an equivalent term for map? I know that a map is a type of fold however restriction is significant. Also it would be useful to have an alternative term to use when the word “map” is ambiguous.</p>&#xA;
functional programming
1
General term for map/fmap -- (functional programming) <p>The general term for folds is a catamorphism. The general term for unfold is an Anamorphism. Is there an equivalent term for map? I know that a map is a type of fold however restriction is significant. Also it would be useful to have an alternative term to use ...
habedi/stack-exchange-dataset
85,009
Syntax directed translation part of which compiler phase?
<p>I am reading dragon book for compilers. I am not able to understand in which phase does syntax directed translation actually happen. </p>&#xA;&#xA;<p>A CFG can have set of semantic rules attached to it which is evaluated. For example, we can have semantic rules attached to a CFG which adds the type of identifier in ...
compilers
1
Syntax directed translation part of which compiler phase? -- (compilers) <p>I am reading dragon book for compilers. I am not able to understand in which phase does syntax directed translation actually happen. </p>&#xA;&#xA;<p>A CFG can have set of semantic rules attached to it which is evaluated. For example, we can ha...
habedi/stack-exchange-dataset
85,016
How to prove or disprove the well-Definedness of the Operation $.\:$?
<p>Let $L\subseteq \Sigma^*$ a Language</p>&#xA;&#xA;<p>$R_L$ is the Myhill-Nerode-Relation of $L$</p>&#xA;&#xA;<p>$\equiv_L$ is the Syntactic Congruence of $L$</p>&#xA;&#xA;<p>$R_L$ and $\equiv_L$ are equivalence relations and are defined as follows :</p>&#xA;&#xA;<p>$x\:R_L\:y \:\Leftrightarrow \: [\forall w\in\Sigm...
formal languages
1
How to prove or disprove the well-Definedness of the Operation $.\:$? -- (formal languages) <p>Let $L\subseteq \Sigma^*$ a Language</p>&#xA;&#xA;<p>$R_L$ is the Myhill-Nerode-Relation of $L$</p>&#xA;&#xA;<p>$\equiv_L$ is the Syntactic Congruence of $L$</p>&#xA;&#xA;<p>$R_L$ and $\equiv_L$ are equivalence relations and...
habedi/stack-exchange-dataset
85,023
Are there any non-finite automata?
<p>In automata theory, we all read automata as finite automata, from the very beginning. What I want to know is, why are automata finite? To be clear, what is it in an automaton that is finite - the alphabet, language, strings made with regular expressions, or what? And are there (in theory) any non-finite automata?</p...
automata finite automata
1
Are there any non-finite automata? -- (automata finite automata) <p>In automata theory, we all read automata as finite automata, from the very beginning. What I want to know is, why are automata finite? To be clear, what is it in an automaton that is finite - the alphabet, language, strings made with regular expression...
habedi/stack-exchange-dataset
85,029
Question about the difference between radix trees and patricia trees
<p>I've already done some research on this topic, but it still isn't quite clear to me.</p>&#xA;&#xA;<p>According to <a href="https://cs.stackexchange.com/a/63060/81388">this post</a> patricia trees are radix trees with $r = 2$. Every patricia tree I've seen so far is used to store alphanumeric symbols. Assuming that t...
data structures trees
1
Question about the difference between radix trees and patricia trees -- (data structures trees) <p>I've already done some research on this topic, but it still isn't quite clear to me.</p>&#xA;&#xA;<p>According to <a href="https://cs.stackexchange.com/a/63060/81388">this post</a> patricia trees are radix trees with $r =...
habedi/stack-exchange-dataset
85,034
Graph Coloring Problem : How to Think About Algorithms Exer 1.6.2
<p>The problem says:</p>&#xA;&#xA;<p>Given an undirected simple graph G such that each node has at most d + 1 neighbors, color each node with one of d + 1 colors so that for each edge the two nodes have different colors.</p>&#xA;&#xA;<p>Hint : don't think too hard. just color the nodes. what loop invariant do you need?...
graphs colorings
1
Graph Coloring Problem : How to Think About Algorithms Exer 1.6.2 -- (graphs colorings) <p>The problem says:</p>&#xA;&#xA;<p>Given an undirected simple graph G such that each node has at most d + 1 neighbors, color each node with one of d + 1 colors so that for each edge the two nodes have different colors.</p>&#xA;&#x...
habedi/stack-exchange-dataset
85,036
How would one reduce HaltTM to ATM
<p>Assuming that ATM is decidable, how to build a TM S that uses a TM R that takes as input and decides if M accepts w, to decide HaltTM, which we already know is undecidable, hence ATM isn't decidable. So how exactly do we go about this?</p>&#xA;
turing machines computability reductions
1
How would one reduce HaltTM to ATM -- (turing machines computability reductions) <p>Assuming that ATM is decidable, how to build a TM S that uses a TM R that takes as input and decides if M accepts w, to decide HaltTM, which we already know is undecidable, hence ATM isn't decidable. So how exactly do we go about thi...
habedi/stack-exchange-dataset
85,037
Does a graph diameter equal to DFS tree depth?
<p>given an unweighted graph, does the graph <strong>diameter</strong> equal to the maximum DFS tree <strong>depth</strong>?</p>&#xA;&#xA;<p>and the same about BFS?</p>&#xA;&#xA;<p>regarding both directed and undirected graphs.</p>&#xA;&#xA;<p>thanks :)</p>&#xA;
graphs graph traversal equality
1
Does a graph diameter equal to DFS tree depth? -- (graphs graph traversal equality) <p>given an unweighted graph, does the graph <strong>diameter</strong> equal to the maximum DFS tree <strong>depth</strong>?</p>&#xA;&#xA;<p>and the same about BFS?</p>&#xA;&#xA;<p>regarding both directed and undirected graphs.</p>&#xA;...
habedi/stack-exchange-dataset
85,039
Proof of correctness for a triangulation-algorithm
<p>I'm working on the following exercise:</p>&#xA;&#xA;<blockquote>&#xA; <p>Consider a point set $S = \{ p_1, p_2, ..., p_n \}$ in the plane in general position (i.e., no three points of $S$ are collinear). The points of $S$ have pairwise different $y$-coordinates and are sorted in increasing order of them, i.e., $y(p...
algorithms computational geometry correctness proof
1
Proof of correctness for a triangulation-algorithm -- (algorithms computational geometry correctness proof) <p>I'm working on the following exercise:</p>&#xA;&#xA;<blockquote>&#xA; <p>Consider a point set $S = \{ p_1, p_2, ..., p_n \}$ in the plane in general position (i.e., no three points of $S$ are collinear). The ...
habedi/stack-exchange-dataset
85,046
What is meant by problems not in NP but in NP hard?
<p>If there is a proof that an NP-Hard problem which is not NP-Complete can be solved in P time, it does say that the verification time is polynomial too.</p>&#xA;&#xA;<p>Why doesn't it then mean that all NP-Hard are NP (i.e. NPC)?</p>&#xA;&#xA;<hr>&#xA;&#xA;<p>But, if there is something with exponential verification i...
np complete np hard np
1
What is meant by problems not in NP but in NP hard? -- (np complete np hard np) <p>If there is a proof that an NP-Hard problem which is not NP-Complete can be solved in P time, it does say that the verification time is polynomial too.</p>&#xA;&#xA;<p>Why doesn't it then mean that all NP-Hard are NP (i.e. NPC)?</p>&#xA;...
habedi/stack-exchange-dataset
85,062
Can Hall's theorem be applied to scheduling problems?
<p>If I have a scheduling problem, is it possible that Hall's theorem can be applied? I was thinking that the graph representation of the scheduling problem can be the preferences of the people / workers getting scheduled. Is there any such result or counter-claim?</p>&#xA;
graphs discrete mathematics
1
Can Hall's theorem be applied to scheduling problems? -- (graphs discrete mathematics) <p>If I have a scheduling problem, is it possible that Hall's theorem can be applied? I was thinking that the graph representation of the scheduling problem can be the preferences of the people / workers getting scheduled. Is there a...
habedi/stack-exchange-dataset
85,065
Logic Circuits - Binary divisible by 16
<p>I have a question</p>&#xA;&#xA;<pre><code> Given a 16-bit register A holding a number in 2’s complement form, use a &#xA; single gate (e.g., AND, OR,&#xA; XOR, NAND, NOR, NOT) with an arbitrary number of inputs to implement a &#xA; circuit that produces an&#xA; output 1 if the number is divisible by 16, and an...
logic circuits binary
1
Logic Circuits - Binary divisible by 16 -- (logic circuits binary) <p>I have a question</p>&#xA;&#xA;<pre><code> Given a 16-bit register A holding a number in 2’s complement form, use a &#xA; single gate (e.g., AND, OR,&#xA; XOR, NAND, NOR, NOT) with an arbitrary number of inputs to implement a &#xA; circuit that ...
habedi/stack-exchange-dataset
85,068
Does there exist a sorted search with $O(\log n)$ worst-case runtime and $O(\log \log n)$ on average?
<p>I thought of some mixed algorithm: binary + interpolation search. While first has $O(\log n)$ runtime in both worst and average cases, second has $O(n)$ worst case runtime and $O(\log \log n)$ average case.</p>&#xA;&#xA;<p>However, I think, if such algorithms can exist, there are more than one of them.</p>&#xA;&#xA;...
search algorithms
1
Does there exist a sorted search with $O(\log n)$ worst-case runtime and $O(\log \log n)$ on average? -- (search algorithms) <p>I thought of some mixed algorithm: binary + interpolation search. While first has $O(\log n)$ runtime in both worst and average cases, second has $O(n)$ worst case runtime and $O(\log \log n)$...
habedi/stack-exchange-dataset
85,071
Given a set of points, find all collinear subsets
<h3>General problem</h3>&#xA;&#xA;<ul>&#xA;<li>Given a space $S$ which is $N$-dimensional, bounded, and quantized</li>&#xA;<li>Given a set $P$ of unique points</li>&#xA;<li>Find the set of collinear subsets of $P$, each containing at least 3 points</li>&#xA;<li>One point can exist in multiple subsets</li>&#xA;</ul>&#xA...
algorithms
1
Given a set of points, find all collinear subsets -- (algorithms) <h3>General problem</h3>&#xA;&#xA;<ul>&#xA;<li>Given a space $S$ which is $N$-dimensional, bounded, and quantized</li>&#xA;<li>Given a set $P$ of unique points</li>&#xA;<li>Find the set of collinear subsets of $P$, each containing at least 3 points</li>&...
habedi/stack-exchange-dataset
85,077
Minimum weight k-induced subgraph
<p>Let $G$ be <em>multipartite</em> directed weighted graph with $k$ independent sets (we will call &#xA;them "layers"). We select <em>exactly</em> one node from each layer and form the <a href="https://en.wikipedia.org/wiki/Induced_subgraph" rel="nofollow noreferrer">induced subgraph</a> $H_k$. That is, $H_k$ has exac...
np hard approximation
1
Minimum weight k-induced subgraph -- (np hard approximation) <p>Let $G$ be <em>multipartite</em> directed weighted graph with $k$ independent sets (we will call &#xA;them "layers"). We select <em>exactly</em> one node from each layer and form the <a href="https://en.wikipedia.org/wiki/Induced_subgraph" rel="nofollow no...
habedi/stack-exchange-dataset
85,080
P class definition in Garey and Johnson's Computers and Intractability
<p>I'm reading right now Computers and Intractability by Garey and Johnson. I've found the definition of PTIME complexity class a little strange. This is how it looks:</p>&#xA;&#xA;<p>Let $\Sigma = \{ 0,1\}$. By $\Sigma^{*}$ we denote the set of all finite strings created from symbols from $\Sigma$. If a computation on...
complexity theory time complexity
1
P class definition in Garey and Johnson's Computers and Intractability -- (complexity theory time complexity) <p>I'm reading right now Computers and Intractability by Garey and Johnson. I've found the definition of PTIME complexity class a little strange. This is how it looks:</p>&#xA;&#xA;<p>Let $\Sigma = \{ 0,1\}$. B...
habedi/stack-exchange-dataset
85,082
Algorithm. Input: pointers to k unsorted arrays of different lengths. Needed output: k sorted arrays
<p>$k = \Theta(n)$</p>&#xA;&#xA;<p>The arrays consist only natural numbers $1$ to $n$</p>&#xA;&#xA;<p>The sum of the length of all arrays = $\Theta(n)$</p>&#xA;&#xA;<p>It should return the $k$ original arrays, each sorted on its own.</p>&#xA;&#xA;<p>The running time should be at worst $\Theta(n)$.&#xA;How is it even po...
algorithms counting
1
Algorithm. Input: pointers to k unsorted arrays of different lengths. Needed output: k sorted arrays -- (algorithms counting) <p>$k = \Theta(n)$</p>&#xA;&#xA;<p>The arrays consist only natural numbers $1$ to $n$</p>&#xA;&#xA;<p>The sum of the length of all arrays = $\Theta(n)$</p>&#xA;&#xA;<p>It should return the $k$ o...
habedi/stack-exchange-dataset
85,089
Precomputation for partial products in monoids
<p>Suppose I have a sequence of elements $a_1,\ldots,a_n$ in a group and I want to compute, for varying $1\leq i\leq j\leq n$, the product $b_{i,j}:=\Pi_{i\leq k\leq j}a_k$. Then I can do a precomputation of all $b_{1,j}$ and later determine each needed $b_{i,j}$ as $(b_{1,i-1})^{-1}b_{1,j}$.</p>&#xA;&#xA;<p>The cost i...
algorithms data structures
1
Precomputation for partial products in monoids -- (algorithms data structures) <p>Suppose I have a sequence of elements $a_1,\ldots,a_n$ in a group and I want to compute, for varying $1\leq i\leq j\leq n$, the product $b_{i,j}:=\Pi_{i\leq k\leq j}a_k$. Then I can do a precomputation of all $b_{1,j}$ and later determine...
habedi/stack-exchange-dataset
85,095
Graph coloring decision problem NP-complete
<blockquote>&#xA;<p>Given a graph <span class="math-container">$G = (V, E)$</span> and a natural number <span class="math-container">$k$</span>, consider the problem of determining whether there is a way to color the vertices with two colors in such a way that at least <span class="math-container">$k$</span> edges are ...
complexity theory graphs np complete colorings
1
Graph coloring decision problem NP-complete -- (complexity theory graphs np complete colorings) <blockquote>&#xA;<p>Given a graph <span class="math-container">$G = (V, E)$</span> and a natural number <span class="math-container">$k$</span>, consider the problem of determining whether there is a way to color the vertice...
habedi/stack-exchange-dataset
85,105
Determining whether the output of an algorithm is constant
<p>Suppose I have an algorithm $A$ that is known to halt before $f(n)$ steps for some function $f: \mathbb N \rightarrow \mathbb N$, where $n$ is the size of the input, and output is always either zero or one. Is it a decidable problem to determine whether $A$ always outputs zero? </p>&#xA;
undecidability
1
Determining whether the output of an algorithm is constant -- (undecidability) <p>Suppose I have an algorithm $A$ that is known to halt before $f(n)$ steps for some function $f: \mathbb N \rightarrow \mathbb N$, where $n$ is the size of the input, and output is always either zero or one. Is it a decidable problem to de...
habedi/stack-exchange-dataset
85,114
The maximum number of nodes in a heap tree of degree d and depth k
<p>The maximum number of nodes in a binary tree of depth k is defined by <span class="math-container">$2^{(k+1)}-1$</span>, but the same rule doesn't appear to work for heap trees of different degrees.</p>&#xA;<p>Let's say I have the following tree of degree 3</p>&#xA;<pre><code> 1&#xA; / | \&#xA;2 3 4&#xA;</code><...
trees combinatorics heaps
1
The maximum number of nodes in a heap tree of degree d and depth k -- (trees combinatorics heaps) <p>The maximum number of nodes in a binary tree of depth k is defined by <span class="math-container">$2^{(k+1)}-1$</span>, but the same rule doesn't appear to work for heap trees of different degrees.</p>&#xA;<p>Let's say...
habedi/stack-exchange-dataset
85,122
Is there a set of NP-hard problems that are most commonly used for proving NP-hardness?
<p>Are there any NP-hard problems that are considered kind of the standard for reductions? There's so many but it feels like some come up more often than others (for example Vertex Cover, Independent Set, 3-SAT, etc.). I'm sure people just pick whatever is most convenient, but where's the boundary between "more useful"...
complexity theory np complete np hard np
1
Is there a set of NP-hard problems that are most commonly used for proving NP-hardness? -- (complexity theory np complete np hard np) <p>Are there any NP-hard problems that are considered kind of the standard for reductions? There's so many but it feels like some come up more often than others (for example Vertex Cover...
habedi/stack-exchange-dataset
85,123
Proving that a Turing machine decides a language in NP
<p>Suppose a deterministic Turing machine T decides language L and L is in NP. Then must it be provable in ZF that T decides L?</p>&#xA;
complexity theory logic
1
Proving that a Turing machine decides a language in NP -- (complexity theory logic) <p>Suppose a deterministic Turing machine T decides language L and L is in NP. Then must it be provable in ZF that T decides L?</p>&#xA;
habedi/stack-exchange-dataset
85,126
Does MST exclude the edge belongs to the cycle of the graph?
<p>For any simple, connected, undirected graph $G(V,E,w)$ with each carrying distinct positive edge weights, is it true that MST will contain all the edges which do not lie in any cycle of $G$?</p>&#xA;&#xA;<p>I think MST can take any edge of irrespective of the fact whether it is an edge of cycle (like I simply use Kr...
graphs minimum spanning tree
1
Does MST exclude the edge belongs to the cycle of the graph? -- (graphs minimum spanning tree) <p>For any simple, connected, undirected graph $G(V,E,w)$ with each carrying distinct positive edge weights, is it true that MST will contain all the edges which do not lie in any cycle of $G$?</p>&#xA;&#xA;<p>I think MST can...
habedi/stack-exchange-dataset
85,134
Is the halting problem decidable by an "infinite Turing machine"?
<p>It has been shown of course that the halting problem is undecidable. That is, we cannot formulate a Turing machine that will decide for any arbitrary turing machine whether it will halt or not. </p>&#xA;&#xA;<p>However, I'm wondering, if we want to decide for the set of Turing machines $T$, whether a turing machine ...
undecidability halting problem
1
Is the halting problem decidable by an "infinite Turing machine"? -- (undecidability halting problem) <p>It has been shown of course that the halting problem is undecidable. That is, we cannot formulate a Turing machine that will decide for any arbitrary turing machine whether it will halt or not. </p>&#xA;&#xA;<p>Howe...
habedi/stack-exchange-dataset
85,140
hardware interrupts and context switch
<p>I have recently studied about interrupts and context switch i have read that the hardware interrupts cause the interrupt service subroutine to execute for this i read mixed articles saying that there no need for a context switch to kernel mode and some say we need a context switch to kernel mode from user mode do w...
operating systems
1
hardware interrupts and context switch -- (operating systems) <p>I have recently studied about interrupts and context switch i have read that the hardware interrupts cause the interrupt service subroutine to execute for this i read mixed articles saying that there no need for a context switch to kernel mode and some s...
habedi/stack-exchange-dataset
85,144
Existence of one and two state PDAs
<p>I came across following fact in Automata book by Hopcroft, Ullman:</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Theorem 1:</strong> For every PDA accepting by empty stack (PDAeS), there is an equivalent one state PDA accepting by empty stack.</p>&#xA;</blockquote>&#xA;&#xA;<p>I was wondering how this applies to:</p>&#...
automata finite automata compilers pushdown automata
1
Existence of one and two state PDAs -- (automata finite automata compilers pushdown automata) <p>I came across following fact in Automata book by Hopcroft, Ullman:</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Theorem 1:</strong> For every PDA accepting by empty stack (PDAeS), there is an equivalent one state PDA acceptin...
habedi/stack-exchange-dataset
85,154
Maximize the number of edges in subgraph
<p>We are given a graph $G=(V,E)$ and we want an algorithm to find a set of vertices $U$ to maximize the following quantity : $\frac{|E(U)|}{|U|}$ where $E(U)$ denotes the number of edges in the subgraph made with vertex set $U$.</p>&#xA;
algorithms graphs linear programming
1
Maximize the number of edges in subgraph -- (algorithms graphs linear programming) <p>We are given a graph $G=(V,E)$ and we want an algorithm to find a set of vertices $U$ to maximize the following quantity : $\frac{|E(U)|}{|U|}$ where $E(U)$ denotes the number of edges in the subgraph made with vertex set $U$.</p>&#xA...
habedi/stack-exchange-dataset
85,169
Intersection between regular language and context-free language
<p>In general, context-free algorithm are not closed under intersection but the intersection between a regular language and a CF language is known to be context-free.</p>&#xA;&#xA;<p>My question is: does exist an algorithm to compute intersection in these special cases?</p>&#xA;&#xA;<p>Thanks.</p>&#xA;
regular languages context free
1
Intersection between regular language and context-free language -- (regular languages context free) <p>In general, context-free algorithm are not closed under intersection but the intersection between a regular language and a CF language is known to be context-free.</p>&#xA;&#xA;<p>My question is: does exist an algorit...
habedi/stack-exchange-dataset
85,172
Find maximum non contiguous subarray that respect a specific rule
<p>Given these two arrays:</p>&#xA;&#xA;<pre><code>[5, 3, 4, 1, 2]&#xA;&#xA;[1, 3, 2, 4, 5]&#xA;</code></pre>&#xA;&#xA;<p>Find the maximum subsequence in both arrays that the index of the elements are in a crescent order:</p>&#xA;&#xA;<p>Example: <code>[3, 4]</code> it's an answer because the indexes are in a crescent ...
arrays maximum subarray c++
1
Find maximum non contiguous subarray that respect a specific rule -- (arrays maximum subarray c++) <p>Given these two arrays:</p>&#xA;&#xA;<pre><code>[5, 3, 4, 1, 2]&#xA;&#xA;[1, 3, 2, 4, 5]&#xA;</code></pre>&#xA;&#xA;<p>Find the maximum subsequence in both arrays that the index of the elements are in a crescent order:...
habedi/stack-exchange-dataset
85,185
Solve Time Complexity problem using Time Hierarchy
<p>I am trying to understand Time Hierarchy. I have an example that is solvable using the rules of Time Hierarchy. I would like an explanation on how to solve so that I may understand better how to use Time Hierarchy.</p>&#xA;&#xA;<p>I need to show that the following are either equal, on inclusive of one another...</p>...
complexity theory time complexity polynomial time p vs np
1
Solve Time Complexity problem using Time Hierarchy -- (complexity theory time complexity polynomial time p vs np) <p>I am trying to understand Time Hierarchy. I have an example that is solvable using the rules of Time Hierarchy. I would like an explanation on how to solve so that I may understand better how to use Time...
habedi/stack-exchange-dataset
85,207
Explain Hashed page tables in operating system
<p>I have a difficult time understanding hashed page tables used in virtual memory management. Here is picture of the slide that I am referring to:</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/wRaFe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wRaFe.png" alt="Hashed page table"></a></p>&#xA;...
operating systems hash hash tables virtual memory paging
1
Explain Hashed page tables in operating system -- (operating systems hash hash tables virtual memory paging) <p>I have a difficult time understanding hashed page tables used in virtual memory management. Here is picture of the slide that I am referring to:</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/wRaFe.png" r...
habedi/stack-exchange-dataset
85,210
Why is recursive programming problematic for branch predictors
<p>Consider for example the following recursive program:</p>&#xA;&#xA;<pre><code>function fibonacci(int n) {&#xA; if (n &lt; 2) {&#xA; return 1;&#xA; } else {&#xA; return fibonacci(n - 2) + fibonacci(n - 1);&#xA; }&#xA;}&#xA;</code></pre>&#xA;&#xA;<p>The question is now, why recursive programs ar...
computer architecture recursion cpu
1
Why is recursive programming problematic for branch predictors -- (computer architecture recursion cpu) <p>Consider for example the following recursive program:</p>&#xA;&#xA;<pre><code>function fibonacci(int n) {&#xA; if (n &lt; 2) {&#xA; return 1;&#xA; } else {&#xA; return fibonacci(n - 2) + fibona...
habedi/stack-exchange-dataset
85,211
Meaning of the Time Hierarchy Theorem
<p>Given two positive integers $c_1$ and $c_2$ such that $c_1 &lt; c_2$, it's easy to prove that $n^{c_1}$ is $\mathcal{O}(n^{c_2})$ while $n^{c_2}$ is not $\mathcal{O}(n^{c_1})$. In general, for any functions $f(n)$ and $g(n)$ it is possible to determine which one (or both) is true, $f \in \mathcal{O}(g)$ or $g \in \m...
complexity theory time complexity
1
Meaning of the Time Hierarchy Theorem -- (complexity theory time complexity) <p>Given two positive integers $c_1$ and $c_2$ such that $c_1 &lt; c_2$, it's easy to prove that $n^{c_1}$ is $\mathcal{O}(n^{c_2})$ while $n^{c_2}$ is not $\mathcal{O}(n^{c_1})$. In general, for any functions $f(n)$ and $g(n)$ it is possible ...
habedi/stack-exchange-dataset
85,219
Finding whether the language is CFL or regular
<p>$L = (0^i 1)^n$ where i=1,2,3,4...n and n>=0</p>&#xA;&#xA;<p>For eg :- 00010001 doesn't belong to the language as n=2 but i=3 at the beginning.</p>&#xA;&#xA;<p>001001001 belongs to L as n=3 and i=2 in all cases.</p>&#xA;&#xA;<p>I know the above language is not regular for sure as value of 'i' depends on value of '...
formal languages regular languages
1
Finding whether the language is CFL or regular -- (formal languages regular languages) <p>$L = (0^i 1)^n$ where i=1,2,3,4...n and n>=0</p>&#xA;&#xA;<p>For eg :- 00010001 doesn't belong to the language as n=2 but i=3 at the beginning.</p>&#xA;&#xA;<p>001001001 belongs to L as n=3 and i=2 in all cases.</p>&#xA;&#xA;<p>...
habedi/stack-exchange-dataset
85,221
Can Haskell ensure a Functor (or other typeclasses) satisfies its law?
<p>It seems that Functor definitions in Haskell can be accepted if the type is correct.<br>&#xA;This code compiles, but it doesn't satisfy the functor law:</p>&#xA;&#xA;<pre><code>data Bst a = NIL | Node a (Bst a) (Bst a) deriving (Eq, Ord, Show)&#xA;&#xA;instance Functor Bst where&#xA; fmap _ NIL = NIL&#xA; fmap f (...
haskell
1
Can Haskell ensure a Functor (or other typeclasses) satisfies its law? -- (haskell) <p>It seems that Functor definitions in Haskell can be accepted if the type is correct.<br>&#xA;This code compiles, but it doesn't satisfy the functor law:</p>&#xA;&#xA;<pre><code>data Bst a = NIL | Node a (Bst a) (Bst a) deriving (Eq, ...
habedi/stack-exchange-dataset
85,222
Find the first integer with exactly $n$ divisors
<p>For given positive integer $n$ find the first number $x$ with exactly $n$ divisors. For simplicity of the problem we can assume that $x$ will always fit in integer size and $n \leq 1000$. </p>&#xA;&#xA;<p><strong>Example</strong></p>&#xA;&#xA;<p>If $n=4, x = 6, \text{ divisors of 6 are } \{1, 2, 3, 6\}\\n=6, x=12, \...
number theory
1
Find the first integer with exactly $n$ divisors -- (number theory) <p>For given positive integer $n$ find the first number $x$ with exactly $n$ divisors. For simplicity of the problem we can assume that $x$ will always fit in integer size and $n \leq 1000$. </p>&#xA;&#xA;<p><strong>Example</strong></p>&#xA;&#xA;<p>If ...
habedi/stack-exchange-dataset
85,229
Unary Turing-unrecognizable language
<p>One of my final exam questions asked me to give a Turing-unrecognizable language over an unary alphabet, which I wasn't able to complete, but I ended using the Busy Beaver function (BB(k)) which is known to be something intractable or uncomputable so that I constructed the language as a set of strings 1^BB(k) for n...
turing machines undecidability
1
Unary Turing-unrecognizable language -- (turing machines undecidability) <p>One of my final exam questions asked me to give a Turing-unrecognizable language over an unary alphabet, which I wasn't able to complete, but I ended using the Busy Beaver function (BB(k)) which is known to be something intractable or uncomputa...
habedi/stack-exchange-dataset
85,231
Decidability of whether a language described by Turing machine is regular
<p>I am trying to prove decidability of problem whether language described by Turing machine is regular. My idea is that I can simulate finite automaton with a subset of Turing machine instructions, namely ones that check for symbol and then move right. If the language is not regular, then simulated FA will eventually ...
computability regular languages undecidability
1
Decidability of whether a language described by Turing machine is regular -- (computability regular languages undecidability) <p>I am trying to prove decidability of problem whether language described by Turing machine is regular. My idea is that I can simulate finite automaton with a subset of Turing machine instructi...
habedi/stack-exchange-dataset
85,236
Traveling Salesman Solution
<p>This problem has been heavily studied, and at last may have a potential solution.&#xA;The concept I have come up with was made entirely on my own, but is close to some other theories that will be referenced.</p>&#xA;&#xA;<p>The intended purpose for posting here is to have more experienced software developers review ...
algorithms traveling salesman
1
Traveling Salesman Solution -- (algorithms traveling salesman) <p>This problem has been heavily studied, and at last may have a potential solution.&#xA;The concept I have come up with was made entirely on my own, but is close to some other theories that will be referenced.</p>&#xA;&#xA;<p>The intended purpose for posti...
habedi/stack-exchange-dataset
85,266
Proof of equivalence of L0 and language accepted by made up machine
<p>I have a made up machine, which has the same definition as Turing machine, but the transition function and the step of computation of the machine. What would be the approach of the proof that the language accepted by this machine is (or is not) equal to L0 (recursively enumerable language)?</p>&#xA;
computability turing machines
1
Proof of equivalence of L0 and language accepted by made up machine -- (computability turing machines) <p>I have a made up machine, which has the same definition as Turing machine, but the transition function and the step of computation of the machine. What would be the approach of the proof that the language accepted ...
habedi/stack-exchange-dataset
85,272
What is the time complexity of $\sum_{i=0}^{\frac{n}{k}} p_i\cdot 2^{ik}$ if $p$ is a binary number?
<p>Let $p$ be a number represented in binary of length $n$. We'll divide $p$ into $\frac{n}{k}$ parts, each of length $k$ (let each part be $p_i$, $0 \le i\le \frac{n}{k}$) where $k=\lg n$. Now we want to represent $p$ as a sum:&#xA;$$&#xA;\sum_{i=0}^{\frac{n}{k}} p_i\cdot 2^{ik} \qquad(*)&#xA;$$</p>&#xA;&#xA;<p>I know...
algorithms time complexity
1
What is the time complexity of $\sum_{i=0}^{\frac{n}{k}} p_i\cdot 2^{ik}$ if $p$ is a binary number? -- (algorithms time complexity) <p>Let $p$ be a number represented in binary of length $n$. We'll divide $p$ into $\frac{n}{k}$ parts, each of length $k$ (let each part be $p_i$, $0 \le i\le \frac{n}{k}$) where $k=\lg n...
habedi/stack-exchange-dataset
85,291
Approximation factor of NP-complete problems
<p>We talked about the following theorem in class but I am still having problems to understand it:</p>&#xA;&#xA;<p><em>For a NP-complete decision problem "Does a valid solution with a value $\leq K$ exist?" there is no approximation algorithm for the corresponding minimization problem with an approximation factor $\lt ...
approximation
1
Approximation factor of NP-complete problems -- (approximation) <p>We talked about the following theorem in class but I am still having problems to understand it:</p>&#xA;&#xA;<p><em>For a NP-complete decision problem "Does a valid solution with a value $\leq K$ exist?" there is no approximation algorithm for the corre...
habedi/stack-exchange-dataset