I’m lost–can’t figure out the algorithm to output a trie.
class Trie
@value
@children = [] # array of tries
@number_exists # bool
end
0 # Root = nil
/
1 => number_exists = true(#1)
/
1 => number_exists = true(#11)
/ => 1 => true(#111)
/ => 2 => true(#1112)
/ => 2 => true(#112)
/ => 5 => true(#1125)
0 => number_exists = true(#110)
Any help is much appreciated, thanks!
Justin