in reply to Re: Challenge: Fast Common Substrings
in thread Challenge: Fast Common Substrings
However, I'd like to slightly revise the algorithm you outlined. Consider the following example:
"ab" appears twice in the first string, and so it gives a node with two leaves. The actual condition you should check is whether a node has one leaf containing the % separator and another leaf without the % symbol.string = ababc%bc$ | |(3:abc%bc$)|leaf |(1:ab)| | |(5:c%bc$)|leaf tree:| | |(3:abc%bc$)|leaf |(2:b)| | | |(6:%bc$)|leaf | |(5:c)| | | |(9:$)|leaf | | |(6:%bc$)|leaf |(5:c)| | |(9:$)|leaf | |(6:%bc$)|leaf | |(9:$)|leaf
blokhead
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Challenge: Fast Common Substrings (O(n)?)
by tye (Sage) on Apr 04, 2007 at 21:53 UTC | |
by lima1 (Curate) on Apr 04, 2007 at 22:12 UTC | |
Re^3: Challenge: Fast Common Substrings
by lima1 (Curate) on Apr 04, 2007 at 16:25 UTC |