Frage im Vorstellungsgespräch bei Amazon

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

Antworten zu Vorstellungsgespräch

Anonym

19. Jan. 2011

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

2

Anonym

5. Feb. 2011

Use Boyer-moore algorithm.

1

Anonym

23. Feb. 2011

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

Anonym

13. März 2011

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

Anonym

11. Dez. 2011

Use Robin-karp or KMP algorithm