Question: C++ program... please program in C++ and include the operations shown in the HashTable class section. Implement a closed hash table data structure, and use

C++ program... please program in C++ and include the operations shown in the HashTable class section.

Implement a closed hash table data structure, and use this hash as the index for rapid searching of a database of

student records.

Include Listed classes in the HashTable.cpp and not in main:

bool HashTable::insert(int key, T value, int& collisions) Insert a new key/value pair into the table. Duplicate keys are not allowed. This function should return true if the key/value pair is successfully inserted into the hash table, and false if the pair could not be inserted (for example, due to a duplicate key already found in the table). If the insertion is successful, the number of collisions occuring during the insert operation should be returned in collisions.

bool HashTable::remove(int key) If there is a record with the given key in the hash table, it is deleted and the function returns true; otherwise the function returns false.

bool HashTable::find(int key, T& value) If a record with the given key is found in the hash table, the function returns true and a copy of the value is returned in value. Otherwise the function returns false.

float HashTable::alpha() returns the current loading factor, , of the hash table.

Your hash table should also overload operator such that cout

C++ program... please program in C++ and include the operations shown inthe HashTable class section. Implement a closed hash table data structure, anduse this hash as the index for rapid searching of a databaseof student records. Include Listed classes in the HashTable.cpp and not inmain: bool HashTable::insert(int key, T value, int& collisions) Insert a new key/value

______________________________________________________________________________________________________________

//Slot.h file for guidance, not neccesarily part of program but could be similar

#pragma once

#include

#include

#include

using namespace std;

enum SlotType {normalSlot, emptySlot, tombstone};

template class Slot

{

private:

int key;

T value;

SlotType type;

public:

Slot()

{

key = 0;

type = emptySlot;

}

Slot(int newkey, T newvalue)

: key(newkey), value(newvalue)

{

type = normalSlot;

}

void kill() {

type = tombstone;

}

// Get the integer key of a record

int getKey() const {

return key;

}

// Get the value of a record

T getValue() const {

return value;

}

// Check if a record is empty

bool isEmpty() const {

return(type == emptySlot);

}

// Check if a record is a normal record

bool isNormal() const {

return(type == normalSlot);

}

// Check if a record is a tombstone

bool isTombstone() const {

return (type == tombstone);

}

// Overload the

friend ostream& operator

if (me.isTombstone())

os >";

else if (me.isEmpty())

os >";

else

os

return os;

}

~Slot()

{

}

};

//end Slot.h

Project #4-Hash Table Indexing Learning Objectives Implement a data structure to meet given specifications Design, implement, and use a closed hash table data structure Perform empirical analysis of algorithm performance Use a hash table as an index to a data store Overview Your task for this assignment is to implement a closed hash table data structure, and to use this hash as the index for rapid searching of a database of student records. Project #4-Hash Table Indexing Learning Objectives Implement a data structure to meet given specifications Design, implement, and use a closed hash table data structure Perform empirical analysis of algorithm performance Use a hash table as an index to a data store Overview Your task for this assignment is to implement a closed hash table data structure, and to use this hash as the index for rapid searching of a database of student records

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!