Skip to content

Commit 54a4d01

Browse files
committed
fix bugs
1 parent 375cfde commit 54a4d01

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

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

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,24 +171,20 @@ public static void main(String[] args) {
171171
* No fixed 10-20 word limitation.
172172
*/
173173

174-
String[] words = { "hello", "hell", "hel", "help", "helps", "helping", "helicopter", "hero", "her", "cat",
175-
"car", "care", "career", "dog" };
174+
String[] words = { "hello", "hell", "hel", "help", "helps", "helping", "helicopter", "car", "career", "dog" };
176175

177176
// Dynamically insert all words
178177
for (String word : words) {
179178
trie.insert(word);
180179
}
181180

182181
// Search
183-
System.out.println(
184-
"Search 'hello': " + trie.search("hello"));
182+
System.out.println("Search 'hello': " + trie.search("hello"));
185183

186-
System.out.println(
187-
"Search 'xyz': " + trie.search("xyz"));
184+
System.out.println("Search 'xyz': " + trie.search("xyz"));
188185

189186
// Prefix
190-
System.out.println(
191-
"Starts with 'hel': " + trie.startsWith("hel"));
187+
System.out.println("Starts with 'hel': " + trie.startsWith("hel"));
192188

193189
// Autocomplete
194190
System.out.println("\nSuggestions for 'hel':");

0 commit comments

Comments
 (0)