Pregunta de entrevista de Amazon

Write a function to search for a string within another string. Analyze it's complexity, and propose optimizations.

Respuestas de entrevistas

Anónimo

19 ene 2011

Represent the string in Suffix Tree and u can find the pattern in O(m) time.

2

Anónimo

5 feb 2011

Use Boyer-moore algorithm.

1

Anónimo

13 mar 2011

I wonder if you had to code BM algorithm during the interview. That would be... hard...

Anónimo

11 dic 2011

Use Robin-karp or KMP algorithm

Anónimo

23 feb 2011

@jimmy thanks http://www.movsd.com/bm.htm