baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
This is a post regarding potential ideas so no code required. I am just trying to see if I forgot some obvious solution.
Problem:
Given two strings with the same prefix and the same length:
What would be the fastest way (the least number of computational steps) to identify the length of the shared prefix between two strings. An obvious solution is to just start pairwise matching of characters until a mismatch is located. But is there a way to preprocess this particular string in order to reduce the number of pairwise comparisons. Also given a large number of such cases what would be a better solution then to just pairwise compare strings? any suggestion is more than welcomed (code not required)aaababbbababbbabababb aaababbbabaaababbabba
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: String matching idea
by choroba (Cardinal) on Sep 18, 2015 at 12:06 UTC | |
|
Re: String matching idea
by Tux (Canon) on Sep 18, 2015 at 12:24 UTC | |
by salva (Canon) on Sep 18, 2015 at 12:31 UTC | |
by Tux (Canon) on Sep 18, 2015 at 13:41 UTC | |
|
Re: String matching idea
by hippo (Archbishop) on Sep 18, 2015 at 12:11 UTC | |
|
Re: String matching idea
by salva (Canon) on Sep 18, 2015 at 12:29 UTC | |
by Anonymous Monk on Sep 18, 2015 at 18:32 UTC | |
by salva (Canon) on Sep 19, 2015 at 07:06 UTC | |
|
Re: String matching idea
by Anonymous Monk on Sep 18, 2015 at 17:52 UTC |