-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathstringset.h
More file actions
33 lines (26 loc) · 809 Bytes
/
Copy pathstringset.h
File metadata and controls
33 lines (26 loc) · 809 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
#ifndef STRINGSET_H /* Prevent multiple inclusion... */
#define STRINGSET_H
#include <string>
using namespace std;
class Stringset {
private:
struct Node {
string key;
Node *next;
Node(string k, Node *n) { key = k; next = n; }
Node() { key = ""; next = NULL; }
};
//by me: https://stackoverflow.com/questions/9285742/double-pointers-to-c-objects
//by me: If you want a dynamic (raw) array of (raw) pointers, then you'll indeed need a pointer-to-pointer.
Node **table; // array of pointers to linked lists
int size; // size of table, as currently allocated
int num_elems; // number of elements stored in the table
public:
Stringset();
~Stringset();
bool find(string key);
void insert(string key);
void remove(string key);
void print(void);
};
#endif