adt 1 - Abstract Data Types Whats an ADT? Generically...

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

View Full Document Right Arrow Icon
Abstract Data Types
Background image of page 1

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

View Full DocumentRight Arrow Icon
Abstract Data Types 2 What’s an ADT? Generically speaking, an Abstract Data Type is a collection of data AND a set of operations on the data. What is the significance of an ADT? It enables you to think abstractly about data… you can separate operations from implementation. Typically, you choose a data structure and algorithms that provide an implementation of an ADT.
Background image of page 2
Abstract Data Types 3 Array as an ADT As an exercise, let’s think of an Array as an ADT. Another name for an Array is a vector. ADT Array { instances set of (index,value) pairs, so NO two pairs have the same index operations Create(): create an empty array Store(index, value): add this pair to the set, deleting the existing pair with the same index Retrieve(index): return the pair with this index value }
Background image of page 3

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

View Full DocumentRight Arrow Icon
Abstract Data Types 4 Example: grades={(bobby,88), (susie, 45), (jimbo, 98), (janie,92) } grades.Store(susie,86) grades.Retrieve(jimbo) C++ provides a built-in array that is a structured data type. <data type> array[u
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.

This note was uploaded on 03/17/2010 for the course CS 162 taught by Professor Fant during the Spring '08 term at Portland State.

Page1 / 7

adt 1 - Abstract Data Types Whats an ADT? Generically...

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