This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.