1.5. Why Study Data Structures and Abstract Data Types - Problem Solving With Algorithms and Data Structures
1.5. Why Study Data Structures and Abstract Data Types - Problem Solving With Algorithms and Data Structures
Problem
6/11/17,
... 6:34 PM
Earlier, w e ref erred to procedural abstraction as a process that hides the details of a particular f unction
to allow the user or client to view it at a very high level. We now turn our attention to a similar idea, that
of data abs traction. An abs tract data type , sometimes abbreviated ADT, is a logical description of
how w e view the data and the operations that are allow ed w ithout regard to how they w ill be
implemented. This means that w e are concerned only w ith w hat the data is representing and not w ith
how it w ill eventually be constructed. By providing this level of abstraction, w e are creating an
e ncaps ulation around the data. The idea is that by encapsulating the details of the implementation, w e
are hiding them f rom the users view . This is called inform ation hiding.
Figure 2 show s a picture of w hat an abstract data type is and how it operates. The user interacts w ith
the interf ace, using the operations that have been specif ied by the abstract data type. The abstract
data type is the shell that the user interacts w ith. The implementation is hidden one level deeper. The
user is not concerned w ith the details of the implementation.
(../_images/adt.png)
The implementation of an abstract data type, of ten ref erred to as a data s tructure , w ill require that w e
provide a physical view of the data using some collection of programming constructs and primitive data
types. As w e discussed earlier, the separation of these tw o perspectives w ill allow us to def ine the
complex data models f or our problems w ithout giving any indication as to the details of how the model
w ill actually be built. This provides an im ple m e ntation-inde pe nde nt view of the data. Since there
w ill usually be many diff erent w ays to implement an abstract data type, this implementation
independence allow s the programmer to sw itch the details of the implementation w ithout changing the
w ay the user of the data interacts w ith it. The user can remain f ocused on the problem-solving
process.
1 of 1