Pergunta de entrevista da empresa Amazon

Design a data structure to store strings efficiently for following operations : 1. IsPrefix (s1, s2) : Is s1 a prefix of s2. 2. IsEqual(s1, s2) : Are s1 and s2 equal. 3. common prefix(s1, s2) : Return the common prefix of the given strings s1 and s2.

Respostas da entrevista

Sigiloso

9 de jan. de 2012

Reverse the strings and use a suffix tree. (A suffix tree is a type of radix tree.)

Sigiloso

13 de jan. de 2012

Suffix Array ?