Author |
Topic: Longest repeated String in two strings (Read 720 times) |
|
downloadprj
Newbie
Posts: 4
|
|
Longest repeated String in two strings
« on: Nov 24th, 2007, 7:18am » |
Quote Modify
|
Find the longest repeated string in two strings. It has to be a contiguous string in both. e.g. str1 = "bdhalgorithmseh" str2 = "sdalgorithmqgf" Result = "algorithm"
|
« Last Edit: Nov 24th, 2007, 7:19am by downloadprj » |
IP Logged |
|
|
|
johny_cage
Full Member
Gender:
Posts: 155
|
|
Re: Longest repeated String in two strings
« Reply #2 on: Nov 27th, 2007, 7:03am » |
Quote Modify
|
@Link above Can anybody please elaborate, that how the suffix tree leaves are having the values (x:y). It is confusing....
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Longest repeated String in two strings
« Reply #3 on: Nov 27th, 2007, 7:10am » |
Quote Modify
|
I think in x:y x represent the id# of the string, and y the position in that string where the match starts. So e.g. in that diagram, "A$" occurs at position 3 of strings 1 (BABA) and 2 (ABBA)
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
johny_cage
Full Member
Gender:
Posts: 155
|
|
Re: Longest repeated String in two strings
« Reply #4 on: Nov 27th, 2007, 11:22am » |
Quote Modify
|
@Towr yes u r right...
|
|
IP Logged |
|
|
|
|