instruction stringlengths 0 29.8k ⌀ |
|---|
null |
Note that the above LP allows you to have a negative weighted cycle. That cycle could be edge disjoint from the flow that goes from $s$ to $t$. The cycle still satisfies the flow conservation and capacity constraints. Therefore, the solution of the above LP is not necessarily the shortest trail path. |
Note that the above LP allows you to have a negative weight cycle. That cycle could be edge disjoint from the flow that goes from $s$ to $t$. The cycle still satisfies the flow conservation and capacity constraints. Therefore, the solution of the above LP is not necessarily the shortest trail path.
For example, cons... |
Note that the above LP allows you to have a negative weight cycle. That cycle could be edge disjoint from the flow that goes from $s$ to $t$. The cycle still satisfies the flow conservation and capacity constraints. Therefore, the solution of the above LP is not necessarily the shortest trail.
For example, consider ... |
null |
null |
Your this claim: "*When algorithm uses "even way" the optimization doesn't change logic and result*" is incorrect.
Since the "even way" is dependent on the "odd way" (due to recursive dependency), the optimization does change the result.
For example, consider the following example when optimized algorithm is used... |
null |
Your worst case scenario is when you have many 10 bit codewords.
The trick is to consider the worst possible case starting from the right.
0,
100,
101000,
1010010,
10100110,
101001110,
1010011110, ... (total 2)
1010011111,
1010100000, ... (total 32)
1010111111,
... |
yes, if all probabilities are in form of $2^k$ then the arithmetic encoding will be the same as huffman encoding. both achieving the expected length of $H(X)$ (entropy).
In such conditions branching in arithmetic coding will be exact and behave the same way huffman coding does. |
null |
I have a problem domain that has several kinds of symmetries. I will try to keep this as general as possible. Given an array of strings:
["4533", "1234", ...]
The two symmetries that I have in the problem is that you can permute any two "columns", for example "123" is equivalent to "213" (all strings are the same... |
null |
null |
null |
Just like in [This thread](https://cs.stackexchange.com/questions/56923/maximum-set-packing-and-minimum-set-cover-duality) that was posted here before, I came upon the same issue where I do not understand how are those problems dual to each other.
More precisely, how and why the optimal solution to the primal and d... |
Minimum set cover problem and dual, the maximum set packing |
|algorithms|optimization|linear-programming| |
Why is the Turing machine model relevant? |
null |
Just like in [This thread](https://cs.stackexchange.com/questions/56923/maximum-set-packing-and-minimum-set-cover-duality) that was posted here before, I came upon the same issue where I do not understand how are the relaxed maximum set packing problem and the minimum set cover problem are dual to each other.
More ... |
Just like in [This thread](https://cs.stackexchange.com/questions/56923/maximum-set-packing-and-minimum-set-cover-duality) that was posted here before, I came upon the same issue where I do not understand how are the relaxed maximum set packing problem and the minimum set cover problem are dual to each other.
More ... |
Just like in [This thread](https://cs.stackexchange.com/questions/56923/maximum-set-packing-and-minimum-set-cover-duality) that was posted here before, I came upon the same issue where I do not understand how are the relaxed maximum set packing problem and the minimum set cover problem are dual to each other.
More ... |
Just like in [This thread](https://cs.stackexchange.com/questions/56923/maximum-set-packing-and-minimum-set-cover-duality) that was posted here before, I came upon the same issue where I do not understand how are the relaxed maximum set packing problem and the minimum set cover problem are dual to each other.
More ... |
null |
null |
Given 2D arrays (number of rows between 0 and 10, number of columns between 0 and 10, elements are integers between 0 and 31)
Two arrays $A,B$ are *equivalent* $A\\sim B$ if $A$ can be transformed into $B$ via permutations of
- rows
- columns
- alphabet
e.g.
$\begin{pmatrix}
1&2&3\\\\
2&2&3
\end{pmatri... |
Looking for efficient algorithm to pick out a unique equivalence class representative for 2D arrays with lots of symmetries |
|algorithms|optimization|sorting| |
Given 2D arrays (number of rows between 0 and 10, number of columns between 0 and 10, elements are integers between 0 and 31)
Two arrays $A,B$ are *equivalent* $A\sim B$ if $A$ can be transformed into $B$ via permutations of
- rows
- columns
- alphabet
e.g.
$\begin{pmatrix}
1&2&3\\\\
2&2&3
\end{pmatrix... |
null |
In my opinion, it is quite difficult to answer your question because it is very broad. However, I'll try point out several facts that might help you choose a course of action. I will cite the [proof assistants][1] (PAs) I know or have been working with.
You correctly stated that [mechanical theorem provers][2] (MTPs... |
null |
In my opinion, it is quite difficult to answer your question because it is very broad. However, I'll try point out several facts that might help you choose a course of action. I will cite the [proof assistants][1] (PAs) I know or have been working with.
You correctly stated that [mechanical theorem provers][2] (MTPs... |
null |
null |
null |
With a binary tree, the 3 approaches for the tree below are listed.
```
A
/ \
B C
Inorder => Left, Root, Right. - B, A, C
Preorder => Root, Left, Right. - A, B, C
Post order=> Left, Right, Root. - B, C, A
```
I drew this up to get a better understanding because I thought of p... |
Are pre-order, in-order and post-order the only traversals for depth-first search? |
|trees|binary-trees|depth-first-search| |
I have a 2D array grid where each cell has a number in it, i would need a alghorithm that returns me the value of that cell depending on the X, Y position (0, 0 is bottom left)
[![number grid1][1]][1]
This is the grid in question, it can be infinite in size and "grows" in such a way that it always adds first the ... |
Alghorithm to calculate x, y positions of a grid with the following numbers (details inside) |
|algorithms|number-theory| |
null |
Given 2D arrays (number of rows between 0 and 10, number of columns between 0 and 10, elements are integers between 0 and 31)
Two arrays $A,B$ are *equivalent* $A\sim B$ if $A$ can be transformed into $B$ via permutations of
- rows
- columns
- alphabet
e.g.
$\begin{pmatrix}
1&2&3\\\\
2&2&3
\end{pmatrix... |
null |
I am not sure if there is a direct way to compute it but here's one that works. Let $M$ be your matrix. The value of $M[i,j]$ is given by:
$$
M[i,j]=\begin{cases}
j^2 + i & \text{if $j \ge i$ }\\
i^2 + 2i - j & \text{otherwise}
\end{cases}
$$
This comes from the observation that the values ... |
Given 2D arrays (number of rows between 0 and 10, number of columns between 0 and 10, elements are integers between 0 and 31)
Two arrays $A,B$ are *equivalent* $A\sim B$ if $A$ can be transformed into $B$ via permutations of
- rows
- columns
- alphabet
e.g.
$\begin{pmatrix}
1&2&3\\
2&2&3
\end{pmatrix}
... |
null |
I am not sure if there is a direct way to compute the entries given the row and column, but here's one that works. Let $M$ be your matrix. The value of $M[i,j]$ is given by:
$$
M[i,j]=\begin{cases}
j^2 + i & \text{if $j \ge i$ }\\
i^2 + 2i - j & \text{otherwise}
\end{cases}
$$
This comes fr... |
null |
null |
null |
If you are literally looping through all row permutations, and for each one looping through all column permutations, then you're spending at least $O(n!^2 \cdot poly(n))$ time on that; note that if you define the lexicographical order based on rows, so in your example `1,2,3,2,2,3` vs `1,1,2,1,3,2`. Then you can do muc... |
Your problem is related to graph isomorphism, for which there is no known polynomial-time algorithm. Therefore, you should not expect any efficient algorithm that works on all cases.
In particular, your problem is [GI-hard](https://en.wikipedia.org/wiki/Graph_isomorphism_problem), so there is unlikely to be any eff... |
null |
You may be interested in some linear algebra over finite field $\mathbb{F}_2$. Basically, vectors in the linear complement to $W$ should have the maximal Hamming distance. The trouble is that linear algebra over finite fields is not as straightforward as over $\mathbb{C}$. Nevertheless, linear algebra over $\mathbb{F}_... |
Consider the following automaton.
[![enter image description here][1]][1]
How does one find a DFA with an equivalent language *using an algorithm*? In particular, I was requested to use the algorithm described in the answer to [this question][2]. The problem arises from the fact that $a, b$ both map to $q_{1}$.... |
Finding a DFA with same language as given $\epsilon$-NFA |
|formal-languages|regular-languages|automata|regular-expressions| |
null |
null |
Sorry if this is a stupid question. But it really intrigued me. Same resources at different algorithms are telling different ways to test these stuffs.
Here's an algorithm and how I'd test for its 3 things.
Process Larry:
do{
while(turn!="Larry");
critical section
... |
What's the standard technique to test if the algorithm satisfies mutual exclusion, progress and bounded waiting or not? |
|concurrency|mutual-exclusion|critical-section| |
I liked your observations really good but unfortunately your algorithm cannot handle more than 1 depth difference at a time. I tested it with
f = [6,1,1,1,1]. the h = [2, 2, 2, 3, 3] while the actual algorithm output is [1,3,3,3,3].
For testing I had to rewrite your code in python so I can understand it easier.
... |
null |
The Triangle Finding problem (TF) in Graph Theory was shown by Itai and Rodeh in 1977 [1] to be solvable as fast$^1$ as Boolean Matrix Multiplication (BMM, Matrix Multiplication over ${0, 1}$ with AND for $\times$ and OR for $+$). It seems to be common knowledge that BMM itself is solvable as fast as ordinary Matrix Mu... |
Has Triangle Finding ever been faster than Matrix Multiplication? |
|complexity-theory|graphs|time-complexity|matrix-multiplication| |
The Triangle Finding problem (TF) in Graph Theory was shown by Itai and Rodeh in 1977 [1] to be solvable as fast$^1$ as Boolean Matrix Multiplication (BMM, Matrix Multiplication over ${0, 1}$ with AND for $\times$ and OR for $+$). It seems to be common knowledge that BMM itself is solvable as fast as ordinary Matrix Mu... |
The Triangle Finding problem (TF) in Graph Theory was shown by Itai and Rodeh in 1977 [1] to be solvable as fast$^1$ as Boolean Matrix Multiplication (BMM, Matrix Multiplication over ${0, 1}$ with AND for $\times$ and OR for $+$). It seems to be common knowledge that BMM itself is solvable as fast as ordinary Matrix Mu... |
The Triangle Finding problem (TF) in Graph Theory was shown by Itai and Rodeh in 1977 [1] to be solvable as fast$^1$ as Boolean Matrix Multiplication (BMM, Matrix Multiplication over ${0, 1}$ with AND for $\times$ and OR for $+$). It seems to be common knowledge that BMM itself is solvable as fast as ordinary Matrix Mu... |
The Triangle Finding problem (TF) in Graph Theory was shown by Itai and Rodeh in 1977 [1] to be solvable as fast$^1$ as Boolean Matrix Multiplication (BMM, Matrix Multiplication over ${0, 1}$ with AND for $\times$ and OR for $+$). It seems to be common knowledge that BMM itself is solvable as fast as ordinary Matrix Mu... |
The Triangle Finding problem (TF) in Graph Theory was shown by Itai and Rodeh in 1977 [1] to be solvable as fast$^1$ as Boolean Matrix Multiplication (BMM, Matrix Multiplication over $\{0, 1\}$ with AND for $\times$ and OR for $+$). It seems to be common knowledge that BMM itself is solvable as fast as ordinary Matrix ... |
|complexity-theory|graphs|time-complexity|history|matrix-multiplication| |
null |
|lambda-calculus|proof-assistants| |
null |
null |
null |
null |
null |
null |
null |
null |
null |
We have to derive an optimal binary encoding for the infinite set of symbols $\{s_1, s_2, \dots \}$. Their distribution is given by
$$p(s_i) = 9 \cdot 10^{-i}$$
My intuition was to use a Huffman encoding. Obviously the Huffman encoding
algorithm needs to first find the smallest two elements, which we can't do. But... |
Is there an algorighm where I provide a list of squares, for example:
sq1 = [(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]
sq2 = [(1, 0), (1, 1), (2, 1), (2, 0), (1, 0)]
sq3 = [(1, 1), (1, 2), (2, 2), (2, 1), (1, 1)]
[![enter image description here][1]][1]
and it will return some sort of "collinear c... |
Collinear convex hull |
|algorithms|convex-hull| |
Because a lot of really practical problems are the halting problem in disguise. A solution to them solves the halting problem.
You want a compiler that finds the fastest possible machine code for a given program? Actually the halting problem.
You have JavaScript, with some variables at a high security level and s... |
null |
I was working on an algorithm to find prime numbers, and I needed to allocate memory for each prime number that I found so far. I will do a search up to N and need to allocate all memory in advance. I found the following : https://t5k.org/howmany.html . This gave me some nice approximations for how many numbers I shou... |
How to allocate memory for prime numbers |
|algorithms|space-complexity|primes| |
null |
Given a $3SAT$ instance with $V$ variables, where each variable occurs 4 times: twice as positive and twice as negative literal. This problem is $NP-Complete$.
Now, given an additional constraint that this $3SAT$ instance is 'densely connected' as follows: For any integer $k$, if we select any $2^k-1$ clauses, the n... |
Computational Complexity of Densely Connected 3SAT |
|complexity-theory|time-complexity| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.