instruction stringlengths 0 29.8k ⌀ |
|---|
Reading this as "a route may have repeated places but it should have at least 20 different places", I'd formalise the invariant as follows, using that sequences themselves are finite maps from prefixes of the positive integers to the element type.
$\forall x: \mathrm{ran}~\mathit{routes} \cdot \# (\mathrm{ran}~x) \g... |
I was wondering if the combination of Horn-SAT and XOR-SAT is solvable in polynomial time or not.
It seems they can be solved in polynomial time as both are in class P and also that Horn-SAT is P-complete thus XOR-SAT must be reducible to HORN-SAT .
Just want to clarify if that's the case. |
Is Horn-SAT with XOR-relations NP-complete? |
|complexity-theory|satisfiability| |
I was wondering if the combination of Horn-SAT and XOR-SAT is solvable in polynomial time or not.
It seems they can be solved in polynomial time as both are in class P and also that Horn-SAT is P-complete thus XOR-SAT must be reducible to HORN-SAT .
Just want to clarify if that's the case.
EDIT:
By,HORN-sat... |
I was wondering if the combination of Horn-SAT and XOR-SAT is solvable in polynomial time or not.
It seems they can be solved in polynomial time as both are in class P and also that Horn-SAT is P-complete thus XOR-SAT must be reducible to HORN-SAT .
Just want to clarify if that's the case.
Edit:
By,HORN-sat... |
Note that we can express variable negation with XOR-clauses, that is, if we have a variable $x$, we can introduce a variable $x'$ and a XOR-clause $(x \oplus x')$, and now $x' = \lnot x$. Therefore, we can write arbitrary CNF:s as conjuctions of clauses with only negative literals and XOR-clauses, and therefore Horn-SA... |
Separate the domains of the permutation and the conjugation. If X is a set and $\sigma$ is some permutation of X (take $X=\{1,2,\ldots, n\}$, say), imagine there's a new set of Z of the same cardinality as X and a one-to-one, onto mapping $f: Z\to X$. Consider $f^{-1} \sigma f$. It's a function on Z that first maps eve... |
I was wondering if the combination of Horn-SAT and XOR-SAT is solvable in polynomial time or not.
It seems they can be solved in polynomial time as both are in class P and also that Horn-SAT is P-complete thus XOR-SAT must be reducible to HORN-SAT .
Just want to clarify if that's the case.
By,HORN-sat with X... |
The process can be summarized by the four rules below ($x_n$ is the XOR up to $n$ inclusive, and the vertical bar denotes concatenation):
$$\begin{align}x_{n-1}= 0|00, n=m|00&\to x_n=m|00=n\\
x_{n-1}= m|00, n=m|01&\to x_n=0|01=1\\
x_{n-1}= 0|01, n=m|10&\to x_n=m|11=n+1\\
x_{n-1}= m|11, n=m|11&\to x_n=0|00=0\end{a... |
In this [paper](https://people.mpi-inf.mpg.de/~mehlhorn/ftp/mehlhorn22.pdf) they prove that the number of rotations after doing $n$ insertions or deletions to a weight-balanced tree is $O(n)$ (when starting from an empty tree).
What isn't clear to me though is how many times each node becomes the new root of a sub-t... |
How many times is a node rotated towards the root in a weight-balanced tree? |
|data-structures|binary-trees|binary-search-trees| |
The process can be summarized by the four rules below ($x_n$ is the XOR up to $n$ inclusive, and the vertical bar denotes concatenation, $m$ is any number):
$$\begin{align}
n&=m|00,x_{n-1}= 0|00 &\to x_n&=m|00=n\\
n&=m|01,x_{n-1}= m|00&\to x_n&=0|01=1\\
n&=m|10,x_{n-1}= 0|01&\to x_n&=m|11=n+1\\
n&=m|11,x_{n-1}= ... |
The process can be summarized by the four rules below (the second operand is the bitwise XOR up to $4n-1$):
$$\begin{align}
(4n+0)&\oplus0=4n\\
(4n+1)&\oplus4n=1\\
(4n+2)&\oplus1=4n+3\\
(4n+3)&\oplus(4n+3)=0\end{align}$$
|
null |
The process can be summarized by the four rules below (the second operand is the bitwise XOR up to the left operand minus one):
$$\begin{align}
(4n+0)&\oplus0=4n\\
(4n+1)&\oplus4n=1\\
(4n+2)&\oplus1=4n+3\\
(4n+3)&\oplus(4n+3)=0\end{align}$$
|
The process can be summarized by the four rules below (the second operand is the bitwise XOR up to the left operand minus one):
$$\begin{align}
(4n+0)&\oplus0=4n\\
(4n+1)&\oplus4n=1\\
(4n+2)&\oplus1=4n+3\\
(4n+3)&\oplus(4n+3)=0\end{align}$$
E.g.
$$\begin{align}
101101|00&\oplus000000|00=101101|00\\
10110... |
The process can be summarized by the four rules below (the right operand is the bitwise XOR up to the left operand minus one):
$$\begin{align}
(4n+0)&\oplus0=4n\\
(4n+1)&\oplus4n=1\\
(4n+2)&\oplus1=4n+3\\
(4n+3)&\oplus(4n+3)=0\end{align}$$
E.g.
$$\begin{align}
101101|00&\oplus000000|00=101101|00\\
101101... |
null |
null |
Let's do products first.
The usual cartesian product $A \times B$ is also called a *binary* product because we are making a product of *two* sets. We could make a ternary product $A \times B \times C$. What is the most general case? Well, to have an index set $I$ and a family of sets $X_i$, one for each $i \in I$, and... |
null |
Let's do products first.
The usual cartesian product $A \times B$ is also called a *binary* product because we are making a product of *two* sets. We could make a ternary product $A \times B \times C$. What is the most general case? Well, to have an index set $I$ and a family of sets $X_i$, one for each $i \in I$, and... |
Add 0 to the xor sum, which doesn't change it.
Then split the sum into groups of four from 4k to 4k+3, which will always have an xor of 0.
Depending on n modulo 4, these groups cover everything, or there is n = 4k left, or n, n+1 = 4k, 4k+1 left, or n, n+1, n+2 = 4k, 4k+1 and 4k+2 left. Calculate the xor of the... |
Take your TSP problem, then add a city X which has a distance of 0 from the starting city, and a T miles from any other city, where T is more than all other distances added.
If you solve the modified TSP instance, X must be one of the neighbours of the starting city, otherwise the tour would have a length of 2T. Th... |
null |
null |
Use equation (3.14) or other means to show that $(n+o(n))^{k}=\Theta\left(n^{k}\right)$ for any real constant $k$. Conclude that $\lceil n\rceil^{k}=\Theta\left(n^{k}\right)$ and $\lfloor n\rfloor^{k}=\Theta\left(n^{k}\right)$.
Where equation (3.14) is:
$1+x \leq e^{x}$ |
This is an exercise in CLRS 4th Edition. I am not sure how to solve this question, and I am not even sure how I would use equation 3.14 |
|algorithms|algorithm-analysis|discrete-mathematics| |
Let $f(n) \in o(n)$ and consider sufficiently large values of $n$.
There is some constant $c$ s.t. $f(n) \le cn$. Defining $c' = (1+c)^k$ (notice that $c'$ is a constant):
$$
n^k \le (n+ f(n))^k \le (n(1+c))^k = n^k (1+c)^k = c' n^k
$$
Then you just need to observe that:
$$
n^k \le \lceil n \rceil^k \le (n+1)^... |
null |
In this [post](https://cs.stackexchange.com/q/16634/157195),Monotone$(+, 2^-)$-SAT problem is defined as follows:
Given a monotone CNF formula $F^+$, where each variable appears exactly once (as a positive literal), and a monotone 2-CNF formula $F_2^-$ defined on the same variables as $F^+$, where all variables are... |
Complexity of this variant of the Monotone(+,2−) -SAT problem? |
|complexity-theory|np-complete|satisfiability| |
The 2-bytes number 0x0201 has the most significant byte 0x02 and the least significant byte 0x01.
A little-endian machine will store them by increasing addresses as 0x01 0x02.
A big-endian machine will store them by increasing addresses as 0x02 0x01.
This is about all there is to know.
|
Given an arbitrary (potentially ambiguous) context free grammar $G: \mathbb{G}$, and string $\alpha: \Sigma^\ast$, is there a decision procedure that returns whether appending and/or prepending symbols can alter the parse forest of $\alpha$? In other words, we want a function $F: (\mathbb{G} \times \Sigma^\ast) \righta... |
Given an arbitrary (potentially ambiguous) context free grammar $G: \mathbb{G}$, and string $\alpha: \Sigma^\ast$, is there a decision procedure that returns whether appending and/or prepending symbols can alter the parse forest of $\alpha$? In other words, we want a function $F: (\mathbb{G} \times \Sigma^\ast) \righta... |
Prove that:
$\lg (\Theta(n))=\Theta(\lg n)$ |
How do I prove the following relationship between big-theta notation and logarithms? |
|algorithms|algorithm-analysis|asymptotics| |
null |
Say for example I'd like to state that there exists a pair of vertices such that they form an edge in one graph but not some other graph. I'd go about it as follows:
$$ \exists u, v \in V, (u,v) \in G, (u,v) \not\in H $$
My main question here is: Is my use of commas fine (it seems odd, since there's commas betwee... |
What is the proper way to write logic formula, say concerning graph theory? |
|graphs|logic|syntax| |
It is in P. Suppose the first clause of $F^+$ has $k_1$ variables, and the second clause has $k_2$ variables. Then there are $k_1 k_2$ ways to pick one variable from the first clause, and one variable from the second clause. For each such way, set those variables to true in $F_2^-$ (i.e., replace those variables wit... |
Let $S_1,\dots,S_{3m}$ denote the integers that form the 3-partition instance. Let $T=(S_1+\dots + S_n)/m$, so that $T$ is the target sum for each triple. As noted on Wikipedia, without loss of generality [we may assume](https://en.wikipedia.org/wiki/3-partition_problem#Variants) that $S_i \in (T/4,T/2)$ for every $i... |
null |
The standard logical notation I have seen among computer scientists for saying there exists $x \in X$ such that $\varphi(x)$ holds is to write
$$\exists x \in X . \varphi(x).$$
In other words, we use a period. Sometimes people will instead write
$$\exists x \in X \; \varphi(x)$$
i.e., they use no separator... |
## The Question ##
----------
I define the language$$\mathsf{2-SIMPLE-PATH}=\left\{ \left\langle G,s,t\right\rangle \left|\begin{array}{c}
\mathsf{there\;are\;two\;different}\\
\mathsf{simple\;paths\;from}\;s\;\mathsf{to}\;t\;\mathsf{in}\;G
\end{array}\right.\right\} $$
where $G$ is a directed graph.
... |
Proving 2-SIMPLE-PATH is NL |
|time-complexity|np-complete|reductions|space-complexity|nondeterminism| |
The problem is to find the shortest distance in a weighted graph, where the weight of each edge is non-negative and it is given that the weight of each edge is less than a constant C. For example, C = 500.
I know that I can solve this problem using Dijkstra, however, the time complexity would be high. The problem sh... |
Find the shortest distance path in a weighted graph, where the weight of each edge is non-negative and less than a constant C = 500 in linear time |
|algorithms|graphs|graph-traversal|weighted-graphs| |
Algorithm:
1. Build a new graph $G' = (V', E')$, where for every edge $e = (u,v) \in E$ with weight $w(e) > 1$:
Replace the edge by a path P (simple) of length $w(e)$, where each edge in path $P$ has weight of 1.
Meaning, path $P$ will have $w(e)-1$ nodes and $w(e)$ edges.
$P = (u, x_1, x_2,..,x_{w(e)... |
Proving the language 2-SIMPLE-PATH is in NL |
**Algorithm:**
1. Build a new graph $G' = (V', E')$, where for every edge $e = (u,v) \in E$ with weight $w(e) > 1$:
Replace the edge by a path P (simple) of length $w(e)$, where each edge in path $P$ has weight of 1.
Meaning, path $P$ will have $w(e)-1$ nodes and $w(e)$ edges.
$P = (u, x_1, x_2,..,x_{... |
Your observation is correct. The second string is always longer than the first. Now you have to use induction to actually prove that intuition. This can be done by observing some kind of regularity in how those strings look.
For me it is helpful not to focus on the specific pair of strings, but on the *overhang*. I... |
null |
With n = 10^6 bodies, the obvious method to track their movements by having a system of simultaneous differential equations taking O(n^2) operations per step with a rather large constant will take you ages.
There is a faster method as far as I know that takes O (n log n) operations; I've only read about it, so you'... |
Let us call $\begin{bmatrix}b\\ ca\end{bmatrix},$
$\begin{bmatrix}a\\ ab\end{bmatrix},$
$\begin{bmatrix}ca\\ a\end{bmatrix},$
$\begin{bmatrix}bac\\ c\end{bmatrix}$ type 1, 2, 3, 4 respectively.
<!-- A list of the dominos is consistent if the string on the top row starts with the string on the bottom row or vice... |
null |
With sufficiently clever hardware, you can optimise the seek time: Assume that each read operation reads some portion of a track, and you know that portion. One full rotation takes 10ms, the same as moving 100 tracks. You can then take the rotation into consideration, and try to go to a track first where the data will ... |
null |
null |
As the question suggest. I want an algorithm that runs in linear time which finds the longest prefix of a substring that is a sub-prefix of the same string.
**Formally:**
___
Given a string $S$ of length $n$, we define a function $\delta_{S}:$ $[n]\rightarrow[n]$ as follows. For each integer $w$, $1\le w\le n$... |
Longest prefix of string S that is also a sub-prefix of S in linear time |
|algorithms|strings|substrings|string-matching| |
What are some recent breakthroughs in computer science? I am especially interested in research which have received inadequate attention or attains significant improvements over previous approaches. |
What are some recent breakthoughs in computer science [>=~2020]? |
|research| |
How manufacturers lock their devices to run only software by them? And how it is possible at all? For example: upgradeable toothbrush, mobile device, smart watch |
How manufacturers lock their devices to run only software by them? And how it is possible at all? |
|operating-systems| |
null |
Operating systems can verify that a particular code sequence originated from an authentic source using code signatures. This cryptographic technique verifies that a trusted entity - as identified by a public key - asserted the code sequence is authentic. To prevent a hardware device from being reprogrammed, the signatu... |
Given an arbitrary (potentially ambiguous) context free grammar $G: \mathbb{G}$, and string $\alpha: \Sigma^\ast$, is there a decision procedure that returns whether appending and/or prepending symbols can alter the parse forest of $\alpha$? In other words, we want a function $F: (\mathbb{G} \times \Sigma^\ast) \righta... |
Given an arbitrary (potentially ambiguous) context free grammar $G: \mathbb{G}$, and string $\alpha: \Sigma^\ast$, is there a decision procedure that returns whether appending and/or prepending symbols can alter the parse forest of $\alpha$? In other words, we want a function $F: (\mathbb{G} \times \Sigma^\ast) \righta... |
How do manufacturers lock their devices to run only software by them? And how is it possible at all? For example: upgradeable toothbrush, mobile device, smart watch |
null |
Here is the solution when the vector is two-dimensional. This process can be extended exactly in the same way to higher dimensions. As mentioned in the comments https://link.springer.com/content/pdf/10.1007/BF02579456.pdf?pdf=button shows the general solution.
Z is the set of vectors given to us. Let $L_i$ denote th... |
I want to know if there exist a algorithm to efficiently compute the number of odd nodes in an undirected graph?
This [post](https://cstheory.stackexchange.com/q/32889/67865) conclusion seems to be that this is #P-hard but this doesn't seem that hard to me but I don't have any direct argument against it ,that's why... |
Complexity of counting odd node in an undirected graph? |
|algorithms|complexity-theory|graphs| |
I want to know if there exist a algorithm to efficiently compute the number of odd vertex in an undirected graph?
A graph vertex in a graph is said to be an odd vertex if its vertex degree is odd, degree of a graph vertex ***v*** of a graph **G** is the number of graph edges which touch vertex ***v***.
This [post... |
I am new to reinforcement learning, and recently came across the following issue. When implementing a mutli-armed bandit algorithm using thompson sampling, each arm's t*rue success probability* is required to derive the *estimated* reward distributions of each option. However, I was under the assumption that multi-arme... |
Multi-Armed Bandit |
|reinforcement-learning| |
I was watching [some lectures][1] by Prof. Pfenning on Proof Theory. Between 5:30 and 15:00, he gave a list for some different kinds of judgments along with their calculus and computation phenomena that they can represent or model. I am looking for a more comprehensive list. I would like to compare and know the advanta... |
## The Question ##
----------
I define the language$$\mathsf{2-SIMPLE-PATH}=\left\{ \left\langle G,s,t\right\rangle \left|\begin{array}{c}
\mathsf{there\;are\;two\;different}\\
\mathsf{simple\;paths\;from}\;s\;\mathsf{to}\;t\;\mathsf{in}\;G
\end{array}\right.\right\} $$
where $G$ is a directed graph.
... |
null |
null |
As the question suggest. I want an algorithm that runs in linear time which finds the longest prefix of a substring that is a sub-prefix of the same string.
**Formally:**
___
Given a string $S$ of length $n$, we define a function $\delta_{S}:$ $[n]\rightarrow[n]$ as follows. For each integer $w$, $1\le w\le n$... |
null |
As the question suggest. I want an algorithm that runs in linear time which finds the longest prefix of a substring that is a sub-prefix of the same string.
**Formally:**
___
Given a string $S$ of length $n$, we define a function $\delta_{S}:$ $[n]\rightarrow[n]$ as follows. For each integer $w$, $1\le w\le n$... |
if L is CF does that mean L interaction L reverse is also CF? thats the whole question since CF is clsoed for reverse it makes sense but there are alot of refute out there for interactions, so I was wondering how can i prove it ? |
if L is CF does that mean L interaction L reverse is also CF? |
|automata| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.