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
- (a)Complete the table to show the remaining hash values.[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]
Mark scheme
Marking points from the official mark scheme (May/June 2023). The mark or mark type is shown in brackets.
- [2] (a) One mark for each correct hash value (Max 2) Record key: 1050, Hash value: 0 Record key: 1025, Hash value: 2
- [4] (b) One mark per mark point (Max 4) MP1 A collision occurs when the record key doesn't match the stored record key MP2 this means the determined storage location has already been used for another record. If the record is to be stored MP3 Search the file linearly MP4 to find the next available storage space (closed hash) MP5 Search the overflow area linearly MP6 to find next available storage space (open hash) If the record is to be found MP7 search the overflow area linearly (open hash) until the matching record key is found MP8 search linearly from where you are (closed hash) until the matching record key is found MP9 If not found record is not in file
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →