instruction
stringlengths
0
29.8k
⌀
Given an undirected graph $(V,E)$ with weights on edges $\in Z$ is it possible to find a negative cycle with **even** length in polynomial time?
Negative cycle of even length
|graphs|graph-traversal|weighted-graphs|
Given an undirected graph $(V,E)$ with weights on edges $\in Z$ is it possible to find a negative cycle of **even** length (not the weight of the cycle, but the number of edges contained in the cycle) in polynomial time?
While this seems like homework, since it was asked 8 years ago it is probably past the point that the question asker can benefit from this for that course. Build a graph $G_2 = (U, E_2)$ of where the vertices of $G_2$ are only the $u$-vertices from your original graph. And join an edge between any two tournaments $u...
I have a very strange (arbitrary) problem that I have been trying to wrap my head around, but have been struggling to figure out how to accomplish this. I'll use Rust but in a pseudo-code fashion, these probably won't compile. ### Background The library function takes a `&[u64]` (a slice/array/list of unsigned, 6...
Splitting a Larger Unsigned Integer into Summable Parts
|binary|bit-manipulation|
null
null
null
I was studying the dining philosopher problem and its solution using semaphores, and I came across this : **Code for the ith philosopher:** while(1) { take_chopstick[i]; take_chopstick[ (i+1) % 5] ; EATING THE NOODLE put_chopstick[i]...
Order of releasing the semaphores
|operating-systems|mutual-exclusion|critical-section|semaphore|
I was studying the dining philosopher problem ([See problem description][1]) and its solution using semaphores, and I came across this : **Code for the ith philosopher:** while(1) { take_chopstick[i]; take_chopstick[ (i+1) % 5] ; EATING THE NOODLE ...
Given an undirected graph $(V,E)$ with weights on edges $\in Z$ is it possible to find a negative cycle of **even** length (not the weight of the cycle, but the number of edges contained in the cycle) in polynomial time? Motivation: ----------------- A simpler implementation of minimum weighted maximal matching ...
What is the smallest 3-CNF system of equations possible that enforces the boolean expression: a = b + c for boolean variables a, b, c?
what is the smallest 3-CNF possible that enforces the boolean expression: a = b + c?
|boolean-algebra|
What is the smallest 3-CNF system of equations possible that enforces the boolean expression: a = b + c for boolean variables a, b, c? 'Smallest' can be defined as: (1) Number of 3 CNF clauses. (2) Number of new variables introduced in the clauses. We are interested in both cases.
To begin with, note that $b+c$ can be expressed as the disjunction $b\lor c$. To enforce equation, you need to express "$a$ iff $(b\lor c)$", and that can encoded as the following CNF formula: $$ \phi = (\neg a \lor b \lor c) \wedge ((\neg b \wedge \neg c) \lor a)$$ Indeed, I used the fact that $A\to B \equiv \neg A...
null
To begin with, note that $b+c$ can be expressed as the disjunction $b\lor c$. To enforce equation, you need to express "$a$ iff $(b\lor c)$", and that can be encoded as the following CNF formula: $$ \phi = (\neg a \lor b \lor c) \wedge ((\neg b \wedge \neg c) \lor a)$$ Indeed, I used the fact that $A\to B \equiv \ne...
null
null
null
Given an undirected graph $(V,E)$ with weights on edges $\in Z$ is it possible to find a negative cycle of **even** length (not the weight of the cycle, but the number of edges contained in the cycle) in polynomial time? Formally: Find a sequence of vertices $\{v_1,v_2,...,v_k,v_1\}$ such that 1) For every $i$, ...
null
We have shown that any comparative sorting algorithm has the worst-case complexity of $\Omega(\log (n!)) = \Omega(n \log n)$, as it has to cover all the ways a permutation can be, and according to the pigeonhole principle, there is a case where more than or equal to half of the currently unknown permutations would be u...
Is there a [non-comparative] sorting algorithm, sorting an array in $o(n \log n)$?
|asymptotics|sorting|
null
null
null
Say I have the Halting Problem H = {<M,w> | M halts on input w}, and some undecidable Language L of the sort L = {M | M does a thing}. If I want to reduce H to L, from what I understand, I have to construct a Turing Machine M' which takes the input <M,w>, and if <M,w> halts, M' does the thing, if <M,w> doesn’t...
Reducing from the complement of the Halting Problem
|computability|reductions|halting-problem|
Radix sort can sort an array in $O(n.w)$ where $w$ is the key length. As $w$ is $O(\log n)$, this means it can sort an array with the performance of $O(n \log n)$. In fact, every non-comparison sort in the form of $O(n.w)$ or $O(n.k/d)$ is $O(n \log n)$. https://www.drdobbs.com/architecture-and-design/the-fastest-so...
The term 'superexponential' is _not_ a precise description of algorithmic complexity, but it always suggests a growth greater than a simple exponential function of form $b^n, b > 1$. There are three main levels of superexponential growth: 1. Beyond the class __E__, the class of all problems with _simple exponential_...
The term 'superexponential' is _not_ a precise description of algorithmic complexity, but it always suggests a growth greater in order than a simple exponential function of form $b^n$ for some $b > 1$. There are three main levels of superexponential growth: 1. Beyond the class __E__, the class of all problems with _...
You have `n` types work items. Each work item must be distributed to at least ```m``` processors. There are k processors (n > k > m) available. You want to distribute work as fairly as possible. Finally, you want to minimize the number of repeating pairs of work items across processors. I don't know how to express i...
Distribute work minimizing
|assignment-problem|
null
null
Note that by reducing from the complement of the halting problem, that is from $\overline{HALT_{TM}} = \{ \langle M, w\rangle: \text{$M$ is a TM that does not halt on $w$} \}$, then you (by you I mean the reduction) need, upon getting in put of the form $\langle M, w\rangle$, to construct, halt and output a description...
Note that by reducing from the complement of the halting problem, that is from $\overline{HALT_{TM}} = \{ \langle M, w\rangle: \text{$M$ is a TM that does not halt on $w$} \}$, then you (by you I mean the reduction) need, upon getting in put of the form $\langle M, w\rangle$, to construct, halt and output a description...
For the question to be understandable, you should indicate that "a machine does a thing" actually means that "a machine performs some finite computation and then halts". Anyway, this should clarify the reduction concept to you: Note that by reducing from the complement of the halting problem, that is from $\overline...
**Context:** While exploring the fundamentals of polyhedral optimization and **attempting to explore a connection map from the input Static Control Part (SCoP) to the iteration domain**, I am confused about whether I am making the correct connections or not. **Explored connection map:** [![enter image descript...
Nested Loop (SCoP) to Iteration Domain in Polyhedral Optimization: Explored connection are correct?
|optimization|sets|notation|loops|iteration|
**Context:** While exploring the fundamentals of polyhedral optimization and **attempting to explore a connection map from the input Static Control Part (SCoP) to the iteration domain**, I am confused about whether I am making the correct connections or not. **Explored connection map:** [![enter image descript...
null
null
**Context:** While exploring the fundamentals of polyhedral optimization and **attempting to explore a connection from the input Static Control Part (SCoP) to the iteration domain from birds eye view**, I am confused about whether I am making the correct connections or not. **Explored connection map:** [![ente...
Let $C_1$ and $C_2$ be languages representing the conditions $1$ and $2$, respectively. Then, $C_1 \in \text{NP-complete}$ and $C_2 \in \text{PTIME}$, and by writing down formally what you mentioned, we get $A = \overline{C_1} \cap \overline{C_2}$. Now you can use the following claim: **Claim:** A language $L$ i...
Let $C_1$ and $C_2$ be languages representing the conditions $1$ and $2$, respectively. Then, $C_1 \in \text{NP-complete}$ and $C_2 \in \text{PTIME}$, and by writing down formally what you mentioned, we get $A = \overline{C_1} \cap \overline{C_2}$. Now you can use the following claim: **Claim:** A language $L$ i...
The source hinted that it is by the definition of median and outlined how to verify an element in $O(1)$. If $l > m$, $left = \lceil (l - m) / 2 \rceil$, $right = \lceil (l + m) / 2 \rceil$. Else, $left = 1$, $right = l$. The median is guaranteed to be found in $A[left..right]$ using that range, or if not then tr...
Consider the halting problem $HALT_{TM} = \{\langle M, w\rangle: M \text{ is a TM that halts on input } w\}$, and some undecidable Language $L$ of the form $L = \{\langle M\rangle: M \text{ does a thing} \}$. If I want to reduce the halting problem to $L$, from what I understand, I have to construct a Turing Mach...
null
It doesn't matter how you pop, either min first, max first, or alternating. It is still $O(\log n)$ for each pop.
null
Here's a counter example on [codeforces](https://codeforces.com/blog/entry/123083). However if it's *complete* bipartite matching, we can use the greedy Nobel winning [algorithm](https://en.wikipedia.org/wiki/Gale%E2%80%93Shapley_algorithm) in Economics.
null
null
null
null
null
SCoP to Iteration Domain in Polyhedral Optimization: Explored connection are correct?
null
null
**Context:** While exploring the fundamentals of polyhedral optimization and **attempting to explore a connection from the input Static Control Part (SCoP) to the iteration domain from birds eye view**, I am confused about whether I am making the correct connections or not. **Explored connection map:** [![ente...
I have a very strange (arbitrary) problem that I have been trying to wrap my head around, but have been struggling to figure out how to accomplish this. I'll use Rust but in a pseudo-code fashion, these probably won't compile. ### Background The library function takes a `&[u64]` (a slice/array/list of unsigned, 6...
Having a complete bipartite graph with parts $A$ and $B$, which is edge-weighted, is there a way to compute a maximum weight matching such that: 1. Only a constant number $n$ of vertices from $A$ are used. 2. An edge points to each of the vertices in $B$. In simple terms, *pruning* the original graph so that I g...
Weighted bipartite perfect matching with a fixed number of vertices
|graphs|combinatorics|matching|bipartite-matching|clustering|
Given a Problem $A$ that has an answer $true$ if and only if both conditions $1$ and $2$ are $false$, for some conditions 1 and 2. Whether condition $2$ is $true$ can be tested with certainty in deterministic polynomial time. Thus, we can say that answer to an instance of $A$ is $false$ in polynomial time (in case ...
|complexity-theory|np-complete|polynomial-time-reductions|
null
null
To borrow part of a description from a similar but distinct question: there exist 2^(2^N) different functions which accept N binary inputs and return a 1 bit output. For the purposes of my question I am calling these N-input-gates. I want to know if there exists a general algorithm which can always describe an optim...
Is there an algorithm to implement N-input-gates using smaller gates?
|optimization|boolean-algebra|binary|digital-circuits|bit-manipulation|
null
I have a function $f$ such that is the sum of big O terms, such as $$f=\sum_{i=1}^x i +O(x)+O(x-1)+O(x-2)+\ldots$$ where $x$ is a positive integer. Am I correct in that I can simply write $$f=\sum_{i=1}^x i + O(x)$$ because I just need to write the bigger value for the big O? Any intuitive, even inform...
Adding O(x)+O(x-1)+O(x-2)+
|asymptotics|big-o-notation|
There is most likely no polynomial-time algorithm, i.e., no approach that will be efficient on all inputs. The problem is $\Sigma_2^P$-complete, i.e., at least as hard or even harder than NP-hard, even when limiting to a basis of standard two-input gates. However there are heuristic methods. See also https://en.wi...
null
null
Having a complete bipartite graph with parts $A$ and $B$, which is edge-weighted, is there a way to compute a maximum flow such that: 1. Only a constant number $n$ of vertices from $A$ are used. 2. An edge points to each of the vertices in $B$. In simple terms, *pruning* the original graph so that I get $n$ clus...
Weighted bipartite maximum flow with a fixed number of vertices
Having a complete bipartite graph with parts $A$ and $B$, which is edge-weighted, is there a way to compute a maximum flow such that: 1. Only a constant number $n$ of vertices from $A$ are used. 2. An edge points to each of the vertices in $B$. In essence, which nodes from $A$ and which remaining edges to remo...
Having a complete bipartite graph with parts $A$ and $B$, which is edge-weighted, is there a way to compute a maximum flow such that: 1. Only a constant number $n$ of vertices from $A$ are used. 2. An edge points to each of the vertices in $B$. In essence, which nodes from $A$ and which remaining edges to remo...
Having a complete bipartite graph with parts $A$ and $B$, which is edge-weighted, is there a way to compute a subgraph maximizing the sum of all its weights and: 1. Only a constant number $n$ of vertices from $A$ are used. 2. An edge points to each of the vertices in $B$. In essence, which nodes from $A$ and whi...
Weighted bipartite maximum cost with a fixed number of vertices
Having a complete bipartite graph with parts $A$ and $B$, which is edge-weighted, is there a way to compute a subgraph maximizing the sum of all its weights and: 1. Only a constant number $n$ of vertices from $A$ are used. 2. At most one edge points to each of the vertices in $B$. In essence, which nodes from $A...
Having a complete bipartite graph with parts $A$ and $B$, which is edge-weighted, is there a way to compute a subgraph with the maximum sum of all weights and: 1. Only a constant number $n$ of vertices from $A$ are used. 2. At most one edge points to each of the vertices in $B$. In essence, which nodes from $A$ ...
SCoP, Iteration Domain in Polyhedral Optimization and use of Presburger arithmetic
null