Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 14 Online
OpenStudy (anonymous):

Ps3 problem 3: I am at a loss as to how to approach this problem. Say our target = batcatfatbat and key = bat We can break the key into k1 = ba k2 = t so then firstMatch = (0, 9) and secondMatch = (2,5,8,11) and length = 2 #ba is what we measure? plug the first for each tuple into n+m+1=k 0 + 2 + 1 != 2 I'm not even sure what I am asking at this point...are any of my explanations/understandings of the problem incorrect I guess?

OpenStudy (anonymous):

You wouldn't break "bat" into "ba" and "t". You need to drop a letter. So the three cases for "bat" would be: "ba", "" "b", "t" "", "at"

OpenStudy (anonymous):

Here's a picture of what you're trying to match at the first index. You don't do all those matches at the same time, in fact they're all separate, but it shows conceptually what you're supposed to be trying to match. |dw:1318060251246:dw|

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!