Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the class HashTable with D buckets, write a function called FindMax , to find the record with maximum key in the Hash Table. To

Given the class HashTable with D buckets, write a function called FindMax , to find the record

with maximum key in the Hash Table. To accomplish this, you can assume that the class SortedChain

has a public function member also called FindMax that finds the record with maximum key

(is the last record of the chain) in a chain. The function FindMax of the class HashTable will call

the function FindMax of SortedChain for each of its buckets and will determine the record

with maximum key. You can assume that E is a class and Key( ) is a function of the class

that returns the key value:

class E {

public:

int key;

int data;

int KEY( ) {return key;}

}

The class SortedChain already contains a function FindMax that returns the record (or object E)

With maximum key , that is the last element of the chain;

template

class SortedChain {

public:

bool FindMax (E& e) const; // this function returns the element with maximum key

// return false if chain is empty, or first = 0; otherwise return true

}

The class HashTable has a function FindMax that uses FindMax of SortedChain for each of its buckets.

Write the function

template

class HashTable {

public

bool FindMax(E& e) const; // write a function to find the record (type E) with maximum

// key (return the record in E),

// since each of its buckets is a SortedChain, you must use

// Findmax of SortedChain. If the hash table is empty, return false

// otherwise return true

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_2

Step: 3

blur-text-image_3

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

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

What are the objectives of Human resource planning ?

Answered: 1 week ago

Question

Explain the process of Human Resource Planning.

Answered: 1 week ago

Question

Question What is the doughnut hole in HSA coverage?

Answered: 1 week ago