Skip to content

Instantly share code, notes, and snippets.



Last active Nov 9, 2019
What would you like to do?
queue = [root]
while queue is not empty:
r = queue.pop()
for each a in symbols:
let p = ps(r)
while g(p, a) is none:
p = ps(p)
// s = r + a is not in the trie
if g(r, a) is none:
f(r, a) = p
s = g(r, a)
ps(s) = g(p, a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.