isEmpty and apply methods for trie implemented