User Defined
User Defined
3 (a) A hashing algorithm is used to calculate storage locations for records in a random access file.
It calculates hash values by using the function modulus 3.
The function modulus gives the remainder after integer division.
For example, 1030 modulus 3 = 1. Therefore, the record key 1030 gives a hash value of 1.
Complete the table to show the remaining hash values.
Record key. Hash value
1030 1
1050. ............ ...
1025. ................ [2]
(b) Describe what happens, in relation to the storage or retrieval of a record in the file, when
the calculated hash value is a duplicate of a previously calculated hash value for a different
record key.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
2 (a) Describe how records are organised and accessed in a sequential file.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(b) A hashing algorithm is used to calculate storage locations for records in a random access file.
The algorithm calculates hash values using the function modulus 5.
3003 3
1029. ........
7630. .......... [2]