instruction
stringlengths
0
29.8k
⌀
|complexity-theory|decision-problem|
null
This problem sounds very hard, especially at the scale you're dealing with. One approach might be to try using a SAT solver. I don't know whether this will be even remotely feasible to solve with SAT, but you could give it a try. Let boolean variable $x_{j,k}$ represent whether bit index $j$ is the $k$th one sel...
null
null
In the example you've given it's simple to encode inputs such that they must satisfy the promise. However, in many cases it's hard to do that. Look at the following promise problem, for example: given a SAT instance which has either 0 or 1 solutions, return YES iff it has a single solution. If there is some encoding...
null
I have a matrix: | -- | c1 | c2 | c3 | |:--:|:--:|:--:|:--:| | r1 | AA | BB | CC | | r2 | CC | RR | BB | | r3 | EE | DD | FF | | r4 | KK | DD | EE | | r5 | DD | GG | KK | | r6 | PP | QQ | KK | Each column in a row represents a namespace. I can reorder elements of each row (i.e., row `r1`): - `[AA, BB, C...
null
null
In the Louvain algorithm, a super node is created in the second phase with self-loops from the sum of intra-community edges. According to the [original paper][3] and the [lecture CS224W][1], self-loop edges are counted with a factor of 1, while edges between different nodes of the same community are counted with a fact...
Louvain algorithm: self-loop weight is double gives incosistent modularity result
|algorithms|graphs|
In the Louvain algorithm, a super node is created in the second phase with self-loops from the sum of intra-community edges. According to the [original paper][1] and the [lecture CS224W][2], self-loop edges are counted with a factor of 1, while edges between different nodes of the same community are counted with a fact...
In the Louvain algorithm, a super node is created in the second phase with self-loops from the sum of intra-community edges. According to the [original paper][1] and the [lecture CS224W][2], self-loop edges are counted with a factor of 1, while edges between different nodes of the same community are counted with a fact...
In the Louvain algorithm, a super node is created in the second phase with self-loops from the sum of intra-community edges. According to the [original paper][1] and the [lecture CS224W][2], self-loop edges are counted with a factor of 1, while edges between different nodes of the same community are counted with a fact...
In the Louvain algorithm, a super node is created in the second phase with self-loops from the sum of intra-community edges. According to the [original paper][1] and the [lecture CS224W][2], self-loop edges are counted with a factor of 1, while edges between different nodes of the same community are counted with a fact...
Louvain algorithm: self-loop weight calculations for super-node
Two letters should be sufficient as the following example shows: let $L_1=\{a^nba^n\mid n\geq1\}$ and $L_2=\{b^nab^n\mid n\geq1\}$. Then we have $$(L_1\|L_2)\cap a^*b^*a^*b^*=\{a^mb^{n+1}a^{m+1}b^n\mid m,n\geq1\}\,.$$ This equation holds, since we can only map the letters of a word from $L_1\subseteq a^*ba^*$ to the ...
null
Consider small instance of GAP involving 5 items and 2 resources with capacities 5 and 12 respectively. If we have cost matrix Cij and also consumption matrix bij with jobs vs resources, how can we calculate the objective function value using modified greedy heuristic algorithm when we have dual multiplier values alpha...
How an assignment problem is solved using greedy heuristic algorithm
|greedy-algorithms|assignment-problem|
null
I want to know the minimum number of elements needed to create a tree with the longest path having n edges. How can I approach this problem using the forest implementation of disjoint sets with union by rank and path compression? Would it just be n+1 elements? Or am I missing something? I feel as though n+1 would be to...
Finding Minimum Elements for Longest Path in Disjoint Set
|algorithms|shortest-path|sets|disjoint-sets|rank|
Given two types, T1 and T2, how does structural equivalence work when they're self-referential? Further, how do we go about proving it? ``` T1: struct { a: int, b: pointer to T2 } T2: struct { a: int, b: pointer to T1 } ``` I was attempting to create a directed graph, and by proving the directed graphs are equ...
Structural equivalence of self-referential structures
|programming-languages|directed-graphs|
In the Louvain algorithm, a super node is created in the second phase with self-loops from the sum of intra-community edges. According to the [original paper][1] and the [lecture CS224W][2], self-loop edges are counted with a factor of 1, while edges between different nodes of the same community are counted with a fact...
T1: struct { a: int, b: pointer to struct { a: int, b: pointer to T1 }} and T2: struct { a: int, b: pointer to struct { a: int, b: pointer to T2 }} seem to be structurally equivalent.
null
Since your types both reference each other, these are not inductive types, but [coinductive types](https://cs.stackexchange.com/questions/525/what-is-coinduction). That's because, if you expand out T1 and T2 (as you have done partially in the question), you get an infinite structure: ``` T1 = { a: int, { a: int, { a:...
Since your types both reference each other, these are not inductive types, but [coinductive types](https://cs.stackexchange.com/questions/525/what-is-coinduction). That's because, if you expand out T1 and T2 (as you have done partially in the question), you get an infinite structure: ``` T1 = { a: int, { a: int, { a:...
Given strings `s1` and `s2`, consider the problem of converting `s1` to a palindrome string `p` such that `s2` is a substring of `p`, where the only operation allowed on `s1` is replacement of any character with any other character. What is the minimum number of operations required for this task?
Convert given string to palindrome with given substring
It is not known, but believed to be unlikely. The Clique problem is NP-complete. If a NP-complete problem was in co-NP, then we would have NP = co-NP. It is an open problem whether NP = co-NP, but most complexity theorists expect that NP != co-NP -- which would imply that Clique is not in co-NP. See also https://...
null
|programming-languages|type-theory|directed-graphs|
null
I'm trying to prepare for mock exam, could you please help me with possible solutions? Design and analyze an efficient algorithm that, given n distinct integers, returns an element which is neither the smallest nor the largest
Design and analyze an efficient algorithm that, given n distinct integers, returns an element which is neither the smallest nor the largest
|algorithms|algorithm-analysis|sorting|quicksort|
null
null
Straight forward and simple solution- 1)Randomly select any three integers from the list ,say p,q,r. 2)Return the element which is not maximum and minimum among p,q,r. Since all elements in the given list are distinct. Thus the solution is guaranteed for n>=3.
null
null
I am conducting a stateful search of a large graph in an effort to find some solutions of minimal cost. With an [admissible heuristic](https://en.wikipedia.org/wiki/Admissible_heuristic) for estimated time to completion from a state (as in [A*][1]), I would be able to drop states out of the search queue to improve runt...
What is a good heuristic for multi-point A* on a directed graph?
|optimization|minimum-spanning-tree|heuristics|directed-graphs|
I am conducting a stateful search of a large graph in an effort to find some solutions of minimal cost. With an [admissible heuristic](https://en.wikipedia.org/wiki/Admissible_heuristic) for estimated time to completion from a given state (as in [A*][1]), I would be able to drop states out of the search queue to improv...
null
As said elsewhere, the solution is the median of any three elements. As there can be $3$ outcomes, any solution based on comparison of the values must do at least $2$ comparisons. On the other hand, only $3$ different comparisons can be made. So far, we cannot tell if the worst-case requires $2$ or $3$ comparisons. ...
null
Say there is a push-down automaton, in this example I'll use a [Deadfish][1]-like set: `+: increase x by 1` `0: set x to 0` `ln: set x to ln(x) <-- real valued result` With x being an infinite precision real-valued variable, does this allow said machine to have more power than if it was operating on integer...
null
In the Louvain algorithm, a super node is created in the second phase with self-loops from the sum of intra-community edges. According to the [original paper][1] and the [lecture CS224W][2], self-loop edges are counted with a factor of 1, while edges between different nodes of the same community are counted with a fact...
What's the proper way to declare an object in pseudocode. For example: const car = {type:"Fiat", model:"500", color:"white"}; Would it be correct to write object car { type: "Fiat" model: "500" color: "white" } Or should a different format be used? Thanks in advance.
Declaring a JavaScript object in pseudocode
|pseudocode|
We know that determining whether two vertices (or two edges) fall on a triangle is relatively easy. However, I am not sure if there are any algorithms for general k-cycles. That is to say, I would like to determine whether two given vertices (or two edges) fall on a cycle of a specific length. I am not aware of the ...
How to determine if two vertices (or two edges) fall on a cycle of a specific length?
|graphs|
I'm working on problem 19.4-1 from the CLRS book, which asks to show that the height of an n-node Fibonacci heap can be greater than O(lg n) by exhibiting a sequence of operations that creates a Fibonacci heap consisting of just one tree that is a linear chain of n nodes. I'm not sure if by "linear chain" the proble...
Question about CLRS problem 19.4-1
|algorithms|heaps|linked-lists|
null
null
I have some troubles in understanding of the Brzozowski's algorithm for NFA to minimized DFA transformation. Or maybe I'm doing a mistake in the NFA to DFA transformation steps. The Algorithm, as described in [Wikipedia](https://en.wikipedia.org/wiki/DFA_minimization#Brzozowski's_algorithm), is as follows: 1. Rever...
Brzozowski's algorithm for Kleene star NFA
|finite-automata|
I have been asked to describe through an FSA a system where some inputs do not determine any state transitions, but that provide outputs. There is no self-transition, and the input is not rejected: the state literally does not change, while an output is produced. I started with NFSAs, but it does not seem to suit the r...
How can I describe an FSA where one or more inputs generate outputs but do not cause transitions?
|finite-automata|
null
null
null
If P = NP, then is it the case that there exists a total recursive function from the set of polynomial-time nondeterministic Turing machines to the set of polynomial-time deterministic Turing machines such that it sends every nondeterministic machine to an equivalent deterministic machine?
Converting P = NP into an effective equivalence algorithm
|complexity-theory|computability|
Yes, this is a consequence of the existence of NP-complete problems. (Of course a bit of care is needed to state the result precisely, e.g. the set of polytime (non)deterministic machines is not itelf recursive.)
If $k$ is an input, and the cycle is not allowed to repeat vertices, then as you say, the problem is NP-hard, as it is at least as hard as the Hamiltonian cycle problem (simply set $k$ equal to the number of vertices in the graph). If $k$ is fixed and small, I believe the problem can be solved in polynomial time (bu...
There is no one "proper" way. Pseudocode is not a formally defined language that has an accepted syntax. Rather, it is an informal form of communication. The criterion is: will it be clear to the reader? That will require you to use some judgement and knowledge of your audience. If you are not sure, I suggest ...
My question is pretty much just the title. It is pretty easy to see that any finite language can be solved in $O(1)$ time. For this reason, every finite languages is in $P$, $L$, and $DTIME(O(1))$. But are finite languages the *only* languages that can be decided in constant time?
Does $\texttt{DTIME}(O(1))$ contain only finite languages?
|complexity-theory|
No, for example the language of all possible input strings can be decided in O(1) time. Just return True without reading the input. In general, note that you can only read a constant prefix of the input.
No, for example the language of all possible input strings can be decided in O(1) time. Just return True without reading the input. More generally, note that you can only read a constant prefix of the input in constant time.
null
null
I am studying the complexity of SAT resolution refutation. There is a useful tool named weakening rule > T[he weakening rule][1]: B -->B ∨ C says that from a clause B we can derive the weaker clause B ∨ C for an arbitrary C. We say that B ∨ C is a weakening of B. We can add this extra rule without loss of gene...
Why weakening rule doesn't increase the size of resolution refutation?
|complexity-theory|satisfiability|induction|
null
One big problem in complexity theory is $P$ vs $L$. I was just thinking about why this isn't trivial, and I came up with the following example. Of course, it cannot work as a proof as it seems too easy. So what is wrong in the below "proof?" Let $\Sigma = \{0, 1\}$. $L \subset \Sigma^*$ where $$ l \in L \iff \te...
Why doesn't the problem of determining whether a word has the same number of 0's and 1's prove $P \neq L$?
|complexity-theory|polynomial-time|
If $k$ is an input, and the cycle is not allowed to repeat vertices, then as you say, the problem is NP-hard, as it is at least as hard as the Hamiltonian cycle problem (simply set $k$ equal to the number of vertices in the graph). If $k$ is fixed and small and the cycle is not allowed to repeat vertices, I believe ...