File organisation and access
| English | Chinese | Pinyin |
|---|---|---|
| file organisation | 文件组织 | wén jiàn zǔ zhī |
| access method | 访问方式 | fǎng wèn fāng shì |
| serial | 串行 | chuàn xíng |
| sequential | 顺序 | shùn xù |
| random | 随机 | suí jī |
How files are organised
- File organisation 文件组织 is how records are laid out; the access method 访问方式 is how the program reaches one.
- Three organisations: serial 串行, sequential 顺序, random 随机.
- Match the organisation to the dominant operation.
File access route
Follow a file from storage to program and back safely.
Sequential file organisation is well suited to processing every record in turn.
Direct access suits looking up a single record.
Serial, sequential, random
| Organisation | Layout | Access | Good for |
|---|---|---|---|
| Serial | records in the order added | sequential only | logs, audit trails |
| Sequential | records sorted by a key | sequential (can stop/binary-search) | master files, in-order reports |
| Random (direct) | records at positions computed from the key | direct, very fast | lookup tables, accounts |
- Serial appends fast but searches slowly; sequential searches faster but inserts slowly; random gives fast single-key lookup.

Serial file: records are kept in the order they were added
A serial file stores records:
Serial files keep records in arrival order — fast to append, slow to search. Sequential files are sorted by key.
Match each file organisation to how it stores records.
Serial = arrival order; sequential = sorted; random = hashed position; indexed-sequential = sorted + an index.
A random (direct-access) file places each record:
A key is converted (often by a hash) to a position, so a single-key lookup is very fast.
Access methods
- Sequential access — read from the start to the record you want.
- Direct (random) access — jump straight to a known position.
- Match the structure to the dominant operation: single-key lookups favour random; in-order reports favour sequential.

A set is an unordered collection of unique values
To produce reports in key order, the best file organisation is:
A sequential file is already in key order, so reading it sequentially gives an in-order report.
Matching access to need
- Sequential organisation suits processing every record (like payroll).
- Direct/indexed organisation suits instant lookup of one record (like a booking).
- File access can be sequential or direct; a hashing algorithm maps a record key (the key field) to a storage address.
You've got it
- serial = order added (logs); sequential = sorted by key (master files); random = key-computed position
- serial appends fast, searches slow; random gives fast direct lookup
- sequential access reads start→end; direct access jumps to a position
- choose the organisation to fit the main operation