An abstract data type (ADT) specifies a type’s possible values, permitted operations, computational complexities, outputs, and side effects without prescribing storage or physical-memory details. A data structure is the concrete implementation of that specification: its data representation plus the algorithms that manipulate it. The ADT serves users; the implementation serves implementers. section 1.1.1 section 1.4
Define an ADT as a contract before choosing its representation:
- Specify the API, including each operation’s inputs and outputs. section 1.1.2
- Describe high-level behavior and the guarantees visible to clients. section 1.1.2 section 2.4
- State invariants when internal properties must remain true to preserve the contract. section 2.4
- Choose a data model and algorithms, then analyze operation performance. section 1.1.2 section 2.4
Priority queue and heap
A priority queue ADT exposes operations such as top, peek, insert, remove, update, and size, while guaranteeing that the returned top element has the highest current priority. A heap is one concrete implementation, using an array and algorithms that preserve its invariants; a sorted list is another possible implementation. Clients can rely on the contract without depending on the representation. section 2.4
Table 2.1 API and contract for priority queue (view table figure)
The API-and-contract table makes the separation between client-visible behavior and implementation choices explicit. section 2.4



