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.