trie
•
○ = node · ◎ ringed = end of a word
insert / search / startsWith
▸1insert(word):2 cur = root3 for ch in word: descend, creating if needed4 cur.isWord = true56search(word):7 walk word; node = end8 return node exists AND node.isWord910startsWith(prefix):11 walk prefix; return the path exists
state
- methodsinsert · search · startsWith