Dec 30, 2008

Two strings str1 and str2, find longest common substring

Two strings str1 and str2, find longest common substring
A new method:
Build the hash table based on all substring from str1. O(n^2)
For each substring from str2, lookup the hash table and keep the max length of substring. O(n^2)

No comments:

Post a Comment