You are on page 1of 1

● Store_word()


● find_hash2(w,n):
Set int w_l= length of the word
Initialize integer s=0
Start a for loop :
For x=0 to x=w_l-1
s+=word[x]
Now return h2= (s/w_l)%size of the hash table

● find_hash1(w,n)
Set int w_l= length of the word
Check whether w_l==1
Then return h1 as 2*(int)word%size of hash table
Else set an integer s=word[w_l-1]+word[w_l-2]+word[0]+word[1]
Then return h2 as (s/w_l)%size of the hash table

● Print_table(H,n)
For int i=0 to i<m
Check if H[i]!= NULL is true
Then initialise a node temp and set it= H[i]
Now start a while loop with the condition– Temp!=NULL
Print temp.key
Set temp=temp->next
Once all of the words in a chain are printed, while loop is exited and elements at
the next level of hash table is printed
Else if H[i]==NULL. Print Null.

You might also like