This is a homework as you will notice, i have worked on it really much but i think i dont have the enough knowledge of "c" to do it and this is a hard question to ask to a beginner. Thanks to everybody who replies.


i want to construct a hash for a file named CATALOG.Structure of it is:
File name
# of attributes
Attribute info 1
Attribute info 2
...
Attribute info n

structure of the attribute info is:
Name Type
.. ..
.. ..

Name is a string of 15 characters in length, Type is a field of type char with the possible values of

i for int
l for long
f for float
s for string (at most 15 characters)
c for char

EXAMPLE CATALOG:
courses.in
3
course_name s
credit i
instructor s

EXAMPLE 'courses.in' file
Math 115 4 John Nash
...
...

After building the hash it should be printed into a file named hashex.out
if it contains buckets they will be tab seperated.

EXAMPLE output:
bucket1
bucket1a
bucket1b
bucket2
bucket3
bucket4
bucket4a

SOME SPECIFICATIONS:
hash size: 20 buckets
bucketing factor:1
hash function: key mod 20
the 1st field of the record is an integer and it is taken as the key.

last of all implement selection: select statement will be given in the command prompt

EX: 1.out -s instructor=John Nash

result will be printed in the standard output, each record should be given in a separate line and the fields will be blank seperated.