#ifndef __TRIE_H #define __TRIE_H #include #include #include template class Trie { public: Trie() {} Trie(int capacity, T value) : words_count(0), children(capacity, NULL), value(value) { } ~Trie() {} T get(string key) { //assert(key.length() > 0); //assert('a' <= key[0] && key[0] <= 'z'); char c = key[0]; if (children[c - 'a'] == NULL) return NULL; if (key.length() == 1) return children[c - 'a']->value; return children[c - 'a']->get(key.substr(1)); } void insert(string key, T value){} T remove(string key){} // returns the value of the node to be removed int get_num_nodes_with_prefix(string key) {} private: int count; vector children; T value; }; #endif // __TRIE_H