U13 data representation Flashcards
user defined data type
- derived from one or more existing datatypes
- used to extend the built-in datatypes
- programmer’s requirement
why are user defined data types necessary
- no suitable datatype is provided by the language used
- if a programmer needs a specific datatype
- that meets program requirements
non-composite datatype
- single datatype that does not refer to another datatype
- e.g: enumerated, pointer, real, string, char, boolean
composite datatype
- datatype that refers to other datatypes
- data type is constructed from other datatypes
- e.g: record, list, set, array, class, queue, linked list, dictionary
record
collection of related items which may be of different datatypes
list
indexed collection that can contain different datatypes
set
supports mathematical operation
class
gives properties and methods for an object
array
collection of items of the same datatype
enumerated datatype
- non-composite
- defined by a given list of all possible values
- in an order
pointer datatype
- non-composite
- used to reference a memory location
dereferencing
getting the value in an address
record datatype
- composite datatype
- a collection of multiple datatypes
declaring a range
- 0-89
- DECLARE number : 0..89
file organization
refers to the way data is stored in a file
serial file organization
- data is stored in chronological order
- easy to append data to the end of the file
- 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
- appending records
- small file, so easy to search
- when re-organizing as re-sorting is not required
sequential file organization
- a method of file organization in which files are stored with ordered records
- records are stored in the order of the key fields
- new records are inserted into their correct position
when is sequential used
- when there are unique fields, so it can be used for indexing
- when it needs to be sorted in an order
- batch processing (processing of transaction in a group)
random file organization
- record location is calculated
- using a hashing algorithm on a key field
- speed of data access is increased
- can be used as lookup file
- if a record cannot be stored
- then subsequent location is searched (closed hash)
- or an overflow area is searched (open hash - chaining)
hashing algorithm
a mathematical function to find a hash key to access data
bucketing (closed hashing)
a method to deal with hashing collisions in which another empty space is found
chaining (open hashing)
a method to deal with hashing collisions in which linked lists are used to find the location in ROM
rehashing (closed hashing)
a method to deal with hashing collisions in which another algorithm is used
how is sequential access used
- earliest reading/data is accessed first
- each successive reading is read
- until final reading is accessed
floating point representation
representation of real numbers
mantissa
the significant digits of floating point number
exponent
the power of base 2 (that the mantissa is raised to)
normalization
a technique that is used to make your data more accurate
random file
- can be read/write at the same time
- contains a collection of data
- normally as records of a fixed length
- can be thought of as having a file pointer that can be moved to any location or address of the file
- record at that location can then be read or written