Hi please help me with this. My head really hurts from attempting to answer this question. Thanks a lot!

#define maxCells 1000
#define maxCS 11
#define maxIT 19
typedef struct
{
char LN[16], FN[24], MI;
}nametype;
typedef struct studtype
{
unsigned long ID;
nametype name;
char course[8];
int yr;
}student;
typedef struct ctype
{
student stud;
int next;
}celltype;
typedef struct
{
int *Header;
int CourseCtr; /*holds the # of elements for each course*/
}CSIT;
typedef CSIT Dictionary[2];
typedef int LIST;
typedef struct
{
celltype heap[maxCells];
int AvailPtr; /*holds the index to the first available cell in the VH*/
}*VirtualHeap;

Problem Definition: A list of BSCS and BSIT student records is stored in internal memory represented using cursor-based implementation. The list is to be converted into a dictionary, a set ADT. The dictionary is represented in memory using open-hashing (cursor-based). Each group in the header table is sorted in ascending order according to ID.
*Hash function exists and can be called in your function. The function will accept an element as its parameter and return the appropriate hash value for each element.
Write the code of the function CreateDic() – the function will convert the list of BSCS and BSIT student records into a dictionary, which will be returned to the calling function. Each student record is uniquely identified by the ID.

See this tutorial for details on writing a hash table. As far as extracting each item in the list for adding to the dictionary, it should be a simple cursor-based traversal:

Dict CreateDic(void)
{
    void AddDic(Dict*, student*);

    LIST cursor;
    Dict dict;

    for (cursor = 0; cursor != -1; cursor = VH->head[cursor].next)
        AddDic(&Dict, &VH->heap[cursor].stud);

    return dict;
}

AddDic() would generate the hash and add a copy of the student to your hash table. Note that I'm making quite a few assumptions in that CreateDic() because you didn't provide all of the necessary details. But it should be sufficient to exhibit how you might traverse the list.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.