Question: Question: How can I implement a hashtable that has 3 slots and an overflow bucket under these conditions in C++? The KEY,DATA pairs are both

 Question: How can I implement a hashtable that has 3 slots

Question:

How can I implement a hashtable that has 3 slots and an overflow bucket under these conditions in C++? The KEY,DATA pairs are both strings with 10 bytes and 20 bytes respectively.

The memory data structure, called a hash table, consists of a primary and overflow area. The primary are has 20 buckets, each bucket containing 3 hash slots, an overflow pointer and count fields. The overflow area contain an additional number of buckets dedicated to handle collisions. Bucket zero's overflow pointer field may be used to point to the next available overflow bucket in the event of a collision. Bucket n, Slot 1 KEY DATA Slot 2 DATA Slot 3 KEY DATA Overflow Pointer Count A collision occurs when two or more data keys hash to the same bucket. If a collision occurs and there is a vacant slot in the primary area bucket, the record is stored in the first available slot. If the primary area bucket is full and an overflow bucket has been allocated, store the record in the next available slot within overflow area bucket. If no overflow bucket has been allocated, allocate one (link the primary area bucket to its overflow bucket using the pointer field). The memory data structure, called a hash table, consists of a primary and overflow area. The primary are has 20 buckets, each bucket containing 3 hash slots, an overflow pointer and count fields. The overflow area contain an additional number of buckets dedicated to handle collisions. Bucket zero's overflow pointer field may be used to point to the next available overflow bucket in the event of a collision. Bucket n, Slot 1 KEY DATA Slot 2 DATA Slot 3 KEY DATA Overflow Pointer Count A collision occurs when two or more data keys hash to the same bucket. If a collision occurs and there is a vacant slot in the primary area bucket, the record is stored in the first available slot. If the primary area bucket is full and an overflow bucket has been allocated, store the record in the next available slot within overflow area bucket. If no overflow bucket has been allocated, allocate one (link the primary area bucket to its overflow bucket using the pointer field)

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!