Abstract Data Type
Abstract Data Type
Def. Consists of
storage structures (data structures)
to store the data items
and
algorithms for the basic operations.
Data Structure
• A data structure is the physical implementation of an ADT.
– Each operation associated with the ADT is implemented by one
or more subroutines in the implementation.
Data Type
ADT:
Data Items:
Type
Logical
Operations Form
Each byte (or word) has an address making it possible to store and
retrieve contents of any given memory location.
Therefore:
the most basic form of data: sequences of bits
simple data types (values are atomic — can't be subdivided) are ADTs.
Implementations have:
» Storage structures: memory locations
» Algorithms: system hardware/software to do basic operations.
Data Structures & Algorithms
Boolean data
0 0 0 x !x
0 0 1
1 0 1
0 1
1 1 1 1 0
Data Structures & Algorithms
Character Data
Store numeric codes (ASCII, EBCDIC, Unicode)
1 byte for ASCII and EBCDIC,
2 bytes for Unicode
ASCII/EBCDIC
Unicode
Integer Data
88 = 0000000001011000
2
Signed integer:
Store in a fixed number w of bits using one of the following representations:
Data Structures & Algorithms
Sign-magnitude representation
88 0 _000000001011000
sign bit
–88 _000000001011000
1
Example: –88
1. 88 as a 16-bit base-two number 0000000001011000
2. Complement this bit string 1111111110100111
3. Add 1 1111111110101000