instruction
stringlengths
0
29.8k
⌀
I.e. is it right to say "a PTAS parameterized by *sth*"? Is it unusual, and is it correct?
Can a PTAS be called one if it is parameterized by one of the problem inputs (in addition to ε)?
|algorithms|complexity-theory|approximation|parameterized-complexity|
null
null
null
The 3-co-SAT problem consists of deciding whether if a 3CNF formula, has an unsatisfiable assignment of variables, i.e., assignment of variables that evaluates to 0. We know that 3-co-SAT is in coNP, however, I do not understand why it is also not in P? It seems to be very easy to check whether if there exists an un...
Your argument that two states are not enough seems solid. The automaton needs a simple path of length two where only the last state is accepting. Once we know this we can play with the automaton. Create three states: initial state $0$, seen letter $0$ as state $1$, and accept after $0a$ as state $2$. From this we c...
In lambda calculus, $\lambda xy.\phi$ isn't in general equivalent to $\lambda yx.\phi$. However, it seems possible to imagine a calculus which replaces application with something like specification, where order of specification is unimportant: $$\mathit{Term} ::= \mathit{Var} \mid [\mathit{Var} := \mathit{Term}] \mi...
Lambda calculus with unordered application
|lambda-calculus|functional-programming|variable-binding|
In lambda calculus, $\lambda xy.\phi$ isn't in general equivalent to $\lambda yx.\phi$. However, it seems possible to imagine a calculus which replaces application with something like specification, where order of specification is unimportant (at least when the substitutions target different variables): $$\mathit{Te...
A DFA must have at most a single transition on a given input. In your example, being in state $B$ and reading a 1 you have two choices for the resulting state: go to $A$ or $C$. You could, though have a nondeterministic FA that would achieve this. The resulting language would consist of all strings of $1$s of even leng...
co-SAT is not asking whether there exists an unsatisfying assignment, it is asking if every assignment evaluates to false.
I have a set of closed curves (not convex, not planar) in 3D. The goal is to produce A mesh (any will do) that is manifold and contains the closed curves as boundaries/holes. For example like this drawing: [![enter image description here][1]][1] In the case of 2 boundaries you would get something close to t...
Topologizing boundaries in 3D space
|graphs|computational-geometry|convex-hull|
Instead of "path", Let us use ["walk"](https://en.wikipedia.org/wiki/Path_(graph_theory)#Walk,_trail,_and_path) for a sequence of edges sequence of edges which joins a sequence of vertices (that can revisit vertices and edges). We will reserve "path" for its usual meaning, "a walk in which all vertices are distinct". ...
I was wondering about a solution for the following problem: > Given a directed graph $G=(V,E)$ and a subset of vertices $U \subseteq V$ suggest an algorithm that finds if there is a directed path (the path can revisit vertices/edges) that visits every node in $U$. I was thinking about running DFS\BFS from each ve...
Algorithm for finding a path in a directed graph that visits each node in a given subset
|algorithms|graphs|directed-graphs|linear-complexity|
null
Instead of "path", Let us use ["walk"](https://en.wikipedia.org/wiki/Path_(graph_theory)#Walk,_trail,_and_path) for a sequence of edges which joins a sequence of vertices (that can revisit vertices and edges). We will reserve "path" for its usual meaning, a walk in which all vertices are distinct. This answer descri...
null
I was thinking what if you just started with the node with lowest degree $u$ (only count undirected edges) and picked random edge that is connected to that and direct that inwards. EX: undirected edge $uv \to (v,u)$. Then repeat. In this process, if we get through all edges properly then its possible if not then its no...
Turning an undirected graph into a directed graph such that in-degree of all nodes is at most 1 or show it is not possible
|algorithms|graphs|
null
null
For my MSc thesis, I need to prove rigorously that $\log x = o(\sqrt{x}).$ How can I do it?
How can I prove rigorously that $\log x = o(\sqrt{x})$?
|upper-bound|
Using [L'Hôpital's rule][1]: $$ \lim_{x \to \infty} = \frac{\log x}{x^{1/2}} = \lim_{x \to \infty} \frac{(1/x)}{(1/2) x^{-1/2}} = \lim_{x \to \infty} \frac{2}{x^{1/2}} = 0. $$ Therefore, for any $c>0$, there exists some $n_0$ such that, for all $n \ge n_0$, $\log x \le c \sqrt{x}$. This satisfies the definiti...
Using [L'Hôpital's rule][1]: $$ \lim_{x \to \infty} \frac{\log x}{x^{1/2}} = \lim_{x \to \infty} \frac{(1/x)}{(1/2) x^{-1/2}} = \lim_{x \to \infty} \frac{2}{x^{1/2}} = 0. $$ Therefore, for any $c>0$, there exists some $n_0$ such that, for all $n \ge n_0$, $\log x \le c \sqrt{x}$. This satisfies the definitio...
You will probably admit $$z=o(e^z)$$ (which is obvious by Taylor). Then with $z=\alpha\log(x)$, $$\alpha\log(x)=o(x^\alpha)$$ and you can drop the factor $\alpha$ in the LHS.
null
Example of function f(x) such that it is true that f(x)= Ω((x)) but that it is not true that f(x)= ω(g(x))
Comparison between big-Ω and ω notations
|algorithms|asymptotics|big-o-notation|
This problem is called **Interval Partitioning Problem**, and it can be solved in $O(n\log n)$ time by a greedy algorithm. You can refer to [this courseware](https://ocw.tudelft.nl/wp-content/uploads/Algoritmiek_Interval_partitioning.pdf) for details.
Example of function f(x) such that it is true that `f(x) = Ω(g(x))` but that it is not true that `f(x) = ω(g(x))`
null
I was wondering if it is possible to list all subsets of size $k$ of the set $\{1,...,n\}$ by performing at most $C \binom{n}{k}$ operations for a fixed constant $C$. I did find a way to compute these subsets more efficiently than by just listing all subsets of size $k$. An example is starting with $[1,...,k]$, inc...
Listing all subsets of size $k$ of $\{1,2,...,n\}$ with just $\binom{n}{k}$ operations
|complexity-theory|time-complexity|
Listing all subsets of size $k$ of $\{1,2,...,n\}$ with just $C \binom{n}{k}$ operations
$x \in \Omega(x) \setminus \omega(x)$.
I am working on designing a DFA with the language $a^i b^j c^k$ such that $i + j + k$ is odd I thought along the following lines: $i+j+k$ is odd $\Rightarrow$ two of them are even and one is odd or all of them are odd. But designing a DFA like this will lead to a complex and big DFA. I am not sure if there is a s...
null
[![enter image description here][1]][1] Question is **add minimum number of edges so that this given graph consists an eulerian path but no necessarily eulerian circuit. Why do edges less than these given edges won't suffice?** As I solved this question, it turns out that an eulerian path can exist by removing ...
Add minimum numbers of edges to the graph for the existence of an eulerian path
|graphs|eulerian-paths|
[![enter image description here][1]][1] Question is **add minimum number of edges so that this given graph consists an eulerian path but no necessarily eulerian circuit. Why do edges less than these given edges won't suffice?** As I solved this question, it turns out that an eulerian path can exist by removing ...
null
I was wondering about a solution for the following problem: > Given a directed graph $G=(V,E)$ and a subset of vertices $U \subseteq V$ suggest an algorithm that finds if there is a directed path that visits every node in $U$. The path can revisit vertices/edges. The path can visit vertices not in $U$ repeatedly as ...
[![enter image description here][1]][1] Question is **add minimum number of edges so that this given graph consists an eulerian path (but not necessarily an eulerian circuit). Why do edges less than these given edges won't suffice?** As I solved this question, it turns out that an eulerian path can exist by rem...
null
This problem is described by Borsch et al. (1977), who showed that adding edges to make an Eulerian graph is polytime solvable. If you want to delete edges, the story changes, and the problem is NP-complete, see Cygan et al. (2014). The proof? A cubic planar graph has a Hamiltonian path of and only if you c...
null
In Harper's [Practical Foundations for Programming Languages](http://www.cs.cmu.edu/~rwh/pfpl/2nded.pdf), page 19, rule (2.9) defines the $sum$ function inductively. Then the author introduced Theorem 2.4 to prove $sum$ is indeed a function, that is, $c:nat$ is guaranteed to exist and to be unique for any $a:nat$ and $...
Formalize the proof of theorem 2.4 in Harper's PFPL
|programming-languages|induction|
In Harper's [Practical Foundations for Programming Languages](http://www.cs.cmu.edu/~rwh/pfpl/2nded.pdf), page 19, rule (2.9) defines the $sum$ function inductively. Then the author introduced Theorem 2.4 to prove $sum$ is indeed a function, that is, $c:nat$ is guaranteed to exist and to be unique for any $a:nat$ and $...
null
In Harper's [Practical Foundations for Programming Languages](http://www.cs.cmu.edu/~rwh/pfpl/2nded.pdf), page 19, rule (2.9) defines the $sum$ function inductively. $$ \frac{b:nat}{sum(zero;b;b)}\tag{rule 2.9a} $$ $$ \frac{sum(a;b;c)}{sum(succ(a);b;succ(c))}\tag{rule 2.9b} $$ Then the author introduced T...
null
The example says that C is unreachable, but there is the production S-> aBC so C is clearly reachable. This is an error right? or am I missing something.[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/csXwb.jpg
Example 7.1 correctness in Introduction to Automata Theory, Languages, and Computation
|automata|context-free|chomsky-hierarchy|
f(x) = Ω(g(x)) , f(x) = ω(g(x)) Ω(g(x)) = ω(g(x)) 0 = (ω - Ω)(g(x)) We have a TRUE statement whenever the difference between small omega and big omega approaches zero. Define indicator function: when big omega, then TRUE, else (small omega) -> FALSE.
Pick $f(x) = g(x) = x$. Then $f(x) \in \Omega(g(x))$ and $f(x) \not \in \omega(g(x))$.
Just because C is a suffix of output of rule S -> aBC doesn't make C reachable from S, since aBC -> C is not necessarily reachable. Reachability from initial state is about reachability of strings of terminal symbols (denoted by strings containing only lower case letters). Nonterminals (the capital letters) are suppos...
null
null
This problem is called **Interval Partitioning Problem**, and it can be solved in $O(n\log n)$ time by a greedy algorithm. You can refer to [this courseware](https://ocw.tudelft.nl/wp-content/uploads/Algoritmiek_Interval_partitioning.pdf) for details. Actually, this problem can be reduced to the [Graph Colorin...
This problem is called **Interval Partitioning Problem**, and it can be solved in $O(n\log n)$ time by a greedy algorithm. You can refer to [this courseware](https://ocw.tudelft.nl/wp-content/uploads/Algoritmiek_Interval_partitioning.pdf) for details. Actually, this problem can be reduced to the [Graph Colorin...
null
given array A which is made of $logn + 1$ sub arrays which are sorted, I need to sort ASAP. example of array : $A[500,501,3,8,100,1,2,9]$ as you can see, sub arrays are :$[1:2][3:5][6:]$ my solution was: merge all logn + 1 arrays together, simultaneously. so like I compare : $1:3:500$ >> append 1 to sorted ...
merging logn + 1 sorted subarrays
|time-complexity|sorting|mergesort|
I know that Open TSP is NP-Hard, but is it NP-Complete? I ask this because I recently found a solution to Open TSP but can't find a good resource to tell me whether or not Open TSP is NP-Complete.
Is Open TSP NP-Complete?
|np-complete|np-hard|np|p-vs-np|traveling-salesman|
An **edge cut** of a graph $G$ induced by **a partition** of $G$'s vertices into sets $X$ and $Y$ is the set of all edges with one endpoint in $X$ and another endpoint in $Y$. An **edge separator** is a set of edges whose removal will increase the number of connected components in the graph. Note that these ar...
How to determine if a set of edges is an edge cut of a graph?
|graphs|
I know that One Way TSP (TSP but the salesman does not have to return to his original city) is NP-Hard, but is it NP-Complete? I ask this because I recently found a solution to Open TSP but can't find a good resource to tell me whether or not Open TSP is NP-Complete.
Is One Way TSP NP-Complete?
null
The answer depends on how you define "One Way TSP". If the One Way TSP problem asks to compute the tour itself, then it cannot possibly be NP-complete since it is not a decision problem, and hence it does not even belong to the class NP. If the problem is that of *deciding* whether there is a tour having cost at ...
null
As you say, a *cut* in a graph $G=(V,E)$ is an edge set $C$ with the property that you may partition the vertices of $G$ (let's call the parts $A$ and $B$) in such a way that $C$ is exactly the set of edges with one end in $A$ and the other in $B$. This implies that the subgraph $H=(V,C)$ is bipartite with color classe...
I learned that Y fast tries support amortized loglog(u) time insertions , deletions. and loglog(u) time membership, successor and predecessor operations with O(n) space. So when n is closer to U in dense big data environments Y fast tries seem better than B trees. But most database systems use Btrees internally. I ...
How do XFast and Y Fast Tries compare to B trees in performance?
|big-data|b-tree|
given array A of size $n$ which is made of $logn + 1$ sub arrays which are sorted, I need to sort ASAP. example of array : $A[500,501,3,8,100,1,2,9]$ as you can see, sub arrays are :$[1:2][3:5][6:]$ my solution was: merge all logn + 1 arrays together, simultaneously. so like I compare : $1:3:500$ >> append ...
In a personal project of mine, I have been faced with the following problem. I have an $n \times n$ matrix $T$ where an entry $t_{ij} \geq 0$ denotes an arbitrary metric between two points $i$ and $j$ in the 2D Euclidean space. What I would like to do is create a graph $G=(V,A)$ which can approximate matrix $T$ wher...
Approximate euclidean graph from distance matrix?
|algorithms|mathematical-programming|
In a personal project of mine, I have been faced with the following problem. I have an $n \times n$ matrix $T$ where an entry $t_{ij} \geq 0$ denotes an arbitrary metric between two points $i$ and $j$ in the 2D Euclidean space. What I would like to do is create a graph $G=(V,A)$ which can approximate matrix $T$ wher...