Skip to content
Advertisement

Tag: trie

Python `collections.defaultdict` for the same class

I try to use a Trie data structure for some coding problem. For each node in a trie, you typically put a a list of reference of its children. So, I thought about using defaultdict to create a default empty trie node if some children does not exists in a lookup. However, I don’t know how to use defaultdict to

Advertisement