instruction
stringlengths
0
29.8k
⌀
for a language $L$ we define $rev\left(L\right)=\left\{ \sigma_{n}\cdot\ldots\cdot\sigma_{1}\mid w=\sigma_{1}\cdot\ldots\cdot\sigma_{n}\in L\right\} $. My question is, are $\mathsf{L,NL}$ closed under this operation? Meaning, for example, that if $L\in\mathsf{L}$ is $rev(L)\in\mathsf{L}$? I think the answer is...
Are $\mathsf{L,NL}$ closed under reverse operation?
|turing-machines|np-complete|reductions|space-complexity|complexity-classes|
I don't see the claim that $O(3^{tw}) \cdot |V(T)| = O(3^{tw})$, as you mention. Instead, $O^*(3^{tw}) \cdot |V(T)| = O^*(3^{tw})$. The notation $O^*$ is a shorthand used to suppress polynomial factors in the input size $n$. You should read $O^*(3^{tw})$ as $O(3^{tw} \cdot \text{poly}(n))$.
We know that the K-median problem is proved to be NP-Hard. In fault-tolerant K-median problem on an undirected graph $G=(V, E)$: We are given a set of facilities $F\subseteq V$ and a set of demands (or clients) $D\subset V$ in a metric space. We can open at most $k$ facilities and then assign each client $j$ to th...
fault-tolerant K-median problem on an undirected graph
|algorithms|complexity-theory|graphs|optimization|approximation|
null
subject: pairing numbers and intervals Let `NUMBERS` be a list of `n` integer numbers. The numbers are listed in no specific order. Duplicates are possible. Let `INTERVALS` be a list of `m` intervals. The low and high limits of the intervals are integer numbers. The intervals are listed in no specific order. Dupl...
pairing numbers and intervals
|algorithms|matching|intervals|
I am new to reinforcement learning, and recently came across the following issue. When implementing a multi-armed bandit algorithm, we assume we have k machines with reward probabilities [p_1,..., p_k] which we try to approximate. While these probabilities are clearly unknown to the player himself, they must still be e...
null
## Problem Given an array $A[1...n]$ of distinct integers with at least a local minima, output a local minima. A local minima is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$ ### Notes I know how to solve this problem if $1$ and $n$ are also considered a local minima or if the integers are in the...
Local minima in array in $O(log n)$
|algorithms|arrays|
I'd like to decide whether, given a connected graph $G = (V, E)$ and an integer $k$ as input, $G$ admits two vertex-disjoint subgraphs $T_1 = (V_1, E_1)$ and $T_2 = (V_2, E_2)$ such that $T_1$ and $T_2$ are trees, $V_1 \cup V_2 = V$ (so in some way they are spanning), and $|V_1 - V_2| \leq k$ (they aren't too different...
Is deciding whether a graph admits two vertex-disjoint spanning trees of bounded size difference NP-hard?
|graphs|partitions|spanning-trees|
In the general case, it is impossible to solve this in time $O(\log(n))$. Assume that the array $A$ contains $\dfrac n2$ equal elements and other values (so that there is certainly a local minimum). Whatever the algorithm, the equal elements could be sampled every time, without letting the algorithm conclude.
I'd like to decide whether, given a connected graph $G = (V, E)$ and an integer $k$ as input, $G$ admits two vertex-disjoint subgraphs $T_1 = (V_1, E_1)$ and $T_2 = (V_2, E_2)$ such that $T_1$ and $T_2$ are trees, $V_1 \cup V_2 = V$ (so in some way they are spanning), and $|V_1 - V_2| \leq k$ (they aren't too different...
In the general case, it is impossible to solve this in time $O(\log(n))$, as is shown by an adversary argument. Take any minimum finding algorithm, let the $k^{\text{th}}$ value that it samples from $A$ have the value $k$, and let the last sampled value form a local minimum. The algorithm will only find the minimum ...
In the general case, it is impossible to solve this in time $O(\log(n))$, as is shown by an adversary argument. Take *any* minimum finding algorithm, let the $k^{\text{th}}$ value that it samples from $A$ be larger than the previous for the first $\dfrac n2$ times, and let the remaining values form at least one loca...
In the general case, it is impossible to solve this in time $O(\log(n))$, as is shown by an adversary argument. Take *any* minimum finding algorithm, let the $k^{\text{th}}$ value that it samples from $A$ be larger than the previous for the first $\dfrac n2$ times, and let the remaining values form at least one loca...
I'd like to decide whether, given a connected graph $G = (V, E)$ and an integer $k$ as input, $G$ admits two vertex-disjoint subgraphs $T_1 = (V_1, E_1)$ and $T_2 = (V_2, E_2)$ such that $T_1$ and $T_2$ are trees, $V_1 \cup V_2 = V$ (so in some way they are spanning), and $|V_1 - V_2| \leq k$ (they aren't too different...
## Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minima, output a local minima. A local minima is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. ### Notes I know how to solve this problem if $1$ and $n$ are also considered a local minima. We do not have ...
{"Voters":[{"Id":16034,"DisplayName":"Yves Daoust"}]}
In the general case, it is impossible to solve this in time $O(\log(n))$, as is shown by an adversary argument. Take *any* minimum finding algorithm, let the $k^{\text{th}}$ value that it samples from $A$ keep forming an increasing sequence for the first $\dfrac n2$ times, and let the remaining values form at least ...
{"Voters":[{"Id":16034,"DisplayName":"Yves Daoust"}]}
## Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minima, output a local minima. A local minima is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. ### Notes I know how to solve this problem if $1$ and $n$ are also considered a local minima. We do not have ...
Thompson sampling doesn't require knowing the true success probability of each arm. I'm not clear on why you suggest it does. Quite to the contrary, it computes an integral over all possibilities for what that probability could be (or, it estimates this integral by sampling from the distribution over such probabiliti...
## Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minima, output a local minima. A local minima is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. ### Notes It could be useful to have an $O(1)$ property to know if A[i...j] has a local minima. So far i know...
## Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minima, output a local minima. A local minima is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. ### Notes It could be useful to have an $O(1)$ property to know if A[i...j] has a local minima. So far i know...
## Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minima, output a local minima. A local minima is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. ### Notes It could be useful to have an $O(1)$ property to know if $A[i...j]$ has a local minima. So far i kn...
Do you have a polynomial-time algorithm to construct those polynomially instances? If you can construct those polynomially many instances in polynomial time, then you have a [Cook reduction](https://en.wikipedia.org/wiki/Polynomial-time_reduction#Turing_reductions) (also known as a polynomial-time Turing reduction), n...
In the general case, it is impossible to solve this in time $O(\log(n))$, as is shown by an adversary argument. Take *any* minimum finding algorithm, and for every $A[i]$ value it queries, the value is $i$, except for the very last, which forms the only local minimum configuration. This obviously has complexity $\Th...
## Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minimum, output a local minimum. A local minimum is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. ### Notes It could be useful to have an $O(1)$ property to know if $A[i...j]$ has a local minimum. So far ...
Local minimum in array in $O(log n)$
null
## Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minimum, output a local minimum. A local minimum is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. ### Notes It could be useful to have an $O(1)$ property to know if $A[i...j]$ has a local minimum. So far ...
The $P/NP$ conjecture is about theoretical complexity classes. It is *not* about practical running times. You cannot run a $\Theta (n^{10})$ algorithm on with $n=40$ elements in reasonable time, and you can very well run a $\Theta(2^n)$ algorithm with $n=40$. The distinction is more qualitative than quantitative, an...
The $P/NP$ conjecture is about theoretical complexity classes. It is *not* about practical running times. You cannot run a $\Theta (n^{10})$ algorithm on with $n=40$ elements in reasonable time, and you can very well run a $\Theta(2^n)$ algorithm with $n=40$. The distinction is more qualitative than quantitative, an...
In the general case, it is impossible to solve this in time $O(\log(n))$, as is shown by an adversary argument. Take *any* minimum finding algorithm, and for every $A[i]$ value it queries, the value is $i$, except for the very last, which forms the only local minimum configuration. This obviously has complexity $\Th...
## Main Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minimum, output a local minimum. A local minimum is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. ### Notes It could be useful to have an $O(1)$ property to know if $A[i...j]$ has a local minimum. So...
Local minimum in array in $O(\log n)$
## Main Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minimum, output a local minimum. A local minimum is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. ### Notes It could be useful to have an $O(1)$ property to know if $A[i...j]$ has a local minimum. So...
We are learning of the Ford-Fulkerson Algorithm for max-flow/min-cut, and I have been wondering of the following question: How do we exactly find which nodes are on the "sink" side of the min-cut produced using the algorithm? I have read here https://www.geeksforgeeks.org/minimum-cut-in-a-directed-graph/ tha...
Finding the nodes in the source and sink side of a min-cut
|network-flow|minimum-cuts|ford-fulkerson|
You can prove that any minimal s-t-cut results in two connected components, the one with s in, and the one with t in. Call them S and T. Then the actual cut is all the edges that go from S to T.
I was playing around with https://visualgo.net/en/maxflow when I realized a pattern: [![enter image description here][1]][1] Take this graph, for example. We notice that the min-cut divides the graph into two sets of nodes: {0, 2, 3, 6} and {1, 4, 5, 7}. I noticed that choosing any node within {0, 2, 3, 6} as...
Will the Ford-Fulkerson Algorithm always return the same min-cut for any source-sink from one side of the min-cut to the other?
|network-flow|minimum-cuts|ford-fulkerson|
What is the definition of the term "small systems" in the context of computer science? My professor didn't really define the term, they just gave examples of some small systems. I'm having a hard time finding a concrete definition of the term online. This is not a homework question. I just want to know the definition s...
Definition of the term "small systems" in computer science
|definitions|
It should be noted that Unary ($|\Sigma|=1$) all-accepting NFA universality becomes a Directed Graph cycle-detection problem and is in P
It should be noted that **Unary** ($|\Sigma|=1$) **all-accepting NFA universality** becomes a **Directed Graph cycle-detection problem** and is in P
There is not a precise, standard, accepted definition of that phrase. What counts as "small" is likely a subjective matter, and probably depends on context.
Suppose I'm given a set $S$ and antichain $A \subset 2^S$ ($\forall a_1,a_2\in A: a_1\neq a_2 \iff a_1 \nsubseteq a_2$). Let's call subset $b \in 2^S$ *covered by* $A$ if $\exists a \in A :b \subseteq a $. I'm looking for a way to answer "**What part/what percentage of $2^S$ is covered by $A$?**" Due to $|S|>...
Is there a practical algorithm for estimation of antichain coverage of a superset?
|sets|
Is there a practical algorithm for estimating antichain coverage of a superset?
I suggest you use [inclusion-exclusion](https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle). Let $A=\{a_1,\dots,a_n\}$. Let $B_i$ denote the set of all subsets of $a_i$, i.e., $B_i=\{b \in 2^S \mid b \subseteq a_i\}$. The inclusion-exclusion principle says that $$\Big| \bigcup_i B_i \Big| = \s...
That is an interesting observation. However, the propostion is not true in general. For a counterexample, consider the weight directed graph with $w(\overrightarrow{AB})=2$, $w(\overrightarrow{BC})=1$ and $w(\overrightarrow{AC})=1$. [![enter image description here][1]][1] Let $A$ be the source node and $C$ be...
null
For $k = 0$, this problem is equivalent to the problem known as *Balanced Connected Vertex 2-Partition problem*: given a graph $G = (V,E)$, find a partition of the vertex set $V = V_1 \cup V_2$ such that $|V_1| = |V_2| = |V|/2$ and the induced subgraphs $G[V_1]$ and $G[V_2]$ are connected. Note that if an induced subg...
Suppose there is an array $A[1..n]$.$A$ contains a permutation of $\{1,2,3,\dots,n\}$. We run the following algorithm $m$ times to sort $A$: - for each odd index of $A$ from left to right ,respectively, put $A[i]$ be the minimum of its and right adjacent (if exists). Also we augment index of larger number to $A...
Proving correctness of a particular algorithm
|algorithms|induction|
I have been trying to find a a CFG for this language generated. I came to the conclusion that I need three parts 1) When i <= j 2) When j < 2j < i 3) When j < i < 2j I was able to come up the production rules for 1 and 2 but I'm getting stuck at 3. I thought I found a solution here (The heading was " ...
Is this language, L = {0^i 1^j | i != 2j},a context free language or not?
|formal-languages|context-free|formal-grammars|
I will only argue about 3), since this is the case you're having troubles with. Consider $\{ 0^i 1^j \mid j \le i \le 2j \}$ for a moment. You can get a CFG for this language by noticing that you can "match" each occurrence of a $1$ to either $1$ or $2$ occurrences of $0$s (in such a way that every occurrence of $0...
null
**added.** See the answer by John L. for a formalization of my ideas here. 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 ...
null
### Summary Recently I have had a path-finding puzzle that has some complex constraints (currently, I don't have any solution for this one) - A 2D matrix represented the graph. The length of a path is the number of traversed cells. - One or more **number sequences** are to be found inside the matrix. Each sequence i...
Solution for the path-finding problem which visits multiple sequences of nodes
|algorithms|shortest-path|
Your problem is equivalent to the problem of finding a maximum matching in a *convex bipartite graph* (a bipartite graph $G=(A,B,E)$ where the vertices on one side, say $A$, admit an ordering $a_1,\ldots,a_n$ such that each vertex in $B$ is adjacent to an interval $a_i,\ldots,a_j$ for some $1\leq i\leq j\leq n$). Googl...
Your problem is equivalent to the problem of finding a maximum matching in a *convex bipartite graph* (a bipartite graph $G=(A,B,E)$ where the vertices on one side, say $A$, admit an ordering $a_1,\ldots,a_n$ such that each vertex in $B$ is adjacent to an interval $a_i,\ldots,a_j$ for some $1\leq i\leq j\leq n$). Googl...
Suppose there is an array $A[1..n]$.$A$ contains a permutation of $\{1,2,3,\dots,n\}$. We run the following algorithm $m$ times to sort $A$: - for each odd index of $A$ from left to right ,respectively, put $A[i]$ be the minimum of its and right adjacent (if exists). Also we store index of larger number for $A[...
By linking every other vertex, you create an inner convex polygon of $\left\lceil\dfrac n2\right\rceil$ sides, which can only be intersected twice by a line segment. By induction, there will be $O(\log n)$ intersections.
### Summary Recently I have had a path-finding puzzle that has some complex constraints (currently, I don't have any solution for this one) - A 2D matrix represented the graph. The length of a path is the number of traversed cells. - One or more **number sequences** are to be found inside the matrix. Each sequence i...
## Main Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minimum, output a local minimum. A local minimum is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. Find an $O(\log n)$ algorithm or prove such an algorithm doesn't exist ### Notes It could be usefu...
Local minimum in array, $O(\log n)$ algorithm
Local minimum in array, find $O(\log n)$ algorithm
Your problem is equivalent to the problem of finding a maximum matching in a *convex bipartite graph* (a bipartite graph $G=(A,B,E)$ where the vertices on one side, say $A$, admit an ordering $a_1,\ldots,a_n$ such that each vertex in $B$ is adjacent to an interval $a_i,\ldots,a_j$ for some $1\leq i\leq j\leq n$). Googl...
Considering the case where A[1] < A[2] < A[m-1] < A[m] < A[m+1] < A[n-1] < A[n] ``` o /. o . ... . o . / . o . /. . o . . ... . . o . . / . . o . . . . ...
Considering the case where A[1] < A[2] < A[m-1] < A[m] < A[m+1] < A[n-1] < A[n] ``` o /. o . ... . o . / . o . /. . o . . ... . . o . . / . . o . . . . ...
## Main Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minimum, output a local minimum. A local minimum is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. Find an $O(\log n)$ algorithm or prove such an algorithm doesn't exist ### Notes It could be usefu...
## Main Problem Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minimum, output a local minimum. A local minimum is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$. Find an $O(\log n)$ algorithm or prove such an algorithm doesn't exist ### Notes It could be usefu...
null
[![enter image description here][1]][1] I Hope someone Can help me with that: [1]: https://i.stack.imgur.com/9Sm7u.png what is the runtime complexity of the algorithm (base 2) Thanks a Lot!
A Problem with Solving a Recurrence relation
|algorithms|runtime-analysis|recurrence-relation|
Let $n:=2^m$ and take the logarithm. $$\log(T(2^m))=2\log(T(2^{m-1}))+2^m$$ or $$S(m)=2S(m-1)+2^m.$$ By educated guess (or alternative methods), the solution is $$S(m)=(m+S_0)2^m$$ so that $$T(n)=2^{(\log(n)+T_1)n}=\left(2^{T_1}n\right)^n$$
I have been trying to find a a CFG for this language generated. I came to the conclusion that I need three parts 1) When $i \le j$ 2) When $j < 2j < i$ 3) When $j < i < 2j$ I was able to come up the production rules for 1 and 2 but I'm getting stuck at 3. I thought I found a solution in [Context Free Gra...
Is the language $L = \{0^i 1^j | i \ne 2j\}$ context free?