ABSTRACTION OF DATA STRUCTURES
def: a DATA TYPE is a COMBINATION of two sets:
1. a set of values (like integer, or real, or char)
2. a set of operations on those values (e.g. addition, mult,
print, ord)
The OPERATIONS are inextricable from the notion of the DATA
TYPE. It is wrong to think of a data type as just a certain set
of values.
def: a STRUCTURED DATA TYPE, or DATA STRUCTURE is a data type whose values
1. can be decomposed into to a set of component data elements,
each of which is either atomic or another data structure.
(e.g. array of integers, set of pointers, array of arrays)
2. include a set of associations, or relationships, (structure)
involving the component elements. (e.g. the random access
structure of an array, the FIFO structure of a queue, the LIFO
structure of a stack, the sequential access structure of a
linked list)
The way we view things like pointers, sets, real numbers,
integers, records, binary search trees, and so on, involves
abstraction -- inside a computer, these structures really do
not exist in the way we like to think of them. They are all
implemented as a jumble of bits in the vast majority of modern
computers.
The way we see these things in our "mind's eye" is an
abstraction -- our model of what these things are is taken from
other areas, and we have found ways to IMPLEMENT our
abstraction on the computer.
Def: an ABSTRACT data type "a data type that exists as a
product of our imagination and concentrates on the essential
properties of the data type, ignoring implementation
constraints and details."
SPECIFICATION OF AN ABSTRACT DATA TYPE:
To describe an abstract data type (ADT) is to provide adequate
information in the following four areas:
1. elements -- what are the component data types from which the
data structure is constructed?
2. structure -- how are the elements related to each other in
the composite?
3. domain -- what is the set of allowable structured values?
4. operations -- the actions that can be carried out upon the
data. important in defining the data -- you can not really be
clear on the structure without knowing what operations exist.
Each ADT operation is described as a "BLACK BOX". One
describes what inputs are allowed, and what outputs result from
any allowed input. But one does not describe "how" the
operation accomplishes the task of furnishing the output. Not
"how", just "what". "How" is up to the implementer of the
specified data structure -- and may vary greatly from
implementation to implementation.
IMPLEMENTATION CONSIDERATIONS:
We can IMPLEMENT abstract data types -- these "blueprints" --
by using the built-in data types of a programming language, or
by directly using the physical data types of a given computer.
The text contains many implementations of data structures. The
code includes data type and variable declarations to implement
("represent") elements and, partly, structure. Operations are
implemented with function declarations. In many cases we
discuss DIFFERENT implementations of a given data structure,
pointing out the advantages and disadvantages of each one.
An important consideration in this is the question of HOW
EFFICIENT the operations turn out to be in the various
implementations. And to evaluate efficiency, we need to know
about various tests used, including big-O analyses of
(asymptotic) complexity.