Chap13 HW TextProcessing
Chap13 HW TextProcessing
CSCI-313
HW#13
R-13.7
-----------------------------------------------------------------------------------
---------------------------------------------
C-13.28
The running time of the algorithm depends on the size of the noncompact
representation of the suffix trie. In the worst case, the algorithm's time
complexity can be O(n^2), where n is the length of the input string.
-----------------------------------------------------------------------------------
---------------------------------------------
C-13.29
import java.util.*;
class TrieNode {
private Map<Character, TrieNode> children;
private boolean isEndOfWord;
public TrieNode() {
children = new HashMap<>();
isEndOfWord = false;
}
public Trie() {
root = new TrieNode();
}