Domanda di colloquio di Amazon

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

Risposte di colloquio

Anonimo

19 gen 2011

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

2

Anonimo

5 feb 2011

Use Boyer-moore algorithm.

1

Anonimo

23 feb 2011

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

Anonimo

13 mar 2011

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

Anonimo

11 dic 2011

Use Robin-karp or KMP algorithm