-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestTrie.cpp
More file actions
43 lines (36 loc) · 1021 Bytes
/
TestTrie.cpp
File metadata and controls
43 lines (36 loc) · 1021 Bytes
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
#include <iostream>
#include <string>
using namespace std;
#include "Trie.h"
int main(int argc, char const *argv[])
{
Trie trie;
cout << "add \"find\"..." << endl;
trie.insert("find");
cout << "add \"fine\"..." << endl;
trie.insert("fine");
cout << "add \"hello\"..." << endl;
trie.insert("hello");
cout << "add \"finding\"..." << endl;
trie.insert("finding");
cout << "add \"hello\"..." << endl;
trie.insert("hello");
cout << endl;
cout << "search \"find\": ";
cout << trie.search("find") << endl;
cout << "search \"finding\": ";
cout << trie.search("finding") << endl;
cout << "search \"hello\": ";
cout << trie.search("hello") << endl;
cout << "remove \"hello\"... " << endl;
trie.remove("hello");
cout << "search \"hello\": ";
cout << trie.search("hello") << endl;
cout << "remove \"finding\"... " << endl;
trie.remove("finding");
cout << "search \"finding\": ";
cout << trie.search("finding") << endl;
cout << "search \"find\": ";
cout << trie.search("find") << endl;
return 0;
}