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
101,108
Can a RE language be reduced to a non-RE language?
<p>In our lecture notes about many-one reduction we showed that the following statements hold:&#xA;<span class="math-container">$$ L, L' \subseteq \mathbb{N}\space and \space L\leq L'$$</span>&#xA;<span class="math-container">$$(I)\space L' \in RE \implies L\in RE$$</span>&#xA;<span class="math-container">$$(II)\space ...
computability reductions
1
Can a RE language be reduced to a non-RE language? -- (computability reductions) <p>In our lecture notes about many-one reduction we showed that the following statements hold:&#xA;<span class="math-container">$$ L, L' \subseteq \mathbb{N}\space and \space L\leq L'$$</span>&#xA;<span class="math-container">$$(I)\space L...
habedi/stack-exchange-dataset
101,110
Grammar with same variables
<p>If a grammar has the same variable multiple times, is it the same as adding a <span class="math-container">$\mid$</span> between them? For example, is</p>&#xA;&#xA;<p><span class="math-container">$$\begin{align*}S &amp;\to bB \\&#xA;S &amp;\to \varepsilon \\&#xA;B &amp;\to cB \\&#xA;B &amp;\to \varepsilon \end{a...
formal grammars
1
Grammar with same variables -- (formal grammars) <p>If a grammar has the same variable multiple times, is it the same as adding a <span class="math-container">$\mid$</span> between them? For example, is</p>&#xA;&#xA;<p><span class="math-container">$$\begin{align*}S &amp;\to bB \\&#xA;S &amp;\to \varepsilon \\&#xA;B &...
habedi/stack-exchange-dataset
101,111
Why do DFAs with a single final state have less power?
<p>I came across this question in a test and I had to answer whether it is true or false.</p>&#xA;&#xA;<blockquote>&#xA; <p>DFA with single final state has the same powers as DFA with more than one final state.</p>&#xA;</blockquote>&#xA;&#xA;<p>I was confused by what definition of "power" have they used. Generally, we...
automata finite automata computation models
1
Why do DFAs with a single final state have less power? -- (automata finite automata computation models) <p>I came across this question in a test and I had to answer whether it is true or false.</p>&#xA;&#xA;<blockquote>&#xA; <p>DFA with single final state has the same powers as DFA with more than one final state.</p>&...
habedi/stack-exchange-dataset
101,120
Minimum finger search tree complexity
<p>Suppose I have an AVL tree with a pointer to the minimal element. I'd like to conduct a search for some key x, which is the <span class="math-container">$k$</span>-smallest key in the entire tree.&#xA;I can do this by "climbing" up the tree's left branch, comparing x with the current key. As long as </p>&#xA;&#xA;<b...
time complexity balanced search trees
1
Minimum finger search tree complexity -- (time complexity balanced search trees) <p>Suppose I have an AVL tree with a pointer to the minimal element. I'd like to conduct a search for some key x, which is the <span class="math-container">$k$</span>-smallest key in the entire tree.&#xA;I can do this by "climbing" up the ...
habedi/stack-exchange-dataset
101,123
What happens if I replace $<$ with $\le$ in Dijkstra's algorithm?
<p>The following is Dijkstra's algorithm for finding the shortest path in a graph. I know something wrong happens if I replace <code>d[u] + weight(u,v) &lt; d[v]</code> with <code>d[u] + weight(u,v) &lt;= d[v]</code>. What would be an example of the algorithm working incorrectly with that replacement?</p>&#xA;&#xA;<pre...
graphs shortest path
1
What happens if I replace $<$ with $\le$ in Dijkstra's algorithm? -- (graphs shortest path) <p>The following is Dijkstra's algorithm for finding the shortest path in a graph. I know something wrong happens if I replace <code>d[u] + weight(u,v) &lt; d[v]</code> with <code>d[u] + weight(u,v) &lt;= d[v]</code>. What would...
habedi/stack-exchange-dataset
101,127
What does it mean to logically imply another predicate?
<ul>&#xA;<li><p>Consider the following predicate formulas.</p>&#xA;&#xA;<p><span class="math-container">$F1: \forall x \exists y ( P(x) \to Q(y) ).$</span></p>&#xA;&#xA;<p><span class="math-container">$F2: \exists x \forall y ( P(x) \to Q(y) ).$</span></p>&#xA;&#xA;<p><span class="math-container">$F3: \forall x P(x) \t...
predicate logic
1
What does it mean to logically imply another predicate? -- (predicate logic) <ul>&#xA;<li><p>Consider the following predicate formulas.</p>&#xA;&#xA;<p><span class="math-container">$F1: \forall x \exists y ( P(x) \to Q(y) ).$</span></p>&#xA;&#xA;<p><span class="math-container">$F2: \exists x \forall y ( P(x) \to Q(y) )...
habedi/stack-exchange-dataset
101,135
How to calculate the minimum number of groups, by grouping groups with capacity together?
<p>I need to group cars (and their passengers) with other cars, and I don't know how to approach this problem.</p>&#xA;&#xA;<p>If I have, for example, 3 cars. Car A with 7 seats and 2 passengers (3/7 because of the driver). Car B, 2/2. Car C, 1/3.&#xA;The most wasteful clustering would be [A, B, C]. But car C has room ...
graphs trees network flow clustering group theory
1
How to calculate the minimum number of groups, by grouping groups with capacity together? -- (graphs trees network flow clustering group theory) <p>I need to group cars (and their passengers) with other cars, and I don't know how to approach this problem.</p>&#xA;&#xA;<p>If I have, for example, 3 cars. Car A with 7 sea...
habedi/stack-exchange-dataset
101,141
DFS & BFS Spanning Trees
<p>I want to construct a DFS and a BFS spanning trees for the graph below. The root is node a. At each step the next edge to be traversed should be the cheapest one. </p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/bkrsK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bkrsK.png" alt="enter image d...
graph traversal minimum spanning tree spanning trees
1
DFS & BFS Spanning Trees -- (graph traversal minimum spanning tree spanning trees) <p>I want to construct a DFS and a BFS spanning trees for the graph below. The root is node a. At each step the next edge to be traversed should be the cheapest one. </p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/bkrsK.png" rel="nof...
habedi/stack-exchange-dataset
101,147
DP recurrence relations: Coin change vs Knapsack
<p>Take:</p>&#xA;&#xA;<ol>&#xA;<li>KP recurrence relation </li>&#xA;</ol>&#xA;&#xA;<p><span class="math-container">$ max { [v + f(k-1,g-w ), f(k-1,g)] } $</span> if w &lt;= g and k>0</p>&#xA;&#xA;<ol start="2">&#xA;<li>CCP recurrence relation</li>&#xA;</ol>&#xA;&#xA;<p><span class="math-container">$ min {[1 + f(r,...
dynamic programming recurrence relation knapsack problems coin change
1
DP recurrence relations: Coin change vs Knapsack -- (dynamic programming recurrence relation knapsack problems coin change) <p>Take:</p>&#xA;&#xA;<ol>&#xA;<li>KP recurrence relation </li>&#xA;</ol>&#xA;&#xA;<p><span class="math-container">$ max { [v + f(k-1,g-w ), f(k-1,g)] } $</span> if w &lt;= g and k>0</p>&#xA;&...
habedi/stack-exchange-dataset
101,152
LET REC recursive expression static typing rule
<p>I'm taking a programming languages course and had a question regarding the typing rules for a recursive <code>let rec</code> expression in a static typing system.</p>&#xA;&#xA;<p>To be more specific, we're using the textbook <em>Essentials of Programming Languages (3e) - Friedman &amp; Wand</em>.</p>&#xA;&#xA;<p><br...
programming languages type theory type checking
1
LET REC recursive expression static typing rule -- (programming languages type theory type checking) <p>I'm taking a programming languages course and had a question regarding the typing rules for a recursive <code>let rec</code> expression in a static typing system.</p>&#xA;&#xA;<p>To be more specific, we're using the ...
habedi/stack-exchange-dataset
101,156
Counting the number of multiples of number A that perfectly divides the number B
<p>What is the best way of counting the number of multiples of number A that perfectly divides the number B.</p>&#xA;&#xA;<p>This is the sub problem for one of the questions I am solving on codechef.&#xA;This is the best I could come up with.</p>&#xA;&#xA;<pre><code>int func(int A,int B){&#xA; int res = 0;&#xA; i...
algorithms coding theory mathematical programming
1
Counting the number of multiples of number A that perfectly divides the number B -- (algorithms coding theory mathematical programming) <p>What is the best way of counting the number of multiples of number A that perfectly divides the number B.</p>&#xA;&#xA;<p>This is the sub problem for one of the questions I am solvi...
habedi/stack-exchange-dataset
101,157
In RegExr, why is regex OR in JavaScript sometimes not commutative?
<p>On <a href="https://regexr.com/" rel="nofollow noreferrer">https://regexr.com/</a>, using the default JavaScript (Browser) engine, the languages <span class="math-container">$L(a^*|b^*)$</span> and <span class="math-container">$L(b^*|a^*)$</span> are not the same.&#xA;The first one matches only <span class="math-con...
regular expressions
1
In RegExr, why is regex OR in JavaScript sometimes not commutative? -- (regular expressions) <p>On <a href="https://regexr.com/" rel="nofollow noreferrer">https://regexr.com/</a>, using the default JavaScript (Browser) engine, the languages <span class="math-container">$L(a^*|b^*)$</span> and <span class="math-containe...
habedi/stack-exchange-dataset
101,162
Context free grammar problem for number of a's is twice the number of b's
<p>Can you to find for me a context free grammar for the following language?</p>&#xA;<p><span class="math-container">$$\{w\in\{a,b\}^*: \#_a(w)=2\#_b(w)\} $$</span></p>&#xA;<p>Here <span class="math-container">$\#_a(w)$</span> counts the number of <span class="math-container">$a$</span>'s in <span class="math-container...
formal languages context free formal grammars
1
Context free grammar problem for number of a's is twice the number of b's -- (formal languages context free formal grammars) <p>Can you to find for me a context free grammar for the following language?</p>&#xA;<p><span class="math-container">$$\{w\in\{a,b\}^*: \#_a(w)=2\#_b(w)\} $$</span></p>&#xA;<p>Here <span class="m...
habedi/stack-exchange-dataset
101,164
About hardware multithreading
<p>I'm reading <a href="https://en.wikipedia.org/wiki/Multithreading_(computer_architecture)" rel="nofollow noreferrer">Multithreading (computer architecture) - Wiki</a>, aka hardware threading, and I'm trying to understand the second paragraph:</p>&#xA;&#xA;<blockquote>&#xA; <p>(p2): Where multiprocessing systems inc...
computer architecture parallel computing threads
1
About hardware multithreading -- (computer architecture parallel computing threads) <p>I'm reading <a href="https://en.wikipedia.org/wiki/Multithreading_(computer_architecture)" rel="nofollow noreferrer">Multithreading (computer architecture) - Wiki</a>, aka hardware threading, and I'm trying to understand the second p...
habedi/stack-exchange-dataset
101,179
Strongly connected orientations of undirected graphs
<p>I'm trying to prove the following.</p>&#xA;&#xA;<blockquote>&#xA; <p>There exists a strongly connected orientation of a connected, undirected graph&nbsp;<span class="math-container">$G$</span> if, and only if, <span class="math-container">$G$</span>&nbsp;has no bridge.</p>&#xA;</blockquote>&#xA;&#xA;<p>(An orientat...
graphs
1
Strongly connected orientations of undirected graphs -- (graphs) <p>I'm trying to prove the following.</p>&#xA;&#xA;<blockquote>&#xA; <p>There exists a strongly connected orientation of a connected, undirected graph&nbsp;<span class="math-container">$G$</span> if, and only if, <span class="math-container">$G$</span>&n...
habedi/stack-exchange-dataset
101,195
Context sensitive language is context free
<p>Problem of determining whether a context sensitive language is context free is undecidable.</p>&#xA;&#xA;<p>How to prove it </p>&#xA;
undecidability context sensitive
1
Context sensitive language is context free -- (undecidability context sensitive) <p>Problem of determining whether a context sensitive language is context free is undecidable.</p>&#xA;&#xA;<p>How to prove it </p>&#xA;
habedi/stack-exchange-dataset
101,202
Turing machine with semi infinite tape - Prove by construction
<p>I'm studying constrained Turing Machines.</p>&#xA;&#xA;<p>There's a theorem that proves that both infinite and semi-infinite tape TM have the same computational power. The theorem that proves this by emulating a TM1 with infinite tape with a multi-track tape TM2, where one track emulates the right part of the TM1 ta...
turing machines proof techniques
1
Turing machine with semi infinite tape - Prove by construction -- (turing machines proof techniques) <p>I'm studying constrained Turing Machines.</p>&#xA;&#xA;<p>There's a theorem that proves that both infinite and semi-infinite tape TM have the same computational power. The theorem that proves this by emulating a TM1 ...
habedi/stack-exchange-dataset
101,205
What changes need to be made to a Turing machine to make them equivalent to a PDA, a DFA?
<p>I believe in order to make a Turing machine have the same power as a DFA (by power I mean all languages which a DFA can decided so can the Turing machine) we just don't allow any use of backtracking or rewriting, that is you can only move right and read the string in the order it is presented.</p>&#xA;&#xA;<p>To sim...
turing machines automata pushdown automata
1
What changes need to be made to a Turing machine to make them equivalent to a PDA, a DFA? -- (turing machines automata pushdown automata) <p>I believe in order to make a Turing machine have the same power as a DFA (by power I mean all languages which a DFA can decided so can the Turing machine) we just don't allow any ...
habedi/stack-exchange-dataset
101,217
Sorted unsigned integer intervals tree structure
<p>The goal is to store <strong>sorted unsigned integer intervals</strong> that can overlap only in the boundaries, e.g., <code>|0–10|10–50|100–110|110–200|</code>. This structure will be created by some <strong>insert operations</strong> (the order matters) in the start and than <strong>queried</strong> by a lot of qu...
intervals
1
Sorted unsigned integer intervals tree structure -- (intervals) <p>The goal is to store <strong>sorted unsigned integer intervals</strong> that can overlap only in the boundaries, e.g., <code>|0–10|10–50|100–110|110–200|</code>. This structure will be created by some <strong>insert operations</strong> (the order matter...
habedi/stack-exchange-dataset
101,218
Does any parser ever parse non deterministic unambiguous context free grammar?
<p>I have been informed parser parses unambiguous context free grammars of <span class="math-container">$DCFL$</span>.</p>&#xA;&#xA;<p>I was wondering if there could be a parser which could make a parsing table for unambiguous grammars of <span class="math-container">$NCFL$</span>? </p>&#xA;&#xA;<p>Note: This has been ...
compilers
1
Does any parser ever parse non deterministic unambiguous context free grammar? -- (compilers) <p>I have been informed parser parses unambiguous context free grammars of <span class="math-container">$DCFL$</span>.</p>&#xA;&#xA;<p>I was wondering if there could be a parser which could make a parsing table for unambiguous...
habedi/stack-exchange-dataset
101,220
How to solve F(n)=F(n-1)+F(n-2)+f(n) recursive function?
<p>Like in the title the following equation:</p>&#xA;<ol>&#xA;<li><span class="math-container">$F(n)=F(n-1)+F(n-2)+f(n)$</span>, with <span class="math-container">$F(0)=0, F(1)=1$</span></li>&#xA;<li><span class="math-container">$f(n)=f(n-1)+f(n-2)$</span>, with <span class="math-container">$f(0)=0, f(1)=1$</span></li>...
recurrence relation recursion discrete mathematics
1
How to solve F(n)=F(n-1)+F(n-2)+f(n) recursive function? -- (recurrence relation recursion discrete mathematics) <p>Like in the title the following equation:</p>&#xA;<ol>&#xA;<li><span class="math-container">$F(n)=F(n-1)+F(n-2)+f(n)$</span>, with <span class="math-container">$F(0)=0, F(1)=1$</span></li>&#xA;<li><span c...
habedi/stack-exchange-dataset
101,228
Smallest possible sorting network for given permutation
<p>I need to build a sorting (comparator) network using comparators for a specific permutation on a set <span class="math-container">$x_1, \dots, x_n$</span>. The solution should not be a general sorting network that sorts every permutation. I should build the smallest possible sorting network for the given permutation...
algorithms sorting
1
Smallest possible sorting network for given permutation -- (algorithms sorting) <p>I need to build a sorting (comparator) network using comparators for a specific permutation on a set <span class="math-container">$x_1, \dots, x_n$</span>. The solution should not be a general sorting network that sorts every permutation...
habedi/stack-exchange-dataset
101,241
Undirected graph with exponential number of simple cycles
<p>Hey I am new to graph theory and this question has me stuck for hours.</p>&#xA;&#xA;<p>What is an example of undirected graph with n nodes where the number of simple cycles is exponential in n.</p>&#xA;&#xA;<p>I was looking at complete graphs, but here's the catch: the total number of edges should be in theta of n.<...
algorithms graphs
1
Undirected graph with exponential number of simple cycles -- (algorithms graphs) <p>Hey I am new to graph theory and this question has me stuck for hours.</p>&#xA;&#xA;<p>What is an example of undirected graph with n nodes where the number of simple cycles is exponential in n.</p>&#xA;&#xA;<p>I was looking at complete ...
habedi/stack-exchange-dataset
101,245
Sorting in a Priority Queue
<p>Does a priority queue <code>Queue&lt;K,V&gt;</code> always sort its elements based on the value of each element or its key?</p>&#xA;&#xA;<p>I know than the priority in the queue is based on the key, and that the element with the highest priority has the minimal key (Correct me if I am wrong) But I am not sure about ...
algorithms data structures sorting priority queues
1
Sorting in a Priority Queue -- (algorithms data structures sorting priority queues) <p>Does a priority queue <code>Queue&lt;K,V&gt;</code> always sort its elements based on the value of each element or its key?</p>&#xA;&#xA;<p>I know than the priority in the queue is based on the key, and that the element with the high...
habedi/stack-exchange-dataset
101,261
Optimality of A* search
<p>I use the A* search algorithm to to search for the shortest path from S to G.<br>&#xA;The evaluation function is <span class="math-container">$f(n) = g(n) + h(n)$</span>. </p>&#xA;&#xA;<p>Since node A and B have the same estimated total cost, I choose to go node A.Then, the <span class="math-container">$f(n)$</span...
search algorithms artificial intelligence
1
Optimality of A* search -- (search algorithms artificial intelligence) <p>I use the A* search algorithm to to search for the shortest path from S to G.<br>&#xA;The evaluation function is <span class="math-container">$f(n) = g(n) + h(n)$</span>. </p>&#xA;&#xA;<p>Since node A and B have the same estimated total cost, I ...
habedi/stack-exchange-dataset
101,269
How to minimize the average distance between pumps and cities?
<p>There are <code>n</code> cities [1, 2, 3, .... n] and <code>k</code> available pumps. These pumps can be installed in <code>k</code> cities. The cities are all in a straight line.</p>&#xA;&#xA;<p>How do I need to install these so that the <em>average distance between the cities and the nearest pumps</em> is minimize...
algorithms dynamic programming
1
How to minimize the average distance between pumps and cities? -- (algorithms dynamic programming) <p>There are <code>n</code> cities [1, 2, 3, .... n] and <code>k</code> available pumps. These pumps can be installed in <code>k</code> cities. The cities are all in a straight line.</p>&#xA;&#xA;<p>How do I need to insta...
habedi/stack-exchange-dataset
101,270
Clarify the steps: what happened in this mathematical modelling of TSP?
<p>Source: <a href="http://examples.gurobi.com/traveling-salesman-problem" rel="nofollow noreferrer">http://examples.gurobi.com/traveling-salesman-problem</a></p>&#xA;&#xA;<p>I don't get this part: (look at the source)</p>&#xA;&#xA;<blockquote>&#xA; <p><span class="math-container">$$\sum_{i,j\in\{1,2,3\},i\neq j} x_{i...
traveling salesman notation
1
Clarify the steps: what happened in this mathematical modelling of TSP? -- (traveling salesman notation) <p>Source: <a href="http://examples.gurobi.com/traveling-salesman-problem" rel="nofollow noreferrer">http://examples.gurobi.com/traveling-salesman-problem</a></p>&#xA;&#xA;<p>I don't get this part: (look at the sour...
habedi/stack-exchange-dataset
101,291
How does hashed inverted page table work?
<p>I understand hash function and inverted page table, but then the book I read describes something called hashed inverted page table (use hash to accelerate the finding because IPT is large), with TLB used. I don't understand why there is an arrow point to itself inside the hash table? Could anyone explain the mechani...
operating systems memory management hash tables paging
1
How does hashed inverted page table work? -- (operating systems memory management hash tables paging) <p>I understand hash function and inverted page table, but then the book I read describes something called hashed inverted page table (use hash to accelerate the finding because IPT is large), with TLB used. I don't un...
habedi/stack-exchange-dataset
101,293
Why is Byzantine Generals Problem with traitors possible?
<p>My question is what makes the Byzantine Generals Problem possible to solve in some cases where traitors exist, for example in the case where there are 4 generals with 1 traitor?</p>&#xA;&#xA;<p>If the generals must either all attack or all retreat at the same time, then surely the traitorous general can simply say "...
byzantine
1
Why is Byzantine Generals Problem with traitors possible? -- (byzantine) <p>My question is what makes the Byzantine Generals Problem possible to solve in some cases where traitors exist, for example in the case where there are 4 generals with 1 traitor?</p>&#xA;&#xA;<p>If the generals must either all attack or all retr...
habedi/stack-exchange-dataset
101,309
How does this use of "apply" in Coq work?
<p>I'm working my way through <a href="https://softwarefoundations.cis.upenn.edu/" rel="nofollow noreferrer">software foundations</a>. In the Chapter titled "Tactics", I'm able to prove this theorem in Coq:</p>&#xA;&#xA;<blockquote>&#xA;<pre><code>Theorem silly_ex :&#xA; (∀ n, evenb n = true → oddb (S n) = true) →&...
coq
1
How does this use of "apply" in Coq work? -- (coq) <p>I'm working my way through <a href="https://softwarefoundations.cis.upenn.edu/" rel="nofollow noreferrer">software foundations</a>. In the Chapter titled "Tactics", I'm able to prove this theorem in Coq:</p>&#xA;&#xA;<blockquote>&#xA;<pre><code>Theorem silly_ex :&#x...
habedi/stack-exchange-dataset
101,311
What is the meaning of max() in intro. to algorithms?
<p>I'm reading chapter 3(growth functions) of CLRS and in giving an example of proving theta for a standard quadratic function the book gives the following value for <span class="math-container">$n_0 = 2 \cdot max(|b|/a, \sqrt{|c|/a})$</span> .</p>&#xA;&#xA;<p>I'm confused regarding what <strong>"max"</strong> means in...
time complexity terminology notation
1
What is the meaning of max() in intro. to algorithms? -- (time complexity terminology notation) <p>I'm reading chapter 3(growth functions) of CLRS and in giving an example of proving theta for a standard quadratic function the book gives the following value for <span class="math-container">$n_0 = 2 \cdot max(|b|/a, \sq...
habedi/stack-exchange-dataset
101,312
Compute the general time complexity of a merge sort algorithm with specified complexity of the merge process
<p>The problem was from an exam, I spent much time wrapping my head up around this kind of problems, so I decided to ask for help ;(</p>&#xA;&#xA;<p>Problem:</p>&#xA;&#xA;<p>We implement a merge sort algorithm to sort <span class="math-container">$n$</span> items. The algorithm will divide the set into 2 roughly equal-...
time complexity discrete mathematics mergesort
1
Compute the general time complexity of a merge sort algorithm with specified complexity of the merge process -- (time complexity discrete mathematics mergesort) <p>The problem was from an exam, I spent much time wrapping my head up around this kind of problems, so I decided to ask for help ;(</p>&#xA;&#xA;<p>Problem:</...
habedi/stack-exchange-dataset
101,316
Relation between Undecidable problems and NP-Hard
<p><a href="https://i.stack.imgur.com/CLN0H.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CLN0H.png" alt="enter image description here"></a></p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/M4SOD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/M4SOD.png" alt="enter image description here"></a></...
complexity theory computability undecidability np hard
1
Relation between Undecidable problems and NP-Hard -- (complexity theory computability undecidability np hard) <p><a href="https://i.stack.imgur.com/CLN0H.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CLN0H.png" alt="enter image description here"></a></p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/M4SOD....
habedi/stack-exchange-dataset
101,324
O(·) is not a function, so how can a function be equal to it?
<p>I totally understand what big <span class="math-container">$O$</span> notation means. My issue is when we say <span class="math-container">$T(n)=O(f(n))$</span> , where <span class="math-container">$T(n)$</span> is running time of an algorithm on input of size <span class="math-container">$n$</span>.</p>&#xA;&#xA;<p...
asymptotics landau notation notation
1
O(·) is not a function, so how can a function be equal to it? -- (asymptotics landau notation notation) <p>I totally understand what big <span class="math-container">$O$</span> notation means. My issue is when we say <span class="math-container">$T(n)=O(f(n))$</span> , where <span class="math-container">$T(n)$</span> i...
habedi/stack-exchange-dataset
101,328
Let $f(n)=\Omega(n), g(n)=O(n)$ and $h(n)=\theta(n)$ then $f(n).g(n)+h(n)$ is?
<p>Let <span class="math-container">$f(n)=\Omega(n), g(n)=O(n)$</span> and <span class="math-container">$h(n)=\theta(n)$</span> then <span class="math-container">$f(n).g(n)+h(n)$</span> is?</p>&#xA;&#xA;<p><strong>My attempt:</strong></p>&#xA;&#xA;<p>Lets <span class="math-container">$f(n)=g(n)=n$</span>, then <span cl...
asymptotics
1
Let $f(n)=\Omega(n), g(n)=O(n)$ and $h(n)=\theta(n)$ then $f(n).g(n)+h(n)$ is? -- (asymptotics) <p>Let <span class="math-container">$f(n)=\Omega(n), g(n)=O(n)$</span> and <span class="math-container">$h(n)=\theta(n)$</span> then <span class="math-container">$f(n).g(n)+h(n)$</span> is?</p>&#xA;&#xA;<p><strong>My attempt...
habedi/stack-exchange-dataset
101,331
Mean geodesic distance between two points in Delaunay Graph
<p>If I have a Delaunay Graph, what is the mean geodesic distance between two randomly chosen nodes.&#xA;I know that in a small world network, it is in O(log(N)), with N being the number of nodes.</p>&#xA;&#xA;<p>Thank you!</p>&#xA;
graphs
1
Mean geodesic distance between two points in Delaunay Graph -- (graphs) <p>If I have a Delaunay Graph, what is the mean geodesic distance between two randomly chosen nodes.&#xA;I know that in a small world network, it is in O(log(N)), with N being the number of nodes.</p>&#xA;&#xA;<p>Thank you!</p>&#xA;
habedi/stack-exchange-dataset
101,338
Understanding access and insertion time of arrays
<p>Why do most implementations of arrays have constant access time and linear insertion time?</p>&#xA;
data structures
1
Understanding access and insertion time of arrays -- (data structures) <p>Why do most implementations of arrays have constant access time and linear insertion time?</p>&#xA;
habedi/stack-exchange-dataset
101,343
Is it possible to write a program that calculates an algorithm's time complexity?
<p>Title is self explanatory.</p>&#xA;&#xA;<p>I have searched here on this site and haven't found any discussion about this.</p>&#xA;&#xA;<p>Is it somehow related to Turing's Halting problem (which is undecidable)?</p>&#xA;
algorithms complexity theory halting problem
1
Is it possible to write a program that calculates an algorithm's time complexity? -- (algorithms complexity theory halting problem) <p>Title is self explanatory.</p>&#xA;&#xA;<p>I have searched here on this site and haven't found any discussion about this.</p>&#xA;&#xA;<p>Is it somehow related to Turing's Halting probl...
habedi/stack-exchange-dataset
101,359
What is the computational complexity of intuitionistic propositional logic?
<p>Consider the decision problem: given formulas of propositional logic <span class="math-container">$\phi_1, \ldots, \phi_n, \psi$</span>, determine whether <span class="math-container">$\phi_1, \ldots, \phi_n \vdash \psi$</span> intuitionistically. This problem is well-known to be decidable, for example using an alg...
complexity theory propositional logic
1
What is the computational complexity of intuitionistic propositional logic? -- (complexity theory propositional logic) <p>Consider the decision problem: given formulas of propositional logic <span class="math-container">$\phi_1, \ldots, \phi_n, \psi$</span>, determine whether <span class="math-container">$\phi_1, \ldot...
habedi/stack-exchange-dataset
101,364
Determine wether a set of sets contains a partition of a given set
<p>Consider the following problem :</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a set of sets of integers, <span class="math-container">$\Sigma = \{S_i, i \in I\}$</span>, and a set G, determine wether <span class="math-container">$\Sigma$</span> contains a partition of G, i.e. a set <span class="math-container">$J \subse...
complexity theory
1
Determine wether a set of sets contains a partition of a given set -- (complexity theory) <p>Consider the following problem :</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a set of sets of integers, <span class="math-container">$\Sigma = \{S_i, i \in I\}$</span>, and a set G, determine wether <span class="math-container">$\...
habedi/stack-exchange-dataset
101,369
Determining a value in an algorithm on its first run
<p>I was given the following algorithm as a solution to one of my problems.&#xA;However, I am baffled at understanding how c' is ever initialized. The first if statement can never be reached, as c' is never set the first time. Can someone explain this to me? Am I just missing where c' gets set?</p>&#xA;&#xA;<p>This is ...
algorithms algorithm analysis approximation
1
Determining a value in an algorithm on its first run -- (algorithms algorithm analysis approximation) <p>I was given the following algorithm as a solution to one of my problems.&#xA;However, I am baffled at understanding how c' is ever initialized. The first if statement can never be reached, as c' is never set the fir...
habedi/stack-exchange-dataset
101,371
Approximation factor shorthand clarification
<p>I'm starting to dabble in the world of approximation algorithms and had a question about the convention many papers will use when talking about the <em>approximation factor</em>. I know that an approximation factor will give the factor within which the algorithm will perform with respect to the optimal solution. Thi...
algorithms algorithm analysis approximation
1
Approximation factor shorthand clarification -- (algorithms algorithm analysis approximation) <p>I'm starting to dabble in the world of approximation algorithms and had a question about the convention many papers will use when talking about the <em>approximation factor</em>. I know that an approximation factor will giv...
habedi/stack-exchange-dataset
101,384
Must $x$ and $y$ be different in a statement of the form $\forall x \forall y \cdots$?
<p>Given the following predicate formula <span class="math-container">$F$</span>:</p>&#xA;&#xA;<p><span class="math-container">$$\forall x \forall y [(\text{italian}(x) \Rightarrow (\text{winWC}(y) \Rightarrow \text{happy}(x))]$$</span></p>&#xA;&#xA;<p>I am having trouble understanding whether <span class="math-contain...
logic first order logic predicate logic
1
Must $x$ and $y$ be different in a statement of the form $\forall x \forall y \cdots$? -- (logic first order logic predicate logic) <p>Given the following predicate formula <span class="math-container">$F$</span>:</p>&#xA;&#xA;<p><span class="math-container">$$\forall x \forall y [(\text{italian}(x) \Rightarrow (\text{...
habedi/stack-exchange-dataset
101,404
Balanced based representation
<p>I'm interested in balanced base <span class="math-container">$B$</span> representation for fixed point arithmetic. The paper <em>Fixed-point arithmetic in SHE schemes</em> (Costache, Smart, Vivek and Waller, in <em>Proceedings of 23rd International Conference on Selected Areas in Cryptography (SAC 2016)</em>, Spring...
numeral representations
1
Balanced based representation -- (numeral representations) <p>I'm interested in balanced base <span class="math-container">$B$</span> representation for fixed point arithmetic. The paper <em>Fixed-point arithmetic in SHE schemes</em> (Costache, Smart, Vivek and Waller, in <em>Proceedings of 23rd International Conferenc...
habedi/stack-exchange-dataset
101,409
How to decrease the confidence of a Monte Carlo algorithm in its answer?
<p>Recall that a Monte Carlo algorithm is <span class="math-container">$p$</span>-correct if it outputs a correct answer with probability at least <span class="math-container">$p$</span>. In the case of decision problems, where the answer is binary, repeating the MC algorithm can increase the confidence that a correct ...
monte carlo
1
How to decrease the confidence of a Monte Carlo algorithm in its answer? -- (monte carlo) <p>Recall that a Monte Carlo algorithm is <span class="math-container">$p$</span>-correct if it outputs a correct answer with probability at least <span class="math-container">$p$</span>. In the case of decision problems, where th...
habedi/stack-exchange-dataset
101,410
Quotient in LOOP program
<p>I want to construct a LOOP-computable program for the integer division (quotient): </p>&#xA;&#xA;<p>x = a DIV b</p>&#xA;&#xA;<p>The LOOP specification can be seen here: <a href="https://en.wikipedia.org/wiki/LOOP_(programming_language)" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/LOOP_(programming_langua...
turing machines computability loops primitive recursion
1
Quotient in LOOP program -- (turing machines computability loops primitive recursion) <p>I want to construct a LOOP-computable program for the integer division (quotient): </p>&#xA;&#xA;<p>x = a DIV b</p>&#xA;&#xA;<p>The LOOP specification can be seen here: <a href="https://en.wikipedia.org/wiki/LOOP_(programming_langu...
habedi/stack-exchange-dataset
101,415
what is a shearlet/shearlet transform and how can i use it?
<p>from what wikipedia says <a href="https://en.wikipedia.org/wiki/Shearlet" rel="nofollow noreferrer">shearlet</a> is a successor to wavelets(whatever that is) and that they are extremely good at representing complicated data efficiently. But neither wikipedia nor other articles that i found have any layman definition...
approximation data compression
1
what is a shearlet/shearlet transform and how can i use it? -- (approximation data compression) <p>from what wikipedia says <a href="https://en.wikipedia.org/wiki/Shearlet" rel="nofollow noreferrer">shearlet</a> is a successor to wavelets(whatever that is) and that they are extremely good at representing complicated da...
habedi/stack-exchange-dataset
101,416
Complexity of a set partition derived problem
<p>I am stuck at the complexity of the following problem:&#xA;Given a multiset <span class="math-container">$S = \{x_1,..., x_n\}$</span> of <span class="math-container">$n$</span> integers and a natural number <span class="math-container">$k$</span>. Can <span class="math-container">$S$</span> be partitioned into mult...
complexity theory partitions
1
Complexity of a set partition derived problem -- (complexity theory partitions) <p>I am stuck at the complexity of the following problem:&#xA;Given a multiset <span class="math-container">$S = \{x_1,..., x_n\}$</span> of <span class="math-container">$n$</span> integers and a natural number <span class="math-container">...
habedi/stack-exchange-dataset
101,418
Big O analysis trying to follow a logic
<p>Can someone please help me understand why(the derivation) "<strong>and m = 2n+1 for each n.</strong>"?&#xA;I am trying to follow the logic of the solution provide while myself have a different approach. Here is my thinking (questions state below):</p>&#xA;&#xA;<p>The inner for loop runs m times from 1 and the outer ...
complexity theory algorithm analysis asymptotics
1
Big O analysis trying to follow a logic -- (complexity theory algorithm analysis asymptotics) <p>Can someone please help me understand why(the derivation) "<strong>and m = 2n+1 for each n.</strong>"?&#xA;I am trying to follow the logic of the solution provide while myself have a different approach. Here is my thinking ...
habedi/stack-exchange-dataset
101,420
Modular exponentiation in P
<p>I need to prove that the following language is in <span class="math-container">$\mathsf{P}$</span>:&#xA;<span class="math-container">$$ L = \{\langle x,y,z,d \rangle : xˆy \equiv z \pmod{d}\}.$$</span></p>&#xA;&#xA;<p>I'm assuming I just have to prove with an algorithm or negate that it's part of NP. But I don't kno...
complexity theory number theory
1
Modular exponentiation in P -- (complexity theory number theory) <p>I need to prove that the following language is in <span class="math-container">$\mathsf{P}$</span>:&#xA;<span class="math-container">$$ L = \{\langle x,y,z,d \rangle : xˆy \equiv z \pmod{d}\}.$$</span></p>&#xA;&#xA;<p>I'm assuming I just have to prove ...
habedi/stack-exchange-dataset
101,421
Can product DFA for intersection of two disjoint languages be minimal?
<p>I know that it isn't necessary that cross product automaton for two minimal DFAs be minimal, but according to my analysis, if two DFAs do not have any common string then their cross product of minimal DFAs would be minimal. What should I do to prove this?</p>&#xA;
finite automata
1
Can product DFA for intersection of two disjoint languages be minimal? -- (finite automata) <p>I know that it isn't necessary that cross product automaton for two minimal DFAs be minimal, but according to my analysis, if two DFAs do not have any common string then their cross product of minimal DFAs would be minimal. W...
habedi/stack-exchange-dataset
101,424
Multiple rounds of bipartite matching problem
<p>I have a set of investors (say n), and a set of startups (say m). At the start, I have all the investors say either yes or no to the startup (which corresponds to whether they want to interact with them or not). </p>&#xA;&#xA;<p>Now, I have to conduct a networking event of r rounds considering this scenario. In each...
graphs bipartite matching
1
Multiple rounds of bipartite matching problem -- (graphs bipartite matching) <p>I have a set of investors (say n), and a set of startups (say m). At the start, I have all the investors say either yes or no to the startup (which corresponds to whether they want to interact with them or not). </p>&#xA;&#xA;<p>Now, I have...
habedi/stack-exchange-dataset
101,448
Can two free variables in lambda calculus have different values?
<p>I am studying lambda calculus for the first time and I was trying to do the reduction beta of the lambda term <span class="math-container">$(\lambda x.xy)y$</span>. Can I assume that these two free variables <span class="math-container">$y$</span> are the same? Or do I need to rename the rightmost <span class="math-...
lambda calculus
1
Can two free variables in lambda calculus have different values? -- (lambda calculus) <p>I am studying lambda calculus for the first time and I was trying to do the reduction beta of the lambda term <span class="math-container">$(\lambda x.xy)y$</span>. Can I assume that these two free variables <span class="math-conta...
habedi/stack-exchange-dataset
101,450
Parser theory: How to systematically compute FOLLOW sets?
<p>Forgive me for my ignorance as I am self-teaching myself some of this theory... I am having some trouble understanding how to systematically/algorithmically compute FOLLOW sets, given that I have computed the FIRST sets. </p>&#xA;&#xA;<p>For the following grammar:</p>&#xA;&#xA;<pre><code>E -&gt; TE'&#xA;E' -&gt; +TE...
compilers sets parsers syntax
1
Parser theory: How to systematically compute FOLLOW sets? -- (compilers sets parsers syntax) <p>Forgive me for my ignorance as I am self-teaching myself some of this theory... I am having some trouble understanding how to systematically/algorithmically compute FOLLOW sets, given that I have computed the FIRST sets. </p...
habedi/stack-exchange-dataset
101,451
Quick Sort - First Element As Pivot
<p>I'm studying Quick-Sort and I am confused as to how it works when the first element is chosen as the pivot point.</p>&#xA;&#xA;<p>I am trying to trace the first step in the Quick-Sort algorithm, to move the pivot (15) into its appropriate position.</p>&#xA;&#xA;<p>Example: [15, -7, 22, 7, 21, 34, -13, 19]</p>&#xA;&#...
sorting quicksort
1
Quick Sort - First Element As Pivot -- (sorting quicksort) <p>I'm studying Quick-Sort and I am confused as to how it works when the first element is chosen as the pivot point.</p>&#xA;&#xA;<p>I am trying to trace the first step in the Quick-Sort algorithm, to move the pivot (15) into its appropriate position.</p>&#xA;&...
habedi/stack-exchange-dataset
101,461
Representing chained XOR operations as linear inequalities
<p>I'm trying to solve an integer linear program (ILP) in which a constraint of the following kind must be met:</p>&#xA;&#xA;<p><span class="math-container">$x_1 \oplus x_2 \oplus \cdots \oplus x_n = 1$</span> </p>&#xA;&#xA;<p>where <span class="math-container">$\oplus$</span> is the binary <em>xor</em> operator.</p>&#...
boolean algebra linear algebra integer programming xor
1
Representing chained XOR operations as linear inequalities -- (boolean algebra linear algebra integer programming xor) <p>I'm trying to solve an integer linear program (ILP) in which a constraint of the following kind must be met:</p>&#xA;&#xA;<p><span class="math-container">$x_1 \oplus x_2 \oplus \cdots \oplus x_n = 1...
habedi/stack-exchange-dataset
101,463
Determining properties of linear code from generator matrix
<p>I have a problem in error-correcting codes.</p>&#xA;&#xA;<p>Say we have a generator matrix of a linear binary code</p>&#xA;&#xA;<p><span class="math-container">$$g=\begin{pmatrix}&#xA;10011 \\&#xA;01101&#xA;\end{pmatrix}&#xA;$$</span></p>&#xA;&#xA;<blockquote>&#xA; <p>Q1: How many different codeword do we have? How...
error correcting codes
1
Determining properties of linear code from generator matrix -- (error correcting codes) <p>I have a problem in error-correcting codes.</p>&#xA;&#xA;<p>Say we have a generator matrix of a linear binary code</p>&#xA;&#xA;<p><span class="math-container">$$g=\begin{pmatrix}&#xA;10011 \\&#xA;01101&#xA;\end{pmatrix}&#xA;$$</...
habedi/stack-exchange-dataset
101,465
Are non-regular languages decidable?
<p>Given a language L, I've shown that L is not regular. Can I conclude that it is not decidable or are there non-regular languages that are decidable? </p>&#xA;
computability
1
Are non-regular languages decidable? -- (computability) <p>Given a language L, I've shown that L is not regular. Can I conclude that it is not decidable or are there non-regular languages that are decidable? </p>&#xA;
habedi/stack-exchange-dataset
101,471
Language that fulfills pumping lemma but is not in RE
<p>I am supposed to find a language <span class="math-container">$$L\subseteq \Sigma ^*, \Sigma \subseteq \mathbb{N}$$</span> that fullfills the pumping lemma and is not in RE and not in coRE. I've never constructed a language with a given constraint, I've only shown that a certain language satisfies a given one. Not w...
formal languages computability pumping lemma
1
Language that fulfills pumping lemma but is not in RE -- (formal languages computability pumping lemma) <p>I am supposed to find a language <span class="math-container">$$L\subseteq \Sigma ^*, \Sigma \subseteq \mathbb{N}$$</span> that fullfills the pumping lemma and is not in RE and not in coRE. I've never constructed ...
habedi/stack-exchange-dataset
101,473
Prove complement a^nb^nc^n is contextfree
<p>So the complement of L1 = {<span class="math-container">$a^{n}b^{n}c^{n}$</span> | n <span class="math-container">$\geq$</span> 1} would be L2 = {a,b,c}* \ {<span class="math-container">$a^{n}b^{n}c^{n}$</span> | n <span class="math-container">$\geq$</span> 1}.</p>&#xA;&#xA;<p>In other words, any combinations of a,b...
context free formal grammars
1
Prove complement a^nb^nc^n is contextfree -- (context free formal grammars) <p>So the complement of L1 = {<span class="math-container">$a^{n}b^{n}c^{n}$</span> | n <span class="math-container">$\geq$</span> 1} would be L2 = {a,b,c}* \ {<span class="math-container">$a^{n}b^{n}c^{n}$</span> | n <span class="math-containe...
habedi/stack-exchange-dataset
101,476
Avoiding overflow in computing the ratio of two large numbers
<p>Is there a trick for computing the expression &#xA;<span class="math-container">$x + (exp(x)-x)/(exp(2*x) + 1)$</span> while avoiding an overflow? &#xA;Currently, computation seems to fail for any <span class="math-container">$x \geq 710$</span>, presumably because computing <span class="math-container">$exp(2*x)$</...
numerical analysis
1
Avoiding overflow in computing the ratio of two large numbers -- (numerical analysis) <p>Is there a trick for computing the expression &#xA;<span class="math-container">$x + (exp(x)-x)/(exp(2*x) + 1)$</span> while avoiding an overflow? &#xA;Currently, computation seems to fail for any <span class="math-container">$x \g...
habedi/stack-exchange-dataset
101,486
Variant of interval scheduling (multiple machines with given availability)
<p>I am looking for an algorithm to solve the following variant of interval scheduling : schedule some tasks on multiple machines, which are only available during a given interval of time. Two tasks cannot be performed at the same time by the same machine. I am trying to maximize the number of scheduled tasks. </p>&#x...
algorithms combinatorics scheduling
1
Variant of interval scheduling (multiple machines with given availability) -- (algorithms combinatorics scheduling) <p>I am looking for an algorithm to solve the following variant of interval scheduling : schedule some tasks on multiple machines, which are only available during a given interval of time. Two tasks canno...
habedi/stack-exchange-dataset
101,503
Do these answers work even when we change the values?
<p>So I know that these are both true, but if I change the values would they still be true? Do these statements hold for any value?</p>&#xA;&#xA;<p>A) Suppose f is a flow of value 50 from s to t in a flow network G. The capacity of the minimum s-t cut in G is equal to 50. </p>&#xA;&#xA;<p>Suppose we were using 100 or m...
graphs network flow
1
Do these answers work even when we change the values? -- (graphs network flow) <p>So I know that these are both true, but if I change the values would they still be true? Do these statements hold for any value?</p>&#xA;&#xA;<p>A) Suppose f is a flow of value 50 from s to t in a flow network G. The capacity of the minim...
habedi/stack-exchange-dataset
101,505
How to count stores in cache analysis of matrix multiplication
<p>I'm trying to understand cache misses/iter and came across this that I couldn't understand or reason out. </p>&#xA;&#xA;<p>For <strong>ijk</strong> iteration, my slides say that there are 2 loads and 0 stores.</p>&#xA;&#xA;<pre><code>for (i=0; i&lt;n; i++) {&#xA; for (j=0; j&lt;n; j++) {&#xA; sum = 0.0;&#xA; fo...
computer architecture arrays cpu cache matrix
1
How to count stores in cache analysis of matrix multiplication -- (computer architecture arrays cpu cache matrix) <p>I'm trying to understand cache misses/iter and came across this that I couldn't understand or reason out. </p>&#xA;&#xA;<p>For <strong>ijk</strong> iteration, my slides say that there are 2 loads and 0 s...
habedi/stack-exchange-dataset
101,511
Why are threads called the unit of dispatch?
<p>Threads called the "unit of dispatch" but what does that mean? I was looking over the web and two operating systems books but I can't find the answer. It seems that processes are defined by two characteristics: resource ownership and scheduling/execution. I understand that threads are within processes, and that ther...
operating systems process scheduling threads
1
Why are threads called the unit of dispatch? -- (operating systems process scheduling threads) <p>Threads called the "unit of dispatch" but what does that mean? I was looking over the web and two operating systems books but I can't find the answer. It seems that processes are defined by two characteristics: resource ow...
habedi/stack-exchange-dataset
101,518
Running time in FPT
<p>For a certain parameter <span class="math-container">$k$</span>, is the algorithm with the running time of <span class="math-container">$O(k.n^{\log{n}})$</span> in class <span class="math-container">$FPT$</span>? I would appreciate if you can kindly guide me through.</p>&#xA;
algorithms complexity theory
1
Running time in FPT -- (algorithms complexity theory) <p>For a certain parameter <span class="math-container">$k$</span>, is the algorithm with the running time of <span class="math-container">$O(k.n^{\log{n}})$</span> in class <span class="math-container">$FPT$</span>? I would appreciate if you can kindly guide me thr...
habedi/stack-exchange-dataset
101,521
How to maintain completely dynamic convex hull quickly?
<p>If there's no deletion, we can use <span class="math-container">$2$</span> balanced trees to maintain <span class="math-container">$2$</span> half convex hulls(up and down). In this way, we can insert <span class="math-container">$n$</span> points in <span class="math-container">$O(n\log n)$</span> time.(In the begi...
data structures time complexity computational geometry
1
How to maintain completely dynamic convex hull quickly? -- (data structures time complexity computational geometry) <p>If there's no deletion, we can use <span class="math-container">$2$</span> balanced trees to maintain <span class="math-container">$2$</span> half convex hulls(up and down). In this way, we can insert ...
habedi/stack-exchange-dataset
101,524
Why do we have to make variables unique when evaluating $\lambda$-calculus?
<p>I'm studying <span class="math-container">$\lambda$</span>-calculus and came across a problem that I'm not sure how to understand. More specifically, it's about evaluating <span class="math-container">$\lambda$</span>-calculus expressions using <span class="math-container">$\beta$</span>-reduction.</p>&#xA;<p>I was ...
reductions lambda calculus
1
Why do we have to make variables unique when evaluating $\lambda$-calculus? -- (reductions lambda calculus) <p>I'm studying <span class="math-container">$\lambda$</span>-calculus and came across a problem that I'm not sure how to understand. More specifically, it's about evaluating <span class="math-container">$\lambda...
habedi/stack-exchange-dataset
101,530
Distinct Minimum Weight Spanning Trees
<p>I am trying to find the total number of <strong>distinct minimum weight spanning trees(MWST)</strong> in a simple, undirected, unlabeled and weighted graph but I am confused whether should I have to consider Isomorphic trees(if it is present) as a single minimum weight spanning tree or not while counting the distinc...
algorithms graphs
1
Distinct Minimum Weight Spanning Trees -- (algorithms graphs) <p>I am trying to find the total number of <strong>distinct minimum weight spanning trees(MWST)</strong> in a simple, undirected, unlabeled and weighted graph but I am confused whether should I have to consider Isomorphic trees(if it is present) as a single ...
habedi/stack-exchange-dataset
101,536
What is the point in hashing a value?
<p>I apologise if this is not the right place for this question... I didn't want to ask on Stackoverflow or CodeReview as it will closed in minutes as "too broad".</p>&#xA;&#xA;<p>A client of mine is writing an API that takes a piece of personal-identifying information as the parameter in the URL, and has asked that th...
hash encryption
1
What is the point in hashing a value? -- (hash encryption) <p>I apologise if this is not the right place for this question... I didn't want to ask on Stackoverflow or CodeReview as it will closed in minutes as "too broad".</p>&#xA;&#xA;<p>A client of mine is writing an API that takes a piece of personal-identifying inf...
habedi/stack-exchange-dataset
101,543
Determine whether a system of $n$ linear equations has solutions in $\{0, 1\}^n$ in polynomial time
<p>I'm trying to determine whether it is possible to decide if a system of <span class="math-container">$n$</span> linear equations with integer coefficients and <span class="math-container">$n$</span> variables has a solution in <span class="math-container">$\{0, 1\}^n$</span> in polynomial time.</p>&#xA;&#xA;<p>Addit...
complexity theory time complexity np complete polynomial time
1
Determine whether a system of $n$ linear equations has solutions in $\{0, 1\}^n$ in polynomial time -- (complexity theory time complexity np complete polynomial time) <p>I'm trying to determine whether it is possible to decide if a system of <span class="math-container">$n$</span> linear equations with integer coeffici...
habedi/stack-exchange-dataset
101,556
Every vertex cover is a dominating set
<blockquote>&#xA; <p>Suppose <span class="math-container">$G$</span> is a connected graph and <span class="math-container">$S$</span> is a vertex cover. Prove that <span class="math-container">$S$</span> is also a dominating set.</p>&#xA;</blockquote>&#xA;&#xA;<p>Can I get some help with proving this? I know that a do...
graphs set cover
1
Every vertex cover is a dominating set -- (graphs set cover) <blockquote>&#xA; <p>Suppose <span class="math-container">$G$</span> is a connected graph and <span class="math-container">$S$</span> is a vertex cover. Prove that <span class="math-container">$S$</span> is also a dominating set.</p>&#xA;</blockquote>&#xA;&#...
habedi/stack-exchange-dataset
101,561
Is there a running hash algorithm that can efficiently handle arbitrary updates to a file's contents?
<p>This question is about file-hashing/fingerprinting algorithms (similar to <code>SHA-1</code> and <code>MD5</code> and so on). Those algorithms are handy because they give you a small (and fixed-sized) hash code for any file, which can be later used to efficiently determine if that file is different from another fil...
efficiency hashing
1
Is there a running hash algorithm that can efficiently handle arbitrary updates to a file's contents? -- (efficiency hashing) <p>This question is about file-hashing/fingerprinting algorithms (similar to <code>SHA-1</code> and <code>MD5</code> and so on). Those algorithms are handy because they give you a small (and fi...
habedi/stack-exchange-dataset
101,566
Shortest path with a start vertex that touches all nodes at least once with repeats allowed
<p>I tried looking this problem up for quite a bit now, but can't seem to find a whole lot of discussion about this. At first it sounded like the TSP to me, but I don't think so (it's much harder to do I believe). Maybe I am over thinking this though? I'm not looking for the fastest solution, but I fear a brute-force a...
graphs shortest path graph traversal
1
Shortest path with a start vertex that touches all nodes at least once with repeats allowed -- (graphs shortest path graph traversal) <p>I tried looking this problem up for quite a bit now, but can't seem to find a whole lot of discussion about this. At first it sounded like the TSP to me, but I don't think so (it's mu...
habedi/stack-exchange-dataset
101,570
Is it decidable that a context free language contains a given regular language?
<p>I've been asked to solve this problem, but I'm completely stuck now.</p>&#xA;&#xA;<blockquote>&#xA; <p>Is the set <span class="math-container">$\{G \in\text{CFG} \mid L(G)\supseteq L(A) \}$</span> where A is DFA fixed beforehand decidable? </p>&#xA;</blockquote>&#xA;&#xA;<p>I know I've to find a reduction, and as a...
formal languages context free reductions undecidability decision problem
1
Is it decidable that a context free language contains a given regular language? -- (formal languages context free reductions undecidability decision problem) <p>I've been asked to solve this problem, but I'm completely stuck now.</p>&#xA;&#xA;<blockquote>&#xA; <p>Is the set <span class="math-container">$\{G \in\text{C...
habedi/stack-exchange-dataset
101,575
Does $\Sigma^* \cdot a^nb^n=\Sigma^*$
<p>Is it true to say that <span class="math-container">$\Sigma^* \cdot$</span> {<span class="math-container">$a^nb^n: n&gt;=0$</span>} = <span class="math-container">$\Sigma^*$</span></p>&#xA;&#xA;<p>Becuase if we take <span class="math-container">$\Sigma^*$</span> and concatenate it to {<span class="math-container">...
formal languages
1
Does $\Sigma^* \cdot a^nb^n=\Sigma^*$ -- (formal languages) <p>Is it true to say that <span class="math-container">$\Sigma^* \cdot$</span> {<span class="math-container">$a^nb^n: n&gt;=0$</span>} = <span class="math-container">$\Sigma^*$</span></p>&#xA;&#xA;<p>Becuase if we take <span class="math-container">$\Sigma^*$...
habedi/stack-exchange-dataset
101,589
Does every infinite context free language contain an infinite regular subset?
<p>Can someone explain to me if this is true or not?</p>&#xA;
regular languages context free
1
Does every infinite context free language contain an infinite regular subset? -- (regular languages context free) <p>Can someone explain to me if this is true or not?</p>&#xA;
habedi/stack-exchange-dataset
101,594
if $L_1$ and $L_2$ are languages over the same alphabet and $L_1 \cap L_2$ is context free, at least one of them must be context free
<p>I am having a hard time understanding if this would be true or false, can someone point me in the right direction?</p>&#xA;
regular languages context free closure properties
1
if $L_1$ and $L_2$ are languages over the same alphabet and $L_1 \cap L_2$ is context free, at least one of them must be context free -- (regular languages context free closure properties) <p>I am having a hard time understanding if this would be true or false, can someone point me in the right direction?</p>&#xA;
habedi/stack-exchange-dataset
101,605
Reduce ATM to REGULAR_TM
<p>Consider <span class="math-container">$\mathsf{REGULAR_{TM}} = \{\langle M \rangle \mid \text{$M$ is a TM and $L(M)$ is a regular language}\}$</span>.</p>&#xA;<p>Let <span class="math-container">$S$</span> be the following algorithm, which solves <span class="math-container">$\mathsf{A_{TM}}$</span>: “On input <span...
turing machines computability reductions undecidability
1
Reduce ATM to REGULAR_TM -- (turing machines computability reductions undecidability) <p>Consider <span class="math-container">$\mathsf{REGULAR_{TM}} = \{\langle M \rangle \mid \text{$M$ is a TM and $L(M)$ is a regular language}\}$</span>.</p>&#xA;<p>Let <span class="math-container">$S$</span> be the following algorith...
habedi/stack-exchange-dataset
101,609
Karp reduction from NP-hard problem to unknown problem
<p>If I know that problem <span class="math-container">$A$</span> is NP-hard, but know nothing of problem <span class="math-container">$B$</span> and I know that the following Karp reduction is true:</p>&#xA;&#xA;<p><span class="math-container">$$A \to B \, .$$</span></p>&#xA;&#xA;<p>Is it correct to conclude that <spa...
reductions np hard
1
Karp reduction from NP-hard problem to unknown problem -- (reductions np hard) <p>If I know that problem <span class="math-container">$A$</span> is NP-hard, but know nothing of problem <span class="math-container">$B$</span> and I know that the following Karp reduction is true:</p>&#xA;&#xA;<p><span class="math-contain...
habedi/stack-exchange-dataset
101,616
How to analyze the worst case of weighted quick-union method on union-find
<p>Here is exercise 1.5.15 in <em>Algorithms</em> 4th Edition by Robert Sedgewick and Kevin Wayne.</p>&#xA;&#xA;<blockquote>&#xA; <p>Show that the number of nodes at each level in the worst-case trees for weighted quick-union are binomial coefficients. Compute the average depth of a node in a worst-case tree with <spa...
algorithms data structures union find
1
How to analyze the worst case of weighted quick-union method on union-find -- (algorithms data structures union find) <p>Here is exercise 1.5.15 in <em>Algorithms</em> 4th Edition by Robert Sedgewick and Kevin Wayne.</p>&#xA;&#xA;<blockquote>&#xA; <p>Show that the number of nodes at each level in the worst-case trees ...
habedi/stack-exchange-dataset
101,617
Few questions about Mergesort and Recirsion algorithms
<ol>&#xA;<li>Can we use recursive algorithm to find the greatest element of a finite list when numbers are unsorted. </li>&#xA;<li>How to use recursive algorithm to find the least element of a finite list of unsorted numbers where repetitions of number is allowed.</li>&#xA;<li>How can Mergesort calls itself n^2 times o...
algorithm analysis sorting recursion
1
Few questions about Mergesort and Recirsion algorithms -- (algorithm analysis sorting recursion) <ol>&#xA;<li>Can we use recursive algorithm to find the greatest element of a finite list when numbers are unsorted. </li>&#xA;<li>How to use recursive algorithm to find the least element of a finite list of unsorted number...
habedi/stack-exchange-dataset
101,620
Normal form of relation R
<p>It is given that for a relation R all the attributes of the relation appear in some of the candidate keys. It is also given that there is only one compound candidate key which exists for a relation, all the other candidate keys are simple candidate keys. What can be said about the normal form of R?</p>&#xA;&#xA;<p>I...
database theory normal forms relational algebra relational calculus
1
Normal form of relation R -- (database theory normal forms relational algebra relational calculus) <p>It is given that for a relation R all the attributes of the relation appear in some of the candidate keys. It is also given that there is only one compound candidate key which exists for a relation, all the other candi...
habedi/stack-exchange-dataset
101,629
Regular expression over alphabet A = {0 , 1, 2} for words that contain at least one 0 and don't contain 11
<p>I got that I can get (1) followed by not (1) like this &#xA;<span class="math-container">$$ (0+2)^*1(0+2)^* $$</span>&#xA;From this point I'm actually stuck. I can't set the (0) to be somewhere in expression. The only expressions I get are ambiguous (where I can get the same word different ways from regex) and quite...
regular expressions
1
Regular expression over alphabet A = {0 , 1, 2} for words that contain at least one 0 and don't contain 11 -- (regular expressions) <p>I got that I can get (1) followed by not (1) like this &#xA;<span class="math-container">$$ (0+2)^*1(0+2)^* $$</span>&#xA;From this point I'm actually stuck. I can't set the (0) to be s...
habedi/stack-exchange-dataset
101,635
Number of contiguous subsequences summing to a given target
<p>I could not figure out an efficient way (better than <span class="math-container">$O(n^2)$</span>) to count the number of contiguous subsequences of an array of both positive and negative integers summing up to a given number <span class="math-container">$k$</span>.</p>&#xA;&#xA;<p>For example, if <span class="math-...
data structures dynamic programming subsequences
1
Number of contiguous subsequences summing to a given target -- (data structures dynamic programming subsequences) <p>I could not figure out an efficient way (better than <span class="math-container">$O(n^2)$</span>) to count the number of contiguous subsequences of an array of both positive and negative integers summin...
habedi/stack-exchange-dataset
101,637
Dijkstra’s shortest path algorithm
<p>I'm learning about <strong>single source shortest path algorithms</strong> and need to clarify few doubts-</p>&#xA;&#xA;<ol>&#xA;<li>Does Dijkstra’s assumes that the weights of edges in a graph searched by it are positive integers.</li>&#xA;<li>Does Dijkstra’s assumes that the graph searched by it is free of cycles....
algorithms algorithm analysis shortest path
1
Dijkstra’s shortest path algorithm -- (algorithms algorithm analysis shortest path) <p>I'm learning about <strong>single source shortest path algorithms</strong> and need to clarify few doubts-</p>&#xA;&#xA;<ol>&#xA;<li>Does Dijkstra’s assumes that the weights of edges in a graph searched by it are positive integers.</...
habedi/stack-exchange-dataset
101,646
Is $L = a^{n}b^{n+m}c^{m} | n,m \geq 0$ a context free or a recursive language?
<p>My initial thought is that L can't be context free since I can use the pumping lemma. I also don't think a grammar can be generated since it needs to keep track of the number of c's and a's. However, I'm having a hard time coming up with an algorithm for this language.</p>&#xA;
context free
1
Is $L = a^{n}b^{n+m}c^{m} | n,m \geq 0$ a context free or a recursive language? -- (context free) <p>My initial thought is that L can't be context free since I can use the pumping lemma. I also don't think a grammar can be generated since it needs to keep track of the number of c's and a's. However, I'm having a hard t...
habedi/stack-exchange-dataset
101,652
Boolean Functions Implemented by Multiplexers
<p>Electrical engineers often use multiplexers to implement Boolean functions. What is the correct technical term for this model of computation? Is it Decision Tree model or is there another name?</p>&#xA;
reference request
1
Boolean Functions Implemented by Multiplexers -- (reference request) <p>Electrical engineers often use multiplexers to implement Boolean functions. What is the correct technical term for this model of computation? Is it Decision Tree model or is there another name?</p>&#xA;
habedi/stack-exchange-dataset
101,654
Is the set of context free grammars that generate all words in co-RE?
<p>Is <span class="math-container">$\{\langle G \rangle | L(G) = \sum^{\star}\}$</span> in co-RE? <span class="math-container">$\langle G \rangle$</span> is the encoding of a context free grammar. My intuition is that this is false.</p>&#xA;
formal languages turing machines context free semi decidability
1
Is the set of context free grammars that generate all words in co-RE? -- (formal languages turing machines context free semi decidability) <p>Is <span class="math-container">$\{\langle G \rangle | L(G) = \sum^{\star}\}$</span> in co-RE? <span class="math-container">$\langle G \rangle$</span> is the encoding of a contex...
habedi/stack-exchange-dataset
101,663
Is this a valid induction proof example ?
<p>Learning induction proof now, found a "simple" example, which is a bit confusing to me (not sure if it is a valid example). If so, why the IH(&#xA;suppose a root of rank k has at least <span class="math-container">$2^k$</span> vertices in its tree&#xA;)is a valid one since it just repeating the statement that we a...
proof techniques correctness proof induction
1
Is this a valid induction proof example ? -- (proof techniques correctness proof induction) <p>Learning induction proof now, found a "simple" example, which is a bit confusing to me (not sure if it is a valid example). If so, why the IH(&#xA;suppose a root of rank k has at least <span class="math-container">$2^k$</sp...
habedi/stack-exchange-dataset
101,670
Lambda Calculus - Call-by-name AND call-by-value reduction
<p>I have been tasked with reducing the following lambda expression:</p>&#xA;&#xA;<blockquote>&#xA; <p>(λpq.pqp)(λab.a)(λab.b)</p>&#xA;</blockquote>&#xA;&#xA;<p>using call-by-name and call-by-value reduction strategies.</p>&#xA;&#xA;<p><strong>Call-by-name</strong></p>&#xA;&#xA;<p>strategy: Left-most, outermost redex ...
turing machines lambda calculus
1
Lambda Calculus - Call-by-name AND call-by-value reduction -- (turing machines lambda calculus) <p>I have been tasked with reducing the following lambda expression:</p>&#xA;&#xA;<blockquote>&#xA; <p>(λpq.pqp)(λab.a)(λab.b)</p>&#xA;</blockquote>&#xA;&#xA;<p>using call-by-name and call-by-value reduction strategies.</p>...
habedi/stack-exchange-dataset
101,673
Dependency on adjacent blocks decreases as block count increases
<p>The following is an excerpt from <em>Information Theory: A Tutorial Introduction</em>, page 65.</p>&#xA;<blockquote>&#xA;<p>Now, supposing the identity of each letter in English does not depend&#xA;on any letter that is more than 10 letters away. In practice, the&#xA;dependency between letters diminishes rapidly as ...
information theory entropy
1
Dependency on adjacent blocks decreases as block count increases -- (information theory entropy) <p>The following is an excerpt from <em>Information Theory: A Tutorial Introduction</em>, page 65.</p>&#xA;<blockquote>&#xA;<p>Now, supposing the identity of each letter in English does not depend&#xA;on any letter that is ...
habedi/stack-exchange-dataset
101,681
What is the difference between "information model" and "conceptual model"?
<p>I am trying to figure out the difference between <strong>information</strong> and <strong>conceptual models</strong>. For me, both terms seem to mean be the same, but I cannot find a reference where this is established. They are never used together; maybe because they are from different domains?</p>&#xA;&#xA;<p>My q...
modelling
1
What is the difference between "information model" and "conceptual model"? -- (modelling) <p>I am trying to figure out the difference between <strong>information</strong> and <strong>conceptual models</strong>. For me, both terms seem to mean be the same, but I cannot find a reference where this is established. They ar...
habedi/stack-exchange-dataset
101,682
Which one of these two sets is computably enumerable?
<p>M is a turing machine description, L(M) is recognized by M, |L(M)| is the size of this language.</p>&#xA;&#xA;<ol>&#xA;<li><p>{M : |L(M)| &lt;= 330}</p></li>&#xA;<li><p>{M : |L(M)| >= 330}</p></li>&#xA;</ol>&#xA;&#xA;<p>I don't quite understand what this question is asking. Does the first question mean M accepts at...
turing machines computability enumeration
1
Which one of these two sets is computably enumerable? -- (turing machines computability enumeration) <p>M is a turing machine description, L(M) is recognized by M, |L(M)| is the size of this language.</p>&#xA;&#xA;<ol>&#xA;<li><p>{M : |L(M)| &lt;= 330}</p></li>&#xA;<li><p>{M : |L(M)| >= 330}</p></li>&#xA;</ol>&#xA;&#xA...
habedi/stack-exchange-dataset
101,685
Finding the longest path in an undirected node-weighted tree
<p>I have a tree where each node is assigned a weight (a real number that can be positive or negative). I need an algorithm to find a simple path of maximum total weight (that is, a simple path where the sum of the weights of the nodes in the path is maximum). There's no restriction on what node the path starts or ends...
algorithms graphs
1
Finding the longest path in an undirected node-weighted tree -- (algorithms graphs) <p>I have a tree where each node is assigned a weight (a real number that can be positive or negative). I need an algorithm to find a simple path of maximum total weight (that is, a simple path where the sum of the weights of the nodes ...
habedi/stack-exchange-dataset
101,686
Sorting n element using Fibonacci Heap
<p>How can I design a sorting algorithm of n elements using a Fibonacci Heap?</p>&#xA;&#xA;<p>Will it be a flavoured version of heap-sort where I replace the heap data-structure with Fibonacci Heap?</p>&#xA;&#xA;<p>Your help is appreciated</p>&#xA;
sorting heaps
1
Sorting n element using Fibonacci Heap -- (sorting heaps) <p>How can I design a sorting algorithm of n elements using a Fibonacci Heap?</p>&#xA;&#xA;<p>Will it be a flavoured version of heap-sort where I replace the heap data-structure with Fibonacci Heap?</p>&#xA;&#xA;<p>Your help is appreciated</p>&#xA;
habedi/stack-exchange-dataset
101,689
How to give a context free grammar for any given language ie: a^n (ba)^m a^n
<p>i am trying to understand Context free grammar and generate a CFG for any given language. </p>&#xA;&#xA;<p>when you're given a language , what is the best way to generate a CFG from it? are there any steps to follow to help you create a CFG for any language? is there ways of breaking down the language to make it sim...
context free
1
How to give a context free grammar for any given language ie: a^n (ba)^m a^n -- (context free) <p>i am trying to understand Context free grammar and generate a CFG for any given language. </p>&#xA;&#xA;<p>when you're given a language , what is the best way to generate a CFG from it? are there any steps to follow to hel...
habedi/stack-exchange-dataset
101,693
Some explanations needed about Negation in Gentzen's Natural Deduction rules
<p>I'm beginning to have an understanding thanks to some videos relating to "Proposition as Types". But, I don't come from a theoretical CS background, so maybe I'm blocked probably a bit by notation...</p>&#xA;&#xA;<p>Given that I have understood, Conjunction, Disjunction, Implication, </p>&#xA;&#xA;<p>I'm stumbling o...
natural deduction
1
Some explanations needed about Negation in Gentzen's Natural Deduction rules -- (natural deduction) <p>I'm beginning to have an understanding thanks to some videos relating to "Proposition as Types". But, I don't come from a theoretical CS background, so maybe I'm blocked probably a bit by notation...</p>&#xA;&#xA;<p>G...
habedi/stack-exchange-dataset
101,703
Resource Reservation: No Greedy Approach?
<p>I'm considering the general resource reservation problem: n processes, m resources. Each process requests a set of resources and each resource can be used by exactly one process. Processes are only active if they have all requested resources.</p>&#xA;&#xA;<p>Instance: A set of processes P, a set of resources R, the ...
graphs np complete reductions
1
Resource Reservation: No Greedy Approach? -- (graphs np complete reductions) <p>I'm considering the general resource reservation problem: n processes, m resources. Each process requests a set of resources and each resource can be used by exactly one process. Processes are only active if they have all requested resource...
habedi/stack-exchange-dataset
101,712
Write a routine to print the numbers 1 to 6 and back to 1 again without using any loops
<p>Can anyone help with this question? I currently have this solution that prints </p>&#xA;&#xA;<blockquote>&#xA; <p>1 2 3 4 5 6</p>&#xA;</blockquote>&#xA;&#xA;<p>but I'm having trouble going back down to 1.</p>&#xA;&#xA;<pre><code>public class noLoop{&#xA;&#xA; public static void main(String []args){&#xA; ...
recursion java
1
Write a routine to print the numbers 1 to 6 and back to 1 again without using any loops -- (recursion java) <p>Can anyone help with this question? I currently have this solution that prints </p>&#xA;&#xA;<blockquote>&#xA; <p>1 2 3 4 5 6</p>&#xA;</blockquote>&#xA;&#xA;<p>but I'm having trouble going back down to 1.</p>...
habedi/stack-exchange-dataset