On Mon, Aug 8, 2011 at 2:46 AM, Tuba Lambanog <tuba.lamba...@gmail.com> wrote:
> I’m having a hard time thinking through the process of generating the
> candidate suffix set using set forms, and I’m beginning to think I
> have selected an arduous path (for me).
>
> Thoughts?

Store the prefixes in a patricia tree, and the reversed suffixes in
another patricia tree. For suffixes, start at the end of the word and
walk backward while traversing the suffix tree until hitting a leaf.
Each node traversed (including the root, which is the empty string) is
a potential suffix and you traverse them in short-to-long order, so
reverse that to get them in long-to-short order. The case for prefixes
is analogous except you start at the start of the word and walk
forward while traversing the prefix tree. "No suffix" and "No prefix"
needn't be handled as special cases; they are just the empty string as
suffix or prefix, of length zero.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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

Reply via email to