Ch. 13 Data Representation

13.1 User-defined data types

Non-composite data types

Enumerated data type

Pseudocode example:

TYPE
	DECLARE TDirections = (North, East, South, West)
	DECLARE TDays = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)
ENDTYPE

DECLARE Direction1 : TDirections
DECLARE StartDay : TDays
Direction1 <- North
StartDay <- Wednesday
IF Day > Friday:
	Weekend = TRUE

Pointer data type

TYPE <identifier> = ^<data type>

Composite data types

Record data type (AS)

Pseudocode example:

TYPE StudentRecord
	DECLARE LastName : STRING
	DECLARE FirstName : STRING
	DECLARE DateOfBirth : DATE
	DECLARE YearGroup : INTEGER
	DECLARE FormGroup : CHAR
ENDTYPE

Set data type

Pseudocode example:

TYPE LetterSet = SET OF CHAR
DEFINE Vowels ('A', 'E', 'I', 'O', 'U') : LetterSet

Class data type

13.2 File organisation and access

File organisation

Serial file organisation

Sequential file organisation

Random file organisation (Direct-access files)

File access

Sequential access

Direct access

Hashing algorithms

13.3 Floating-point numbers, representation and manipulation

Floating-point number representation

Potential rounding errors and approximations

Normalisation

Floating-point problems