instruction
stringlengths
0
29.8k
⌀
|algorithm-analysis|asymptotics|runtime-analysis|
Consider the family of grammars $G_n,~n\geq2$. $$S \rightarrow A_ib_i~,~for~~1\leq i \leq n$$ $$A_i \rightarrow a_jA_i~|~a_j~,~for~~1 \leq i,j \leq n~~and~~i \neq j$$ where multiple alternative right sides result from different values of $i,j$ while the terminal symbols $a_i$ and $b_i$ are not necessarily diffe...
|formal-grammars|parsing|
|formal-languages|regular-languages|closure-properties|
Given languages $L_1,L_2$, defines $X(L_1,L_2)$ by $\qquad X(L_1,L_2) = \{w \mid w \not\in L_1 \cup L_2 \}$ If $L_1$ and $L_2$ are regular, how can we show that $X(L_1,L2)$ is also regular?
There are several ways to show that a language is regular (check the question [How to prove a language is regular?](http://cs.stackexchange.com/questions/1331/how-to-prove-a-language-is-regular)) Specifically for the language in your question, start with DFAs for $L_1$ and $L_2$ and try to construct an NFA for $X(L_...
In the multiway cut problem, the input is an undirected graph G= (V, E) and set of terminal nodes s1, s2....sk are in V. The goal is to find a minimum set of edges in E whose removal leaves all terminals in different components. a) How do we show that this problem can be solved exactly in polynomial time when k is...
Multiway Cut Q- Polynomial time
|untagged|
Say I had the choice of choosing one out of the following two optimization problems which I could use to solve my problem. Which choice is the fastest? How much of a trade-off would it be-as in - Is the improvement in speed by many factors!? 1) Minimizing a convex function L(X) in one matrix variable with orthogonal...
Time - Complexity Convex Optimization and Eigen Decomposition
|algorithms|optimization|time-complexity|linear-algebra|
null
Show that the language of strings not in the union of two regular languages is regular
null
I am working [1] with a certain structure, and I wonder if someone has seen it before. I am no mathematician, so all I can say is that I will do my best to describe this structure. It is actually very simple. I am sure I have seen it (and its interpretation) somewhere, years ago, perhaps in some old first year un...
Has someone seen this structure before?
|logic|
Say I had the choice of choosing one out of the following two optimization problems which I could use to solve my problem. Which choice is the fastest? How much of a trade-off would it be? Is the improvement in speed by many factors!? 1. Minimizing a convex function $L(X)$ in one matrix variable with orthogonality ...
In the multiway cut problem, the input is an undirected graph $G= (V, E)$ and set of terminal nodes $s_1, s_2,\ldots s_k$ are in $V$. The goal is to find a minimum set of edges in $E$ whose removal leaves all terminals in different components. 1. How do we show that this problem can be solved exactly in polynomial ...
|algorithms|graphs|approximation|network-flow|
|algorithms|time-complexity|optimization|efficiency|linear-algebra|
|logic|natural-language-processing|
I have a list of numbered elements 1 to N that fit into positions on a number line starting with 1. I also have constraints for these elements: - The element 1 is in position 1, and element N must be at a position >= the position of element N-1. (i.e. element 2 could be at position 1, element 3 at position 7, and e...
Find maximum distance between elements given constraints on some
|optimization|dynamic-programming|linear-programming|
I am working [1] with a certain structure, and I wonder if someone has seen it before. I am no mathematician, so all I can say is that I will do my best to describe this structure. It is actually very simple. I am sure I have seen it (and its interpretation) somewhere, years ago, perhaps in some old first year un...
Consider the family of grammars $G_n,~n\geq2$. $$S \rightarrow A_ib_i~,~for~~1\leq i \leq n$$ $$A_i \rightarrow a_jA_i~|~a_j~,~for~~1 \leq i,j \leq n~~and~~i \neq j$$ where multiple alternative right sides result from different values of $i,j$ while the terminal symbols $a_i$ and $b_i$ are not necessarily diffe...
null
First your integer numbers are converted into binary numbers. <br/>For example, in CPU integer 2 is converted to 0010. > A `digital comparator` or magnitude comparator is a hardware electronic > device that takes two numbers as input in binary form and determines > whether one number is greater than or less than o...
null
The question really depends on what is the precise definition of a 2-hop. If by a 2-hop you mean the set $$hp(v) = \{ u \mid \mbox{there is a path of length 2 between u and v}\},$$ then the current answer is no, you cannot do it faster than $O(n^{\omega})$ where $\omega$ is the usual constant associated with the comple...
Let's say we have 10 people, each with a list of favorite books. For a given person X, I would like to find a special subset of X's books liked only by X, i.e. there is no other person that likes all of the books in X's special subset. I think of this special subset as a unique "fingerprint" for X. I would apprecia...
Finding "fingerprint" sets
|algorithms|sets|
No, it is not a context-free language. From my original SO answer: consider the string $0^n1^n0^n1^n \in L$, where $n$ is the pumping length from the pumping lemma for context-free languages. This fails the pumping lemma for context-free languages; in particular, we have seven cases for $vxy$: 1. $vxy$ consists enti...
null
This isn't a particularly clever algorithm, but it's polynomial, and I think it should work. Take any set. For each element in this set, count the number of remaining sets which do not contain it and remember which sets contain it. Pick the element with the highest count, and redo the counts for the remaining elements,...
This isn't a particularly clever algorithm, but it's polynomial, and I think it should work. Take any set. For each element in this set, count the number of remaining sets which do not contain it and remember which sets contain it. Pick the element with the highest count, and redo the counts for the remaining elements,...
What you describe is a linear program. You can use the following formulation: Let $x_i$ be the $i$th element. The variables are $d_1,\ldots, d_{n-1}$, where $d_i$ denotes difference between $x_{i+1}$ and $x_i$. You require $d_i\ge 0$. If two elements $x_i,x_j$ should be at least within some distance $\ell^-_{ij}$...
Proving that the clique cover problem is in NPC by reducing from k-coloring
null
I'm reviewing for a computability test, and my professor has not provided solutions to his practice questions. I came up with a "solution" to this problem, but it really seems like my answer is wrong (since I call upon $\mathsf{Halt}$ twice)... We are given this initial language for some machine $M$: $\mathsf{2St...
Reducing a problem to Halt
|computability|reductions|
This problem, for me, looks very interesting. It was about to find a simple cycle (i.e. cycle where are not repeat nodes) in a directed graph. My solution is going like this, i.e, this graph is a case problem: ![enter image description here][1] I know that there is a cycle in a graph, when you can find "back edg...
Find the Simple Cycles in a Directed Graph
|graph-theory|
This question appears to be very Googleable. For example, you may be interested in the algorithm presented in this paper: [Finding all the elementary circuits of a directed graph][1]. Donald B. Johnson. SIAM J. COMPUT. Vol. 4, No. 1, March 1975 > **Abstract.** An algorithm is presented which finds all the element...
First of all I find it rather artificial to argue with reductions, since a more direct argument is applicable here. However, you can of course do it. I think your approach follows basically the right direction. But it is not a *clean* reduction. Here is how I would phrase it. We want to show that ${\sf 2Strings}$...
null
I am working [1] with a certain structure, and I wonder if someone has seen it before. I am no mathematician, so all I can say is that I will do my best to describe this structure. It is actually very simple. I am sure I have seen it (and its interpretation) somewhere, years ago, perhaps in some old first year un...
I am working [1] with a certain structure, and I wonder if someone has seen it before. I am no mathematician, so all I can say is that I will do my best to describe this structure. It is actually very simple. I am sure I have seen it (and its interpretation) somewhere, years ago, perhaps in some old first year un...
null
Do there exist robust structures in Conway Life? For instance, has anyone constructed a spaceship with a shield that absorbs all small oscillators and gliders it collides with? My apologies if this is not the right forum for this question.
Cell walls in Conway Life?
|cellular-automata|
@Raphael : Definition of trailing : Any terminal which is present at the last of a right sentential form (and not the sentence) which is derived from a non-terminal is the trailing of that non-terminal. TRAILING(E) : E -> E + T -- In this the trailing is '+' <br> -> E + T * F [using T->T*F] -- Here trailing is...
null
Not what you are looking for. But just for the purpose sharing knowledge, you can do that with $O(|E|)$ *messages* if you assume that each vertex to act as a *processor*. Note each vertex has a comparable value. Therefore, there exists some vertices such that they are larger than all their neighbors. These vertices do ...
I got this question on my final exam: L = {w(wrR) | w is an element of {0,1}* } Note: Come up with a w. wr means take w and replace all (0's with 1's) and (1's with 0's) wrR means reverse the string wr. Is this a Context Free Language?
Is this a Context Free Language?
|formal-languages|context-free|
I got this question on my final exam: L = {w(wrR) | w is an element of {0,1}* } Note: There is a substring w. wr means take w and replace all (0's with 1's) and (1's with 0's) wrR means reverse the string wr. Is this a Context Free Language? --------------- > I've thought about it being a cont...
I got this question on my final exam: L = {w(wrR) | w is an element of {0,1}* } Note: There is a substring w. wr means take w and replace all (0's with 1's) and (1's with 0's). wrR means reverse the string wr. Is this a Context Free Language? --------------- > I've thought about it being a co...
I got this question on my final exam: Is the following language context-free? $$ L = \{w\bar w^R \mid w\in \{0,1\}^* \}$$ **Notation**: The string $\bar w$ is obtained from $w$ by replacing all 0s with 1's and all 1's with 0's. The string $\bar w^R$ is $\bar w$ in reverse order. --------------...
Do there exist robust structures in [Conway's Game of Life](http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)? For instance, has anyone constructed a spaceship with a shield that absorbs all small oscillators and gliders it collides with?
Cell walls in Conway's Game of Life?
null
See "[eaters][1]" category. They can absorbe gliders and spaceships, but I'm not an expert and I don't know if there are "walls" capable of absorbing everything. Perhaps it is a nice subject to investigate! (see the references at the bottom of [Wikipedia pages][2] for modern approaches using constraint solvers). ...
I assume you want the fingerprint to be as small as possible. Then this is the [Hitting Set][1] problem: For each person, make a list of all books liked by X but not by this person. Then, the goal is to select at least one book from each list. The problem is NP-hard, so you can't expect to find an algorithm that always...
I am working [1] with a certain structure, and I wonder if someone has seen it before. I am no mathematician, so all I can say is that I will do my best to describe this structure. It is actually very simple. I am sure I have seen it (and its interpretation) somewhere, years ago, perhaps in some old first year un...
Maybe I did not understand the question correcty (based on somewhat complicated answers), but here goes. You just go through all persons, and through all their books, that they like. You create a data structure (prefferably a Hash Map $M$), where key is the book and value is a list of persons who like this book. You fi...
I am working [1] with a certain structure, and I wonder if someone has seen it before. I am no mathematician, so all I can say is that I will do my best to describe this structure. It is actually very simple. I am sure I have seen it (and its interpretation) somewhere, years ago, perhaps in some old first year un...
I am working [1] with a certain structure, and I wonder if someone has seen it before. I am no mathematician, so all I can say is that I will do my best to describe this structure. It is actually very simple. I am sure I have seen it (and its interpretation) somewhere, years ago, perhaps in some old first year un...
You may use the formula I have derived. (M-B)c(A) + Summation (r=0 to N-A-1) (B+r)c(r) * (N-r+M-B-1)c(N-r) . You need to simplify it further to convert into O(logn) solution.
You may use the formula I have derived: $${M-B \choose A} + \sum_{r=0}^{N-A-1} {B+r \choose r} {N-r+M-B-1 \choose N-r}$$ You need to simplify it further to convert into $O(\log n)$ solution.
You may use the formula I have derived: $${N-A+B \choose B} {M-B+A \choose A} + \sum_{r=0}^{N-A-1} {B+r \choose r} {N-r+M-B-1 \choose N-r}$$ You need to simplify it further to convert into $O(\log n)$ solution.
You may use the formula I have derived: $${N-A+B \choose B} {M-B+A \choose A} + \sum_{r=0}^{N-A-1} {B+r \choose r} {N-r+M-B-1 \choose N-r}$$ where, A=P and B=Q. You need to simplify it further to convert into $O(n log n)$ solution.
A Context free grammer is one whose LHS is free from any terminal symbols in expression. According to the expression it is clearly CFG.
A Context free grammer is one in which LHS of atleast one of the productions is free from any terminal symbols (context). According to your production rule,it is clearly CFG.
We start from the common corner grid (B,N-A) of the rectangle and the cut part. Now, we start from grid (0,0) and find path till that corner multiplied by paths from that corner till grid (N+1,M+1) , i.e the first term of above expression. Now further we move one grid back and calculate path from grid (0,0) till that g...
I'm trying to solve a graph problem ( it's not for homework, just to practise my skills ). A dag $G(V,E)$ is given, where $V$ is the set of vertices and $E$ the edges. The graph is represented as an adjacency list, so $A_i$ is a set containing all the connections of $i$. My task is to find which vertices are reachable ...
Efficient algorithm for retrieving the transitive closure of a directed acyclic graph
|graphs|
First your integer numbers are converted into binary numbers. <br/>For example, in CPU integer 2 is converted to 0010 > A `digital comparator` or magnitude comparator is a hardware electronic > device that takes two numbers as input in binary form and determines > whether one number is greater than or less than or...
null
I was reading Wiki on [feature vectors][1], and as far as I can see, it suggests creating new features from already existing features: > Higher-level features can be obtained from already available features > and added to the feature vector, for example for the study of diseases > the feature 'Age' is useful and i...
Do linearly dependent features in feature vectors improve the feature vector?
|machine-learning|
right quotient is defined as Right Quotient L1/L2={ x| xy ∈ L1 & y ∈ L2 } xy/y= x ex: L1={ab,aab,baa} L2={b} remove from right L1/L2={a,aa,∈} in above example should ∈ be included in final result or not? i read it somwhere it was included but i am not getting how?
right quotient- confusion related to ∈ in final result
|formal-languages|finite-automata|
I'm trying to solve a graph problem (it's not for homework, just to practice my skills). A DAG $G(V,E)$ is given, where $V$ is the set of vertices and $E$ the edges. The graph is represented as an adjacency list, so $A_v$ is a set containing all the connections of $v$. My task is to find which vertices are reachable fr...
|algorithms|graphs|
When is epsilon a part of the result of computing the right quotient?
null