# <[] contains [] ?> block (KMP algorithm)

Test project
Script pic

FAQ

Q: Is it case-sensitive?
A: Yes!

Q: Why is it so complex?
A: Because I used the KMP algorithm.

Q: What is its time complexity?
A: Linear.

I said "Hello contains h" and it responded with false. Fix that.

Nevermind I just saw the FAQ

That code gives me a headache. I guess it would help if I understood what "border" means in this context.

Is this algorithm supposed to be extra fast or something? It's not sublinear time or anything, because of those FOR EACH blocks.

There is a difference to (big) letter H and (small letter) h. I think is good that this in this project to, because it is difference big and small letters... But code is unnecessarily expanded, because for it we have a simple way:

What if you want to check if apple contains le?

I asked if "Hello world this is a test" contained "owtias" and it returned false

not sure why you would bring that up since that's the expected result.

actually, a better way would be to do

uh, it doesn't work like that. Here's a few examples for how it works.

"hello world" contains "h"
"hello world" does not contain "m"
"hello world" contains "he"
"hello world" does not contain "hw"

So this block can can look that:

Guys, did you ever used the search engine?

Thanks!

In my program, I called the failure function “border”.

Oh! I may have independently invented that, in the TECO search command. You only look at each character in the big text once, but you keep a list of pending possibilities. Cool.

Couldn't you just do

for a text/number-contains-text/number??

That could work, but it won't work if you're testing for an empty string.

Have you had a look at my FAQ section?

Yes. That doesn't solve anything, though.

well duh

Please don't be rude.