Sollicitatievraag bij Amazon

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

Antwoorden op sollicitatievragen

Anoniem

19 jan 2011

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

2

Anoniem

5 feb 2011

Use Boyer-moore algorithm.

1

Anoniem

23 feb 2011

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

Anoniem

13 mrt 2011

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

Anoniem

11 dec 2011

Use Robin-karp or KMP algorithm