I have an assignment I'm working on in C but I didn't want to ask for any code specifically. I just wanted to ask about the methods to use. The program reads a text file where it tells you the number of values to hash. The hash function is completely universal so the text file doesn't tell you how large the table really needs to be. My idea was to go through the whole text file before inserting any values in order to find the largest hash value, so I know how large the hash table will be and dynamically allocate the memory for that size. How is this method?
Also, in order to prevent collisions I'm going to set up separate hash tables per linked list node, but I'm not sure how many nodes I should set up which equates to the number of possible collisions.
*edit, am I just creating a new node in the case of a collision? That would make sense.
If I'm way off track, please tell me as this is the first time I'm dealing with these topics. Thank you.