in reply to Longest String Matching
Reverse the string you're searching, and add the items you're searching for (reversed too) to a Tree::Trie, which is optimized for fast prefix searches. You're not using a has but it's still O(1).
|
---|
In Section
Seekers of Perl Wisdom