(String[] args)
| 3 | public class TrieExample { |
| 4 | |
| 5 | public static void main(String[] args) { |
| 6 | Trie t = new Trie(); |
| 7 | |
| 8 | /* insert words */ |
| 9 | t.insert("a"); |
| 10 | t.insert("inn"); |
| 11 | t.insert("to"); |
| 12 | t.insert("tea"); |
| 13 | t.insert("ted"); |
| 14 | t.insert("ten"); |
| 15 | |
| 16 | /* search words */ |
| 17 | System.out.println(t.checkWord("inn")); |
| 18 | System.out.println(t.checkWord("tea")); |
| 19 | System.out.println(t.checkWord("tee")); |
| 20 | System.out.println(t.checkWord("te")); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | class Trie { |