Skip to content

Instantly share code, notes, and snippets.

View krgaurav2011's full-sized avatar

KUMAR GAURAV krgaurav2011

View GitHub Profile
#include <iostream>
#include <vector>
#include <string>
#define SIZE 26
using namespace std;
struct TrieNode {
TrieNode* child[SIZE] = {};
bool isEndofWord = false;
};
#include <iostream>
#include <string>
#include <vector>
#include <memory>
#define SIZE 26
using namespace std;
class TrieNode {
public:
shared_ptr<TrieNode> child[SIZE];
@krgaurav2011
krgaurav2011 / gist:d09f56e3cd6a98d10fb36817be368c17
Created February 12, 2019 20:47
C++ Implementation of Trie using unordered map
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
using namespace std;
struct TrieNode {
unordered_map<char,TrieNode*> child;
bool isEndofWord = false;
};
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
using namespace std;
struct TrieNode {
unordered_map<char,TrieNode*> {};
bool isEndofWord = false;
};