From d9018d7e81d64db7d09c038b3fde8ece521f62e1 Mon Sep 17 00:00:00 2001 From: aj-34719 Date: Sun, 3 Oct 2021 00:23:38 +0530 Subject: [PATCH] added trie data structure implimentation --- include/trie.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 include/trie.h diff --git a/include/trie.h b/include/trie.h new file mode 100644 index 0000000..fdbf7ce --- /dev/null +++ b/include/trie.h @@ -0,0 +1,28 @@ + +#include +using namespace std; + +class trieNode { + public: + char data; + bool isTerminating; + trieNode** child; + + public: + trieNode(char data){ + this->data = data; + isTerminating = false; + child = new trieNode*[26]; + for(int i=0; i<26; i++) + child[i] = NULL; + } +}; + +class trie{ + private: + trieNode* node; + + trie(){ + node = new trieNode('\0'); + } +}; \ No newline at end of file