Question: Program Overview Programming Assignment 1. I need to write a program that uses the hashing functions and declarations. The program must insert the months jan

Program Overview Programming Assignment 1. I need to write a program that uses the hashing functions and declarations. The program must insert the months "jan" thru dec" and must also have the number of days in each of the months. Please organize this into a hash table of size 5. . string months[12]={JAN, FEB". ....."NOV, DEC"}; int days[12]={31, 28,...... ,30, 31}; ii. int hashFun( string Name) { int x=retum (int(Name[0]) + int Name[1]) + int (Name[2]) %5: Hashing is a searching technique to speed up the searching process. Given array: a[8]={ 22,77,72,10,19,21,30,99}. To search for any item such as 99, we have to start from a[0] and compare 99 with a[i], i=1,2,....7 to find it. This is the concept of linear search which requires at most n comparisons (n is the array size) with O(n). Now we introduce how to implement hashing to make the searching processes faster. For any set of data, we introduce a hash function and a hash table. The hash table is an array of pointers in which each pointer is pointing to a linked list. We use the hash function to help us distribute data within the linked lists. The worth case is when all data goes to only one linked list (in the following example that would happened if all numbers are multiple of 5), and the best case is when data are distributed at least evenly within all linked lists. There is no formula to find the best hash table size, it requires programmers experience and the history of data. Data Hash function Hash table: a[0] 22 Takes one item from the Hash table is an array of pointers. Each pointer array, mode it with the points to a linked list. Suppose we want the size a[1] 77 size of the hash table in of the hash table to be 5 a[2] 72 this example the size is Step . Initialize the hash table by making 5) to return a number a[3] 10 H[i]=NULL for i=0,1,2,3,4 between 0 and 4 a[4] 19 H[O] NULL index=a[i] % 5; H[1] NULL a[5] 21 H[2] NULL insert a[i] in front of H[3] NULL a[6] 30 linked list pointed by NULL H[index] in the hash Sep ii. Use the hash function to insert a[i] into linked a[7] 99 table list H[index] } iii. struct node { string monthName; int monthDays; node *next; H[4] a. Display the hash table b. Ask user to enter the first 3 letters of a month in uppercase, if the name is found in the hash table, then display the month name followed by the number of days in that month and number of comparisons to find it. H[1] 22%5=2, insert 22 into H[2] 77%5=2, insert 77 into H[2] H[O] 72%5=2, insert 72 into H[2] 10%550, insert 10 into H[0] 19%5-4, insert 19 into H[4] H[2] 21%5=1, insert 21 into H[1] H[3] 30 %5=0, insert 30 into HOJ H[4] 99%5=4, insert 99 into H[4] 3010 NULL 21 NULL 72 77 22 NULL NULL 9919+NULL