emory-courses / dsa-java

Data Structures and Algorithms in Java
https://emory.gitbook.io/dsa-java/
42 stars 55 forks source link

[HW#2 getting existing children node] #149

Closed MimiOlayeye closed 4 years ago

MimiOlayeye commented 4 years ago

I want to improve the runtime of my code when traversing the Trie. for my BFS traversal I've been checking every letter in the alphabet for the child nodes'. Is there a way we utilize getChildrenMap to retrieve only the existing nodes? That way I don't have to check every letter.

lujiaying commented 4 years ago

If creating the TrieTree using given dict.txt, the TrieTree could be a tree that has limited child nodes. Then during traversal, it already saves some time. Does it help?