Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In c + + please help me complete this dict.h #pragma once #include #include #include #include treeClass.hpp #include pair.hpp template class Dictionary {
In c please help me complete this
dict.h
#pragma once
#include
#include
#include
#include "treeClass.hpp
#include "pair.hpp
template
class Dictionary
private:
Tree dictTree;
public:
Dictionary default;
bool empty
return dictTree.isEmpty;
sizet size
return dictTree.size;
ValueType& getKeyType key
void setKeyType key, ValueType value
Pair thePair MakePairkey value;
bool inTree dictTreethePair thePair;
if inTree
return thePair.second;
else
throw std::outofrangeItem does not exist in Dictionary";
void insertKeyType key, ValueType value
BST b;
Pair newEntry MakePairkey value;
dictTree.insertnewEntry;
bInsertkey value;
list getKeys
list listKey;
return listKey;
list getValues
list listValue;
return listValue;
ValueType& atconst KeyType item
ValueType theValue;
Pair thePair MakePairitem theValue;
bool inTree dictTreethePair thePair;
if inTree
return thePair.second;
else
throw std::outofrangeItem does not exist in Dictionary";
ValueType& operatorconst KeyType& key
return atkey;
ValueType& operatorconst KeyType item
return atitem;
;
pair.hpp
#pragma once
template
class Pair
public:
KeyType first;
ValueType second;
Pair delete;
PairKeyType x ValueType y : firstx secondy
bool operatorconst Pair rhs const
bool meetsCriteria false;
if thisfirst rhsfirst
meetsCriteria true;
return meetsCriteria;
bool operatorconst Pair rhs const
bool meetsCriteria false;
if thisfirst rhsfirst
meetsCriteria true;
return meetsCriteria;
bool operatorconst Pair rhs const
bool meetsCriteria false;
if thisfirst rhsfirst
meetsCriteria true;
return meetsCriteria;
;
template
Pair& MakePairKeyType first, ValueType second
Pair newPair new Pairfirst second;
return newPair;
template
class Pear
public:
T key;
T value;
;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started