instruction
stringlengths
0
29.8k
⌀
Call such a set "universal transformer". Yes, there is a universal transformer. ------ Let $\mathcal{ALL}$ be the set of all Turing machines, that is, $\mathcal{ALL}=\{\langle M\rangle\mid M\text{ is a Turing machine}\}$, where $\langle\cdot\rangle$ is some fixed encoding scheme for Turing machines. By abus...
This is an exam question I couldn't solve If I store 2^59 as double, that would give me 1 * 2^58. Is the answer just 2? I.e. next value is 2^60??
How much larger is the next representable value if 2^59 is stored in a double?
|floating-point|
Suppose that we have a problem in $NP \cap coNP$, if we find an algorithm that solves the problem in P, does this mean that $NP=P$?
Problem in $NP \cap coNP$ and in P implies $NP=P$
|complexity-theory|np-complete|np|
Problem in $NP \cap coNP$ and in P implies $NP=P$?
No. $P$ is a subset op both $NP$ and $coNP$ so any problem in $P$ is in $NP\cap coNP$. To show that $NP=P$ you need to show that all problems in $NP$ have a polynomial time solution. If you would show that a $NP$-complete problem is in $NP\cap coNP$ however you would show $NP=P$.
Not at all. Take _any_ problem in P. Then the problem is automatically in NP and in co-NP, and therefore in the intersection, so you would conclude that P = NP. Because of one problem in P. That's obviously not correct.
Write down the exponent. Then look at the mantissa. It has a certain number of bits. The highest bit is not stored because it is always 1, and that bit has a value of $2^{59}$. How many bits of the mantissa are stored, and how many bits are there? Figure out the value of the lowest bit. You get the next representab...
null
In some works, such as the recent maxflow paper, there is reference to an "almost-linear" complexity, which typically refers to a complexity of $O(n^{1+o(1)})$. This is similar to the notion of quaslinear complexity, which refers to a complexity of $O(n \log^{O(1)} n)$. It is clear that quasilinear complexity is ...
Difference between "almost-linear" and "quasilinear" time complexities
|complexity-theory|time-complexity|asymptotics|space-complexity|complexity-classes|
Consider a long-lived TCP session with an end-to-end bandwidth of 1Gbps. The session starts with a sequence number of 1234. The minimum time (in seconds, rounded to the closet integer) before this sequence number can be used again is _________. The solution given for above question was : [(2^32)*8]/(10^9) = 34.359...
TCP Warp Around time - Sequence number Problem
|computer-networks|tcp|
An insertion could at worse cause a rotation on every level, hence with complexity $O(h)$ where $h$ stands for the height. Now thanks to balancing, $h=O(\log n)$.
What is the best way of implementing the following function, $$f(x) = \frac{x}{\max(1, |x|)},$$ where $x$ is complex, using a Cartesian representation of $x$ with IEEE 754 floating point representations (i.e., `float` or `double`) for the real and imaginary parts such that $|f(x)| \leq 1$ for all possible values ...
Question: we have the following language: $$L = \{\langle M \rangle : L \langle M \rangle < \infty \operatorname{ and M is a TM}\}$$ Prove it is a decidable language or not. ---------- My idea was to use reduction on this but I can't find the proper one and I don't even know if it is decidable or not.
Prove that the following language is Decidable or not
|formal-languages|turing-machines|automata|reductions|undecidability|
null
Question: we have the following language: $$L = \{\langle M \rangle :| L \langle M \rangle| < \infty \operatorname{ and M is a TM}\}$$ Prove it is a decidable language or not. ---------- My idea was to use reduction on this but I can't find the proper one and I don't even know if it is decidable or not.
I am currently trying to learn some more about complexity classes. I found this exercise but I cannot find a proper solution to this exercise: [![Principia matematica][1]][1] [1]: https://i.stack.imgur.com/kTgf0.png I know this is in NP, can I also say it is in P? If that's the case how could I formall...
To what complexity class does this language belongs?
|complexity-theory|np|
null
In coding theory we typically consider the situation where we have a channel that connects a sender and receiver. The messages flowing from the sender to the receiver are corrupted by an error source ES. We have an error detection and correction mechanism that is typically fine-tuned to ES. Wikipedia (https://en.wi...
Algebra of error models and error correcting codes?
|information-theory|coding-theory|error-correcting-codes|entropy|algebra|
I suggest you read up on how TCP works and why do we need the sequence number. It is just a matter of unit conversions once you understand it. But I'll try to explain it in simple terms. A packet consists of bytes. In TCP every byte has a sequence number. What do we need it for? In short to avoid duplicates, indicat...
given some $n$ I would be interested to know what is the count of all 3SAT formulas under $n$ that are unsatisfiable. An partially example of all 3SAT forumlas under $n=3$ is the following: $$ ( x \lor y \lor z) = Satisfiable \\ ... \\ ( x \lor y \lor z)\land ( \neg x \lor \neg y \lor z)= Satisfiable \\ ... \...
Could we know what's the total number of unsatisfiable 3SAT formulas for a given n?
|satisfiability|p-vs-np|3-sat|
given some $n$ I would be interested to know what is the count of all 3SAT formulas under $n$ that are unsatisfiable. An example of all 3SAT forumlas under $n=3$ is the following: $$ ( x \lor y \lor z) = Satisfiable \\ ... \\ ( x \lor y \lor z)\land ( \neg x \lor \neg y \lor z)= Satisfiable \\ ... \\ ( x \l...
Here is an example of a function which is "almost-linear" yet not quasilinear. Let $f(n)=n~n^{(\log n)^{-1/2}}$. $f(n)$ is almost-linear. For any constant $c$, $$\lim_{n\to\infty}\frac{n~n^{(\log n)^{-1/2}}}{n(\log n)^c}= \lim_{n\to\infty}\frac{e^{(\log n)~(\log n)^{-1/2}}}{e^{c\log\log n}}= \lim_{n\to\infty}...
I got a question: Design a pushdown automata that can recognize strings in L= {$ a^n b^{2n} c^{3n} | n ≥ 0 $} . I tried to think and design it, but I couldn't find it. The best that I can think of is L= {$ a^n b^{m} c^{m+n} | m,n ≥ 0 $} . I only can make sure that c appears as much as a+b appear. So, I'm wondering, ...
Is this a context free language? I need to make PDA but I don't think it is doable
|context-free|pushdown-automata|
I was wondering if, given an algorithm for 3SAT, testing it on Barthel instances would provide a general idea of how well it empirically performs on hard instances. What would other hard instances look like that would perhaps be more telling? *Defining Barthel instances*: I have only seen them namedropped so I thoug...
The issue might be that 2SAT can be solved in polynomial time while 3SAT is NP-complete and can't. When the computational complexity becomes much higher, the proofs of your 2SAT method might not translate well to 3SAT or it works but you just don't have time to wait around for the solution. It's hard to say unless y...
For $L= \{a^n b^{2n} c^{3n} | n ≥ 0 \}$ you will be failed to make PDA with one-stack. Because here is two comparisons, one $a$ should be checked against with $2b$ and $3c,$ but when you complete one $a$ checked against with $2b$ then stack will be empty, and there will be pending of $c$'s computation. This two com...
given some $n$ variables I would be interested to know what is the count of all 3SAT formulas under $n$ that are unsatisfiable. An example of all 3SAT forumlas under $n=3$ is the following: $$ ( x \lor y \lor z) = Satisfiable \\ ... \\ ( x \lor y \lor z)\land ( \neg x \lor \neg y \lor z)= Satisfiable \\ ... \...
Could we know what's the total number of unsatisfiable 3SAT formulas for a given n variables?
null
For $L= \{a^n b^{2n} c^{3n} | n ≥ 0 \}$ you will be failed to make PDA with one-stack. Because here is two comparisons, one $a$ should be checked against with $2b$ and $3c,$ but when you complete one $a$ checked against with $2b$ then stack will be empty, and there will be pending of $c$'s computation. This two com...
The answer above which claims "it doesn't work" doesn't quite make sense. Doesn't work for what? Which implementation of it? I realize I'm writing this with the luxury of 7 years having passed, but it's worth updating. Scott Aaronson assumed in his 2015 blogpost that a MemComputer is purely an analog machine (which...
Question: we have the following language: $$A = \{\langle M \rangle :| L( M)| < \infty \text{ and } M\text{ is a Turing machine}\}$$ where $\langle M\rangle$ is the encoding of $M$ and $L(M)$ is the language accepted by $M$. Prove $A$ is a decidable language or not. ---------- My idea was to use reduction o...
Prove that the language of all Turing machines that accept finitely many words is decidable or not
|formal-languages|turing-machines|reductions|undecidability|
Let $f_a(n)=n^{1+(\log n)^{-a}}$, where $a\ge0$. - $a=0$. $f_0(n)=n^2$ is not "almost-linear". - $0<a<1$. Since $(\log n)^{-a}=o(1)$, $f_a(n)$ is almost-linear. For any constant $c$, $$\begin{aligned} \lim_{n\to\infty}\frac{f_a(n)}{n(\log n)^c} &=\lim_{n\to\infty}\frac{n^{(\log n)^{...
In 2014, inspired by [Regex Golf](https://alf.nu/RegexGolf), I started exploring, along with a mathematician going by the name **teukon**, what could be done in the unary domain in ECMAScript regex that went significantly beyond matching primes and powers of 2 (both of which were puzzles in the Regex Golf site). This i...
null
null
This answer is based on Optidad's original answer and I feel like to make it more clear. (It meant to be in the comment but I want to illustrate with pictures.) **Hamiltonian Path** problem: > Given a directed graph $G$, does it contains a Hamiltonian path? Note that the path is allow to start at any node and ...
Does there exist a flow graph that always requires flow to be pushed back no matter what ordering of augmenting paths is chosen in [Ford Fulkerson](https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm)? Let's assume we use the standard procedure of repeating this step: 1. Find an augmenting path $p$ in ...
|network-flow|ford-fulkerson|open-problem|
This answer is based on Optidad's original answer and I feel like to make it more clear. (It meant to be in the comment but I want to illustrate with pictures.) **Hamiltonian Path** problem: > Given a directed graph $G$, does it contains a Hamiltonian path? Note that the path is allow to start at any node and ...
I am currently working on data compression and thought it would be a good time to read up on the basics of information theory to better understand data compression and its algorithms. As I understand, given a set of data, we can compute the minimum no. of bits on average required to encode the data my multiplying th...
How many bits are required to encode information in probability set G = [0.001, 0.002, 0.003, 0.994]?
|information-theory|data-compression|entropy|
Here is one way to do it, the number of epsilons can probably be reduced though: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/6H2Zw.png
null
null
Given an undirected weighted graph $G$ and two vertices $s, t$. We want to find a path $P$ from $s$ to $t$ that minimizes the following objective function $f$ $$L(P) = max(len(P), max\{c(e) \mid e \in P\})$$ For example, consider the following graph [![enter image description here][1]][1] Here we have two w...
Shortest path problem with additional constraint of minimal weight
|graphs|optimization|
null
Given an undirected weighted graph $G$ and two vertices $s, t$. We want to find a path $P$ from $s$ to $t$ that minimizes the following objective function $f$ $$L(P) = max(len(P), max\{c(e) \mid e \in P\})$$ For example, consider the following graph [![enter image description here][1]][1] Here we have two w...
I have encountered a following problem: Given the list of $k$ values from range $[v_{min}; v_{max}]$, find $m$ non-overlaping ranges of length $l$, such that maximises the number of values from the original range that would fit into those new ranges. For example: Given a list `[2, 3, 4, 5, 10, 11, 12, 21, 22...
Non-overlaping fixed-width ranges with most occurrences
|algorithms|
Let's consider this problem first. Given an integer $C$, return the length $\ell(C)$ of the shortest $s$-$t$ path in the subgraph of $G$ induced by all the edges with cost at most $C$. Clearly this problem can be solved in time $O(m + n \log n)$, where $n$ and $m$ are the number of edges and vertices of $G$, respec...
Let $c_1, c_2, \dots, c_k$ be the costs of the edges in $G$, in increasing order (no repetitions) and let's restrict ourselves to the case in which $s$ and $t$ are connected in $G$ and the length of the shortest path from $s$ to $t$ in $G$ is at most $c_k$ (otherwise the problem is trivial). Let $c_0 = -\infty$. C...
Using a fixed-length code, you indeed need two bits and the average length is 2. With a variable-length code, you will reserve a single bit (say 0) for the most frequent symbol, and two or three bit numbers (say 10, 110 and 111) for the remaining cases. The average length will remain close to 1.
Let's restrict ourselves to the case in which $s$ and $t$ are connected in $G$ and the length of the shortest path from $s$ to $t$ in $G$ is not larger than the maximum edge cost (otherwise the problem is trivial). Consider this simpler problem first: Given an integer $c$, return the length $\ell(c)$ of the shorte...
Using a fixed-length code, you indeed need two bits and the average length is 2. With a variable-length code, you will reserve a single bit (say 0) for the most frequent symbol, and two or three bit numbers (say 10, 110 and 111) for the remaining cases. The average length will remain close to 1. >!More precisely...
What is the best way of implementing the following function, $$f(x) = \frac{x}{\max(1, |x|)},$$ where $x$ is complex, using a Cartesian representation of $x$ with IEEE 754 floating point representations (i.e., `float` or `double`) for the real and imaginary parts such that $|f(x)| \leq 1$ for all possible values ...
I didn't encounter that question, but what I would do is use Counting sort(Because we have the range of values) and then I would loop over the sorted array and choose those m parts, I didn't quite understood the part - " find m non-overlaping ranges of length l, such that maximises the number of values from the origina...
|algorithms|dynamic-programming|
Given an undirected weighted graph $G$ and two vertices $s, t$. We want to find a path $P$ from $s$ to $t$ that minimizes the following objective function $f$ $$L(P) = max(len(P), max\{c(e) \mid e \in P\})$$ For example, consider the following graph [![enter image description here][1]][1] Here we have two w...
Suppose I have a graph with node weights, for example: [![A graph][1]][1] [1]: https://i.stack.imgur.com/8OBZy.png If a node has weight -1, it is "happy". If a node has positive weight, it is "unhappy", and wants to leave the graph. How do I efficiently calculate which nodes I should kick out of the...
Efficiently determine which nodes should leave a graph while maintaining connectedness
|graphs|weighted-graphs|spanning-trees|connected-components|max-cut|
|graphs|optimization|weighted-graphs|connected-components|max-cut|
Suppose I have a graph with node weights, for example: [![A graph][1]][1] [1]: https://i.stack.imgur.com/8OBZy.png If a node has weight -1, it is "happy". If a node has positive weight, it is "unhappy", and wants to leave the graph. How do I efficiently calculate which **unhappy** nodes I should kic...
null
Given an undirected weighted graph $G$ and two vertices $s, t$. We want to find a path $P$ from $s$ to $t$ that minimizes the following objective function $f$ $$L(P) = max(len(P), max\{c(e) \mid e \in P\})$$ For example, consider the following graph [![enter image description here][1]][1] Here we have two w...
Most versions of simulated annealing I've seen are implemented similar to what is [outlined in the wikipedia](https://en.wikipedia.org/wiki/Simulated_annealing#:~:text=Simulated%20annealing%20(SA)%20is%20a,space%20for%20an%20optimization%20problem.) pseudocode below: ``` Let s = s0 For k = 0 through kmax (exclusive)...
Simulated Annealing - Intuition
|algorithms|optimization|combinatorics|search-algorithms|simulated-annealing|
null
Suppose I have a graph with node weights, where a weight is either -1 or a positive integer. For example: [![A graph][1]][1] If a node has weight -1, it is "happy", and cannot be kicked out of the graph. If a node has positive weight, it is "unhappy", and can be kicked out of the graph. How do I efficien...
I saw the word "redex" in the context of proramming language theory/semantics in 2018 and now when I was reading a neurosymbolic [research paper][1] (machine learning with neural nets + symbolic algorithms). The research paper said: > Constructing $I\beta'$ (operator that inverts one step of beta-reductions/functi...
Suppose I have a graph with node weights, where a weight is either -1 or a positive integer. For example: [![A graph][1]][1] If a node has weight -1, it is "happy", and cannot be kicked out of the graph. If a node has positive weight, it is "unhappy", and can be kicked out of the graph. How do I efficien...
VC dimension covers the binary classification case, i.e. when we want to get a predictor $X \to \{0, 1\}$. Using VC dimension, we can get the upper bound on the sample complexity for PAC-learning. In our problem, we have 3 classes, i.e. we want to train a predictor $X \to \{0, 1, 2\}$. We have a kind-of "VC dimens...
PAC learning for multiple classes through VC dimension
|learning-theory|vc-dimension|