Build your algorithmic thinking foundation
Section 1 of 5
Understand the power of abstraction in computer science. Learn how ADTs provide a clean interface between data and operations, enabling modular and maintainable software design.
An Abstract Data Type (ADT) is composed of a collection of data and a set of operations on that data. It emphasizes what operations can be performed rather than how they are implemented.
Think about what you can do with data, not how it's implemented
Data and operations are bundled together, hiding internal details
Internal representation is hidden from users
abstract typedef <element_type, index_type> Array
//definition clause
element_type A [max_size]
index_type i
//condition clause
index_type == integerMust represent all necessary ADT values and be private
Consistent with chosen representation, private helpers
abstract <element_type> Extract (A, i)Precondition: 0 ≤ i < max_size
Postcondition: Extract == A[i]
abstract Store(A, i, value)Precondition: 0 ≤ i < max_size
Postcondition: A[i] == value