Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ For this exercise, you will implement the following methods for a Hash Table: A function that computes the hash of a key and the

C++

For this exercise, you will implement the following methods for a Hash Table: A function that computes the hash of a key and the linear probing function, as well as the insert function. You will also need to implement the class for the Hash Table. For bonus points, the hashing function is worth 2 points, the linear probing function is worth 3 points, and the insert is worth 5 points.

Note: You need to implement a partial class for testing. The data is stored as an array of the class, with the index being the hash of a key and each array element being a pointer to a Node. The node class (which can simply be a structure), should also be created and should have a key attribute and value attribute.

Pseudocode for Node/Hash Table class:

Define class Node:

Key: string, public

Value: Integer, public

//Note: typically, value is templated to support multiple types, but for simplicity lets just support integers.

Define class HashTable

Table: Array of Node Pointers, private

Size: Integer, private

Table(s: Integer): Constructor, public

Allocate Table of size s. Set all pointers to NULL.

Size is set to s.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

Understand why customers are loyal to a particular service firm.

Answered: 1 week ago