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
92,452
Does This Prove $P \neq NP$? (Randomly Populated Binary Tree)
<p>Suppose a binary tree with $n$ levels and exactly $2^n-1$ nodes. </p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/JDhE2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JDhE2.png" alt=""></a></p>&#xA;&#xA;<p>The nodes are random and their value does not determine their position in the tree at al...
complexity theory
1
Does This Prove $P \neq NP$? (Randomly Populated Binary Tree) -- (complexity theory) <p>Suppose a binary tree with $n$ levels and exactly $2^n-1$ nodes. </p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/JDhE2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JDhE2.png" alt=""></a></p>&#xA;&#xA;<p>The...
habedi/stack-exchange-dataset
92,466
Uniform sampling with constraints
<p>Suppose one wants to uniformly sample a string $w$ of a given length over a finite alphabet, such $w$ satisfies a set of structural constraints (such as - "the third character has to be equal to the first character and the last character has to be equal to the second one").<br>&#xA;The obvious method is to uniformly...
probability theory probabilistic algorithms sampling
1
Uniform sampling with constraints -- (probability theory probabilistic algorithms sampling) <p>Suppose one wants to uniformly sample a string $w$ of a given length over a finite alphabet, such $w$ satisfies a set of structural constraints (such as - "the third character has to be equal to the first character and the la...
habedi/stack-exchange-dataset
92,472
High-level requirements for a Proof of "Saving to the Database"
<p>This question is about a few sentence description of what a proof would look like (and technologies / logics involved) for a complex api call through many layers. Trying to get a sense of the techniques and key points to watch out for. I understand it would take a lot of work.</p>&#xA;&#xA;<p>In learning about forma...
proof techniques formal methods software verification
1
High-level requirements for a Proof of "Saving to the Database" -- (proof techniques formal methods software verification) <p>This question is about a few sentence description of what a proof would look like (and technologies / logics involved) for a complex api call through many layers. Trying to get a sense of the te...
habedi/stack-exchange-dataset
92,478
What the State is, and Where it comes from, when Generating Reachability Graphs
<p>For <a href="https://en.wikipedia.org/wiki/Timed_automaton" rel="nofollow noreferrer">Timed Automata</a>, I found <a href="ftp://ftp.cis.upenn.edu/pub/rtg/public_html/papers/issta96.pdf" rel="nofollow noreferrer">Figure 1</a> below. For <a href="https://en.wikipedia.org/wiki/Coloured_Petri_net" rel="nofollow norefer...
graphs automata model checking software verification petri nets
1
What the State is, and Where it comes from, when Generating Reachability Graphs -- (graphs automata model checking software verification petri nets) <p>For <a href="https://en.wikipedia.org/wiki/Timed_automaton" rel="nofollow noreferrer">Timed Automata</a>, I found <a href="ftp://ftp.cis.upenn.edu/pub/rtg/public_html/p...
habedi/stack-exchange-dataset
92,479
Print all subsets of a set ($a$) of $n$ positive integers, such that the product of their elements equals $p$
<p>I have the following problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a set <em>a</em> of <em>n</em> positive integers, write a <em>backtracking</em> C function that prints out all the subsets of <em>a</em> such that the product of their elements is <em>p</em>. Use an array for implementation of the set. What is th...
sets backtracking
1
Print all subsets of a set ($a$) of $n$ positive integers, such that the product of their elements equals $p$ -- (sets backtracking) <p>I have the following problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a set <em>a</em> of <em>n</em> positive integers, write a <em>backtracking</em> C function that prints out all th...
habedi/stack-exchange-dataset
92,480
Huffman Coding - probabilities
<p>I am having trouble understanding a question related to Huffman Coding. We haven't studied it a lot, so I am not even sure how to start.</p>&#xA;&#xA;<p>Given $n ≥ 2$ characters, with probabilities $p_{1} \geq p_{2} \geq ... \geq p_{n}$ Let $p_{i} = 2^{k_{i}}$ with $k_{i} \in \mathbb{N}$ and $\sum_{i=1}^{n} p_{i} = ...
huffman coding
1
Huffman Coding - probabilities -- (huffman coding) <p>I am having trouble understanding a question related to Huffman Coding. We haven't studied it a lot, so I am not even sure how to start.</p>&#xA;&#xA;<p>Given $n ≥ 2$ characters, with probabilities $p_{1} \geq p_{2} \geq ... \geq p_{n}$ Let $p_{i} = 2^{k_{i}}$ with ...
habedi/stack-exchange-dataset
92,484
Difference between dynamic loading and dynamic linking in the OS
<p>First of all, I saw many answers of this topic in Quora, Stackoverflow, and this site. But, I couldn't definitely understand the difference between dynamic loading and dynamic linking.</p>&#xA;<p>What I understood until now is this.</p>&#xA;<blockquote>&#xA;<p><strong>Dynamic loading</strong> : system library or oth...
operating systems compilers
1
Difference between dynamic loading and dynamic linking in the OS -- (operating systems compilers) <p>First of all, I saw many answers of this topic in Quora, Stackoverflow, and this site. But, I couldn't definitely understand the difference between dynamic loading and dynamic linking.</p>&#xA;<p>What I understood until...
habedi/stack-exchange-dataset
92,485
How to prove $c = a + b$ using Program Verification Techniques
<p>I am trying to prove an elementary thing, but it seems at some point you get down to <em>atoms</em> where you can't prove anything else. This is why I am wondering about proving $c = a + b$, it seems like an atom.</p>&#xA;&#xA;<p>\begin{align}&#xA; \{a, b\}\\&#xA; c = a + b\\&#xA; \{a, b, c = a + b\}&#xA;\end{ali...
hoare logic
1
How to prove $c = a + b$ using Program Verification Techniques -- (hoare logic) <p>I am trying to prove an elementary thing, but it seems at some point you get down to <em>atoms</em> where you can't prove anything else. This is why I am wondering about proving $c = a + b$, it seems like an atom.</p>&#xA;&#xA;<p>\begin{...
habedi/stack-exchange-dataset
92,496
Proving that DFA equivalence is decidable
<p>The following question is taken from Sipser:</p>&#xA;&#xA;<blockquote>&#xA; <p>Prove that $EQ_{\mathsf{DFA}}$ is decidable by testing the two DFAs on all strings up to a certain size. Calculate a size that works.</p>&#xA;</blockquote>&#xA;&#xA;<p>Here is the answer:</p>&#xA;&#xA;<blockquote>&#xA; <p>For any DFAs $...
complexity theory turing machines computability undecidability
1
Proving that DFA equivalence is decidable -- (complexity theory turing machines computability undecidability) <p>The following question is taken from Sipser:</p>&#xA;&#xA;<blockquote>&#xA; <p>Prove that $EQ_{\mathsf{DFA}}$ is decidable by testing the two DFAs on all strings up to a certain size. Calculate a size that ...
habedi/stack-exchange-dataset
92,502
In lieu of neural networks and deep learning, what are some approaches to computer vision?
<p>So much software related to computer vision relies on AI and neural networks, I wonder some of the approaches which <em>don't</em> use those methods. How could some of the mainstays of computer vision (eg. recognition and identification) be achieved without "artificial" means?</p>&#xA;&#xA;<p>I'm reading <em>Vision<...
computer vision human computing bio inspired computing
1
In lieu of neural networks and deep learning, what are some approaches to computer vision? -- (computer vision human computing bio inspired computing) <p>So much software related to computer vision relies on AI and neural networks, I wonder some of the approaches which <em>don't</em> use those methods. How could some o...
habedi/stack-exchange-dataset
92,503
How strong "Consistent Guessing Problem" is?
<p>I saw "Rosser’s Theorem via Turing machines" at:</p>&#xA;&#xA;<p><a href="https://www.scottaaronson.com/blog/?p=710" rel="nofollow noreferrer">https://www.scottaaronson.com/blog/?p=710</a></p>&#xA;&#xA;<p>The modified halting problem (Consistent Guessing Problem) CGP is used in the proof:</p>&#xA;&#xA;<pre><code>CGP...
halting problem
1
How strong "Consistent Guessing Problem" is? -- (halting problem) <p>I saw "Rosser’s Theorem via Turing machines" at:</p>&#xA;&#xA;<p><a href="https://www.scottaaronson.com/blog/?p=710" rel="nofollow noreferrer">https://www.scottaaronson.com/blog/?p=710</a></p>&#xA;&#xA;<p>The modified halting problem (Consistent Guess...
habedi/stack-exchange-dataset
92,511
What is a not-well-founded cotree?
<p>I'm reading the paper "Dual of substitution is Redecoration".&#xA;And I'm struggling with understanding the usage of the word "not-well-founded cotrees".</p>&#xA;&#xA;<ol>&#xA;<li>what is a cotree compared to a tree ? I suspect it is a tree for which all relations are inverted, but it is just my assumption.</li>&#xA...
trees category theory duality
1
What is a not-well-founded cotree? -- (trees category theory duality) <p>I'm reading the paper "Dual of substitution is Redecoration".&#xA;And I'm struggling with understanding the usage of the word "not-well-founded cotrees".</p>&#xA;&#xA;<ol>&#xA;<li>what is a cotree compared to a tree ? I suspect it is a tree for wh...
habedi/stack-exchange-dataset
92,522
Why Does the Fixed Point Theorem Apply to Quines?
<p>A quine is a program that outputs its own source code without taking in any input. An example would be this (taken from <a href="https://gist.github.com/benjholla/9dd76ca9269e8c9af99a" rel="noreferrer">here</a>)</p>&#xA;&#xA;<pre><code>public class Quine {&#xA; public static void main(String[] args) {&#xA; ...
fixed point
1
Why Does the Fixed Point Theorem Apply to Quines? -- (fixed point) <p>A quine is a program that outputs its own source code without taking in any input. An example would be this (taken from <a href="https://gist.github.com/benjholla/9dd76ca9269e8c9af99a" rel="noreferrer">here</a>)</p>&#xA;&#xA;<pre><code>public class Q...
habedi/stack-exchange-dataset
92,525
How to prove a side effect in a function
<p>I asked a question earlier about <a href="https://cs.stackexchange.com/questions/92472/high-level-requirements-for-a-proof-of-saving-to-the-database">Saving to the Database</a>, which was very general and about the requirements for a proof when you go through many layers of non-verified systems such as the network a...
proof techniques simulation model checking hoare logic
1
How to prove a side effect in a function -- (proof techniques simulation model checking hoare logic) <p>I asked a question earlier about <a href="https://cs.stackexchange.com/questions/92472/high-level-requirements-for-a-proof-of-saving-to-the-database">Saving to the Database</a>, which was very general and about the r...
habedi/stack-exchange-dataset
92,526
How does pre-training help with semantic segmentation with U-net
<p>I am working with a u-net, a variation of the more commonly known fully convolutional network for semantic segmentation. For training a u-net, I was given the suggestion that I should use a pre-trained network. But, I'm not quite sure how this makes sense. </p>&#xA;&#xA;<p>My understanding is, in pre-training, we fr...
neural networks
1
How does pre-training help with semantic segmentation with U-net -- (neural networks) <p>I am working with a u-net, a variation of the more commonly known fully convolutional network for semantic segmentation. For training a u-net, I was given the suggestion that I should use a pre-trained network. But, I'm not quite s...
habedi/stack-exchange-dataset
92,528
The halting problem for laymen
<p>This line from <a href="https://en.wikipedia.org/wiki/Termination_analysis" rel="nofollow noreferrer">Wikipedia</a> made me want to ask this question:</p>&#xA;&#xA;<blockquote>&#xA; <p>There is, however, no general procedure for determining whether an expression involving looping instructions will halt, even when h...
halting problem
1
The halting problem for laymen -- (halting problem) <p>This line from <a href="https://en.wikipedia.org/wiki/Termination_analysis" rel="nofollow noreferrer">Wikipedia</a> made me want to ask this question:</p>&#xA;&#xA;<blockquote>&#xA; <p>There is, however, no general procedure for determining whether an expression i...
habedi/stack-exchange-dataset
92,536
Do you have to do reduction both ways to prove a problem is NPC?
<p>Also, what's the difference between transforming a problem into another problem and doing a reduction? They sound synonymous to me. Thank you!</p>&#xA;
np complete reductions
1
Do you have to do reduction both ways to prove a problem is NPC? -- (np complete reductions) <p>Also, what's the difference between transforming a problem into another problem and doing a reduction? They sound synonymous to me. Thank you!</p>&#xA;
habedi/stack-exchange-dataset
92,542
If A is reducible to B and B is reducible to A, and A is NPC, is B also NPC?
<p>I was thinking about the max-clique problem and the k-independent set problem. You can show that k-independent set is reducible to max-clique easily and you can show that max-clique is reducible to k-independent set (with a simple for loop). And k-independent set is NPC, so wouldn't that mean max-clique is also NPC,...
complexity theory reductions
1
If A is reducible to B and B is reducible to A, and A is NPC, is B also NPC? -- (complexity theory reductions) <p>I was thinking about the max-clique problem and the k-independent set problem. You can show that k-independent set is reducible to max-clique easily and you can show that max-clique is reducible to k-indepe...
habedi/stack-exchange-dataset
92,554
Strassen's algorithm on unit vectors?
<p>I am trying to do a dot product of two vectors of each 128 dimension. I am just looping each member and calculating the sum.</p>&#xA;&#xA;<pre><code>public Double dotProduct(List&lt;Double&gt; v, List&lt;Double&gt; u) {&#xA; Double dotProduct = 0;&#xA; for (int i = 0; i &lt; 128; i++) {&#xA; dotProduct ...
optimization matrices linear algebra
1
Strassen's algorithm on unit vectors? -- (optimization matrices linear algebra) <p>I am trying to do a dot product of two vectors of each 128 dimension. I am just looping each member and calculating the sum.</p>&#xA;&#xA;<pre><code>public Double dotProduct(List&lt;Double&gt; v, List&lt;Double&gt; u) {&#xA; Double do...
habedi/stack-exchange-dataset
92,568
LPA* implementation keeps looping
<h3>Short story</h3>&#xA;&#xA;<p>I am currently trying to implement LPA* in an existing navigation system and find the algorithm seems to loop forever, expanding the same vertices over and over again. I am wondering what is causing this to happen, and what I can do to rectify this.</p>&#xA;&#xA;<h3>Long story</h3>&#xA;...
algorithms graphs shortest path
1
LPA* implementation keeps looping -- (algorithms graphs shortest path) <h3>Short story</h3>&#xA;&#xA;<p>I am currently trying to implement LPA* in an existing navigation system and find the algorithm seems to loop forever, expanding the same vertices over and over again. I am wondering what is causing this to happen, a...
habedi/stack-exchange-dataset
92,580
Is there an efficient algorithm for WEAK-PARTITION?
<p>Suppose that we are given a list of non-zero integers $(a_1,...,a_n)$ and we want to decide whether there exist $(x_1,...,x_n)$ such that</p>&#xA;&#xA;<p>$x_1a_1 + x_2a_2 + ... + x_na_n = 0$,</p>&#xA;&#xA;<p>$x_i$ $\in$ $\{-1,0,1\}$, with at least one $x_i \neq$ 0.</p>&#xA;&#xA;<p>Note that this is not the same as P...
partitions
1
Is there an efficient algorithm for WEAK-PARTITION? -- (partitions) <p>Suppose that we are given a list of non-zero integers $(a_1,...,a_n)$ and we want to decide whether there exist $(x_1,...,x_n)$ such that</p>&#xA;&#xA;<p>$x_1a_1 + x_2a_2 + ... + x_na_n = 0$,</p>&#xA;&#xA;<p>$x_i$ $\in$ $\{-1,0,1\}$, with at least o...
habedi/stack-exchange-dataset
92,583
Finding independent set of size n in an undirected graph
<p>Is there an algorithm that, given an undirected graph, finds an independent set of size n (where n is less than or equal to the total number of vertices)? </p>&#xA;
graphs
1
Finding independent set of size n in an undirected graph -- (graphs) <p>Is there an algorithm that, given an undirected graph, finds an independent set of size n (where n is less than or equal to the total number of vertices)? </p>&#xA;
habedi/stack-exchange-dataset
92,584
Does selecting the same arm has the same reward?
<p>In multi-armed bandit problem, we have a set of $K$ arms. In each round $t$, a bandit selects an arm $k$ and receives a reward $r_{kt}$. The objective is to maximize the rewards after $T$ rounds.</p>&#xA;&#xA;<p>My question: Does selecting the same arm in two different rounds leads to the same reward? Or the rewards...
machine learning learning theory
1
Does selecting the same arm has the same reward? -- (machine learning learning theory) <p>In multi-armed bandit problem, we have a set of $K$ arms. In each round $t$, a bandit selects an arm $k$ and receives a reward $r_{kt}$. The objective is to maximize the rewards after $T$ rounds.</p>&#xA;&#xA;<p>My question: Does ...
habedi/stack-exchange-dataset
92,587
Any proof of correctness of the Toom-Cook algorithm?
<p>I found the toom-cook algorithm here: <a href="http://www.cs.cmu.edu/~ab/Desktop/15-211%20Archive/res00037/Multiplication_1_print.pdf" rel="nofollow noreferrer">http://www.cs.cmu.edu/~ab/Desktop/15-211%20Archive/res00037/Multiplication_1_print.pdf</a></p>&#xA;&#xA;<p>and have been trying to chase down proof of it be...
algorithms correctness proof
1
Any proof of correctness of the Toom-Cook algorithm? -- (algorithms correctness proof) <p>I found the toom-cook algorithm here: <a href="http://www.cs.cmu.edu/~ab/Desktop/15-211%20Archive/res00037/Multiplication_1_print.pdf" rel="nofollow noreferrer">http://www.cs.cmu.edu/~ab/Desktop/15-211%20Archive/res00037/Multiplic...
habedi/stack-exchange-dataset
92,591
Determining whether the language of a DFA is closed under reversal
<p>The question and its answer is given below:</p>&#xA;<blockquote>&#xA;<p>Let <span class="math-container">$S = \{ \langle M \rangle \mid \text{$M$ is a $\textsf{DFA}$ that accepts $w^{\mathcal{R}}$ whenever it accepts $w$}\}$</span>. Show that <span class="math-container">$S$</span> is decidable.</p>&#xA;<p><strong>A...
turing machines computability
1
Determining whether the language of a DFA is closed under reversal -- (turing machines computability) <p>The question and its answer is given below:</p>&#xA;<blockquote>&#xA;<p>Let <span class="math-container">$S = \{ \langle M \rangle \mid \text{$M$ is a $\textsf{DFA}$ that accepts $w^{\mathcal{R}}$ whenever it accept...
habedi/stack-exchange-dataset
92,596
Relative order of values and weights in Knapsack
<p>In knapsack problem, we have some items with some values and weights. We also have a knapsack with a specific capacity, and we intend to fill the knapsack with these items. The main objective of this problem is to maximize the value of items in the knapsack. </p>&#xA;&#xA;<p>Knapsack can contain maximum 11 kg items<...
knapsack problems
1
Relative order of values and weights in Knapsack -- (knapsack problems) <p>In knapsack problem, we have some items with some values and weights. We also have a knapsack with a specific capacity, and we intend to fill the knapsack with these items. The main objective of this problem is to maximize the value of items in ...
habedi/stack-exchange-dataset
92,607
How to count number of 1s of the first k positions in a bitset (bitmap)?
<p><strong>Input</strong>: Given a bitset $b$, which is is an array of 0s and 1s, of length $L$, and a positive integer $k$.</p>&#xA;&#xA;<p><strong>Output</strong>: the total number of 1s in the first $k$ position of $b$.</p>&#xA;&#xA;<p>Obviously it can be done in $O(k)$, is there any more efficient way in C++ such a...
counting bit manipulation c++
1
How to count number of 1s of the first k positions in a bitset (bitmap)? -- (counting bit manipulation c++) <p><strong>Input</strong>: Given a bitset $b$, which is is an array of 0s and 1s, of length $L$, and a positive integer $k$.</p>&#xA;&#xA;<p><strong>Output</strong>: the total number of 1s in the first $k$ positi...
habedi/stack-exchange-dataset
92,612
Ensure groups of four 3-tuples have 9 unique numbers
<p>Note: I know the numbers are arbitrary, but this problem about this size has practical implications. It is an applied algorithm problem.</p>&#xA;&#xA;<p>Suppose you have 200 bins. Each bin would be very happy to have the integer sequence: 1, 2, 3, 4, 5, 6, 7, 8, 9. And the algorithm would be very happy if all bins g...
approximation set cover
1
Ensure groups of four 3-tuples have 9 unique numbers -- (approximation set cover) <p>Note: I know the numbers are arbitrary, but this problem about this size has practical implications. It is an applied algorithm problem.</p>&#xA;&#xA;<p>Suppose you have 200 bins. Each bin would be very happy to have the integer sequen...
habedi/stack-exchange-dataset
92,618
In a bloom filter, why does the optimal number of hashes *increase* with the number of bits in the filter?
<p>Multiple resources, such as <a href="https://en.wikipedia.org/wiki/Bloom_filter#Optimal_number_of_hash_functions" rel="noreferrer">Wikipedia</a>, state that if you have an $m$-bit Bloom filter with $n$ elements inserted, then the optimal number $k$ of hash functions to use is</p>&#xA;&#xA;<p>$k = \frac{m}{n} \ln 2$<...
bloom filters
1
In a bloom filter, why does the optimal number of hashes *increase* with the number of bits in the filter? -- (bloom filters) <p>Multiple resources, such as <a href="https://en.wikipedia.org/wiki/Bloom_filter#Optimal_number_of_hash_functions" rel="noreferrer">Wikipedia</a>, state that if you have an $m$-bit Bloom filte...
habedi/stack-exchange-dataset
92,620
How to keep track of changes done to concurrent stacks?
<p>I am writing a small RPN calculator that works on some stacks concurrently. For example, if I have two functions:</p>&#xA;&#xA;<pre><code>add-int(a: int, b: int): a b +&#xA;add-float(a: float, b: float): a b +&#xA;</code></pre>&#xA;&#xA;<p>and I have two stacks with the following:</p>&#xA;&#xA;<pre><code>Int [1 2 3]...
concurrency memory management stacks
1
How to keep track of changes done to concurrent stacks? -- (concurrency memory management stacks) <p>I am writing a small RPN calculator that works on some stacks concurrently. For example, if I have two functions:</p>&#xA;&#xA;<pre><code>add-int(a: int, b: int): a b +&#xA;add-float(a: float, b: float): a b +&#xA;</cod...
habedi/stack-exchange-dataset
92,624
Time Complexity of Basic Primality Test Algorithm
<p>The algorithm I'm referring to is one of the most fundamental primality checks: For a number, $n$, check if it is divisible by some odd number, $k$, less than or equal to $\sqrt{n}$. Assume $n$ is a fixed size and that all basic arithmetic operations (add, subtract, multiply, divide, remainder) run in $O(1)$. I don'...
runtime analysis
1
Time Complexity of Basic Primality Test Algorithm -- (runtime analysis) <p>The algorithm I'm referring to is one of the most fundamental primality checks: For a number, $n$, check if it is divisible by some odd number, $k$, less than or equal to $\sqrt{n}$. Assume $n$ is a fixed size and that all basic arithmetic opera...
habedi/stack-exchange-dataset
92,627
DFA impossible problem?
<p>As you can see from the title this is the impression that i have on this problem, but probably it isn't impossible.</p>&#xA;&#xA;<p>The required DFA is :</p>&#xA;&#xA;<p>"The set of the strings with equal number of 0 and 1 such that for each prefix the difference between the number of 0's and the number of 1's is mi...
automata finite automata
1
DFA impossible problem? -- (automata finite automata) <p>As you can see from the title this is the impression that i have on this problem, but probably it isn't impossible.</p>&#xA;&#xA;<p>The required DFA is :</p>&#xA;&#xA;<p>"The set of the strings with equal number of 0 and 1 such that for each prefix the difference...
habedi/stack-exchange-dataset
92,629
Find largest subset of vertices in graph so that every pair of vertices have an edge between them
<p>Let's say you have a graph like this:</p>&#xA;&#xA;<h2><a href="https://i.stack.imgur.com/gRddi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gRddi.png" alt="example"></a></h2>&#xA;&#xA;<p>The largest subset of nodes so that every pair of vertices have an edge between them is $\{3, 5, 7, 12\}$. ...
graphs
1
Find largest subset of vertices in graph so that every pair of vertices have an edge between them -- (graphs) <p>Let's say you have a graph like this:</p>&#xA;&#xA;<h2><a href="https://i.stack.imgur.com/gRddi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gRddi.png" alt="example"></a></h2>&#xA;&#xA;...
habedi/stack-exchange-dataset
92,634
Time complexity of sum of $2^n$ values of polynomials
<p>First a simpler question: let $q_{1}(k),\dots,q_{n}(k)$ be $n$ polynomials of degree smaller or equal to $n$.</p>&#xA;&#xA;<p>Let $f(n): \mathbb{N} \rightarrow \mathbb{N}$ defined by $f(n) = \sum_{i=1}^{n}q_{i}(n)$.</p>&#xA;&#xA;<p>Assume also $0\leq f_{i}(n)\leq n$.</p>&#xA;&#xA;<p>What is the time complexity as a ...
time complexity polynomial time
1
Time complexity of sum of $2^n$ values of polynomials -- (time complexity polynomial time) <p>First a simpler question: let $q_{1}(k),\dots,q_{n}(k)$ be $n$ polynomials of degree smaller or equal to $n$.</p>&#xA;&#xA;<p>Let $f(n): \mathbb{N} \rightarrow \mathbb{N}$ defined by $f(n) = \sum_{i=1}^{n}q_{i}(n)$.</p>&#xA;&#...
habedi/stack-exchange-dataset
92,640
Polynomial-Time Reduction
<p>I have read many resources, but I cannot understand what the polynomial-time reduction is. In everywhere, this is explained with standard-pattern sentences. </p>&#xA;&#xA;<p>Please can anyone explain it in detailed version ?</p>&#xA;
np complete polynomial time
1
Polynomial-Time Reduction -- (np complete polynomial time) <p>I have read many resources, but I cannot understand what the polynomial-time reduction is. In everywhere, this is explained with standard-pattern sentences. </p>&#xA;&#xA;<p>Please can anyone explain it in detailed version ?</p>&#xA;
habedi/stack-exchange-dataset
92,643
Does a subcubic algorithm exist for the following problem?
<p>Given a symmetric real $n \times n$ matrix $A=(a_{ij})$, is there an algorithm which computes the sum $$\sum_{i,j,k}\max(a_{ij},a_{ik},a_{jk})$$ over all $1\leq i&lt;j&lt;k\leq n$ with time-complexity better than $O(n^3)$?</p>&#xA;
algorithms time complexity
1
Does a subcubic algorithm exist for the following problem? -- (algorithms time complexity) <p>Given a symmetric real $n \times n$ matrix $A=(a_{ij})$, is there an algorithm which computes the sum $$\sum_{i,j,k}\max(a_{ij},a_{ik},a_{jk})$$ over all $1\leq i&lt;j&lt;k\leq n$ with time-complexity better than $O(n^3)$?</p>...
habedi/stack-exchange-dataset
92,648
Context-free grammars for two languages
<p>How do I write context-free grammars for the following languages?</p>&#xA;&#xA;<ol>&#xA;<li>$B_2 = \{0^n1^n \mid n &gt; 0\} \cup \{0^n1^{2n} \mid n &gt; 0\}$</li>&#xA;<li>$B_3 = \{a^nb^mc^k \mid k = n+m\}$</li>&#xA;</ol>&#xA;&#xA;<p>Can someone help me? I'm not sure how to deal with the exponents.</p>&#xA;
formal languages context free formal grammars
1
Context-free grammars for two languages -- (formal languages context free formal grammars) <p>How do I write context-free grammars for the following languages?</p>&#xA;&#xA;<ol>&#xA;<li>$B_2 = \{0^n1^n \mid n &gt; 0\} \cup \{0^n1^{2n} \mid n &gt; 0\}$</li>&#xA;<li>$B_3 = \{a^nb^mc^k \mid k = n+m\}$</li>&#xA;</ol>&#xA;&...
habedi/stack-exchange-dataset
92,658
Are there any known implementations of a functional Heap's Algorithm?
&#xA;&#xA;<p><em>TL;DR</em>: Is an implementation of the <a href="https://en.wikipedia.org/wiki/Heap%27s_algorithm" rel="nofollow noreferrer">Heap's Algorithm</a> adhering to the principals of functional programming possible, and are any implementations of it known? And by "adhering to the principals of functional prog...
functional programming permutations
1
Are there any known implementations of a functional Heap's Algorithm? -- (functional programming permutations) &#xA;&#xA;<p><em>TL;DR</em>: Is an implementation of the <a href="https://en.wikipedia.org/wiki/Heap%27s_algorithm" rel="nofollow noreferrer">Heap's Algorithm</a> adhering to the principals of functional progr...
habedi/stack-exchange-dataset
92,673
I can construct DFA for $a^{3n+1}$ but pumping lemma says it is not regular
<p>Recently I stumbled across this language <span class="math-container">$L=\{a^{n}a^{{(n + 1)}^2-n^2} \in \Sigma^* \mid n\geq 0\}$</span> that I can rewrite as <span class="math-container">$a^{3n + 1}$</span>.</p>&#xA;<p>So I applied the pumping lemma to see if it is non regular, and I get:</p>&#xA;<ul>&#xA;<li>given ...
finite automata pumping lemma
1
I can construct DFA for $a^{3n+1}$ but pumping lemma says it is not regular -- (finite automata pumping lemma) <p>Recently I stumbled across this language <span class="math-container">$L=\{a^{n}a^{{(n + 1)}^2-n^2} \in \Sigma^* \mid n\geq 0\}$</span> that I can rewrite as <span class="math-container">$a^{3n + 1}$</span>...
habedi/stack-exchange-dataset
92,681
Different topologically sorted order based on DFS vertex ordering
<p>The algorithm for topological sort, in CLRS goes as follows :</p>&#xA;&#xA;<ol>&#xA;<li>call DFS(G) to compute finishing times <em>v.f</em> for each vertex <em>v</em></li>&#xA;<li>as each vertex is finished, insert it onto the front of a linked list</li>&#xA;<li>return the linked list of vertices</li>&#xA;</ol>&#xA;...
algorithms graph traversal
1
Different topologically sorted order based on DFS vertex ordering -- (algorithms graph traversal) <p>The algorithm for topological sort, in CLRS goes as follows :</p>&#xA;&#xA;<ol>&#xA;<li>call DFS(G) to compute finishing times <em>v.f</em> for each vertex <em>v</em></li>&#xA;<li>as each vertex is finished, insert it o...
habedi/stack-exchange-dataset
92,682
Comparing nodes in A*
<p>Nodes in the open list in A* will be sorted by their f-cost, but if the f-cost of two nodes are equal, will their h-costs instead be compared? I'm asking because I've seen implementations where the h-costs are compared and where they aren't, so which version is the right one? What is the benefit of doing either?</p>...
shortest path
1
Comparing nodes in A* -- (shortest path) <p>Nodes in the open list in A* will be sorted by their f-cost, but if the f-cost of two nodes are equal, will their h-costs instead be compared? I'm asking because I've seen implementations where the h-costs are compared and where they aren't, so which version is the right one?...
habedi/stack-exchange-dataset
92,683
Subset sum into a consecutive range vs. standard subset sum
<p>The following problems live in integer domain. </p>&#xA;&#xA;<p>I want to find a subset of $\{x_0, x_1, \ldots, x_{n-1}\}$ such that the subset's elements sum to any number in a prescribed interval $[X,X+k]$, $k\geq 1$.</p>&#xA;&#xA;<p>We call the above problem A.</p>&#xA;&#xA;<p>An obvious approach is to solve $k+1...
algorithms combinatorics subset sum
1
Subset sum into a consecutive range vs. standard subset sum -- (algorithms combinatorics subset sum) <p>The following problems live in integer domain. </p>&#xA;&#xA;<p>I want to find a subset of $\{x_0, x_1, \ldots, x_{n-1}\}$ such that the subset's elements sum to any number in a prescribed interval $[X,X+k]$, $k\geq ...
habedi/stack-exchange-dataset
92,692
How many queries does it take to find the best flight?
<p>I often find flights through a search engine like <a href="https://www.google.com/flights" rel="nofollow noreferrer">Google Flights</a>. On input some refined subset of the space of all flights (e.g., non-stop only, departing in the morning, from one of two airports, and on a certain date) the search engine returns ...
algorithms optimization search algorithms
1
How many queries does it take to find the best flight? -- (algorithms optimization search algorithms) <p>I often find flights through a search engine like <a href="https://www.google.com/flights" rel="nofollow noreferrer">Google Flights</a>. On input some refined subset of the space of all flights (e.g., non-stop only,...
habedi/stack-exchange-dataset
92,701
Understanding the Reasoning Behind These Typing Rules
<p>So the expression $\Gamma \ \vdash \ e:\sigma$ states that under assumptions $\Gamma$, the expression $e$ has type $\sigma$. Then we have the following <a href="https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system" rel="nofollow noreferrer">rules</a>:</p>&#xA;&#xA;<p>\begin{array}{cl}\displaystyle {\frac...
type theory notation
1
Understanding the Reasoning Behind These Typing Rules -- (type theory notation) <p>So the expression $\Gamma \ \vdash \ e:\sigma$ states that under assumptions $\Gamma$, the expression $e$ has type $\sigma$. Then we have the following <a href="https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system" rel="nofol...
habedi/stack-exchange-dataset
92,703
The total time require for a pipeline to execute
<p>The book says that a total time required for a pipeline with k stages to execute n instructions is as follows.</p>&#xA;&#xA;<p>$T _{k,n} =[pqnk+(1-pq)(k+n-1)] \tau$</p>&#xA;&#xA;<p>p is the probability of encountering a branch instruction.</p>&#xA;&#xA;<p>q is the probability that execution of a branch instruction ...
cpu pipelines
1
The total time require for a pipeline to execute -- (cpu pipelines) <p>The book says that a total time required for a pipeline with k stages to execute n instructions is as follows.</p>&#xA;&#xA;<p>$T _{k,n} =[pqnk+(1-pq)(k+n-1)] \tau$</p>&#xA;&#xA;<p>p is the probability of encountering a branch instruction.</p>&#xA;...
habedi/stack-exchange-dataset
92,715
Recursive relations in binary trees
<p>I have an exercise in my algorithm's Course for which I have the correction but do not understand it. </p>&#xA;&#xA;<p><strong>1.Exercise</strong> .</p>&#xA;&#xA;<p>Let Th be a full binary three of height h(meaning all the levels all completely full). </p>&#xA;&#xA;<p>(1.a) : Let f(h) be the number of leaves of Th(...
binary trees recursion
1
Recursive relations in binary trees -- (binary trees recursion) <p>I have an exercise in my algorithm's Course for which I have the correction but do not understand it. </p>&#xA;&#xA;<p><strong>1.Exercise</strong> .</p>&#xA;&#xA;<p>Let Th be a full binary three of height h(meaning all the levels all completely full). ...
habedi/stack-exchange-dataset
92,720
Finite state automata: final states
<p>In our programming language concepts course, our instructor claimed that it's okay for a final state to lead to another state in a finite state diagram.</p>&#xA;&#xA;<p>But this seems to be a fundamentally contradictory concept. Because a final state by definition is one that terminates transitions, i.e., that once ...
formal languages graphs regular languages finite automata
1
Finite state automata: final states -- (formal languages graphs regular languages finite automata) <p>In our programming language concepts course, our instructor claimed that it's okay for a final state to lead to another state in a finite state diagram.</p>&#xA;&#xA;<p>But this seems to be a fundamentally contradictor...
habedi/stack-exchange-dataset
92,726
Why we write "Ignore the input " when describing an Enumerator?(Sipser Chapter 3)
<p>The Theorem and its proof is given below:</p>&#xA;&#xA;<blockquote>&#xA; <p><a href="https://i.stack.imgur.com/9HLFA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9HLFA.png" alt="enter image description here"></a> &#xA; <a href="https://i.stack.imgur.com/SocNo.png" rel="nofollow noreferrer"><i...
complexity theory turing machines computability
1
Why we write "Ignore the input " when describing an Enumerator?(Sipser Chapter 3) -- (complexity theory turing machines computability) <p>The Theorem and its proof is given below:</p>&#xA;&#xA;<blockquote>&#xA; <p><a href="https://i.stack.imgur.com/9HLFA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.c...
habedi/stack-exchange-dataset
92,729
A necessary [and sufficient?] condition for the number of comparisons required to sort $n$ elements
<p>I am familiar with the decision tree based argument for the minimal number of comparisons required to sort $n$ distinct elements - Since there are $n!$ permutations on the $n$ elements, the decision tree for any comparison based sorting algorithms must have at least $n!$ leaves, and therefore at least one path of le...
time complexity sorting information theory
1
A necessary [and sufficient?] condition for the number of comparisons required to sort $n$ elements -- (time complexity sorting information theory) <p>I am familiar with the decision tree based argument for the minimal number of comparisons required to sort $n$ distinct elements - Since there are $n!$ permutations on t...
habedi/stack-exchange-dataset
92,733
Algorithm for nearest edge detection with respect to a point (in all directions)
<p>I'm looking for an algorithm, a set of algorithms, or any pointers/remarks how to solve the following problem:</p>&#xA;&#xA;<p>Given a polygon, a central point, and a set of points scaterred around the central point inside the polygon, I want to find the nearest "edges" being created by those points with respect to ...
computational geometry
1
Algorithm for nearest edge detection with respect to a point (in all directions) -- (computational geometry) <p>I'm looking for an algorithm, a set of algorithms, or any pointers/remarks how to solve the following problem:</p>&#xA;&#xA;<p>Given a polygon, a central point, and a set of points scaterred around the centra...
habedi/stack-exchange-dataset
92,738
Decidability of determining whether a context-free grammar generates all strings in 1*
<p>How could I prove that the following language is decidable?</p>&#xA;&#xA;<p><span class="math-container">$\{\langle G\rangle \mid G\ \text{is a CFG over}\ \{0,1\}\ \text{and}\ 1^* \subseteq L(G)\}$</span></p>&#xA;&#xA;<p>P.S. &#xA;It's the problem 4.15 of the third edition of the "Introduction to the Theory of Compu...
complexity theory computability context free decision problem
1
Decidability of determining whether a context-free grammar generates all strings in 1* -- (complexity theory computability context free decision problem) <p>How could I prove that the following language is decidable?</p>&#xA;&#xA;<p><span class="math-container">$\{\langle G\rangle \mid G\ \text{is a CFG over}\ \{0,1\}\...
habedi/stack-exchange-dataset
92,740
Why is it called 'throwing' an exception?
<p>I'm just wondering where the phrase "throwing" an exception came from. I understand "raising" an exception but I'm wondering if "throwing" has a reason or meaning behind it?</p>&#xA;
terminology programming languages
1
Why is it called 'throwing' an exception? -- (terminology programming languages) <p>I'm just wondering where the phrase "throwing" an exception came from. I understand "raising" an exception but I'm wondering if "throwing" has a reason or meaning behind it?</p>&#xA;
habedi/stack-exchange-dataset
92,742
How Symbolic Execution Works
<p>From reading (1) below, it seems they have implemented an abstraction layer on top of the code that does what the code already does to some degree. They built an <code>Expression</code> class for symbolic integer manipulation, and they replace any native integer calls with these in their symbolic execution.</p>&#xA;...
algorithms
1
How Symbolic Execution Works -- (algorithms) <p>From reading (1) below, it seems they have implemented an abstraction layer on top of the code that does what the code already does to some degree. They built an <code>Expression</code> class for symbolic integer manipulation, and they replace any native integer calls wit...
habedi/stack-exchange-dataset
92,748
Find the asymptotic bound $\Theta$ of $t(n)=t(\frac{n}{5})+t(\frac{n}{17})+n$
<blockquote>&#xA; <p>Find the asymptotic bound in terms of $\Theta$ (Theta) using the <strong>master theorem</strong> for the following recursive equation.&#xA; Assume that $t(n)= \Theta (1)$ for suffucuently small $n$. &#xA; $$t(n)=t(\frac{n}{5})+t(\frac{n}{17})+n$$</p>&#xA;</blockquote>&#xA;&#xA;<p>I am a bit conf...
asymptotics master theorem divide and conquer
1
Find the asymptotic bound $\Theta$ of $t(n)=t(\frac{n}{5})+t(\frac{n}{17})+n$ -- (asymptotics master theorem divide and conquer) <blockquote>&#xA; <p>Find the asymptotic bound in terms of $\Theta$ (Theta) using the <strong>master theorem</strong> for the following recursive equation.&#xA; Assume that $t(n)= \Theta (1...
habedi/stack-exchange-dataset
92,749
LTL globally implies
<p>I have got confused in undressing the informal definition of LTL below: $$G(\phi \Longrightarrow\psi)\Longrightarrow(G\phi \Longrightarrow G\psi)$$</p>&#xA;&#xA;<ol>&#xA;<li>in many literatures I have seen implies is said as replies like for LHS we can say Always/Globally $\psi$ replies to $\phi$. is it correct?</li...
linear temporal logic temporal logic computation tree logic
1
LTL globally implies -- (linear temporal logic temporal logic computation tree logic) <p>I have got confused in undressing the informal definition of LTL below: $$G(\phi \Longrightarrow\psi)\Longrightarrow(G\phi \Longrightarrow G\psi)$$</p>&#xA;&#xA;<ol>&#xA;<li>in many literatures I have seen implies is said as replie...
habedi/stack-exchange-dataset
92,759
Data Structure for State in Automata
<p>When I read the word "state" I think of a global object with a bunch of properties like the "application state". But it seems that in automata that the state is pretty much just an empty value.</p>&#xA;&#xA;<p>Wondering what specifically the data structure is for automata states in general.</p>&#xA;&#xA;<p>For examp...
data structures automata
1
Data Structure for State in Automata -- (data structures automata) <p>When I read the word "state" I think of a global object with a bunch of properties like the "application state". But it seems that in automata that the state is pretty much just an empty value.</p>&#xA;&#xA;<p>Wondering what specifically the data str...
habedi/stack-exchange-dataset
92,766
Difference Between Tree Automata and Tree Transducers
<p>Wondering what the differences are between <a href="https://en.wikipedia.org/wiki/Tree_automaton" rel="nofollow noreferrer">Tree Automata</a> and <a href="https://en.wikipedia.org/wiki/Tree_transducer" rel="nofollow noreferrer">Tree Transducers</a>.</p>&#xA;&#xA;<p>Wikipedia says:</p>&#xA;&#xA;<blockquote>&#xA; <p>...
automata
1
Difference Between Tree Automata and Tree Transducers -- (automata) <p>Wondering what the differences are between <a href="https://en.wikipedia.org/wiki/Tree_automaton" rel="nofollow noreferrer">Tree Automata</a> and <a href="https://en.wikipedia.org/wiki/Tree_transducer" rel="nofollow noreferrer">Tree Transducers</a>....
habedi/stack-exchange-dataset
92,779
Lack of time hierarchy theorem for probabilistic machines
<p>The Wikipedia page on the <a href="https://en.wikipedia.org/wiki/Time_hierarchy_theorem" rel="nofollow noreferrer">time hierarchy theorem</a> states:</p>&#xA;&#xA;<blockquote>&#xA; <p>A similar theorem is not known for time-bounded probabilistic complexity classes, unless the class also has advice.</p>&#xA;</blockq...
complexity theory
1
Lack of time hierarchy theorem for probabilistic machines -- (complexity theory) <p>The Wikipedia page on the <a href="https://en.wikipedia.org/wiki/Time_hierarchy_theorem" rel="nofollow noreferrer">time hierarchy theorem</a> states:</p>&#xA;&#xA;<blockquote>&#xA; <p>A similar theorem is not known for time-bounded pro...
habedi/stack-exchange-dataset
92,792
What is the most used way to write for-loop as pseudocode?
<ul>&#xA;<li><strong>for</strong> $e\leftarrow1$ to 8 <strong>do</strong></li>&#xA;<li><strong>for</strong> $e\in[1,8]$ <strong>do</strong></li>&#xA;<li><strong>for</strong> $e\in\{x\in\mathbb{N}|1\le x\le8\}$ <strong>do</strong></li>&#xA;</ul>&#xA;&#xA;<p>What is more preferred?</p>&#xA;
loops pseudocode
1
What is the most used way to write for-loop as pseudocode? -- (loops pseudocode) <ul>&#xA;<li><strong>for</strong> $e\leftarrow1$ to 8 <strong>do</strong></li>&#xA;<li><strong>for</strong> $e\in[1,8]$ <strong>do</strong></li>&#xA;<li><strong>for</strong> $e\in\{x\in\mathbb{N}|1\le x\le8\}$ <strong>do</strong></li>&#xA;...
habedi/stack-exchange-dataset
92,796
proof of correctness for greedy knapsack algorithm
<p>I don't really understand why is statement 1 ≥ statement 2 in the attached picture. From what I understand the negative term in statement 2 must be greater than or equal the negative term in statement 1 if statement 1 ≥ statement 2 but I don't really know how. Any help on this matter will be really appreciated. Than...
correctness proof greedy algorithms knapsack problems
1
proof of correctness for greedy knapsack algorithm -- (correctness proof greedy algorithms knapsack problems) <p>I don't really understand why is statement 1 ≥ statement 2 in the attached picture. From what I understand the negative term in statement 2 must be greater than or equal the negative term in statement 1 if s...
habedi/stack-exchange-dataset
92,806
Do we need both path compression and union by rank together in disjoint set data structure?
<p>I was studying disjoint set data structure. I studied path compression and union by rank. Initially all the elements are single in their own set and by performing unions we can combine different sets. &#xA;Now since we are performing union by rank the height of the resultant tree is always minimum. At this point i t...
data structures
1
Do we need both path compression and union by rank together in disjoint set data structure? -- (data structures) <p>I was studying disjoint set data structure. I studied path compression and union by rank. Initially all the elements are single in their own set and by performing unions we can combine different sets. &#x...
habedi/stack-exchange-dataset
92,811
If a connected graph has a bridge then it has a cut vertex
<p>Is it true that if a connected graph has a bridge then it has a cut vertex?</p>&#xA;&#xA;<p>In my point of view, I don't think it is true to consider that a graph having a cut edge will definitely have cut vertex.</p>&#xA;&#xA;<p>Consider a graph with a single edge $uv$; if we remove this edge, the graph will get di...
graphs
1
If a connected graph has a bridge then it has a cut vertex -- (graphs) <p>Is it true that if a connected graph has a bridge then it has a cut vertex?</p>&#xA;&#xA;<p>In my point of view, I don't think it is true to consider that a graph having a cut edge will definitely have cut vertex.</p>&#xA;&#xA;<p>Consider a graph...
habedi/stack-exchange-dataset
92,812
Specific example of a problem that shows why **NP** isn't low for itself
<p>Wikipedia <a href="https://en.wikipedia.org/wiki/Low_(complexity)" rel="nofollow noreferrer">says</a></p>&#xA;&#xA;<blockquote>&#xA; <p>Every class which is low for itself is closed under complement, provided that it is powerful enough to negate the boolean result. This implies that <strong>NP</strong> isn't low fo...
complexity theory oracle machines relativization
1
Specific example of a problem that shows why **NP** isn't low for itself -- (complexity theory oracle machines relativization) <p>Wikipedia <a href="https://en.wikipedia.org/wiki/Low_(complexity)" rel="nofollow noreferrer">says</a></p>&#xA;&#xA;<blockquote>&#xA; <p>Every class which is low for itself is closed under c...
habedi/stack-exchange-dataset
92,814
Is the existence of an oracle such that $P^O = NP^O$ nontrivial?
<p><a href="https://epubs.siam.org/doi/10.1137/0204037" rel="nofollow noreferrer">This</a> famous paper proves the existence of both oracles $A$ and $B$ such that $\textbf{P}^A = \textbf{NP}^A$ and $\textbf{P}^B \neq \textbf{NP}^B$, therefore proving that any resolution to the <strong>P</strong> versus <strong>NP</stro...
complexity theory oracle machines relativization
1
Is the existence of an oracle such that $P^O = NP^O$ nontrivial? -- (complexity theory oracle machines relativization) <p><a href="https://epubs.siam.org/doi/10.1137/0204037" rel="nofollow noreferrer">This</a> famous paper proves the existence of both oracles $A$ and $B$ such that $\textbf{P}^A = \textbf{NP}^A$ and $\t...
habedi/stack-exchange-dataset
92,827
Graph find all vertices that are part of a cycle
<p>I was wondering how I can find all the vertices in a graph that are part of a cycle. To determine this for one vertex, I could just start a DFS from that vertex, but this seems unefficient to me when I want to know for all vertices.</p>&#xA;&#xA;<p>Thanks for your help!</p>&#xA;
algorithms graphs
1
Graph find all vertices that are part of a cycle -- (algorithms graphs) <p>I was wondering how I can find all the vertices in a graph that are part of a cycle. To determine this for one vertex, I could just start a DFS from that vertex, but this seems unefficient to me when I want to know for all vertices.</p>&#xA;&#xA...
habedi/stack-exchange-dataset
92,833
Balance groups based on average, element constraints and size
<p>It's a complex situation, where I want to balance <em>groups</em> of numbers based on the <em>average</em> of these numbers, while keeping the <em>group size</em> unchanged and <em>not breaking elements constraints</em>.</p>&#xA;&#xA;<p>Let me explain in detail what I mean:&#xA;<a href="https://i.stack.imgur.com/VT6...
algorithms mathematical programming pseudocode
1
Balance groups based on average, element constraints and size -- (algorithms mathematical programming pseudocode) <p>It's a complex situation, where I want to balance <em>groups</em> of numbers based on the <em>average</em> of these numbers, while keeping the <em>group size</em> unchanged and <em>not breaking elements ...
habedi/stack-exchange-dataset
92,855
Can we approximate the number of possible witnesses for an NP language?
<p>Assuming $L \in NP$, meaning that L could be verified by some $V(x,y)$, such that there exists a polynomial $P(X)$ such that $|y| \leq P(|x|)$ for every $x \in L$.</p>&#xA;&#xA;<p>I was wondering - can I assume something about the possible witness space?&#xA;My intuition says that this number is bounded by $O(2^{P(|...
time complexity np
1
Can we approximate the number of possible witnesses for an NP language? -- (time complexity np) <p>Assuming $L \in NP$, meaning that L could be verified by some $V(x,y)$, such that there exists a polynomial $P(X)$ such that $|y| \leq P(|x|)$ for every $x \in L$.</p>&#xA;&#xA;<p>I was wondering - can I assume something ...
habedi/stack-exchange-dataset
92,856
What does "AC0 many-one reduction" mean?
<blockquote>&#xA; <p>What does <em>$\mathsf{AC^0}$ many-one reduction</em> mean?</p>&#xA;</blockquote>&#xA;&#xA;<p>I know about polynomial time reductions, but I'm not familiar with $\mathsf{AC^0}$ reductions.</p>&#xA;
reductions circuits
1
What does "AC0 many-one reduction" mean? -- (reductions circuits) <blockquote>&#xA; <p>What does <em>$\mathsf{AC^0}$ many-one reduction</em> mean?</p>&#xA;</blockquote>&#xA;&#xA;<p>I know about polynomial time reductions, but I'm not familiar with $\mathsf{AC^0}$ reductions.</p>&#xA;
habedi/stack-exchange-dataset
92,858
Assumption: A PSPACE-hard problem can be solved in polynomial time
<p>Under the assumption that a PSPACE-hard problem <code>A</code> can be solved in polynomial time, is the following argumentation valid? </p>&#xA;&#xA;<p>Since every problem in PSPACE can be reduced to <code>A</code> in polynomial time, every problem in NP which is a subset of PSPACE is included. That means that each ...
complexity theory complexity classes
1
Assumption: A PSPACE-hard problem can be solved in polynomial time -- (complexity theory complexity classes) <p>Under the assumption that a PSPACE-hard problem <code>A</code> can be solved in polynomial time, is the following argumentation valid? </p>&#xA;&#xA;<p>Since every problem in PSPACE can be reduced to <code>A<...
habedi/stack-exchange-dataset
92,859
Time Complexity: Intuition for Recursive Algorithm
<p>I decide to learn more about dynamic programming, so I started reading the Dynamic Programming chapter from the CLSR book.</p>&#xA;&#xA;<p>The first example problem presented there is Rod Cutting (15.1). Given a rod of length n and a list of prices for rods of any sizes figure out how to cut the rod so that the pric...
time complexity dynamic programming recurrence relation
1
Time Complexity: Intuition for Recursive Algorithm -- (time complexity dynamic programming recurrence relation) <p>I decide to learn more about dynamic programming, so I started reading the Dynamic Programming chapter from the CLSR book.</p>&#xA;&#xA;<p>The first example problem presented there is Rod Cutting (15.1). G...
habedi/stack-exchange-dataset
92,862
Type-0 grammar and terminal symbols
<p>The question is pretty short, but I've been thinking about it quite some time:&#xA;Are terminal symbols that are not in the defined alphabet still valid?</p>&#xA;
automata finite automata chomsky hierarchy termination
1
Type-0 grammar and terminal symbols -- (automata finite automata chomsky hierarchy termination) <p>The question is pretty short, but I've been thinking about it quite some time:&#xA;Are terminal symbols that are not in the defined alphabet still valid?</p>&#xA;
habedi/stack-exchange-dataset
92,867
How does TLC check liveness properties?
<p>The paper <a href="https://lamport.azurewebsites.net/pubs/yuanyu-model-checking.pdf" rel="nofollow noreferrer">"Model Checking TLA+ Specifications"</a> published in 1999 explained how <a href="https://lamport.azurewebsites.net/tla/toolbox.html" rel="nofollow noreferrer">TLC (Temporal Logic Checker)</a> checks safety...
formal languages reference request formal methods model checking tlaplus
1
How does TLC check liveness properties? -- (formal languages reference request formal methods model checking tlaplus) <p>The paper <a href="https://lamport.azurewebsites.net/pubs/yuanyu-model-checking.pdf" rel="nofollow noreferrer">"Model Checking TLA+ Specifications"</a> published in 1999 explained how <a href="https:...
habedi/stack-exchange-dataset
92,874
In Hindley-Milner system, how can I prove that let id=\x.x in id id is well-typed?
<p>I am trying to infer the type and prove that this is well-typed:</p>&#xA;&#xA;<p>let $f =\lambda x.x$ in $f f$</p>&#xA;&#xA;<p>Obviously the $f$ is the identity function, so it's the same as</p>&#xA;&#xA;<p>let $id =\lambda x.x$ in $id$ $id$</p>&#xA;&#xA;<p>I am trying to use these rules to infer the type, going bot...
lambda calculus type inference typing haskell
1
In Hindley-Milner system, how can I prove that let id=\x.x in id id is well-typed? -- (lambda calculus type inference typing haskell) <p>I am trying to infer the type and prove that this is well-typed:</p>&#xA;&#xA;<p>let $f =\lambda x.x$ in $f f$</p>&#xA;&#xA;<p>Obviously the $f$ is the identity function, so it's the ...
habedi/stack-exchange-dataset
92,879
BDD to CNF in linear time
<p>I have a book from my university that claims:</p>&#xA;&#xA;<blockquote>&#xA; <p>There is an linear algorithm that can convert BDD to CNF in linear time, and generate CNF in linear length of the BDD size (number of nodes).</p>&#xA;</blockquote>&#xA;&#xA;<p>Then they wrote an exercise to find one... </p>&#xA;&#xA;<p...
bdd
1
BDD to CNF in linear time -- (bdd) <p>I have a book from my university that claims:</p>&#xA;&#xA;<blockquote>&#xA; <p>There is an linear algorithm that can convert BDD to CNF in linear time, and generate CNF in linear length of the BDD size (number of nodes).</p>&#xA;</blockquote>&#xA;&#xA;<p>Then they wrote an exerci...
habedi/stack-exchange-dataset
92,880
CFG where u has same number of 1s as v
<p>$$L=\{uv\in\{0,1,2\}^*\mid u\in\{0,1\}^*,v\in\{1,2\}^*, \text{ and }u\text{ has the same number of 1s as }v\}.$$</p>&#xA;&#xA;<p>Here is my attempt solution, but it is not completely correct, any hint is appreciated&#xA;(not sure how I can ensure that $u$ and $v$ to have the same number of 1).</p>&#xA;&#xA;<p>\begin...
formal languages context free pushdown automata
1
CFG where u has same number of 1s as v -- (formal languages context free pushdown automata) <p>$$L=\{uv\in\{0,1,2\}^*\mid u\in\{0,1\}^*,v\in\{1,2\}^*, \text{ and }u\text{ has the same number of 1s as }v\}.$$</p>&#xA;&#xA;<p>Here is my attempt solution, but it is not completely correct, any hint is appreciated&#xA;(not ...
habedi/stack-exchange-dataset
92,886
How to apply a Hadamard gate to one qubit in a 2-qubit system?
<p><strong>Edit:</strong></p>&#xA;&#xA;<p>I've pinpointed that the difference between solutions occurs when I apply the $H$, up to there, the solutions match. So, perhaps it is better to phrase my question as: how to apply an $H$ gate to one qubit in a 2-qubit system?</p>&#xA;&#xA;<p><strong>End Edit</strong></p>&#xA;&...
quantum computing
1
How to apply a Hadamard gate to one qubit in a 2-qubit system? -- (quantum computing) <p><strong>Edit:</strong></p>&#xA;&#xA;<p>I've pinpointed that the difference between solutions occurs when I apply the $H$, up to there, the solutions match. So, perhaps it is better to phrase my question as: how to apply an $H$ gate...
habedi/stack-exchange-dataset
92,888
To prove 4-SAT CNF is NP-complete
<p>To answer the question below, </p>&#xA;&#xA;<p>4-SAT: Given a formula in Conjunctive Normal Form, where each clause contains exactly 4 literals, does it have a satisfying truth assignment?</p>&#xA;&#xA;<p>I was going to prove that 4-SAT is in NP-complete. But I saw that the way to prove CNF-SAT is in NP-complete is ...
np complete satisfiability np
1
To prove 4-SAT CNF is NP-complete -- (np complete satisfiability np) <p>To answer the question below, </p>&#xA;&#xA;<p>4-SAT: Given a formula in Conjunctive Normal Form, where each clause contains exactly 4 literals, does it have a satisfying truth assignment?</p>&#xA;&#xA;<p>I was going to prove that 4-SAT is in NP-co...
habedi/stack-exchange-dataset
92,893
Average Case Analysis for finding max in array with duplicated element
<p>I've read some posts about counting the number of assignment inside code of finding the maximum value in array like this:</p>&#xA;&#xA;<pre><code>FindMax(L):&#xA; n = len(L)&#xA; max = L[1]&#xA; for i = 2..n:&#xA; if (max &lt; L[i]) &#xA; max = L[i] (**)&#xA; return max&#xA;</code></pre>&#xA;&#...
runtime analysis
1
Average Case Analysis for finding max in array with duplicated element -- (runtime analysis) <p>I've read some posts about counting the number of assignment inside code of finding the maximum value in array like this:</p>&#xA;&#xA;<pre><code>FindMax(L):&#xA; n = len(L)&#xA; max = L[1]&#xA; for i = 2..n:&#xA; ...
habedi/stack-exchange-dataset
92,904
Checking claim in paper "A Read-Only Transaction Anomaly Under Snapshot Isolation" by Alan Fekete et al
<p>In the 2004 paper "A Read-Only Transaction Anomaly Under Snapshot Isolation" by Alan Fekete et al. (which can be found <a href="https://dl.acm.org/citation.cfm?id=1031573" rel="nofollow noreferrer">here</a> and <a href="https://www.cs.umb.edu/~poneil/ROAnom.pdf" rel="nofollow noreferrer">here</a>) the authors state:...
concurrency database theory databases
1
Checking claim in paper "A Read-Only Transaction Anomaly Under Snapshot Isolation" by Alan Fekete et al -- (concurrency database theory databases) <p>In the 2004 paper "A Read-Only Transaction Anomaly Under Snapshot Isolation" by Alan Fekete et al. (which can be found <a href="https://dl.acm.org/citation.cfm?id=1031573...
habedi/stack-exchange-dataset
92,909
Impact of Polynomial Time Algorithm for an NP Complete problem on Complexity Theory
<p>Assuming (hypothetically) someone proves $P=NP$ by providing a polynomial time algorithm for a $NP-Complete$ problem the Polynomial Hierarchy collapses.</p>&#xA;&#xA;<p>What are the other (important) questions that are still left in complexity theory in respect to the remaining complexity classes?</p>&#xA;&#xA;<p>If...
complexity theory np complete
1
Impact of Polynomial Time Algorithm for an NP Complete problem on Complexity Theory -- (complexity theory np complete) <p>Assuming (hypothetically) someone proves $P=NP$ by providing a polynomial time algorithm for a $NP-Complete$ problem the Polynomial Hierarchy collapses.</p>&#xA;&#xA;<p>What are the other (important...
habedi/stack-exchange-dataset
92,914
Prove that Weighted Independent Set is NP Complete using Independent Set?
<blockquote>&#xA; <p><strong>$k$-Weight Independent Set</strong><br/>&#xA; Input: A vertex weighted graph $G=(V,E,w)$ and an integer $k$.<br/>&#xA; Question: Is the a set $V'\subset V$ such that $V'$ is an independent set and $\sum_{v\in V'} w(v) \geq k$?</p>&#xA;</blockquote>&#xA;&#xA;<p>Showing that this problem i...
complexity theory graphs np complete reductions
1
Prove that Weighted Independent Set is NP Complete using Independent Set? -- (complexity theory graphs np complete reductions) <blockquote>&#xA; <p><strong>$k$-Weight Independent Set</strong><br/>&#xA; Input: A vertex weighted graph $G=(V,E,w)$ and an integer $k$.<br/>&#xA; Question: Is the a set $V'\subset V$ such ...
habedi/stack-exchange-dataset
92,925
What is Follow(X) when there's a rule, A -> XBCD where First(B) and First(C) contain empty, but First(D) do not
<p>I have a question about follow sets. </p>&#xA;&#xA;<p>Suppose there's a rule,</p>&#xA;&#xA;<blockquote>&#xA; <p>A -> XBCD</p>&#xA; &#xA; <p>B -> $\beta$ | $\epsilon$ </p>&#xA; &#xA; <p>C -> $\gamma$ | $\epsilon$</p>&#xA; &#xA; <p>D -> $\delta$ </p>&#xA;</blockquote>&#xA;&#xA;<p>What is Follow(X)?</p>&#xA;&#xA...
parsers
1
What is Follow(X) when there's a rule, A -> XBCD where First(B) and First(C) contain empty, but First(D) do not -- (parsers) <p>I have a question about follow sets. </p>&#xA;&#xA;<p>Suppose there's a rule,</p>&#xA;&#xA;<blockquote>&#xA; <p>A -> XBCD</p>&#xA; &#xA; <p>B -> $\beta$ | $\epsilon$ </p>&#xA; &#xA; <p>C ...
habedi/stack-exchange-dataset
92,930
is it necessary to cover all the verticies in eular path?
<p>I was going through graph theory and came across the term Euler path or some people prefer Euler trail as vertices can repeat.</p>&#xA;&#xA;<p>According to the definition from wiki (<a href="https://en.wikipedia.org/wiki/Eulerian_path" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Eulerian_path</a>), Euler...
algorithms graphs
1
is it necessary to cover all the verticies in eular path? -- (algorithms graphs) <p>I was going through graph theory and came across the term Euler path or some people prefer Euler trail as vertices can repeat.</p>&#xA;&#xA;<p>According to the definition from wiki (<a href="https://en.wikipedia.org/wiki/Eulerian_path" ...
habedi/stack-exchange-dataset
92,935
Can an FO formula with infinite length be expressed with an infinite set of finite formulas?
<p>I'm confused as to why we can't write formulas of infinite length in FO. For example, to express reachability, I understand the proof that there cannot be a single formula for it, but it is expressible with a set of formulas?</p>&#xA;&#xA;<p>Since any formula has an equivalent formula in CNF, if we transform a formu...
logic
1
Can an FO formula with infinite length be expressed with an infinite set of finite formulas? -- (logic) <p>I'm confused as to why we can't write formulas of infinite length in FO. For example, to express reachability, I understand the proof that there cannot be a single formula for it, but it is expressible with a set ...
habedi/stack-exchange-dataset
92,944
Matrix multiplication in recurrent neural networks
<p>I was looking at a <a href="http://www.wildml.com/2015/09/recurrent-neural-networks-tutorial-part-2-implementing-a-language-model-rnn-with-python-numpy-and-theano/" rel="nofollow noreferrer">tutorial</a> for recurrent neural networks in Python, and I have a question in regards to multiplying matrices of different si...
neural networks matrices
1
Matrix multiplication in recurrent neural networks -- (neural networks matrices) <p>I was looking at a <a href="http://www.wildml.com/2015/09/recurrent-neural-networks-tutorial-part-2-implementing-a-language-model-rnn-with-python-numpy-and-theano/" rel="nofollow noreferrer">tutorial</a> for recurrent neural networks in...
habedi/stack-exchange-dataset
92,951
calculting distance between a person and the object in the image
<p>Let's say a person took an image like this&#xA;<a href="https://i.stack.imgur.com/otch8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/otch8.jpg" alt="enter image description here"></a></p>&#xA;&#xA;<p>I have access to all image attributes (like for example image format, resolution and so on), an...
image processing
1
calculting distance between a person and the object in the image -- (image processing) <p>Let's say a person took an image like this&#xA;<a href="https://i.stack.imgur.com/otch8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/otch8.jpg" alt="enter image description here"></a></p>&#xA;&#xA;<p>I have a...
habedi/stack-exchange-dataset
92,964
Computational complexity of Bell numbers
<p>I've been recently dealing with a problem which, when worst case is considered, results in exploration of $B_{n}$ options, where $B_{n}$ is th $n^{th}$ Bell number. I am trying to rigorously prove, that dealing with $B_{n}$ possible solutions results in exponential (or worse?) computational complexity (in terms of $...
complexity theory combinatorics
1
Computational complexity of Bell numbers -- (complexity theory combinatorics) <p>I've been recently dealing with a problem which, when worst case is considered, results in exploration of $B_{n}$ options, where $B_{n}$ is th $n^{th}$ Bell number. I am trying to rigorously prove, that dealing with $B_{n}$ possible soluti...
habedi/stack-exchange-dataset
92,967
Longest repeated substring
<p>I am trying to solve a problem- Longest repeated substring in a string. Firstly, I built a suffix tree that takes O(n) time and then I traversed the suffix tree to find the deepest internal node. I am not sure whether traversing in a suffix tree would be O(n) or not?</p>&#xA;&#xA;<p>These are the properties of a suf...
algorithms strings substrings suffix trees
1
Longest repeated substring -- (algorithms strings substrings suffix trees) <p>I am trying to solve a problem- Longest repeated substring in a string. Firstly, I built a suffix tree that takes O(n) time and then I traversed the suffix tree to find the deepest internal node. I am not sure whether traversing in a suffix t...
habedi/stack-exchange-dataset
92,971
Why is $L := \{b^2a^nb^ma^3|m,n \geq 0\}$ a regular language?
<p>(Pre-note: I'm learning Theory of Computation on my own, so bear with me if I'm saying something wrong/stupid.)</p>&#xA;&#xA;<blockquote>&#xA; <p>Why is $L := \{b^2a^nb^ma^3\mid m,n \geq 0\}$ a regular language?</p>&#xA;</blockquote>&#xA;&#xA;<p>This question appeared in a problem set, whose answer is the following...
regular languages finite automata regular expressions pumping lemma
1
Why is $L := \{b^2a^nb^ma^3|m,n \geq 0\}$ a regular language? -- (regular languages finite automata regular expressions pumping lemma) <p>(Pre-note: I'm learning Theory of Computation on my own, so bear with me if I'm saying something wrong/stupid.)</p>&#xA;&#xA;<blockquote>&#xA; <p>Why is $L := \{b^2a^nb^ma^3\mid m,n...
habedi/stack-exchange-dataset
92,988
Reducing closed TSP to open with fixed starting vertex
<p>I have implemented a branch and bound algoritm for finding a Hamiltonian cycle in my software, but I actually need to find a shortest route from fixed vertex through all verticies ending at any of them. </p>&#xA;&#xA;<p>As far as I understood, I can reduce closed-cycle TSP to open-cycle with fixed starting point by ...
traveling salesman
1
Reducing closed TSP to open with fixed starting vertex -- (traveling salesman) <p>I have implemented a branch and bound algoritm for finding a Hamiltonian cycle in my software, but I actually need to find a shortest route from fixed vertex through all verticies ending at any of them. </p>&#xA;&#xA;<p>As far as I unders...
habedi/stack-exchange-dataset
92,999
Is every reduction function $f \in O(n)$?
<p>I have no detailed questions actually. My question is about a (maybe possible) generalization for reductions.</p>&#xA;&#xA;<p>We defined reduction as following (If I translate a term false please correct me.):</p>&#xA;&#xA;<p>$ L_1, L_2 \in \{0,1\}^* $ two languages.</p>&#xA;&#xA;<p>One may reduce the language $L_1$...
turing machines reductions
1
Is every reduction function $f \in O(n)$? -- (turing machines reductions) <p>I have no detailed questions actually. My question is about a (maybe possible) generalization for reductions.</p>&#xA;&#xA;<p>We defined reduction as following (If I translate a term false please correct me.):</p>&#xA;&#xA;<p>$ L_1, L_2 \in \{...
habedi/stack-exchange-dataset
93,002
By what criteria is the base value selected in Rabin Karp algorithm?
<p>In the Rabin Karp algorithm the rolling hash is calculated as follows:</p>&#xA;&#xA;<pre><code>H1= c1*a^k-1 + c2*a^k-2+c3*a^k-3+…+ck*a^0&#xA;</code></pre>&#xA;&#xA;<p>where <code>a</code> is a constant. On what basis is this <code>a</code> selected? In Cormen they have used a value 10 and at some other places it is ...
algorithms string matching rolling hash
1
By what criteria is the base value selected in Rabin Karp algorithm? -- (algorithms string matching rolling hash) <p>In the Rabin Karp algorithm the rolling hash is calculated as follows:</p>&#xA;&#xA;<pre><code>H1= c1*a^k-1 + c2*a^k-2+c3*a^k-3+…+ck*a^0&#xA;</code></pre>&#xA;&#xA;<p>where <code>a</code> is a constant. ...
habedi/stack-exchange-dataset
93,006
Why is abstraction in lambda calculus called abstraction?
<p>The term abstraction as I understand it, is used in many different contexts, but has one essential meaning, namely that it refers to the “general properties of some class of objects that doesn’t rely on their details”. For example, abstraction in programming is e.g. interfaces that allow you to constrain a set of ob...
lambda calculus
1
Why is abstraction in lambda calculus called abstraction? -- (lambda calculus) <p>The term abstraction as I understand it, is used in many different contexts, but has one essential meaning, namely that it refers to the “general properties of some class of objects that doesn’t rely on their details”. For example, abstra...
habedi/stack-exchange-dataset
93,009
Time complexity of Rabin-Karp algorithm
<blockquote>&#xA; <p><strong>$n$ : length of text T</strong> </p>&#xA; &#xA; <p><strong>$m$ : length of pattern P</strong></p>&#xA;</blockquote>&#xA;&#xA;<p>When I study Rabin-Karp algorithm, I learned the best case of this algorithm is $\theta(n-m+1)$. Because if a hashed number is too small to modulo by some other...
algorithms asymptotics string matching
1
Time complexity of Rabin-Karp algorithm -- (algorithms asymptotics string matching) <blockquote>&#xA; <p><strong>$n$ : length of text T</strong> </p>&#xA; &#xA; <p><strong>$m$ : length of pattern P</strong></p>&#xA;</blockquote>&#xA;&#xA;<p>When I study Rabin-Karp algorithm, I learned the best case of this algorithm...
habedi/stack-exchange-dataset
93,010
Is $\Gamma = Inv(Pol(\Gamma))$?
<p>I'm reading <a href="https://arxiv.org/pdf/cs/0611018.pdf" rel="nofollow noreferrer">A Rendezvous of Logic, Complexity and Algebra</a>, my first introduction to the world of CSP. Let $\Gamma$ be a finite constraint language. It says in Pg. 9 that</p>&#xA;&#xA;<blockquote>&#xA; <p>$Pol(\Gamma)$ is used to denote the...
constraint satisfaction
1
Is $\Gamma = Inv(Pol(\Gamma))$? -- (constraint satisfaction) <p>I'm reading <a href="https://arxiv.org/pdf/cs/0611018.pdf" rel="nofollow noreferrer">A Rendezvous of Logic, Complexity and Algebra</a>, my first introduction to the world of CSP. Let $\Gamma$ be a finite constraint language. It says in Pg. 9 that</p>&#xA;&...
habedi/stack-exchange-dataset
93,026
Add a road to a network (Graph problem with Dijkstra)
<p>Recently i have found a problem stating:&#xA;There is a network of roads G=(V,E)(it is not directed) connecting a set of cities V. The length of each road e ∈ E is le. There is a proposal to add one new road to this network, and there is a list E′ of pairs of cities between which the new road can be built. Each such...
complexity theory graphs time complexity
1
Add a road to a network (Graph problem with Dijkstra) -- (complexity theory graphs time complexity) <p>Recently i have found a problem stating:&#xA;There is a network of roads G=(V,E)(it is not directed) connecting a set of cities V. The length of each road e ∈ E is le. There is a proposal to add one new road to this n...
habedi/stack-exchange-dataset
93,029
Is there a computer science theory behind automatic source code generation
<p>The OpenAPI <a href="https://swagger.io/specification/" rel="nofollow noreferrer">specification</a> aims at standardizing the representation of REST based systems in json and yaml formats. A short version of the <a href="http://petstore.swagger.io/v2/swagger.json" rel="nofollow noreferrer">petstore</a> is below:</p>...
code generation
1
Is there a computer science theory behind automatic source code generation -- (code generation) <p>The OpenAPI <a href="https://swagger.io/specification/" rel="nofollow noreferrer">specification</a> aims at standardizing the representation of REST based systems in json and yaml formats. A short version of the <a href="...
habedi/stack-exchange-dataset
93,030
Algorithm for checking if a list of integers is pairwise coprime
<p>Are thre any efficient algorithms for checking if a list of integers is pairwise coprime, or would a more general algorithm be the best option available?</p>&#xA;
algorithms primes
1
Algorithm for checking if a list of integers is pairwise coprime -- (algorithms primes) <p>Are thre any efficient algorithms for checking if a list of integers is pairwise coprime, or would a more general algorithm be the best option available?</p>&#xA;
habedi/stack-exchange-dataset
93,038
Maximum number of distinct values for bitwise OR
<blockquote>&#xA; <p>You are given an array with $N$ elements. The values of the elements may be any number in the interval $[0,10^9]$. Define $f(a,b)$ as the bitwise or of all the values in the subarray $[a,b]$. Find a bound on the number of distinct values of $f(a,b)$.</p>&#xA;</blockquote>&#xA;&#xA;<p><strong>Attem...
logic arrays
1
Maximum number of distinct values for bitwise OR -- (logic arrays) <blockquote>&#xA; <p>You are given an array with $N$ elements. The values of the elements may be any number in the interval $[0,10^9]$. Define $f(a,b)$ as the bitwise or of all the values in the subarray $[a,b]$. Find a bound on the number of distinct ...
habedi/stack-exchange-dataset
93,041
Multi-processing cpu utilization estimate
<p>I find a formula on my book to estimate cpu utilization under multi-processing.</p>&#xA;&#xA;<p>$ U = 1 - P^n $</p>&#xA;&#xA;<p>U: cpu utilization&#xA;P: cpu idle</p>&#xA;&#xA;<p>I want to know why or how to proof.</p>&#xA;&#xA;<p>Edit:</p>&#xA;&#xA;<p>The book is about operating system, not in english.</p>&#xA;&#xA...
operating systems
1
Multi-processing cpu utilization estimate -- (operating systems) <p>I find a formula on my book to estimate cpu utilization under multi-processing.</p>&#xA;&#xA;<p>$ U = 1 - P^n $</p>&#xA;&#xA;<p>U: cpu utilization&#xA;P: cpu idle</p>&#xA;&#xA;<p>I want to know why or how to proof.</p>&#xA;&#xA;<p>Edit:</p>&#xA;&#xA;<p...
habedi/stack-exchange-dataset