Trie implementation in C++