Trie data stucture problem 9.14

#1

given a string s and a set of string in D,find shortest prefix of s which is not a prefix of any string in D.
can someone provide an example as i think I have only partially understanding of problem.

0 Likes

#2

Hey Akash,

Following is the examples listed in the later version of this book. Please take a look of that:

− If s = “cat” and D = {“dog”, “be”, “cut”} return “ca”.
− If s = “cat” and D = {“dog”, “be”, “cut”, “car”} return “cat”.
− If s = “cat” and D = {“dog”, “be”, “cut”, “car”, “cat”} return ε.

1 Like