Which data structure or algorithm is used to search thousands of different small strings in a fixed text efficiently?
A
Suffix Tree
B
Rabin Karp
C
KMP
D
Boyer Moore
Answers
Explanation:
Both the hashing and the trie provides searching in the linear time. But trie requires extra space for storage and it is collision free. And trie allows finding all the strings with same prefix, so it is also called prefix tree.
Answer:
Suffix Tree is most suitable data structure for searching thousands of different small strings in a fixed text efficiently.
Suffix Tree is most suitable data structure for searching thousands of different small strings in a fixed text efficiently. So option(a) is the correct answer.
Explanation:
Suffix tree is a data structure that is mainly used for finding the patterns of string in another.
This tree is created with suffix of the strings and that is why it requires less time to search for small string since it only checks the suffix of the string not the whole text.
While Rabin Karp is also a popular algorithm for searching the patterns of the string.However, it is not an optimised option for small string in fixed text. It takes more times as compared to suffix tree.
Hence, suffix tree is the correct answer here.
#SPJ2