add trie tree
apply function pointer for trie tree