Trie1 Trie #include using namespace std; const int childMax = 26; const char baseChar = 'A'; struct Trie { Trie* child[childMax]; // 'A' ~ 'Z' bool isRet, isParent; Trie() { fill(child, child + childMax, nullptr); isRet = isParent = false; } ~Trie() { for (int i = 0; i < childMax; ++i) { if (child[i]) delete child[i]; } } void insert(const char* key) { if (*key == '\0') isRet = true; else { int next = *key.. 2020. 9. 4. 이전 1 다음