C++ Trie Implementation --> Prefix Tree + Readable + Understandable
\nclass TrieNode{\npublic:\n    unordered_map<char, TrieNode*> children;\n    bool isWord = false;\n    char val;\n    \n    TrieNode(){}\n    \n    TrieNode(ch
```\nclass TrieNode{\npublic:\n    unordered_map<char, TrieNode*> children;\n    bool isWord = false;\n    char val;\n    \n    TrieNode(){}\n    \n    TrieNode(char v){ this->val = v; }\n};\n\nclass Trie{\nprivate:\n    TrieNode* root;\npublic:\n    Trie(){\n        root = new TrieNode();\n    }\n    \n    void insert(string word){\n        TrieNode* temp = root;\n        \n        for(char ch : word){\n            if(temp->children.find(ch) == temp->children.end()){\n                temp->children[ch] = new TrieNode(ch);\n            }\n            temp = temp->children[ch];\n        }\n        \n        temp->isWord = true;\n    }\n    \n    bool isOrdered(string word){\n        TrieNode* temp = root;\n        \n        for(char ch : word){\n            if(temp == root || temp->isWord){\n                temp = temp->children[ch];\n                continue;\n            }\n            return false;\n        }\n        \n        return true;\n    }\n};\n\nclass Solution {\npublic:\n    string longestWord(vector<string>& words) {\n        Trie* search = new Trie();\n        string curr ("");\n        int size = 0;\n        \n        for(string str : words){\n            search->insert(str);\n        }\n        \n        for(string str : words){\n            if(search->isOrdered(str) && size <= str.size()){\n                curr = (size == str.size()) ? min(curr, str) : str;\n                size = str.size();\n            }\n        }\n        \n        return curr;\n    }\n};\n```
['Trie', 'C', 'C++']