Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

- Execute the calc _ hash function shown in the hash search example below with multiple inputs on a PC and display the results (

- Execute the calc_hash function shown in the "hash search example" below with multiple inputs on a PC and display the results (hash values).
- It can also be executed by simply adding the main function:
int main()
{
printf(%dn, calc_hash(computer));
printf(%dn, calc_hash(California));
...
return 0;
}
- TAB_SIZE must be defined appropriately.
"hash search example"
Table* tab[TAB_SIZE];
int calc_hash(char* name)
{
int i, hash_val;
hash_val=0;
while (*name !=0)
hash_val +=*name++;
return hash_val%TAB_SIZE;
}
Table* lookup_tab(char* name)
{
Table* pe;
for (pe=tab[calc_hash(name)]; pe!=NULL; pe=pe->next){
if (strcmp(pe->name, name)==0)
return pe;
}
return NULL;
}

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

15. Does the all-or-none law apply to dendrites? Why or why not?

Answered: 1 week ago