The location of a record in a random file is determined using a hashing algorithm. A collision may occur during the process of adding a record.
- (a)Outline what is meant by the term collision in this context.[2]
- (b)Explain how a collision can be dealt with when writing records to a random file.[3]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.
- [1] A collision is when the two values / data items in the key field for two records (pass through a hashing algorithm and) result in the same hash value
- [1] ...so the location identified (by the hashing algorithm) may already be in use // two records cannot occupy the same address.
- [1] A process of collision resolution is used
- [1] Start at the original hashed storage space
- [1] ...go through the following spaces in a linear fashion
- [1] ...and store the data item in the first available slot.
- [1] Search the overflow area
- [1] ...go through the following spaces in a linear fashion
- [1] ...and store the data item in the first available slot.
- [1] Each storage space holds a reference to a collection / chain of items
- [1] ...which can be searched individually.
- [1] The data item is stored in the first available space in this chain.
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 →