Adapting pseudocode to java implementation for finding the longest word in a trie
- by user1766888
Referring to this question I asked: How to find the longest word in a trie?
I'm having trouble implementing the pseudocode given in the answer.
findLongest(trie):
//first do a BFS and find the "last node"
queue <- []
queue.add(trie.root)
last <- nil
map <- empty map
while (not queue.empty()):
curr <- queue.pop()
for each son of…