Consider a suffix tree built for a string. What is the main use of this data structure?
Think about searching for patterns efficiently.
A suffix tree allows fast substring search by representing all suffixes of a string in a tree structure.
For a string of length n, how many leaves are there in its suffix tree?
Each suffix corresponds to a unique path ending in a leaf.
Each suffix of the string corresponds to exactly one leaf in the suffix tree, so there are n leaves for a string of length n.
Given a string of length n, what is the best known time complexity to build its suffix tree?
There are linear-time algorithms for suffix tree construction.
Ukkonen's algorithm and others build suffix trees in linear time O(n), making them efficient for large strings.
Which statement correctly describes a key difference between suffix trees and suffix arrays?
Think about how suffixes are organized in each data structure.
Suffix trees represent suffixes as paths in a tree, while suffix arrays store the starting indices of suffixes sorted lexicographically in an array.
Given a suffix tree built for the string banana$, what is the number of occurrences of the substring ana?
String: banana$ Query substring: ana
Count how many suffixes contain the substring ana.
The substring ana appears twice in banana$: starting at positions 1 and 3 (0-based).