Group Group Group Group Group Group Group Group Group

Tries clarification

Hello,

I wanted some clarification on Tries, so if I have an array:

var array = ["dog", "cat", "bird"]

And I insert these elements into the trie, the trie converts these strings to arrays of the characters of the strings and makes the child node, the first letter of the word? Is my understanding correct?

For example “dog” would be converted to [“d”, “o”, “g”] upon insertion and d would be the direct child to the root node?

Thank you for any feedback.

@kelvin_lau Can you please help with this when you get a chance? Thank you - much appreciated! :]

For example “dog” would be converted to [“d”, “o”, “g”] upon insertion and d would be the direct child to the root node?

Yes - every node in the Trie represents a letter