Hs Raveendran wrote:Which is the efficient algorithm to find the occurrence of a given string in a given large text file.
There are two prime algorithms for doing this - the Knuth-Morris-Pratt algorithm and the Boyer-Moore algorithm. Both are fairly easy to implement and Google will provide the details. In this case I would probably use the Knuth-Morris-Pratt algorithm since it requires no backtracking.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
What are you saying? I thought you said that Santa gave you that. And this tiny ad: