Assignment 4 (fixed)

This assignment requires you to write a function which is to be used as a hashing function

The function should use the following prototype:

int hash(char *s);

Define the following constants:

If a = 0 then use 51 instead. If c=0 then use 241 instead.

Let h = 0; define a function on s by:

Return h % 101.

There are of course many different cleverer ways of coding this! The above is quite far from 'clever'... Good solutions definitely have less than 10 lines of code! Marks will definitely be deducted for overly complicated solutions.

You should also indicate, as comments at the end of your code, whether you believe that this hashing function would be any good ? Explain your reasoning!


Deliverables: one (1) .c file saved as plain text containing the above function and the explanation in comments.
Back to main page