since you have M small strings using KMP or RabinKarp will take time O(mn)
but with suffix tree you can do it in O(n+m)
read these and you'll be able to construct one:
http://www.cs.helsinki.fi/u/ukkonen/SuffixT1withFigs.pdf
http://www.cise.ufl.edu/~sahni/dsaaj/enrich/c16/suffix.htm

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to