Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help me fix code in C + + All errors occur in main: #include #include #include #include template class Table { public: static const std::size
Help me fix code in C All errors occur in main: #include
#include
#include
#include
template
class Table
public:
static const std::sizet CAPACITY ;
Table : used
void insertconst RecordType& entry;
void removeint key;
bool isPresentint key const;
void findint key, bool& found, RecordType& result, std::function hashingFunction findIndex 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& i const;
bool neverUsedstd::sizet index const;
bool isVacantstd::sizet index const;
static void quadraticProbeint key, bool& found, std::sizet& i const Table table;
static void secondHashint key, bool& found, std::sizet& i const Table table;
;
template
void Table::insertconst RecordType& entry
bool alreadyPresent;
std::sizet index;
assertentrykey ;
findentrykey, alreadyPresent, index;
if alreadyPresent
assertsize CAPACITY;
index hashentrykey;
while isVacantindex
index nextIndexindex;
used;
dataindex entry;
template
void Table::removeint key
bool found;
std::sizet index;
assertkey ;
findkey found, index;
if found
dataindexkey PREVIOUSLYUSED;
used;
template
void Table::findint key, bool& found, RecordType& result, std::function hashingFunction const
std::sizet index;
hashingFunctionkey found, index;
if found
result dataindex;
template
std::sizet Table::hashint key const
return key CAPACITY;
template
std::sizet Table::nextIndexstd::sizet index const
return index CAPACITY;
template
void Table::findIndexint key, bool& found, std::sizet& i const
std::sizet count ;
i hashkey;
while count CAPACITY && neverUsedi && dataikey key
count;
i nextIndexi;
found dataikey key;
template
bool Table::neverUsedstd::sizet index const
return dataindexkey NEVERUSED;
template
bool Table::isVacantstd::sizet index const
return dataindexkey NEVERUSED dataindexkey PREVIOUSLYUSED;
template
void Table::quadraticProbeint key, bool& found, std::sizet& i const Table table
std::sizet count ;
i tablehashkey;
while count CAPACITY && tableneverUsedi && tabledataikey key
count;
i tablehashkey count count CAPACITY;
found tabledataikey key;
template
void Table::secondHashint key, bool& found, std::sizet& i const Table table
std::sizet count ;
i tablehashkey;
while count CAPACITY && tableneverUsedi && tabledataikey key
count;
i i key CAPACITY;
found tabledataikey key;
int main
Table table;
bool found;
RecordType result;
int key ;
table.findkey found, result, std::bind&Table::quadraticProbe, std::placeholders:: std::placeholders:: std::placeholders:: &table;
table.findkey found, result, std::bind&Table::secondHash std::placeholders:: std::placeholders:: std::placeholders:: &table;
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