L1 - Introduction To ADTs
L1 - Introduction To ADTs
Topics
Scalar data types.
Introduction to Abstract Data Types (ADT)
Implementation of an ADT
Advantages of an ADT
Scalar data types.
Scalar data type
Consists of data values that are considered
non-decomposable (single). See next slide
Examples in C++: char, int, unsigned, long, float, double.
In other words, a
conceptualization of something
at some level of detail
What is abstraction?
To distill (break down) a complicated system into its
most fundamental components (parts).
And
To describe these parts in a simple precise language .
Describing the system parts involves:
Naming them and describing their functionalities.
Abstraction is a powerful technique that helps programmers deal
with complex issues in piecemeal fashion.
“In piecemeal fashion" means one piece at a time rather than
all at once.
Examples of Abstractions
Real-world example
Data abstraction
Procedural abstraction
BUT
You do not need to know the details of the car’s
electrical system, braking system or steering
mechanism.
Abstraction and program
variables (Data Abstraction)
No need to be concerned with the physical structure
of memory in order to declare and use a variable.
total = 9 - 15 + 20 * 6
In other words:
Structures
Classes
Arrays
Abstraction and Data Types
• Abstraction: a definition that captures general
characteristics without details
– Ex: An abstract triangle is a 3-sided polygon. A
specific triangle may be scalene, isosceles, or
equilateral
if (waiting_line.front == NULL)
cout<<“ No more customers;
Advantages of creating ADT Implementations
4. The source code of the program is insulated from the
data structure in the implementation of the ADT.
ONLY the source code for the function in the implementation of the
ADT will have to be changed.