Question: please help with all FixMe lines in the code. in C + + * * * #include #include #include #include / / atoi #include #include
please help with all FixMe lines in the code. in C
#include
#include
#include
#include atoi
#include
#include "CSVparser.hpp
using namespace std;
Global definitions visible to all methods and classes
const unsigned int DEFAULTSIZE ;
forward declarations
double strToDoublestring str char ch;
define a structure to hold bid information
struct Bid
string bidId; unique identifier
string title;
string fund;
double amount;
Bid
amount ;
;
Hash Table class definition
Define a class containing data members and methods to
implement a hash table with chaining.
class HashTable
private:
Define structures to hold bids
struct Node
Bid bid;
unsigned int key;
Node next;
default constructor
Node
key UINTMAX;
next nullptr;
initialize with a bid
NodeBid aBid : Node
bid aBid;
initialize with a bid and a key
NodeBid aBid, unsigned int aKey : NodeaBid
key aKey;
;
vector nodes;
unsigned int tableSize DEFAULTSIZE;
unsigned int hashint key;
public:
HashTable;
HashTableunsigned int size;
virtual ~HashTable;
void InsertBid bid;
void PrintAll;
void Removestring bidId;
Bid Searchstring bidId;
sizet Size;
;
Default constructor
HashTable::HashTable
FIXME : Initialize the structures used to hold bids
Initalize node structure by resizing tableSize
Constructor for specifying size of the table
Use to improve efficiency of hashing algorithm
by reducing collisions without wasting memory.
HashTable::HashTableunsigned int size
invoke local tableSize to size with this
resize nodes size
Destructor
HashTable::~HashTable
FIXME : Implement logic to free storage when class is destroyed
erase nodes beginning
Calculate the hash value of a given key.
Note that key is specifically defined as
unsigned int to prevent undefined results
of a negative list index.
@param key The key to hash
@return The calculated hash
unsigned int HashTable::hashint key
FIXME : Implement logic to calculate a hash value
return key tableSize
Insert a bid
@param bid The bid to insert
void HashTable::InsertBid bid
FIXME : Implement logic to insert a bid
create the key for the given bid
retrieve node using key
if no entry found for the key
assign this node to the key position
else if node is not used
assing old node key to UNITMAX, set to key, set old node to bid and old node next to null pointer
else find the next open node
add new newNode to end
Print all bids
void HashTable::PrintAll
FIXME : Implement logic to print all bids
for node begin to end iterate
if key not equal to UINTMAx
output key, bidID, title, amount and fund
node is equal to next iter
while node not equal to nullptr
output key, bidID, title, amount and fund
node is equal to next node
Remove a bid
@param bidId The bid id to search for
void HashTable::Removestring bidId
FIXME : Implement logic to remove a bid
set key equal to hash atoi bidID cstring
erase node begin and key
Search for the specified bidId
@param bidId The bid id to search for
Bid HashTable::Searchstring bidId
Bid bid;
FIXME : Implement logic to search for and return a bid
create the key for the given bid
if entry found for the key
return node bid
if no entry found for the key
return bid
while node not equal to nullptr
if the current node matches, return it
node is equal to next node
return bid;
Static methods used for testing
Display the bid information to the console std::out
@param b
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
