Address Calculation Sort

Code Id 13
Date Updated 3/7/2010
Title Address calculation sort  
Description
This is one application of sort by insertion. In this method a hashing function f is applied to each key. Depending upon the result of this hashing function the key is placed into one of the linked lists. Each set of keys which hash into the same address are called an equivalent class and  each equivalent class is represented as a linked list.  
                                  
Codes Snippet
# define num key 100
addcal (int a[], int n)
{
int f[5], hash ,i, j ,r, x;
struct  {
int info;
int next;
} rec[numkey];
/*initialize pointers */
for (i= 0;i< 5;i++) 
f[i]= -1;
for(i=0;i <5 ;j ++)
{
r=f[j]:

while (r != -1)
{
a[i++]=rec[r].info;
r = rec[r].next;
}
}
}/* end of  routine */

Comments are closed.