Guest_imported
New member
- Jan 1, 1970
- 0
HI
I am slowly but painfully trying to become a c programmer, I will get ther ein the end I have an assignment to do which Ido not understand the assignment involves hash index which up till now I havnt heard of I have no experience of random files nor the struct function, which I belive can be used here but Im not that far into my studies so I cant use it to date I have done basic c, arrays and jst started the geginning of pointers
I will post my question at the bottom
I obviously dont want anyone to code it for me but would be grateful if some one can break in down so as I can understand it better and give me a few tips perhaps little snipets of code that could be useful
the question
"Hashing" is a method of sorting data in an aray so that it can be retrieved in an efficient manner. Unlike a "Binary search", hashing allows the data to be stored in any order.
This is done using a hashing algorythm to generate a "HASH INDEX" from given a data item (or "KEY". "The hash index" is then used to select the paeticular array element that will store the data (similar infact to random files).
write a program that uses two lists to store the data. One list should be student names and another a list of the course they are enrolled upon at the college. Using the students name as the key, the following algorythm will add together the ASCII values of each non-blank character in the name and then use the MOD operator to convert the total into a range of 0 to Maxnum - 1, where MaxNum is the size of th array
eeg using a value of 24 for Max num
JOHN DOE = 'J' + 'O' + 'H' + 'N' + 'D' + 'O' + 'E';
74 + 79 + 72 + 78 + 68 + 79 + 69 = 519
Many thanks
I am slowly but painfully trying to become a c programmer, I will get ther ein the end I have an assignment to do which Ido not understand the assignment involves hash index which up till now I havnt heard of I have no experience of random files nor the struct function, which I belive can be used here but Im not that far into my studies so I cant use it to date I have done basic c, arrays and jst started the geginning of pointers
I will post my question at the bottom
I obviously dont want anyone to code it for me but would be grateful if some one can break in down so as I can understand it better and give me a few tips perhaps little snipets of code that could be useful
the question
"Hashing" is a method of sorting data in an aray so that it can be retrieved in an efficient manner. Unlike a "Binary search", hashing allows the data to be stored in any order.
This is done using a hashing algorythm to generate a "HASH INDEX" from given a data item (or "KEY". "The hash index" is then used to select the paeticular array element that will store the data (similar infact to random files).
write a program that uses two lists to store the data. One list should be student names and another a list of the course they are enrolled upon at the college. Using the students name as the key, the following algorythm will add together the ASCII values of each non-blank character in the name and then use the MOD operator to convert the total into a range of 0 to Maxnum - 1, where MaxNum is the size of th array
eeg using a value of 24 for Max num
JOHN DOE = 'J' + 'O' + 'H' + 'N' + 'D' + 'O' + 'E';
74 + 79 + 72 + 78 + 68 + 79 + 69 = 519
Many thanks