instruction
stringlengths
0
29.8k
⌀
null
Assume I have a programming language $L$ with well-defined semantics. Showing Turing-completeness is straightforward: if I write a program using $L$ simulating the universal TM, I'm done. What I'm concerned about is another direction. How do we show that a program in $L$ can be simulated by TM when $L$ supports thing...
null
Even if P $\neq$ NP, that says nothing about average case complexity. That for any algorithm for solving a NP complete problem must have at least some instances where it takes more than polynomial time. However it is certainly possible that we find an AI that can solve sat in linear time for 80% of instances better the...
null
Can someone provide a list of references of papers, books, etc. presenting results on the time and space complexity of the problem of *isolating* the roots of a univariate polynomial $P(t)$ with integer coefficients (e.g. $P(t) \in \mathbb{Z}[t]$)? Papers like [this one](https://dl.acm.org/doi/10.1145/2930889.29309...
Time and Space Complexity of Isolating the Roots of a Polynomial
|algorithms|complexity-theory|polynomials|
Once you get the point, you can use [Flood Fill Algorithm][1] to replace the current color in the region containing the point with the new color. Basically, this algorithm starts from a specified point and then recursively(or iteratively) keep replacing the *current color* with the *new specified color* in the neigh...
First of all you should separate the (math) specifications of $L$ and its "execution" from the input/output functions of $L$. If such input/output is crucial for $L$ then you're trying to prove the Turing equivalence of a "device running $L$" with a Turing machine (which is a little bit different). For example if $...
Given that neural nets are good at interpolation (but poor at extrapolation), for a given use case it suffices to solve a few billion large problems and feed them to a sufficiently large net. In some cases this would work.
**Problem**: Let $ A $ be an array of $ n $ different elements from an ordered interval. Let $ I(A) $ be the number of inversions in array $A$, meaning, the number of pairs of indexes $ 0 \leq i < j <n $ for which it occurs that $ A[i] > A[j] $. Notice that $ 0 \leq I(A) \leq {n \choose{} 2} $ and that $ I(A) =...
Calculating number of inversions in array using AVL Finger Tree
|data-structures|trees|
null
Subgraph Isomorphism with Same Number of Nodes
I am looking at a specific variant of subgraph isomorphism: - **Instance** A graph $G = (V_G, E_G)$ and a target graph $H = (V_H, E_H)$ such that **$|V_G| = |V_H|$**. - **Question** Is there a subgraph $G' = (V'_G, E'_G)$ of $G$ that is isomorphic to $H$? (Note the condition $|V_G| = |V_H|$ above, which implie...
I've just started learning computer architectures and I'm having trouble understanding where these are used. I know that parity checking is testing for accurate data transmission between nodes in a communication network. However, when does this parity checking happen on a computer? like does it happen every time dat...
which devices use parity checking?
|computer-architecture|computer-networks|
null
null
When Error-detection and Error-coorrection is performed depends on associated protocol and layers. For example for Ethernet ,Error-detection and Error-coorrection performed in intermediate routers between sender and receiver at layer2(Data-link layer) for both header and data. And at layer3(Network layer) for ...
```java int[] arr = new int[10]; ``` Would this count as a single primitive operation under the RAM model or would it be 10 operations as we are allocating 10 memory locations to this variable "arr"? This also ties in to my other question: if there existed an array of size 1 and we were to increase the size b...
Does creating an array count as a primitive operation under the RAM model?
|algorithms|algorithm-analysis|asymptotics|big-o-notation|
null
I think there is something wrong with the definition of $TreeRank(x)$. Shouldn't it be define as the position of $x$ among the inserted items in the tree and not $A$ entirely? Otherwise, it will not work with your example. If you use my definition, $n - TreeRank(x) $ means you are counting how many elements greater ...
null
I'm wondering if anyone can help me with this. Say I have a DAG, I understand that it has no directed cycles, but it can have loops ( "diamonds" ). My question is, is there a known way to convert such graph to a directed tree that has no loops. I know of the junction tree/ clique tree way, but this results in an und...
Converting a Directed Acyclic Graph to a Directed Tree
|graphs|dag|decomposition|
Let $ G(V,E,w)$ be a graph with no negative weights. Describe an algorithm that returns the shortest cycle containing a node $ v $. I came across this algorithm https://courses.engr.illinois.edu/cs374/sp2017/labs/solutions/lab10-sol.pdf I can't convince myself it is true, because $ d(s,v)+w(s,v)$ might not be...
Calculate shortest cycle that contains node $s$
|graphs|shortest-path|weighted-graphs|
To answer the question "why is the linked algorithm correct?", first of all notice that it works for *directed* graphs. We want to show that the shortest cycle containing $s$ consists of a shortest path from $s$ to some vertex $v$ plus the edge $(v,s)$ such that $d(s,v) + w(v,s)$ is minimized. Let $C = \langle s...
To answer the question "why is the linked algorithm correct?", first of all notice that it works for *directed* graphs. We want to show that the shortest cycle containing $s$ consists of a shortest path from $s$ to some vertex $v$ plus the edge $(v,s)$ such that $d(s,v) + w(v,s)$ is minimized. Let $C = \langle s...
In an undirected graph $G$, remove vertex $v$ and find the shortest path between all pairs of vertices in $N(v)$; i.e. Find $d(a,b):=$shortest path between $a,b\in N(v)$ in graph $G'=G-\{v\}$. Result is $min\{d(a,b)+w(a,v)+w(b,v)|a,b\in N(v)\}$.
Is it true that a given problem is strictly NP-complete iff it's only decidable by universal Turing Machines? Similarly, a problem is in P iff there exists a non-universal Turing machine which solves it? Is it possible to come up with an NP-complete problem which could be solved by a non-universal TM?
Non-universal Turing Machines and NP-completness
|complexity-theory|computability|
OK, let's go with floating point. Any positive floating point number is of the form $m \times 2^e$ where $m$ is in the range $[1,2)$ and $e$ is an integer. If $e$ is even, then: $$\sqrt{m \times 2^{2p}} = \sqrt{m} \times 2^p$$ And if $e$ is odd, then: $$\sqrt{m \times 2^{2p+1}} = \sqrt{m} \times \sqrt{2} \t...
i need help proving the following : $$\sum_{k=1}^{n}\frac{1}{(3k-1)(3k+2)}=\frac{n}{6n+4}$$ for every integer larger or equal to 1 Can you help? Thanks
Need help proving the following for every integer larger or equal to 1
|discrete-mathematics|
i need help proving the following : $$\sum_{k=1}^{n}\frac{1}{(3k-1)(3k+2)}=\frac{n}{6n+4}$$ for every n larger or equal to 1 Can you help? Thanks
Need help proving the following for every n larger or equal to 1
i need help proving the following : $$\sum_{k=1}^{n}\frac{1}{(3k-1)(3k+2)}=\frac{n}{6n+4}$$ for every integer n larger or equal to 1 Can you help? Thanks
Need help proving the following for every integer n larger or equal to 1
$$\sum_{k=1}^{n}\frac{1}{(3k-1)(3k+2)}=\frac{1}{3}\sum_{k=1}^{n}[\frac{1}{3k-1}-\frac{1}{3k+2}]= \frac{1}{3} \{[\frac{1}{2}+\frac{1}{5}+\frac{1}{8}+\frac{1}{11}+\frac{1}{14}.........+\frac{1}{3n-1}]-[\frac{1}{5}+\frac{1}{8}+\frac{1}{11}+\frac{1}{14}.........+\frac{1}{3n-1}+\frac{1}{3n+2}]\}=\frac{1}{3}[\frac{1}{2}-\fr...
I am targeting a simple dictionary-coder compression algorithm that uses a static dictionary (code in an existing program, but I can supply my own dictionary). How can I write a compressor for such an algorithm? The first thought I had was to rank all strings in the data by the size reduction from making them dictionar...
How to Implement Static Dictionary Compression?
|data-compression|
null
> Let a,b,c be arbitrary nodes in the subtrees $\alpha$, $\beta$, > $\gamma$, respectively, in the left tree of Figure 13.2. How do the > depths of a,b,c change when a left rotation is performed on node x in > the figure (figure 13.2 given below)? [![figure 13,2][1]][1] [1]: https://i.stack.imgur.com/jlVht...
How does depths of nodes change after left-rotation in a BST (Exercise qustion from Cormen)
|algorithms|binary-search-trees|
The simplest approach is to use the known text as a "priming text". Conceptually, you run whatever compression algorithm you want on the concatenation of the priming text and the text you want to compress, compress it, but don't transmit the compressed priming text. Exactly how you realise this idea depends on the c...
> Let a,b,c be arbitrary nodes in the subtrees $\alpha$, $\beta$, > $\gamma$, respectively, in the left tree of Figure 13.2. How do the > depths of a,b,c change when a left rotation is performed on node x in > the figure (figure 13.2 given below)? [![figure 13,2][1]][1] **My answer:** Since in the left ...
I'm wondering if anyone can help me with this. Say I have a DAG, I understand that it has no directed cycles, but it can have loops ( "diamonds" ). My question is, is there a known way to convert such graph to a directed tree that has no loops. I know of the junction tree/ clique tree way, but this results in an und...
If the undirected version $G'$ of the DAG $G=(V, E)$ is not connected, then there is no [polytree](https://en.wikipedia.org/wiki/Polytree) that contains all vertices in $V$ and only a subset of the edges in $E$. If $G'$ is connected, then you can compute any spanning tree $T$ of $G'$ and construct the poly-tree that...
null
null
is there a TM $T(m;n)=q$ where $\forall m \forall n \exists q\space U(q;0)=U(m;n)$? * $U$ is a universal turing machine * $m$ is a turing machine number * $n$ is an input to the turing machine * $q$ is the turing machine number with input 0 equivalent to $T_m(n)$ or $U(m;n)$ it seems "obvious" that there is su...
is there a TM $T(m;n)=q$ where $\forall m \forall n \exists q\space U(q;0)=U(m;n)$?
Does adding an $ \epsilon $-transition to a deterministic finite automata preserve the regularity of the language? Don't we have one chance to scan the word? If we choose one direction, don't we miss the other one?
Why does adding an $ \epsilon $-transition to a DFA or NFA preserve the regularity of the language?
|automata|finite-automata|
A language is regular if and only if there exists a NFA (equivalently a DFA) that recognizes it. Adding an $\varepsilon$-transition to a NFA (DFAs are special types of NFAs) still results in a NFA, hence both the the language of the original NFA and the language of the modified NFA are regular.
null
> Let a,b,c be arbitrary nodes in the subtrees $\alpha$, $\beta$, > $\gamma$, respectively, in the left tree of Figure 13.2. How do the > depths of a,b,c change when a left rotation is performed on node x in > the figure (figure 13.2 given below)? [![figure 13,2][1]][1] **My answer:** Since in the left ...
null
null
I have a graph G (G=(V,E)), where each edge has a non negative weight to it. My problem is to find a subset S (it doesn't have to exist) of nodes such the sum of all the weights of the edges that start in S and end in V\S is lower than a given positive k. My approach was to pick a random node in the graph, run a ...
weighted graph separation algorithm proof
|graphs|optimization|weighted-graphs|
I would like to experiment with displaying the output of an analog to digital converter on computer. Samples of the ADC output would determine the intensity of one pixel. The input to the ADC is an array of XY wires, with each XY junction representing a pixel. I can work with such circuitry, but I don't know wher...
Display XY data on computer
|arrays|matrices|square-grid|
null
null
null
null
null
{"Voters":[{"Id":22151,"DisplayName":"DanielV"}]}
The claim is equivalent to claiming that every deepest leaf in a tree rooted at $s$ is an endpoint to a diameter. Suppose $p$ is an arbitrary path with end points $(a,b)$, and that $d$ is some leaf that is one of the deepest. Let $x$ be the deepest common ancestor of $a$ and $b$. Here is how to construct a path ...
{"Voters":[{"Id":22151,"DisplayName":"DanielV"}]}
null
Here's a sketch, for $\epsilon=1/10$ or so. Let $f$ be a $2$-injective function chosen uniformly at random, and let $\widetilde{f}$ be the perturbation of $f$ formed by choosing $Y_1 \subseteq [n], |Y_1| = n/10$ uniformly at random, then choosing $Y_2 \subseteq [n]\setminus Y_1, |Y_2| = n/10$ uniformly at random, th...
Let $U$ be the universal Turing machine. Is there a Turing machine $T$ taking two inputs such that $\forall m \forall n \exists q \; T(m; n) = q \land U(q;0)=U(m;n)$? It seems "obvious" that there is such a Turing machine, but if there is one, then the function $Q(n) = 1 + T(n;n)$ is not computable because it's the ...
Is there a Turing machine that packs a machine and its input into a single machine?
The function $Q(n) = 1 + T(n; n)$ is computable. What you are missing is the fact that in general Turing machines compute *partial* functions. Let us see how your imagined diagonalization argument for $Q$ fails. We want to show that the $k$-th Turing machine does not compute $Q$ by arguing that if it did then $$T(k...
Your algorithm is incorrect. Let $G$ be a cycle on $4$ vertices where edge weights alternate between $2$ and $4$ and consider $k=5$. The graph obtained from $G$ by keeping all and only the edges with weight larger* than $k$ contains no edges. Therefore the sets $S$ that you consider contain a single vertex. Given...
I know that XOR-SAT can be solved in polynomial time using arithmetic in $F_2$ and Gaussian elimination. I have a set of formula that is of the form $$ G_i := \oplus_{j=0}^{i} \left ( a_j \land b_{i-j} \right ) $$ where $a_k, b_k$ are the variables and $\oplus$ denotes XOR and $\land$ denotes logical AND. ...
Reducing a mixed Boolean expression containing XOR of conjunctions
|satisfiability|
I know that XOR-SAT can be solved in polynomial time using arithmetic in $F_2$ and Gaussian elimination. I have a set of formula that is of the form $$ G_i := \oplus_{j=0}^{i} \left ( a_j \land b_{i-j} \right ) $$ where $a_k, b_k$ are the variables and $\oplus$ denotes XOR and $\land$ denotes logical AND. ...
Your question is a bit hard to understand, so let me interpret it in the following way. You are interested in Boolean CSPs (that is, constraint satisfaction problems over Boolean variables) in which the constraints are of the form $$ \bigoplus_{i=1}^n (a_i \land b_i) = 1, $$ where $a_1,\ldots,a_n,b_1,\ldots,b_n$ ar...
null
null