You are being asked to use the hash process on a typical problem with a large individual key.
We follow these steps:
Create one million (1,000,000) visits in a department store and payment by Credit Card (PC).
Cards have sixteen (16) specific fixed digits
but in four (4) of sixteen (16) random positions we have the characters: A, B, C, D.
The remaining positions are fixed!
Payment amounts are random numbers from 10 to 100.
We also randomly pick the day of purchases from Monday to Saturday.
You are requested to store the above information in a Hash Table structure.
The H [N] table we need to store must always be half full and N must be always a prime number.
We begin with N about 1000.
We have to double the table when it's full about half of the table, so the ratio of used seats
of the table in terms of table size (a = n / N, load factor) does not exceed a value we choose eg 0.5 or 0.6
N must always be a prime number!
We only use the matrix H [N] (open addressing) to store all information for each card
and we choose a technique for settling collisions.
Note: Create random numbers with seed 1053592.
It is requested to specify:
• the card with the highest total amount of payments
• the card with the largest number of visits
• the day with the largest number of visits
• the number of collisions in the final panel for 3 different load factor values
(Attention, conflicts refer to cards that appear for the first time since the next times, conflicts are inevitable)
Explanation for card numbers:
The initial constants are 16 digits: 1234567890123456
After placement of A, B, C, D: 123A56B8901C34D6