forked from amega-dsa/starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trie.cpp
45 lines (42 loc) · 1.15 KB
/
trie.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include <string>
#include "trie.hpp"
#include "contributors.hpp"
using namespace std;
string trie_names[100] = {};
int main()
{
int size = 0;
//---------- Contributors Make function calls here and increment size before calling it---------------------------
size++;
paraspatle(trie_names, size);
size++;
satyamshukla(trie_names, size);
size++;
prathameshpatil(trie_names, size);
size++;
shubhagarwal(trie_names, size);
size++;
shubhasri(trie_names, size);
size++;
bhaveshchaudhari(trie_names, size);
size++;
tanmayeegosavi(trie_names,size);
//-------------------------------------------------------------------------------
trie_node *root = new trie_node();
for (int i = 0; i < size; i++)
{
root->insert(trie_names[i]);
}
string name;
cout << "Enter Your Name to search it in the trie : ";
cin >> name;
if (root->search(name))
{
cout << "Yaay! Your name was found in the trie ! Welcome to Amega, We hope you have a fun learning experience" << endl;
}
else
{
cout << "Your name is not in the trie" << endl;
}
}