20090209-ADT-I

20090209-ADT-I - Abstract Data Types (ADTs) An ADT consists...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Abstract Data Types (ADTs) • An ADT consists of: – a set of values, and – a set of operations on those values. • Example: rational numbers – some values: 15/7, -3/4, 123/1, 0/1 (but NOT 1/0 !) – some operations: addition, multiplication, negation • An ADT therefore specifies: what the members are, and what operations are supported.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What an ADT isn’t: • An ADT does not specify: how the data is stored/represented, or how the operations are implemented. • These details are abstracted away. • An ADT is implementation independent • An ADT is language independent. • In Java, an ADT is typically specified in an interface.
Background image of page 2
Data Structures (DS) • A data structure is an implementation of an ADT. • In Java, data structures are classes. • In the Java Collections framework, the List interface specifies an ADT that is implemented by several data structures: – ArrayList (an array-based structure) – LinkedList (a linked structure)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Analogy #1: vending machine • You can perform only the specific tasks that the machine's interface presents to you. • You must understand these tasks.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

20090209-ADT-I - Abstract Data Types (ADTs) An ADT consists...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online