Title: Abstract Data Type
1Abstract Data Type
lists stacks queues
These use these
Review data type originally referred to
primitives and their operators.
user defined classes
In Java this concept is represented by an
abstract class which contains data members and
method headers only. An abstract class must be
extended and cannot be instantiated.
data structures
int double
2Classes are actually data types a programmer
creates, where information hiding is possible.
An example of an abstract class that we will use
is List.
Find an element in the list. Retrieve an element
in the list.
Create the list. Add an element to the
list. Remove an element from the list. Determine
if the list is empty.
3Some classes are not abstract classes but are
written without consideration of the data
structures used in its implementation or detailed
specifications. Examples of these are stacks
and queues which may be implemented by either
arrays or linked lists.
4An ADT specification is an interface.
(what the class user sees usually its
public methods.)
A stack is an ADT which allows data values to be
accessed only one at a time and only the last
inserted.
Stack requires methods push( ), pop( ), peek(
), isEmpty( ), and sometimes isFull( )(depending
on the implementation).
Stacks are often used as aids in more complex
data structures and microprocessors are
stack-based.