It is in fact the longest common substring problem, but applied to words in a text rather than characters in a string, hence the algorithm operates on arrays of strings. I am aware of the O(M+N) algorithm, but it involves suffix trees with which I am unfamiliar and don't want to spend the time investigating right now. The DP solution works today and I want to focus on other parts of the project :)
Also the size of the alphabet in this case is the set of all words in a particular language, most commonly English. I am not sure what the implications of that are for the performance of the suffix tree algo. On Saturday, February 23, 2013 7:54:01 PM UTC-5, Leif wrote: > > This may be slightly off topic, but your "longest contiguous common > subsequence" problem sounds like the "longest common substring" problem. > Your code uses the dynamic programming solution, which is O(M*N), but > there are O(M+N) algorithms that might be faster depending on the length > and "alphabet" of your input sequences. > > On Monday, February 18, 2013 11:16:51 PM UTC-5, Geo wrote: >> >> Hello, >> >> I am cross-posting my Clojure question from StackOverflow. I am trying >> to get an algorithm in Clojure to match Java speed and managed to get the >> performance to within one order of magnitude and wondering if more is >> possible. The full question is here: >> >> >> http://stackoverflow.com/questions/14949705/clojure-performance-for-expensive-algorithms >> >> Thank you. >> > On Monday, February 18, 2013 11:16:51 PM UTC-5, Geo wrote: > > Hello, > > I am cross-posting my Clojure question from StackOverflow. I am trying to > get an algorithm in Clojure to match Java speed and managed to get the > performance to within one order of magnitude and wondering if more is > possible. The full question is here: > > > http://stackoverflow.com/questions/14949705/clojure-performance-for-expensive-algorithms > > Thank you. > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.