This language bar is your friend. Select your favorite languages!

Idiom #159 Trie

Define a Trie data structure, where entries have an associated value.
(Not all nodes are entries)

struct Trie {
    val: String,
    nodes: Vec<Trie>
}
struct Trie
{
    Rune c;
    Trie*[Rune] children;
    bool isEntry;
    bool value;
}
type Trie struct {
	c        rune
	children map[rune]*Trie
	isEntry  bool
	value    V
}
class Trie:
   def __init__(self, prefix, value=None):
       self.prefix = prefix
       self.children = []
       self.value = value

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org