|
|
Returning to Allen Supynuk's C++ and OOP Notes
Why Abstract Data Types (ADTs)?
Abstract Data Types (ADTs)are a higher level way of
looking at programming.
Prototypical ADTs include lists, stacks, and sets.
An abstract data type (ADT) is a mathematical model with
a collection of operations defined on it. [Aho, 1983]
Stacks
Suppose your program needs to keep track of a stack of
things. You have at least two choices for ways of
implementing stacks:
|
|
|
|
|
|
Each method has it's advantages:
*Arrays are very efficient on storage, but are difficult
to extend, easy to implement
*Linked lists have the overhead of a pointer for each
item, are easy to extend, but are a bit harder to implement
Depending on the needs of your program, you will pick one
of these methods.
Unfortunately, you may not be able to determine which is
the best method to use until the middle or end of a project.
|
|
|