Chapter 13 Flashcards
"Data Representation"
user-defined types
derived from one or more existing datatypes
used to extend the built-in datatypes
programmer’s requirement
why are user-defined types necessary
if no suitable datatype is provided by the language used
to provide more flexibility
if a programmer needs a specific datatype/needs to create a new data type
that meets program requirements
composite data types
data types constructed from other types
e.g: record, list, set, array, class, queue, linked list, dictionary
non-composite
datatype that does not refer to another datatype
e.g: enumerated, pointer, real, string, char, boolean
enumerated
non-composite
defines an ordered list of all possible values
enumerated TYPE pseudocode declaration
the values do not need any speech marks etc.
TYPE identifier = (value1, value2, …)
pointer
non-composite
used to reference a memory location
pointer TYPE pseudocode declaration
this is a declaration of the TYPE, not of the variable. if you wish to declare a variable of this pointer type:
TYPE pointerTypeName = ^DATATYPE
DECLARE variableName : pointerTypeName
set
stores groups of values and supports mathematical operations
record
composite
collection of related items with multiple datatypes
a fixed number of components
allows the user to collect values with different data types together.
list
indexed collection that can contain different datatypes
array
indexed collection of items of the same datatype
serial file organization
- data is stored in chronological order (no predefined order)
- data is appended to the end of the file - into the next available space
- (easy to add)
- records need to be accessed one after the other
- allows the data to be read in order of when they were taken
no KEY FIELDS need to be added
when is serial used?
- when chronological order matters
- when wanting to append records
- small file, so easy to search
- when re-organizing as re-sorting is not required
sequential file organization
- records are stored in a predefined order (particular order), stored in the order of the value in the key field
- new records are inserted in the correct position
- a new version of the file has to be created to update the file
- records need to be accessed one after the other
- records can be found by searching from the beginning of the file,
- record by record, until the required record is found or key field value is exceeded.