Professional Documents
Culture Documents
13 - Data Representation
13 - Data Representation
13 - Data Representation
File Access
1. Sequential Access
Used for serial and sequential files.
This method searches for records from the start of the file until the
required record is found.
For a serial file:
The whole file is searched for the record.
New records are appended to the end of the file.
For a sequential file:
The whole file isn’t searched for the record as the records are stored
using key values which are appended to look for the record.
New records are stored in the correct position in the file.
2. Direct Access
Used for sequential and random files.
This method finds a record without the file being read.
It allows specific records to be found more quickly.
For a sequential file:
Index of key fields is used to look up the record in a file.
For a random file:
Hashing algorithm is used to look up the record in a file.
Hashing algorithm:
It is used to perform calculations on the key fields of the records
which in turn give the address of the record.
Use of a hashing algorithm:
The value of key field is divided by 2000.
The remainder is obtained.
The remainder is multiplied by the sum of the start address and the
size allocated to each record.
13- Data Representation
A conflict occurs when the remainders of the key fields are the same.
Dealing with a conflict:
Open hash- Record is stored in the next free space.
Closed hash- An overflow area is allocated and the record is stored in the
next free area in the overflow area.
Past papers:
Serial: Used by text files, left to right, or when storing data to end of file.
Sequential: Data is stored in a fixed order; personal data/ info about user.
Random: Fastest access to data; store logins.
Increasing the exponent increases the range.
Increasing the mantissa increases the precision.