Question: Part 1 : Implementation ### Entry Class Implementation Create an ` Entry ` class to store key - value pairs. #### Entry.h - Member Variables
Part : Implementation
### Entry Class Implementation
Create an Entry class to store keyvalue pairs.
#### Entry.h
Member Variables Private:
K key;
V value;
Member Functions Public:
EntryK V;
~Entry;
K getK;
V getV;
void setKK;
void setVV;
### DNodeG Class Implementation
Develop a DNodeG class to represent nodes in the doubly linked list used in
NodeDictionaryG
#### DNodeG.h
Member Variables Public:
Entry elm;
DNodeG next;
DNodeG prev;
static int activeNodes;
Member Functions Public:
DNodeGconst Entry& Entry DNodeG p nullptr, DNodeG n nullptr;
~DNodeG;
### IteratorG Class Implementation
Develop an IteratorG class template to allow traversal of nodes within the
NodeDictionaryG This iterator provides functionality to navigate through
elements in the doubly linked list.
#### IteratorG.h
Member Variables Private:
DNodeG v;
Member Functions Public:
const V& operator;
bool operatorconst IteratorG& p const;
bool operator!const IteratorG& p const;
IteratorG& operator;
IteratorG& operator;
IteratorGDNodeG u;
const Entry& entry;
### Range Class Implementation
Implement the Range class to represent a range of iterators. This class defines
the boundaries of a range, consisting of a beginning and an end iterator.
#### Range.h
Member Variables Private:
IteratorG b; Beginning of the range.
IteratorG e; End of the range.
Member Functions Public:
Constructor to initialize the range with given iterators.
Rangeconst IteratorG& b const IteratorG& e;
IteratorG& getB; Returns the beginning iterator.
IteratorG& getE; Returns the end iterator.
### NodeDictionaryG Class Implementation
Implement the NodeDictionaryG class to define the dictionary operations using
a doubly linked list with dummy nodes.
#### NodeDictionaryG.h
Member Variables Private:
int uKeys; Current number of unique keys in the dictionary.
int n; Total number of entries in the dictionary.
DNodeG header; Sentinel node at the start of the list.
DNodeG trailer; Sentinel node at the end of the list.
Member Functions Public:
NodeDictionaryG; Constructor to initialize the dictionary with header and trailer nodes.
~NodeDictionaryG; Destructor to clean up memory.
int size const; Returns the total number of entries.
int uniqueKeys const; Returns the number of unique keys.
bool empty const; Checks if the dictionary is empty.
IteratorG begin const; Returns an iterator pointing to the first entry.
IteratorG end const; Returnsan iterator pointing past the last entry.
IteratorG findconst K& k const; Finds the first entry with the given key
Inserts a keyvalue pair.
If there are entry with key k the new entry will be inserted after the last entry with key k
IteratorG putconst K& k const V& v;
void eraseconst K& k; Removes the first entry with the given key.
void eraseconst IteratorG& p; Removes the entry at the given iterator.
void eraseRange& r; Removes all entries in the specified range.
Range findAllconst K& k; Returns a range of entries with the given key.
void print; Prints all entries in the dictionary.
void printRange& r; Prints all entries in the specified range.
### EnglishDictionary Class Implementation
Implement the EnglishDictionary class using the NodeDictionaryG class operations.
#### EnglishDictionary.h Header File
Member Variables Private:
string name; Name of the dictionary.
NodeDictionaryG dictionary; Stores the words and their definitions.
Member Functions Public:
EnglishDictionarystring; Constructor
~EnglishDictionary; Destructor
int words const; Returns the total number of words in the dictionary.
int uniqueWords const; Returns the number of unique words.
bool empty const; Checks if the dictionary is empty.
void addEntry; Adds a new word and its definition.
void deleteFirststring; Deletes the first definition of a word.
void deleteWordstring; Deletes all definitions of a word.
void printDictionarybool; Should be implemented as an recursive function. Prints all entries in the dictionary true forward, false reverse
void printDictionarystring; Prints all definitions for a given word.
Entry findstring; Finds the first entry for a given word.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
