-
Notifications
You must be signed in to change notification settings - Fork 0
/
DictionaryHashtable.hpp
52 lines (39 loc) · 1.15 KB
/
DictionaryHashtable.hpp
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
46
47
48
49
50
51
/**
* Name: Rui Deng
* Dadong Jing
* Data: Feb 12, 2016
* Overview: the header file of DictionaryHashtable
* Assignment number: PA3
*/
/**
* CSE 100 PA3 C++ Autocomplete
* Authors: Jor-el Briones, Christine Alvarado
*/
#ifndef DICTIONARY_HASHTABLE_HPP
#define DICTIONARY_HASHTABLE_HPP
#include <string>
#include <unordered_set>
/**
* The class for a dictionary ADT, implemented as a Hashtable
* When you implement this class, you MUST use a Hashtable
* in its implementation. The C++ unordered_set implements
* a Hashtable, so we strongly suggest you use that to store
* the dictionary.
*/
class DictionaryHashtable
{
public:
/* Create a new Dictionary that uses a Hashset back end */
DictionaryHashtable();
/* Insert a word into the dictionary. */
bool insert(std::string word);
/* Return true if word is in the dictionary, and false otherwise */
bool find(std::string word) const;
/* Destructor */
~DictionaryHashtable();
private:
// Add your own data members and methods here
//using a build-in unordered set to implement the hashtable
std::unordered_set<std::string> myDictionary;
};
#endif // DICTIONARY_HASHTABLE_HPP