-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrie.h
More file actions
35 lines (27 loc) · 997 Bytes
/
trie.h
File metadata and controls
35 lines (27 loc) · 997 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
#include <iostream>
#include <ostream>
#include "node.h"
class Trie
{
private:
Node* root;
void recursiveInsert(Node* root, std::string data, int pointer = 0);
void insert(Node* root, std::string entry);
void ascend(Node* root, std::ostream& os);
void descend(Node* root, std::ostream& os);
void destroy(Node* root);
int search(std::string data, Node* root);
bool remove(std::string data, Node* root);
void visualize(std::ostringstream* listNodes, std::ostringstream* relationships, Node* root);
public:
Trie();
~Trie();
void recursiveInsert(std::string data);
void insert(std::string data);
void ascend(std::ostream& os = std::cout);
void descend(std::ostream& os = std::cout);
void destroy();
int search(std::string data);
bool remove(std::string data);
void visualize(std::string filename);
};