move trie algorithm to Trie directory