implemented a trie data structure