Skip to content

Commit 2d96fa3

Browse files
committed
Remove redundant Trie main method
1 parent 1999ab4 commit 2d96fa3

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

  • src/main/java/com/thealgorithms/others

src/main/java/com/thealgorithms/others/Trie.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -160,39 +160,4 @@ private String normalize(String text) {
160160
return text;
161161
}
162162

163-
// ---------------- MAIN ----------------
164-
165-
public static void main(String[] args) {
166-
167-
Trie trie = new Trie();
168-
169-
/*
170-
* Add as many words as you want.
171-
* No fixed 10-20 word limitation.
172-
*/
173-
174-
String[] words = {"hello", "hell", "hel", "help", "helps", "helping", "helicopter", "car", "career", "dog"};
175-
176-
// Dynamically insert all words
177-
for (String word : words) {
178-
trie.insert(word);
179-
}
180-
181-
// Search
182-
System.out.println("Search 'hello': " + trie.search("hello"));
183-
184-
System.out.println("Search 'xyz': " + trie.search("xyz"));
185-
186-
// Prefix
187-
System.out.println("Starts with 'hel': " + trie.startsWith("hel"));
188-
189-
// Autocomplete
190-
System.out.println("\nSuggestions for 'hel':");
191-
192-
List<String> suggestions = trie.suggestions("hel");
193-
194-
for (String word : suggestions) {
195-
System.out.println(word);
196-
}
197-
}
198163
}

0 commit comments

Comments
 (0)