Trie data structure implementation