- Forward


Abstract Data Types
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Abstract Data Types
Back Forward
  • Defined:
    1. The set of possible values that an instance can take (i.e., the domain or carrier set); and
    2. The set of allowable operations on its instances
  • An Observation:
    • Each ADT can be implemented in more than one way
Implementation of an ADT
Back Forward
  • Defined:
    1. A realization in computer memory (called a data structure) of the values; and
    2. An executable realization of a mechanism (called an algorithm) for performing each of the operations
  • An Observation:
    • In an object-oriented language, an ADT is usually implemented as a class
Data Structures
Back Forward
  • Contiguous Implementations:
    • Values are stored in adjacent memory locations
  • Linked Implementations:
    • Values are "connected" using pointers or references
    • Note: Many books call these "linked list" implementations. This is inappropriate since a "list" is an ADT and, hence, a "linked list" is a particular way of implementing a "list".
  • A Physical Analogue:
    • A warehouse containing outgoing orders
Contiguous Implementations
Back Forward
images/array.gif
Linked Implementations
Back Forward
  • The Components:
    • images/linked_structure_components.gif
  • Types of Nodes:
    • Endogenous - Data is in the node
    • Exogenous - Data is pointed to by the node
Linked Implementations (cont.)
Back Forward

Single, Linear (Endogenous)

images/linked_structure_endogenous_single_linear.gif

Double, Linear (Endogenous)

images/linked_structure_endogenous_double_linear.gif
Linked Implementations (cont.)
Back Forward

Single, Circular (Endogenous)

images/linked_structure_endogenous_single_circular.gif

Double, Circular (Endogenous)

images/linked_structure_endogenous_double_circular.gif
Linked Implementations (cont.)
Back Forward

Binary Tree (Endogenous)

images/linked_structure_endogenous_binary_tree.gif
Linked Implementations (cont.)
Back Forward
  • One Observation:
    • All linked structures can be studied using ideas from graph theory
  • Another Observation:
    • Networks/Graphs are the most general
    • Trees are special cases of networks/graphs
    • Linear structures are special cases of trees
There's Always More to Learn
Back -