instruction
stringlengths
0
29.8k
⌀
No, a compelling reason is that you can't predict the call pattern of the functions. In particular, you cannot predict the recursion depth so it is impossible to preallocate.
Is 4DM NP-complete? An instance of 4DM consists of four disjoint sets X, Y, W and Z of size k, and a set Q of quadruples $Q = \{ (x, y, w, z) | x ∈ X, y ∈ Y, w ∈ W, z ∈ Z \}$ Question: Is there a subset $M ⊆ Q$ such that each of the elements of X, Y, W and Z is in exactly one quadruple in M? The answer I foun...
4DM is Np-complete
|np-complete|reductions|np-hard|np|check-my-answer|
There is a simple greedy algorithm. ### A greedy approach The greedy idea is obvious: starting from the very left, **extend the coverage <!-- without gap --> to the right as far as possible each time**. However, it may not be obvious to get it right. We should search each next positive interval by the followin...
Consider this problem from [Jeff Erickson: *Algorithms*][1] that already in this site, there is a this post [about it][2] where it want us prove a lower bound for it. The question is: >Suppose you are given an array $A[1 .. n]$ of integers, each of which may be positive, negative, or zero. A contiguous subarray...
null
Consider the following problem from [Jeff Erickson: *Algorithms*][1] that also appears in [this post][2], which wants us to prove a lower bound for the problem. >Suppose you are given an array $A[1 .. n]$ of integers, each of which may be positive, negative, or zero. A contiguous subarray $A[i .. j]$ is called a *...
|algorithms|arrays|greedy-algorithms|intervals|
|regular-languages|finite-automata|closure-properties|
null
|computer-architecture|cpu|
null
The following exercise is taken from Theoretical Computer Science by Atiba. >Use Rice's theorem to demonstrate that every decidable language is Turing reducible to some language that is already guaranteed to be decidable (for example, the language of strings that represent the primes). My reasoning is the followi...
Turing-reducibility for guaranteed decider
|turing-machines|rice-theorem|decidability|
It shouldn't be possible as introducing ATM/an ATM decider to the TM decider of your problem should introduce a contradiction to the decider. I am not an expert in decidablity, but it seems that this paper http://www.cs.toronto.edu/~ashe/comp.pdf from the University of Toronto has a good paper on this proof. It might b...
It is generaly not a problem to consider a set as a disjoint copy of another. If you consider a set of integers, just say that the first set are blue integers and the other are red integers. If that is still a problem for you, you can create: $$Z=\{(w, 0)|w\in W\}$$ Now $Z$ is kind of a copy of $W$, but not exactl...
The reason for having a stack is recursion. You don’t need a stack if you don’t have recursion. CDC super computers in the 70s worked just fine without a stack - until they implemented Pascal. On these machines the "Subroutine call" instruction stored a "Jump" instruction just before the start of the called subrout...
I'm interested in testing some Traveling Salesperson (TSP) greedy approximation algorithms for finding the shortest Hamiltonian path for very large graphs. Assume I can construct whatever graph I choose; how could I build a graph with a known shortest Hamiltonian path in polynomial time? A trivial way is to create ...
constructing non-trivial graph with known shortest Hamiltonian path
|graphs|nondeterminism|traveling-salesman|
If $B$ is chosen at random, then $\mathsf{P}^B \neq \mathsf{NP}^B$ almost surely. See for example [lecture notes of Luca Trevisan](http://theory.stanford.edu/~trevisan/cs254-14/lecture04.pdf), [Schöning and Pruim's gem](https://link.springer.com/chapter/10.1007/978-3-642-60322-8_23), or the [original paper of Bennett a...
Is 4DM NP-complete? An instance of 4DM consists of four disjoint sets X, Y, W and Z of size k, and a set Q of quadruples $Q = \{ (x, y, w, z) \mid x ∈ X, y ∈ Y, w ∈ W, z ∈ Z \}$ Question: Is there a subset $M ⊆ Q$ such that each of the elements of X, Y, W and Z is in exactly one quadruple in M? The answer I f...
4DM is NP-complete
> Consider a flow network $G$. Let $(S, T)$ be a min-cut of $G$. Let > $(u, v)$ be an edge that crosses the cut from $S$ to $T$. Claim: > increasing the capacity of $(u, v)$ causes the value of the maximum > flow in $G$ to increase. I'm 99% sure this is false, but I'm struggling to disprove it. Can anyone give me...
In the context of $P$ vs $NP$, I was taught the following during my CS education: - $P$ is the set of problems that can be solved in polynomial time - $NP$ is the set of problems for which solutions can be verified in polynomial time - Until $P$ vs $NP$ is solved, we only know that $P \subseteq NP$ However, ...
Finding a solution vs Proving that a solution exists
|complexity-theory|
In the context of $P$ vs $NP$, I was taught the following during my CS education: - $P$ is the set of problems that can be solved in polynomial time - $NP$ is the set of problems for which solutions can be verified in polynomial time - Until $P$ vs $NP$ is solved, we only know that $P \subseteq NP$ However, ...
In the context of $P$ vs $NP$, I was taught the following during my CS education: - $P$ is the set of problems that can be solved in polynomial time - $NP$ is the set of problems for which solutions can be verified in polynomial time - Until $P$ vs $NP$ is solved, we only know that $P \subseteq NP$ However, ...
You are pretty much asking if there is a broader set of algorithms $X$ such that for some decision problem $p$, there is a non-constructive proof that $p\in P$. This set would be separate from the classes $P, NP$ as those sets only care about the existence of solutions, whether or not they are actually constructabl...
$\mathsf{P}$ and $\mathsf{NP}$ are classes of decision problems. It means that for an instance of such a problem, the question is **always** a Yes-No question. Since you define $X$ as "the set of problems for which we can prove that a solution exists in polynomial time", there is a bit of ambiguity: are those proble...
In the context of $P$ vs $NP$, I was taught the following during my CS education: - $P$ is the set of problems that can be solved in polynomial time - $NP$ is the set of problems for which solutions can be verified in polynomial time - Until $P$ vs $NP$ is solved, we only know that $P \subseteq NP$ However, ...
I'd like to add a few observations about Yves Daoust's answer. The relation $$ (1)\qquad c-\varepsilon<\dfrac{f(n)}{g(n)}<c+\varepsilon $$ can be esaily inferred by tracing $|f(n)/g(n)-c|<\varepsilon$ on the number line like so: [![Number line][1]][1] That is, $f(n)/g(n)$ can be any value in the interval $(c-...
It is generaly not a problem to consider a set as a disjoint copy of another. If you consider a set of integers, just say that the first set are blue integers and the other are red integers. If that is still a problem for you, you can create: $$Z=\{(w, 0)|w\in W\}$$ or $$Z = \{\tilde{w}\mid w\in W\}$$ Now $Z$ is...
Carpenter's algorithm isn't implementable in a computer and makes assumptions that are not realistic in practice, such as that nature works with infinite-precision arithmetic and that you can choose the location of the nail with infinite precision in constant time and that the rubber band will find the global optimum i...
null
null
**Data Structure** > a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data. **Langua...
There seems to be a small confusion with the notation. Notice that $\sigma = \{z = a, \ y = h(b), \ x = h(b) \}$ and $\sigma' = \{z = a, \ y = h(b), \ x = y \}$ are the same unifier, written in a different way. It doesn't matter if we write $x = y$ or $x = h(b)$, since we also have $y = h(b)$. Hence, you did nothing w...
I think you're placing more emphasis than is warranted in these "characteristics" (linear, etc.). At best, those are common patterns that might be helpful to recognize. But they are not some fundamental property of data structures, they are fuzzy (not precisely defined), and so you can use them if they are useful and...
The most common/obvious way is a challenge-response test that is easy for humans but hard for computers (of course, but not only, [CAPTCHA][1]). This kind of test is very effective{1} but falls under the HIP (Human Interactive Proofs) area: it's not transparent. Typical, "simple" approaches to distinguish human w...
null
I'll take a swing at answering your question about why a physical machine might use more memory than the theoretical optimum. The schemes described by Rainer P. and D.W. can be implemented exactly as then have described; however... Your assertion that "I don't think it can be done on real hardware" is probably true,...
I'll take a swing at answering your question about why a physical machine might use more memory than the theoretical optimum. The schemes described by Rainer P. and D.W. can be implemented exactly as then have described; however... Your assertion that "I don't think it can be done on real hardware" is probably true,...
When an operand encodes an address, such as in a Load accumulator (LDA) instruction, it seems like a temporary address storage register is needed. Otherwise, reading the address into standard address register should result in the addressed memory changing while reading the word at the address. Illustrated in timing ...
How are setup and hold and timing constraints handled when reading an address from memory?
|cpu|
null
Don't know if you've solved the problem but here's some of my thoughts: For the first part, running $n^2$ $RCH$ should be a log space reduction since you only require $O(logn)$ extra space to record which pair you are currently checking. For the second part, for each $<G,s,t>$ you can construct a graph $G'$ where...
When an operand encodes an address, and that address changes the "memory address register" and the word in memory being addressed, it seems like timing issues could be a problem. Examples, LDA instruction (load address from memory, load word from that address. ) How is this usually solved (could be different across dif...
When an operand encodes an address, and that address changes the "memory address register" and the word in memory being addressed, it seems like timing issues could be a problem. Examples, LDA instruction (load address from memory, load word from that address. ) Illustrated in timing diagram below. [![enter image...
When an operand encodes an address, and that address changes the "memory address register" and the word in memory being addressed, it seems like timing issues could be a problem. Examples, LDA instruction (load address from memory, load word from that address. ) Illustrated in timing diagram below. [![enter image...
Well, actually there are many different approaches that can be used, and the optimal solution depends on the specific requirements and constraints of the system. While using a temporary register, the address is typically loaded into the MAR in a single clock cycle, and then used to access the word in memory in the n...
I am searching for datasets to evaluate an algorithm designed for tasks such as node-classification (edge-prediction, etc.) on _weighted_ and potentially directed graphs. The [Stanford Network Analysis Project (SNAP)](http://snap.stanford.edu/) repository only contains datasets containing _temporal_ weighted grap...
Weighted-Graph Datasets
|graphs|machine-learning|reference-request|data-sets|
null
null
The most common/obvious way is a challenge-response test that is easy for humans but hard for computers (of course, but not only, [CAPTCHA][1]). This kind of test is very effective{1} but falls under the HIP (Human Interactive Proofs) area: it's not transparent. Typical, "simple" approaches to distinguish human w...
The stabbing number of a triangulated simple polygon P is the maximum number of diagonals intersected by any line segment interior to P. Give an algorithm that computes a convex polygon triangulation with stabbing number O(log n). A convex polygon with n vertex is given, assuming n is even for simplicity. I've alrea...
Convex polygon triangulation with stabbing number O(log n)
|algorithms|computational-geometry|polygons|triangulation|
First, consider a Turing machine as a model (you can use other models too as long as they are Turing equivalent) of the algorithm at hand. When you provide an input of size $n$, then you can think of the computation as a sequence of the machine's configuration after each step, i.e., $c_0, c_1, \ldots$ . Hopefully, the ...
null
When we move the mouse, we can see the cursor moving on the monitor. I know that mouse can send signals according to its movements. Which component of a computer is receiving those signals in the first place? Is this whole process happening only between device controllers and device drivers? Is there any involvement of...
|computer-architecture|operating-systems|
null
In the comparison sort model of sorting, the fastest possible algorithm is order $n \log(n)$, where $n$ is the number of input numbers. What is the time complexity of sorting a list of natural numbers, each represented as a string of ones and zeros, and separated by commas? For example, the input $11,1,10$ would be sor...
Time complexity of sorting binary natural numbers
null
null
Let's say that I have an NP-complete problem such as the Clique Problem. Let's also assume that I have a finte set of graphs. What is the complexity of counting Yes/No instances? More specifically let's define a new decision problem that returns Yes on a finite set of graphs if the number of Yes instances is $\geq$ ...
What is the complexity class of counting Yes/No instances of an NP problem?
|complexity-theory|time-complexity|np-complete|
I think you are looking for [$\#\mathsf{P}$](https://en.wikipedia.org/wiki/%E2%99%AFP), a set of counting problems. See [this paper](https://www.math.cmu.edu/~af1p/Teaching/MCC17/Papers/enumerate.pdf) for some examples of $\#\mathsf{P}$-complete problems.
The three cases of the Master Theorem that you refer to are proved in the _Introduction to Algorithms_ by Thomas H. Cormen,Charles E. Leiserson,Ronald L. Rivest and Clifford Stein (2nd Edition, 2001). It is correctly observed that the recurrence in question falls between Case 2 and Case 3. That is $f(n) = n \log n$ ...
I'm interested in testing some Traveling Salesperson (TSP) greedy approximation algorithms for finding the shortest Hamiltonian path for very large graphs. Assume I can construct whatever graph I choose; how could I build a graph with a known shortest Hamiltonian path in polynomial time? A trivial way is to create ...
null
There is an easy way to find such an oracle that $P^B\not=NP^B$. The set $ S = \{\langle M, 1^n, 1^t\rangle \mid \exists x\in\{0,1\}^n \text{ with TM }M\text{ accepts }x\text{ within }t\text{ steps}\}$ in $NP$-complete. We use the oracle $B = \langle M, x, 1^t\rangle \mid M \text{ accepts }x \text{ within }t\text{ st...
I am trying to find an encoding function e:{0,1}^20→{0,1}^10 and a decoding function d:{0,1}^10→{0,1}^20. Goal is to find d and e so that maxBdH(d(e(B)),B) is as small as possible. Here, dH denotes the Hamming distance, and the maximum is taken over all possible bit arrays of length 20. Haven't been able to find a s...
Encoding and Decoding
|binary|error-correcting-codes|computer-algebra|hamming-code|hamming-distance|
Let's say I have some problem $A \in \mathcal{NP}$, and the problem of certifying a solution of $A$ is a $\mathcal{P}$-complete problem. Does this imply that $A$ is $\mathcal{NP}$-complete? **Example:** $\text{Circuit-SAT} \in \mathcal{NP}$, and certifying a solution of $\text{Circuit-SAT}$ is equivalent to solving ...
If the certification of a problem is P-complete, is the problem NP complete?
|complexity-theory|np-complete|
Let's say I have some problem $A \in \mathcal{NP}$, and the problem of certifying a solution of $A$ is a $\mathcal{P}$-complete problem. Does this imply that $A$ is $\mathcal{NP}$-complete? **Example:** $\text{Circuit-SAT} \in \mathcal{NP}$, and certifying a solution of $\text{Circuit-SAT}$ is equivalent to solving ...
null
There is an easy way to find such an oracle that $P^B\not=NP^B$. The set $ S = \{\langle M, 1^n, 1^t\rangle \mid \exists x\in\{0,1\}^n \text{ with TM }M\text{ accepts }x\text{ within }t\text{ steps}\}$ in $NP$-complete. We use the oracle $B = \langle M, x, 1^t\rangle \mid M \text{ accepts }x \text{ within }t\text{ st...
Why is it important to know if a program terminates or not? In particular, what are some consequences of a non-terminating program?
Why do we care about termination analysis?
|termination|
First, the halting problem is the fundamental building block that enables us to prove that many, many problems we care about are [undecidable](https://en.wikipedia.org/wiki/Undecidable_problem). See https://en.wikipedia.org/wiki/List_of_undecidable_problems. Second, in some contexts, it is important to know that a ...
Let's say I have some problem $A \in \mathcal{NP}$, and the problem of certifying a solution of $A$ is a $\mathcal{P}$-complete problem (I'm considering $\leq_{logspace}$ reductions). Does this imply that $A$ is $\mathcal{NP}$-complete? **Example / Motivation:** $\text{Circuit-SAT} \in \mathcal{NP}$, and certifying ...
I think in your book results, first of all they reduce to FA and then they convert to DFA, just like NDFA to DFA. So that in the second picture actual result comes like this, but they forget to mention some input state in $q_f$ and $q_3$.
null
null
A boolean expression is valid if it is true for every valuation. The problem $\text{BOOL-VAL}$ asks whether a given boolean expression is valid. As the question suggests I need to show that $\text{BOOL-VAL}$ is decidable in linear time. Is $\text{BOOL-VAL}$ the complement of $\text{BOOL-SAT}$? Moreover, A boolea...
Show that $\text{BOOL-VAL}$ and $\text{DNF-SAT}$ is decidable in linear time