Zusammenfassung der Ressource
3. Data types and data structures
- Data types
- Numeric
- Advantages
- Calculations can be done
- Program can alter format
- two types
- Integer- whole numbers
- readl/double/float- decimal numbers
- Boolean- only has two
options- yes or no
- Advantages
- validated- less prone to errors
- easy to understand
- les storage space
- Disadvantages
- limited options
- text
- two types
- String- texts or
numbers that
are stored in
the ASCII code
- character- a string
with 1 data size
- advantages
- can store anything
- disadvantages
- can't do calculations
- Arrays
- A data structure (group of data) of
the same data type grouped under
one identifier. All the data stayed
contiguously in computer memory
- Dimensions
- 1D- list of data
- Advanatges
- Easy to implement
- Disadvantages
- limited space
- same data type
- 2D- stores in a grid
- Advanatges
- good for games
- Simple to program
- Disadvantages
- limited in size
- same data type
- can have up to 32D but most
people go up to about 3D
- declaring
an array
- initialise (give
a name)- easy
to access
- size of the array- locations of
the memory will be reserved
- dimensions- allow position to have meaning
- Data type- allow correct
data to be stored
- Record Format
- file- large quantity of
data (multiple records
- To write:
- To read:
- Record- info. on one particular
thing (multiple fields)
- field- one type of information
- Key field- unique field- used as an identifier
- fixed length- each record
has a certain assigned
amount of space
- quicker to
search
- easier for the
computer to
store things
- Files
- file access
- Serial- stored in the order it
arrives, To add- it just adds on,
To delete- copy files to a
separate tape leaving the one
that needs to be deleted.
- Advantage- quick to store
- Disadvantage- inefficient to locate
- Sequential- puts sorted order depending a
key field, To add- copy files to a separate
tape leaving the one that needs to be deleted.
To delete- same as above just delete
unwanted files
- Advantage- search time is quicker
- Disadvantage- longer to write
- Random- has a space and the data is
stored anywhere depending on the
answer got by a hash calculation done
on the key field, To delete- say that it is
invalid and then overwrite it.
- Advantage- quick to read and write
- Disadvantage- inefficient when there is a large amount of data
- Direct- finds data instantly by using its length
- Advantage-quick to search
- Disadvantage-only works with fixed length records
- Index sequential-like sequential but has an index
- Advantages and disadvantages
same as sequential but more
quicker/ longer
- files: store,
retrieve and
search,
- 1. define the stream (computers can know which
stream using as a multiple streams are being used)
2. use the stream (read/write) 3. close the stream
- end of file character- used
to show where the end of the
file is. allows location of files
much easier.
- estimate
file sizes
- 1. consider the data types for each field and
then the amount of space required for each type
2. record size- add up each individual field size
3. file size- multiply previous to the number of
files 4.files have extra info.- add 10% on
5.ensure that it is in correct units
- programing