What is a typical algorithm for finding a string within a string?

Posted by Courtney85 on Stack Overflow See other posts from Stack Overflow or by Courtney85
Published on 2010-03-24T01:56:26Z Indexed on 2010/03/24 2:03 UTC
Read the original article Hit count: 192

I recently had an interview question that went something like this:

Given a large string (haystack), find a substring (needle)?

I was a little stumped to come up with a decent solution.

What is the best way to approach this that doesn't have a poor time complexity?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about interview-questions