Monkey trie, monkey do

Monkey Forums/Monkey Programming/Monkey trie, monkey do

SpaceAce(Posted 2017) [#1]
If you're in the "trie is try" camp, pretend the title is "monkey try, monkey fly," or something like that. I exhausted my store of wit on the current title.

What is a trie? A trie is a an ordered data structure that excels at storing and facilitating the lookup of strings. Although a trie is not inherently limited to text, dictionary storage is one of the trie's more common usages. A trie is also known as a prefix tree, because it builds a graph where each item in the structure shares the longest possible prefix with each other item in the structure. For a slightly better explanation, complete with a crude diagram, view the readme file in my simpletrie repository: https://github.com/SpaceAceMonkey/simpletrie

Installation:
Clone and copy to your modules directory, the way you would with any other Monkey-X module, then
Import spaceace.simpletrie.cTrie


Usage:
The repository has more complete examples, but here is the minimum you need to do in order to have a functional and useful trie in your Monkey-X project.
Import spaceace.simpletrie.cTrie

Function Main:Int()
    Local root:TrieNode = New TrieNode()
    Trie.Insert(root, "beefalo")
    Print "Does beefalo appear in the trie? " + Int(Trie.Contains(root, "beefalo"))

    Return 0
End Function