instruction stringlengths 0 29.8k ⌀ |
|---|
null |
I have a real-world (see background below) problem wherein a set $S = \{A,B,C,D...\}$ needs to be partitioned into set $P = \{ \{A,B\},\{D\},\{E,F\},\{C,G,H\},...\}$ where $P$ is required to have the fewest possible elements. There are restrictions on which elements of $S$ can be partitioned together; at any time I can... |
How does this partitioning problem map to studied problems? |
|algorithms|partitions| |
null |
function fun(n) {
let i,
j,
p,
q = 0;
for (i = 1; i <= n; ++i) {
p = 0;
for (j = n; j > 1; j = j / 2) {
++p;
}
for (k = 1; k < p; k = k * 2) {
++q;
}
}
return q;
}
let val_q = fu... |
null |
null |
null |
null |
null |
Probably this was not the right place for this question, but anyway, I found the answer in the meantime, in the form of a mostly "digestible" proof at http://wayback.archive.org/web/20141122124458/http://wqzhang.wordpress.com/2009/06/09/sicp-exercise-1-14/. |
null |
I've come up with a greedy algorithm proof for the minimum denominations problem, and I'm curious if someone can verify the correctness of the proof for me. I have simplified the problem by restricting the denomination set to the US Coinage System. Thank you very much in advance.
**A Formal Definition of the Problem... |
null |
null |
> Suppose $P\neq NP$. The following problem can be solved
> in polynomial time?
>
> - Given natural number $n$ and positive real numbers $a_1,a_2,\dots,a_n$ and $b_1,b_2,\dots,b_n$. The goal is to find
> $I\subseteq\{1,2,\dots,n\}$ such that $\sum_{i\in I}b_i$ maximized and
> $\sum_{i\in I}a_i\leq 5$.
B... |
null |
are there some packages in any programming language which make it convenient to solve this specific type of PDE?
$f_t + \left(1 + \xi \frac{\kappa_t - a}{T-t}\right) f_a + \frac{\sigma^2}{2} f_{aa} + r(1-\gamma)f - (\rho + \lambda(a))f + \gamma f^{1-\frac{1}{\gamma}} = 0$
I've come across similar PDEs multiple ti... |
Frameworks for numerically solving this specific form of PDE? |
|numerical-analysis| |
We need to show that:
- there is an oracle $A$ relative to which $NP^A = coNP^A$
- there is an oracle relative to which $NP^B \neq coNP^B$
While I can show the first part of this statement, I can't wrap my head around the hint for the second part.
The hint:
consider the language: $L_B = \{ 1^n : \for... |
Show that the NP vs coNP question relativises both ways |
|complexity-theory| |
Inverse quantization and inverse transform are how the encoder keeps track of which pixel-values the decoder will have in its buffer at any give point in time. If you skip that step, then you make the encoder a tiny bit faster, but the resulting compressed video will be much lower quality.
---
Let $S_i$ be the se... |
I have found two formulas in the [work][1] on pages 5 and 6, of which I am trying to develop a recursive implementation. The similarity to the DFT or FFT might be useful here. I divide this question into three sections, in the first part I explain my thoughts, in the second section there are open questions and in the t... |
null |
Your question contains so many sub-questions and claims, making it really hard to answer, but I will try my best, starting with debunking your claims.
No, You Cannot Predict Halting!
-------------------------------
You are conflating loop detection with the halting problem. Loops are only the very simplest type of... |
null |
null |
The four segments you mentioned are not static - these are in fact registers that can point to any 64kb zone in the 1MB memory. By changing the value of these registers we can point to other fragments of the memory.
The exact computation of the effective address is performed using 2 registers: a segment register (CS... |
null |
The way I understand is that complexity classes which are denoted with $\Sigma_i$ are representing a combination of alternating variable quantifiers which must start with an existential quantifier $\exists$, for example: $\exists y_1 \forall y_2 ... Q y_i$ and the last quantifier does not really matter. That is why we ... |
Polynomial Hierarchy - the difference between $\Pi$ and $\Sigma$ |
|complexity-theory| |
A machine which runs in time $f(n)$ also runs in space $f(n)$, that is, the space used by a machine is always at most the time it uses. In symbols, $\mathrm{space}_M(n) \leq \mathrm{time}_M(n)$.
A machine is in $\mathsf{TIME}(f(n))$ if it runs in time $O(f(n))$. Any such machine also uses space $O(f(n))$ (since the ... |
null |
Your conception of the variable ordering is misleading you, and we can indeed add a dummy variable at the beginning.
If we have a $\Pi_1\mathrm{P}$-problem $S$, we can write it as $S(x) \Leftrightarrow \forall y_1 Q(x,y_1)$. But then of course we also have that $S(x) \Leftrightarrow \exists y_1 \forall y_2 \ Q(x,y_2... |
null |
I have a dataflow graph where a set of different types of tasks are placed in its nodes. For example, I have tasks of types A, B, and C. A-type tasks are placed in all the leaf nodes of the dataflow graph. B-type tasks are placed in nodes with the data from any two nodes hosting A-type tasks or one node hosting B-type ... |
null |
I understand of the existence of Rice's Theorem, however, I want to understand better how this reduction is formed. My professor gives the answer as follows:
"By contradiction, assume that $L$ is decidable and let $D$ be a decider for $L$. Then construct the TM $S$ such that $S$ decides the Halting Problem as follow... |
Hel understanding the proof that $L = \{ \langle M \rangle \mid M \text{ is a TM that accepts the input string } 101\}$ is undecidable |
|turing-machines|computability|reductions|undecidability| |
null |
In a simple weighted graph, with n vertices and m edges , for each pair of vertices we want to find the number of edges that appeared at least in one of the shortest paths between these two vertices.
I assume we can solve it using Floyd-Warshall algorithm or something similar to it but I tried and didn't reach any a... |
number of edges that appeared at least in one shortest path |
|graphs|graph-traversal|weighted-graphs| |
null |
null |
I'm learning NFA and the following question is confusing me.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/0yxQ7.png
Can Someone explain the answer. I have a feeling that it might be wrong.
Thank you! |
Can someone explain the following NFA? |
|finite-automata| |
null |
The following is a naive algorithm:
1. Run Floyd-Warshall algorithm. It will give the shortest path values $d(s,t)$ between every pair of vertices $s, t \in V$.
2. For each edge $(u,v)$ and pair of vertices $s$ and $t$, if $d(s,u) + d(u,v) + d(v,t)= d(s,t)$, means there exists a shortest path from $s$ to $t$ via ... |
My question is simply this: is it possible to upper bound the output length of a halting turing machine? Ie for all inputs length $n$, is there some $f$ such that the size of output $|M(x)| = O(f(n))$?
On the one hand, it seems like yes because every halting machine will leave some finite string on the tape so surel... |
Upper bound on output of halting transducer |
|turing-machines|computability| |
null |
number of edges |
I assume we can solve it using Floyd-Warshall algorithm or something similar to it but I tried and didn't reach any algorithm. I think its complexity should be O(N^3) |
In a simple weighted graph, with n vertices and m edges , for each pair of vertices we want to find the number of edges that appeared at least in one of the shortest paths between these two vertices.
I assume we can solve it using Floyd-Warshall algorithm or something similar to it but I tried and didn't reach any a... |
number of edges that appeared at least in one shortest path |
I am working through the exercises in the book "Term Rewriting and All That" and got stuck on question 2.3. The question reads: find a reduction $\rightarrow$ on $\mathbb{N}$ such that $\rightarrow$ is decidable, but it is undecidable for some $n$ is in normal form. A friend and I came up with two different solutions. ... |
"Term Rewriting and All That" - Exercise 2.3 |
|reductions|undecidability|term-rewriting| |
null |
null |
Help understanding the proof that $L = \{ \langle M \rangle \mid M \text{ is a TM that accepts the input string } 101\}$ is undecidable |
null |
null |
Do any hash functions exist that provide the same result if the input is reversed?
If this is impossible, why is it impossible?
I am interested in sending packets around a circuit in a network in both directions, having each node add its value to the hash and then, when the packets meet, compare the hash values. |
Hash function that returns the same result when the input is reversed |
|algorithms|hash|hashing| |
You could take any hash function $H$ and define a new hash function $H'$ as $H'(x) = H(x \Vert x^R)$, where $\Vert$ denotes concatenation and $x^R$ is the reversed version of $x$. |
Do any hash functions exist that provide the same result if the input is reversed?
If this is impossible, why is it impossible?
I am interested in sending packets of constant size around a circuit in a network in both directions, having each node add its value to the hash and then, when the packets meet, compare ... |
null |
I am working through the exercises in the book "Term Rewriting and All That" and got stuck on question 2.3. The question reads: find a reduction $\rightarrow$ on $\mathbb{N}$ such that $\rightarrow$ is decidable, but it is undecidable for some $n$ in normal form. A friend and I came up with two different solutions. But... |
|regular-languages|finite-automata| |
are there some packages in any programming language which make it convenient to solve this specific type of PDE?
$f_t + \left(1 + \xi \frac{\kappa_t - a}{T-t}\right) f_a + \frac{\sigma^2}{2} f_{aa} + r(1-\gamma)f - (\rho + \lambda(a))f + \gamma f^{1-\frac{1}{\gamma}} = 0$
I've come across similar PDEs multiple ti... |
Do any streaming hash functions exist that provide the same result if the input is reversed?
That is to say, is there some hash function, $h$, such that:
$$ h(h(h(h(0, x_1), x_2), ...), x_n) = h(h(h(h(0, x_n), ...), x_2), x_1) $$
If this is impossible, why is it impossible?
I am interested in sending pack... |
Reversible streaming hash function |
|hash|cryptography|hashing|streaming-algorithm| |
null |
There are several polynomial-based hash functions $H$, where you can rapidly compute $H(m)$ or $H(\text{rev}(m))$ given $m$, and you can do both in a streaming fashion. See below for several candidates for $H$. Then, you can use
$$H'(m) = H(m) \oplus H(\text{rev}(m)),$$
and $H'$ will have the property you are l... |
The greedy algorithm is optimal if it only picks 1c coins. It is optimal if it picks a 5c coin as the highest because the alternative is five 1c. It is optimal if it picks one or two 10c because the alternative is two or four 5c. And it is optimal if it picks 25c coins because the alternative is two 10c and replacing o... |
I have been trying to solve the following problem. I have n intervals each with a cost.I want to choose a subset of the intervals that maximizes the cost but with the following constraint. Each interval when chosen uses one resource from a limited amount say k and when it finishes releases the resource to be used by an... |
Intervals with costs and limited resources, dynamic programming |
|dynamic-programming|intervals| |
Task
-----
Consider the following recursively-defined tree structure:
```
const tree = {
val: 1,
children: [
{val: 2},
{
val: 3,
children: [
{
val: 4,
children: [
{val: 5},
{val: 6},
{val: 7}
]
}
... |
Consider the language L = {<M1 , M2> | Ǝx such that x ∈ L(M1) ∩ L(M2)} Show that L is not decidable.
Im doing a proof by contradiction but im having trouble with the turning machine part |
Turning machines |
|complexity-theory|turing-machines|theory| |
null |
null |
null |
As stated, the problem is impossible (with a non-trivial hash function). Consider the case n=2, then you have that, for example,
$$h(h(0, 1), 2) = h(h(0, 2), 1)$$
That implies that
$$h(h(h(0, 1), 2), 3) = h(h(h(0, 2), 1), 3)$$
So the strings $1,2,3$ and $2,1,3$ are forced to have the same hash even if one i... |
null |
From book "Fabric of reality" by David Deutsch.
> We know from quantum theory that all such variables are quantized, and therefore that, no matter how the computer works, the set of possible programs is discrete. Each program can therefore be expressed as a finite sequence of symbols in a discrete code or computer ... |
David Deutsch says that "number of atoms in universe is finite", but then says that "number of programs of all finite lengths is infinite" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.