Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In c + + template class Table { public: static const std::size _ t CAPACITY = 8 1 1 ; table ( ) ; void
In c
template
class Table
public:
static const std::sizet CAPACITY ;
table;
void insertconst ReacordType &entry
bool alreadPresent;
std::sizet index;
assertentrykey ;
findIndexentrykey, alreadyPresent, index;
if alreadyPresent
assertsize CAPACITY;
index hashentrykey;
while isVacantindex
index nextIndexindex;
used;
dataindex entry;
void removeint key
bool found;
std::sizet index;
assertkey ;
findIndexkey found, index;
if found
dataindexkey PREVIOUSLYUSED;
used;
bool isPresentint key const;
void findint key, bool &found, RecordType &result const;
std::sizet size const return used;
private:
static const int NEVERUSED ;
static const int PREVIOUSLYUSED ;
RecordType dataCAPACITY;
std::sizet used;
std::sizet hashint key const;
std::sizet nextIndexstd::sizet index const;
void findIndexint key, bool &found, std::sizet &index const
std::sizet count;
count ;
i hashkey;
while count CAPACITY && neverusedi && dataikey key
count;
i nextIndexi;
found dataikey key;
bool neverUsedstd::sizet index const return index NEVERUSED;
bool isVacantstd::sizet index const return index PREVIOUSLYUSED;
;
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