Is there a fast algorithm for finding the Largest Common Substring in two strings
or is it an NPComplete problem?
In PHP I can find a needle in a haystack:
<?php
if (strstr("there is a needle in a haystack", "needle")) {
echo "found<br>
";
}
?>
I guess I could do this in a loop over one of the strings
but that would be very expensive! Especially since my application of this is to search a database of email and look for spam (i.e. similar emails sent by the same person).
Does anyone have any PHP code they can throw out there?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…