Hey, i'm not too familiar with c and i need to write a hashing program that takes in a int and a a string. I'm trying to use separate chaining. ok here's my hash function, basic one:
int hash(int key )
{
return key mod TableSIZE
}
here's my stuct to represent an hastable with an array of linklist, i don't know much of C i don't know if this is right.
struct CITYNAME{
char school[MAX_CHAR];
struct CITYNAME *next;
}
struct HashTable
{
int keys[MAX]; // prime number mostly
struct CITYNAME schools[];
}
is that right? if not help me out guys and gals :lol: .
and one more thing to insert, well i have it started , h is my hastable
void insert ( int key, const char* school )
{
int index = hash(key);
h[index] = key; // where the key goes
// now how and where do i insert the string?
h[index]...
..........
}
like i said i don't much of C,i know i have to allocate memory, well that's all my instructor said lol, and this is our first C program can you believe that? :rolleyes: some teachers are just crazy to me. any help would be appreciated
thanks,
Mel