instruction stringlengths 0 29.8k ⌀ |
|---|
I want to prove, that 2OrMoreSAT is NP-complete. It's defined as follows:
A formula is considered strongly satisfiable if there exists a model such that two or more different literals in every clause evaluate to true.
$\textit{2OrMoreSAT} = \{\langle \phi' \rangle \mid \phi' \text{ is a boolean formula in CNF whi... |
I may be wrong, but I think this problem is in $\mathsf{P}$, there is a reduction to $\texttt{2SAT}$.
Consider a clause $C = (x\lor y \lor z)$. From this clause, define:
$$\phi_C = (x\lor a) \land (y \lor b) \land (z\lor c) \land (x\lor \overline{b}) \land(x\lor \overline{c}) \land(y\lor \overline{a})\land (y\lor... |
Planar Convex Hull is a problem where you have $N$ points in a Cartesian plane, and you want to find the smallest convex polygon that encloses the points. QuickHull seems to be the best available algorithm for this, and it finds the hull in $O(N \log h)$ where $h$ is the size of the output.
Interestingly, Michael Sh... |
Why isn't there a computational "Carpenter's Algorithm" for Planar Convex Hull? |
|algorithms|optimization|computational-geometry|convex-hull| |
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... |
Planar Convex Hull is a problem where you have $N$ points in a Cartesian plane, and you want to find the smallest convex polygon that encloses the points. QuickHull seems to be the best available algorithm for this, and it finds the hull in $O(N \log h)$ where $h$ is the size of the output.
Interestingly, Michael Sh... |
A much simpler and cruder reduction based on the same idea of the accepted answer:
On an instance of NEAR-CLIQUE $\langle G,k\rangle$, duplicate $G$ by at most $|V|^2$ times. Do not add any edges between the copies. Then, for each missing edge in $G$, choose one copy and add that edge to the copy. Return $\langle G'... |
A much simpler and cruder reduction based on the same idea of the accepted answer:
On an instance of NEAR-CLIQUE $\langle G,k\rangle$, duplicate $G$ by at most $|V|^2$ times. Do not add any edges between the copies. Then, for each missing edge in $G$, choose one copy that has not been chosen and add that edge to the... |
Planar Convex Hull is a problem where you have $N$ points in a Cartesian plane, and you want to find the smallest convex polygon that encloses the points. QuickHull seems to be the best available algorithm for this, and it finds the hull in $O(N \log h)$ where $h$ is the size of the output.
Interestingly, Michael Sh... |
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 |
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/yhEDy.png
I'm 99% sure this is true, but I'm struggling to prove it. Can anyone give me some tips? |
Struggling to prove this flow network question |
|data-structures|network-flow| |
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/yhEDy.png
I'm 99% sure this is false, but I'm struggling to disprove it. Can anyone give me some tips to find a counter-example? |
Struggling to disprove this flow network question |
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/yhEDy.png
I'm 99% sure this is false, but I'm struggling to disprove it. Can anyone give me some tips to find a counter-example?
I thought of making a graph with a cut and having two edges run through this cut such that one is the minim... |
null |
Since this is a homework question, I'll provide a hint.
Instead of having two edges in the cut, why not try with only one? What if your graph is only one long path? |
I would say that machine learning is a part of computer science.
Machine learning is defined by Tom Mitchell:
> A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P if its performance at tasks in T, as measured by P, improves with experience E.
T... |
null |
Nail all $n$ points in time $O(n)$. Then move a vertical taut rope from far left until you hit the leftmost nail. Next you have two options:
- rotate the two ends until you hit other nails, and continue until you complete the hull "by wrapping". This takes $O(h)$ sweep operations, as you wind every nail once and unw... |
A crude estimate is that the worst number of merges is greater or equal to $\frac{n-1}{4}$. For this, consider the set
\begin{equation}
X=\{(0,1),\ldots,(0,m)\}\cup\{(1, 0),\ldots,(m, 0)\}
\end{equation}
where $m = \lfloor n/2\rfloor$. None of the points of the first list is comparable to one of the points of the s... |
Nail all $n$ points in time $O(n)$. Then sweep a vertical taut rope from far left until you hit the leftmost nail. Next you have two options:
- rotate the two ends until you hit other nails, and continue until you complete the hull "by wrapping". This takes $O(h)$ sweep operations, as you wind every nail once and un... |
null |
A crude estimate is that the worst number of merges is greater or equal to $\frac{n-1}{4}$. For this, consider the set
\begin{equation}
X=\{(0,1),\ldots,(0,m)\}\cup\{(1, 0),\ldots,(m, 0)\}
\end{equation}
where $m = \lfloor n/2\rfloor$. None of the points of the first list is comparable to any of the points of the s... |
A crude estimate is that the worst number of merges is greater or equal to $\frac{n-1}{4}$. For this, consider the set
\begin{equation}
X=\{(0,1),\ldots,(0,m)\}\cup\{(1, 0),\ldots,(m, 0)\}
\end{equation}
where $m = \lfloor n/2\rfloor$. None of the points of the first list is comparable to any of the points of the s... |
Nail all $n$ points in time $O(n)$. Then sweep a vertical taut rope from far left until you hit the leftmost nail. Next you have two options:
- rotate the two ends until you hit other nails, and continue until you complete the hull "by wrapping". This takes $O(h)$ sweep operations, as you wind every nail once and un... |
null |
I have a large array of bits of length $N$.
The query $f(k, m)$ means "find $kth$ zero in the array and the next $m-1$ zeros after it", $k \in [0, N-1], m \ll N$
Currently I use a segment tree over the bit array and my approaches were:
- use [kth zero search procedure](https://cp-algorithms.com/data_structure... |
My lecture notes for gomory-hu trees says that it's easy to see that every GHT of the utility graph $K_{3,3}$ is a star with 5 edges. Is there any easy way to see this without manually computing every gomory-hu tree of the graph? |
Showing that all gomory hu trees of $K_{3,3}$ are stars with 5 edges |
|graphs|trees| |
null |
As pointed out by Yuval Filmus in the comments, I assumed there that the formula had to be in 3CNF, which is not necessarily the case. However, I will let my answer, maybe it can still help.
I may be wrong, but I think this problem is in $\mathsf{P}$, there is a reduction to $\texttt{2SAT}$.
Consider a clause $C ... |
null |
Given a sequence of real numbers $\{a_1, a_2, a_3 \ldots a_n\}$, I wish to design a data structure that supports the following operations on it.
1. $\mathrm{REVERSE}(i,j):$ Reverse the contiguous subsequence $a_i, a_{i+1}\ldots a_j$ i.e. swap $a_i$ with $a_j$, $a_{i+1}$ with $a_{j-1}$ so on and so forth.
2. $\mat... |
Maintaining an array under subarray reversals |
|data-structures| |
It appears you're asking about problems for which there may be more than one correct answer for a given input (not decision problems).
In that case, there may exist a polynomial-time algorithm that finds a solution, but no algorithm that can verify arbitrary solutions. For example, given any string, it's easy to fin... |
I am just wondering how you would write out a proof that the independent set is the complement of the vertex cover. I know how to explain it in common language, just wondering what a more official proof would look like. |
How would you prove that the Independent set is a complement of a vertex cover and vice versa |
|graphs|np-complete|np| |
I am currently learning about context-free grammar, however, I am confused as to why context-free grammar is used over regular languages(Regular expression) and what makes CFG more powerful. Even though the structure is more complex than regular expressions. Also, what is Chomsky's normal form and what advantages does ... |
Context Free Grammar Advantages |
|context-free|regular-expressions| |
I am currently learning about context-free grammar, however, I am confused as to why context-free grammar is used over regular languages(Regular expression) and what makes CFG more powerful. Even though the structure is more complex than regular expressions. Any suggestion would be highly appreciated. |
If no preprocessing of the rectangles is allowed, in the worst case you need $8$ comparisons, full stop. That's because there are $8$ independent coordinates and the answer depends on them.
----------
If preprocessing is allowed, you can determine a vertical or horizontal line by one of the sides that separat... |
Let $C$ be a vertex cover and $I = V \setminus C$.
**Claim.** $I$ is an independent set.
**Proof.** Let $u$ and $v$ be two vertices in $I$. Then, since neither $u$ nor $v$ are in $C$, ... |
While regular languages can allow some particular search (see [Grep](https://en.wikipedia.org/wiki/Grep)), where context-free languages shine is in compilation.
Regular languages can be used to do a lexical analysis, meaning it can recognize lexemes in code. For example, lexical analysis can tell you that `42hello` ... |
{"Voters":[{"Id":155960,"DisplayName":"John Fisher"}]} |
null |
You can get both operations in $O(\log n)$ time with a binary tree. The idea is to store a boolean at each node indicating whether or not the entire subtree underneath the node is logically (not physically) reversed. You can then reverse a node in $O(1)$, by toggling the boolean.
Logical reversal is pretty easy to h... |
null |
You can get both operations in $O(\log n)$ time with a binary tree. The idea is to store a boolean at each node indicating whether or not the entire subtree underneath the node is logically (not physically) reversed. You can then reverse a node in $O(1)$, by toggling the boolean.
Logical reversal is pretty easy to h... |
{"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
{"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
{"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
Thank you. I see how it makes sense going in the opposite direction but i need help proving that this is true |
Is a language semi-decidable iff it is reducible to ATM? |
|reductions|decision-problem|semi-decidability| |
I have been led to believe that the following statement
$X \in NP \land Y \not\in NP \implies X \not\le^m_p Y$
Is True.
But I am having difficult proving it. And I'm not even sure it IS true anymore.
At first it seemed reasonable that it was true. Since X is in NP there must exist some NP-complete ... |
if X is in NP but Y is not in NP then can X be reduced to Y? |
|complexity-theory|np-complete|np|decision-problem| |
I know that languages that have LL(1) grammar also will have LR(1) grammar as LL(1) grammar can be written only for a subset of DCFL whereas LR(1) grammar can be written for all DCFL, but I wanted to know where LL(1) will fall if I had it put it along with LR parsers.
L1 is defined as languages for which LL(1) gramm... |
Is there a language that has a LL(1) grammar but not LALR(1) grammar? |
|formal-languages|lr-k| |
Every language which has an $LR(k)$ grammar for some $k$ has an $SLR(1)$ grammar (which is necessarily also $LALR(1)$ and $LR(1)$). So $LR(1)$ languages and $LALR(1)$ languages are the same set, and as you note $LL(1)$ languages are a proper subset. |
Every language which has an $LR(k)$ grammar for some $k$ has an $SLR(1)$ grammar (which is necessarily also $LALR(1)$ and $LR(1)$).
The proof is constructive: from the $LR(k)$ grammar, you can mechanically derive the $SLR(1)$ grammar.
So $LR(1)$ languages and $LALR(1)$ languages are the same set (which is the set... |
Thank you. I see how it makes sense going in the opposite direction but i need help proving that this is true.
The question from my understanding is that a language needs to be reducible to ATM for it to be considered semi-decidable. What I've tried to do is just understand that if a language is semi-decidable , the... |
I was reading Kleinberg's and Tardo's book (especifically, [this one](https://www.amazon.com/Algorithm-Design-Jon-Kleinberg/dp/0321295358/ref=sr_1_1?keywords=kleinberg+and+tardos+algorithm+design&qid=1670557843&sprefix=kleinberg+and+tar%2Caps%2C153&sr=8-1)) and, on page 38, these authors define the Big-Theta notation o... |
Help understanding the proof of the definition of Big-Theta based on limits |
|big-o-notation| |
I was reading Kleinberg's and Tardo's book (especifically, [this one](https://www.amazon.com/Algorithm-Design-Jon-Kleinberg/dp/0321295358/ref=sr_1_1?keywords=kleinberg+and+tardos+algorithm+design&qid=1670557843&sprefix=kleinberg+and+tar%2Caps%2C153&sr=8-1)) and, on page 38, these authors define the Big-Theta notation t... |
I was reading Kleinberg's and Tardo's book (especifically, [this one](https://www.amazon.com/Algorithm-Design-Jon-Kleinberg/dp/0321295358/ref=sr_1_1?keywords=kleinberg+and+tardos+algorithm+design&qid=1670557843&sprefix=kleinberg+and+tar%2Caps%2C153&sr=8-1)) and, on page 38, these authors define the Big-Theta notation t... |
The stack allows subroutines to be used. It can store return address for "return from subroutine" instruction (RTN) and also arguments for the function.
It is not possible to store return address in the program instruction list itself, because the subroutine might be called from many different places in the program,... |
Is the reason for a stack to decrease the size of a program (by adding the use of subroutines)? |
|computer-architecture|information-theory|cpu|history|stacks| |
The [time hierarchy theorem](https://en.wikipedia.org/wiki/Time_hierarchy_theorem) states that $\mathsf{NP}\subsetneq \mathsf{NEXP}$.
So if you consider a $\mathsf{NP}$-complete problem $A$ (for example $\texttt{SAT}$) and a $\mathsf{NEXP}$-complete problem $B$ (for example [$\texttt{SUCCINCT HAMILTONIAN PATH}$](ht... |
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. |
_If_ the limit exists then f/g will be between c-eps and c+eps for every eps > 0 if n is large enough. The author chose eps=1/2 which is more than good enough to prove big-theta.
But big theta doesn’t require a limit. 2 + cos(n) is big-theta(1). |
The [time hierarchy theorem](https://en.wikipedia.org/wiki/Time_hierarchy_theorem) states that $\mathsf{NP}\subsetneq \mathsf{NEXP}$.
So if you consider a $\mathsf{NP}$-complete problem $A$ (for example $\texttt{SAT}$) and a $\mathsf{NEXP}$-complete problem $B$ (for example [$\texttt{SUCCINCT HAMILTONIAN PATH}$](ht... |
Thank you. I see how it makes sense going in the opposite direction but i need help proving that this is true.
Below is the definition of ATM.
ATM={<M,w>| a TM, M accepts w}
The question from my understanding is that a language needs to be reducible to ATM for it to be considered semi-decidable. What I've trie... |
You start with any number of 1s. Then a zero, one or more 1s, and a zero. That’s the first string in your language. You can follow it by (at least one 1, followed by zero) any number of times, getting more than two zeroes, and then you can add more 1s
$1^* 011^*0 (11^*0)^* 1^*$
If you use + as “once or more” then... |
I already know that SAT and 3-SAT are NP-complete.
If in 3-SAT the Boolean expression should be divided to clauses,such that every clause contains at most (in the original problem it says exactly) three literals would it still be NP-complete?
I think the answer is yes but I'm not sure of my solution. I think the re... |
Variation of 3-SAT |
|np-complete|reductions|np|satisfiability|3-sat| |
By the definition of the limit, we can always establish
$$c-\epsilon<\frac{f(n)}{g(n)}<c+\epsilon$$
by choosing $n$ sufficiently large.
In fact, the proof stops here, as this reads
$$c_0 g(n)\le f(n)\le c_1 g(n).$$
The author preferred to work with $\epsilon=\dfrac c2$ on the left and $\epsilon=c$ on the... |
By the definition of the limit, for any $\epsilon$ we can always establish
$$c-\epsilon<\frac{f(n)}{g(n)}<c+\epsilon$$
by choosing $n$ sufficiently large.
In fact, the proof stops here, as this reads
$$c_0 g(n)\le f(n)\le c_1 g(n).$$
The author preferred to work with $\epsilon=\dfrac c2$ on the left and ... |
By the definition of the limit, for any $\epsilon$ we can always establish
$$c-\epsilon<\frac{f(n)}{g(n)}<c+\epsilon$$
by choosing $n$ sufficiently large.
In fact, the proof stops here, as this reads
$$c_0 g(n)\le f(n)\le c_1 g(n).$$
The author preferred to work with $\epsilon=\dfrac c2$ on the left and ... |
What does it mean by "no consecutive zeros"? That means there is at least one 1 between any two zeros. You can express it as $01^*1$, expecting there might be a 0 downstream.
If there are two non-consecutive zeros, you must have a substring like $011^*0$. All other characters must be optional, which should be bette... |
null |
Yes, it would.
To make this answer self-contained, here is a sketch of how the transformation works.
Take any SAT problem in CNF. Suppose you have a clause that is more than three literals in size. Let's say it's four.
$$x_1 \vee \neg x_2 \vee x_3 \vee \neg x_4$$
Introduce a fresh variable $y$. Then this cl... |
null |
Baker, Gill, and Solovay has shown in their famous paper, that there are oracles $A$ and $B$ with $P^A = NP^A$ and $P^B \not= NP^B$. So, one can't solve the $P$ vs. $NP$ Problem
with methods like diagonalization alone.
To find the oracle $A$ is easy. But the construction of oracle $B$ is very
complicated in the pa... |
Question about the Relativization barrier |
|complexity-theory|time-complexity|p-vs-np|relativization| |
null |
By the definition of the limit, for any $\epsilon$ we can always establish
$$c-\epsilon<\frac{f(n)}{g(n)}<c+\epsilon$$
by choosing $n$ sufficiently large.
In fact, the proof stops here, as this reads
$$c_0 g(n)\le f(n)\le c_1 g(n).$$
The author preferred to work with $\epsilon=\dfrac c2$ on the left and ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.