instruction
stringlengths
0
29.8k
⌀
null
I think the property of being able to reach all the successor states from a current state is crucial and needed in order for the problem to be well-defined. If this was not the case, you might miss out on good solutions. Moreover, **you might never reach a goal state and hence run forever.** The classic AI book by R...
In my class we used Push Down Automata to Context Free Grammar conversion algorithm that produces a lot extraneous states. For example, for two transitions, I am getting following productions > $\delta$(q0,1,Z) = (q0,XZ) [q0,Z,q0] -> 1[q0,X,q0][q0,Z,q0] > [q0,Z,q0] -> 1[q0,X,q1][q1,Z,q0] [q0,Z,q1] -> 1[q...
Eliminating useless productions resulting from PDA to CFG converison
|context-free|pushdown-automata|
In my class we used a Pushdown Automata to Context Free Grammar conversion algorithm that produces a lot extraneous states. For example, for two transitions, I am getting the following productions > $$\begin{gather*} \delta(q_0,1,Z) = (q_0,XZ) \\ {}[q_0,Z,q_0] \to 1[q_0,X,q_0][q_0,Z,q_0] \\ {}[q_0,Z,q_0] \...
**Alternative Formulation** I came up with an alternative formulation to the below problem. The alternative formulation is actually a special case of the problem bellow and uses bipartite graphs to describe the problem. However, I believe that the alternative formulation is still NP-hard. The alternative formulation...
Have you looked at [Handbook of Theoretical Computer Science][1] [1]: http://www.amazon.com/Handbook-Theoretical-Computer-Science-Vol/dp/0262720205/ref=pd_sim_sbs_b_1
Have you looked at [Handbook of Theoretical Computer Science][1] If you want to move beyond imperative algorithms and move into functional programming, take a look at [Purely Functional Data Structures][2]. I know the title says data structures but the algorithms in the book may open your eyes to a different way of ...
null
I am looking for an algorithms book that covers material beyond Corman's book. This can be answered in numerous different ways, depending on what you want "beyond". I would recommend asking much more specific directions, as you are more likely to get specific answers that are helpful. As for some general guida...
Although the comments about the if/else branches are all correct, I would say the answer is O(log n). The reason is that System.out.println("k: " + k); involves conversion of an integer to string output, and this will be O(log n) in the general case (just to print out each digit, even if a lookup table were ...
Here is the question: suppose we are given x cents, the amount we want to pay, and a 6-tuple (p, n, d, q, l, t) that represents respectively the number of pennies, nickels, dimes, quarters, loonies and toonies you have. Assume that you have enough coins to pay x cents. You do not have to pay exactly x cents; you can pa...
How to use dynamic programming to solve this?
|optimization|dynamic-programming|
Could an artificial neural network algorithm be expressed in terms of map-reduce operations? I am also interested more generally in methods of parallelization as applied to ANNs and their application to cloud computing. I would think one approach would involve running a full ANN on each node and somehow integrating...
Could an artificial neural network algorithm be expressed in terms of map-reduce operations?
|parallel-computing|neural-networks|
That looks to me as an instance of the Bounded Knapsack Problem, where there's a limited number of copies of each kind of item, turning the usual maximization of value into a minimization (you want to minimize the total number of coins given, within the possibilities entailed by the coins you have at hand).
I've finished most of the material in Cormen's Intro to Algorithms book and I am looking for an algorithms book that covers material beyond Corman's book. Are there any recommendations? NOTE: I asked this on stackoverflow but wasn't all too happy with the answer.
Book for algorithms beyond Cormen
null
I've finished most of the material in Cormen's Intro to Algorithms book and I am looking for an algorithms book that covers material beyond Corman's book. Are there any recommendations? NOTE: I asked this on stackoverflow but wasn't all too happy with the answer. NOTE: Looking at most of the comments I think ide...
null
NP-hard closure
|complexity-theory|time-complexity|space-complexity|
|complexity-theory|graphs|time-complexity|
Have you looked at [Handbook of Theoretical Computer Science][1] If you want to move beyond imperative algorithms and move into functional programming, take a look at [Purely Functional Data Structures][2]. I know the title says data structures but the algorithms in the book may open your eyes to a different way of ...
Nearest neighbor, nearest insertion, farthest insertion, and cheapest insertion are just some heuristics to get you started. You can also model the problem as a maximum flow integer program. http://www.ida.liu.se/~TDDB19/reports_2003/htsp.pdf
I have a directed weighted graph `G = (V, E, W)`. There is always an edge from a vertex `i` to another one `j`, the weight `w(i,j)` could be positive infinity, and there does not exist any negative cycle. An execution of some algorithms will find the lengths (summed weights) of the shortest paths between all pairs ...
Find all the special graphs which can reduced to the shortest paths graph
|optimization|
As others have noted, books about (advanced) algorithms are best selected by topic. A good but heavy-weight general reference with rigorous analysis is probably [The Art of Computer Programming](http://www-cs-faculty.stanford.edu/~knuth/taocp) by Knuth. As for analysis techniques, you may be interested in [An Introd...
|algorithms|reference-request|books|
|automata|formal-grammars|context-free|pushdown-automata|
|parallel-computing|artificial-intelligence|neural-networks|
I have a directed weighted graph $G = (V, E, W)$. There is always an edge from a vertex $i$ to another one $j$, the weight $w(i,j)$ could be positive infinity, and there does not exist any negative cycle. An execution of some algorithms will find the lengths (summed weights) of the shortest paths between all pairs ...
|algorithms|graphs|
Yes it can, and has been. In the paper [Map-Reduce for Machine Learning on Multicore][1] they discuss using the Map-Reduce paradigm for several common ML algorithms including ANNs. [1]: http://www.cs.stanford.edu/~ang/papers/nips06-mapreducemulticore.pdf
|algorithms|optimization|dynamic-programming|
This is the famous [change-making problem](https://en.wikipedia.org/wiki/Change-making_problem). If you want to solve it with dynamic programming, you have to come up with a suitable recursion. The central question is: > Assuming you know the optimal coin choices for all $k < n$ (cents), how do you derive the opt...
null
I think the property of being able to reach all the successor states from a current state is crucial and needed in order for the problem to be well-defined. If this was not the case, you might miss out on good solutions. Moreover, **you might never reach a goal state and hence run forever.** The classic AI book by R...
Data structure (conventions consistent with the Wikipedia article): struct half_edge; struct vertex { struct half_edge *rep; /* rep->tail == this */ }; struct face { struct half_edge *rep; /* rep->left == this */ }; struct half_edge { struct half_edge *...
Data structure (conventions consistent with the Wikipedia article): struct half_edge; struct vertex { struct half_edge *rep; /* rep->tail == this */ }; struct face { struct half_edge *rep; /* rep->left == this */ }; struct half_edge { struct half_edge *...
I think the property of being able to reach all the successor states from a current state is crucial and needed in order for the problem to be well-defined. If this was not the case, you might miss out on good solutions. Moreover, **you might never reach a goal state and hence run forever.** The classic AI book by R...
null
Suppose we have a directed graph $G=(V,E)$ and two nodes $A$ and $B$. I would like to know if there are already algorithms for calculating the following decision problem: > Are there at least two paths between $A$ and $B$ of the same length? How about the complexity? Can I solve it in polynomial time? ----- ...
I'm writing a small function to altar a graph in a certain way and was wondering if there is a formal name for the operation. The operation takes two distinct edges, injects a new node between the the existing nodes of each edge and then adds an edge between the two new nodes. For example: add new nodes a and ...
Is there a formal name for this graph operation?
|graphs|
Name of this operation is [subdivision][1]. It's useful in [graph minor][2] and related stuff. [1]: http://en.wikipedia.org/wiki/Homeomorphism_%28graph_theory%29#Subdivisions [2]: http://en.wikipedia.org/wiki/Minor_%28graph_theory%29#Topological_minors
null
Given two strings, $r$ and $s$, where $n = |r|$, $m = |s|$ and $m \ll n$, find the minimum edit distance between $s$ for each beginning position in $r$ efficiently. That is, for each suffix of $r$ beginning at position $k$, $r_k$, find the [Levenshtein distance]( http://en.wikipedia.org/wiki/Levenshtein_distance) of...
Efficiently calculating minimum edit distance of a smaller string at each position in a larger one
|algorithms|runtime-analysis|strings|
null
Perhaps I didn't understand what you wrote, but it seems that you're asking for the suffix of r closest in edit distance to s, in which case only the 2m shortest suffixes of r should be checked because the others are too long to be better than editing the length m suffix. It seems more likely to me that you're looki...
There's a [question on SE][q] asking why in Java the right type doesn't get picked in a concrete case. I know that Java can't do it in such "complicated" cases, but I'm asking myself *WHY*? The (for simplicity slightly modified) line failing to compile is Map<String, Number> m = ImmutableMap.builder().build()...
Is the type inference here really complicated?
|type-checking|
|typing|type-inference|java|
null
null
Your attempt is like [subdivision][1]. Actually you used two subdivision and finally you add extra edge between center of subdivision nodes. [1]: http://en.wikipedia.org/wiki/Homeomorphism_%28graph_theory%29#Subdivisions [2]: http://en.wikipedia.org/wiki/Minor_%28graph_theory%29#Topological_minors
I have implemented a topological sort based on http://en.wikipedia.org/wiki/Topological_sort which I'm using for dependency resolution, but it returns a linear list. What kind of algorithm can I use to find the independent paths?
Getting parallel items in dependency resolution
|graphs|
I'm writing a small function to alter a graph in a certain way and was wondering if there is a formal name for the operation. The operation takes two distinct edges, injects a new node between the existing nodes of each edge and then adds an edge between the two new nodes. For example: add new nodes a and b to...
null
Run the usual DP on rev(r) and rev(s). The answer for the length-k suffix is in the entry (k, m) of the last column, assuming that the table is indexed as (index in r, index in s).
There's a [question on SO][q] asking why in Java the right type doesn't get picked in a concrete case. I know that Java can't do it in such "complicated" cases, but I'm asking myself *WHY*? The (for simplicity slightly modified) line failing to compile is Map<String, Number> m = ImmutableMap.builder().build()...
I have implemented a topological sort based on the [Wikipedia article](http://en.wikipedia.org/wiki/Topological_sort) which I'm using for dependency resolution, but it returns a linear list. What kind of algorithm can I use to find the independent paths?
|algorithms|graphs|
|graphs|terminology|
I assume that an edge $(u,v)$ means that $u$ has to be executed before $v$. If this is not the case, turn around all edges. I furthermore assume that you are less interested in paths (those are already given by the DAG) than in a good execution strategy given the dependencies. You can easily adapt the topological so...
What you are interested in are [semi-global and/or local alignments](https://en.wikipedia.org/wiki/Sequence_alignment#Global_and_local_alignments). The usual way to compute those is to adapt the dynamic programing algorithm for the Levenshtein distance: * Initialise the first row/column with $0$ (instead of $i$/$j...
I am looking for an algorithm, which given a graph $G$ and a natural number $t$, determines if $G$ is [$t$-transitive][1]. I am also interested in knowing if this problem is in P, NP, NPC or in some other interesting facts about its complexity class. [1]: http://en.wikipedia.org/wiki/Symmetric_graph
Algorithm to test a graph for $t$-transitivity
|algorithms|graphs|
Research on methods and techniques to ensure the utility and quality of software systems through design and development processes.
null
I am looking for an algorithm, which given a graph $G$ and a natural number $t$, determines if $G$ is [$t$-transitive][1]. I am also interested in knowing if this problem is in P, NP, NPC or some other interesting facts about its complexity class. [1]: http://en.wikipedia.org/wiki/Symmetric_graph
Given two strings, $r$ and $s$, where $n = |r|$, $m = |s|$ and $m \ll n$, find the minimum edit distance between $s$ for each beginning position in $r$ efficiently. That is, for each suffix of $r$ beginning at position $k$, $r_k$, find the [Levenshtein distance]( http://en.wikipedia.org/wiki/Levenshtein_distance) of...
What you are interested in are [semi-global and/or local alignments](https://en.wikipedia.org/wiki/Sequence_alignment#Global_and_local_alignments). The usual way to compute those is to adapt the dynamic programing algorithm for the Levenshtein distance: * Initialise the first row/column with $0$ (instead of $i$/$j...
|algorithms|runtime-analysis|strings|dynamic-programming|string-metrics|
I have to proof that if L1⊂L2 and L1 is not regular then L2 it not regular. This is my proof. Is it valid? Since L1 is not regular, there does not exists a finite automata M1 such that L1 is the language of M1. Pick x∈L1. So x∈L2 and suppose that L2 is regular. Then there exists a finite automata M2 such that L2 is the...
Regular language
|regular-languages|homework|automata|finite-automata|
This is a common limitation of type inferencing and it has to do with the distinction between parameters and results of a function. Generally type inferencing is done strictly with the parameters passed to a function. Consider just the expression: ImmutableMap.builder().build(); This has to be a valid express...
I have to proof that if $L_1 \subset L_2$ and $L_1$ is not regular then $L_2$ it not regular. This is my proof. Is it valid? Since $L_1$ is not regular, there does not exists a finite automata $M_1$ such that $L_1$ is the language of $M_1$. Pick $x\in L_1$. So $x \in L_2$ and suppose that $L_2$ is regular. Then the...
|formal-languages|regular-languages|automata|finite-automata|check-my-proof|
> Since this holds for all $x\in L_1$, we can construct a finite automata which language is $L_1$. And how would you do this? You have an *infinite* amount of paths in hands which you have to mold into a *finite* set of states and edges. In fact, the statement does not hold. >! Remember that $\Sigma^*$ is regu...
Are supersets of non-regular languages also non-regular?
This is a common limitation of type inferencing and it has to do with the distinction between parameters and results of a function. Generally type inferencing is done strictly with the parameters passed to a function. Consider just the expression: ImmutableMap.builder().build(); This has to be a valid express...
I have a problem with the demonstration for construct a GNBA(the generalized nondeterministic Buchi automaton) for LTL formula : Theorem: For any LTL formula $\varphi$ there exists a GNBA $G_{\varphi}$ over alphabet $2^{AP}$ such that: (a) Word($\varphi$)=$L_{\omega}(G_{\varphi})$. (b) $G_{\varphi}$ can be co...
Time to construct GNBA for LTL formula
|logic|automata|formal-methods|model-checking|