4 - CMPSCI 187: Programming With Data Structures Lecture 4:...

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

View Full Document Right Arrow Icon
CMPSCI 187: Programming With Data Structures Lecture 4: Data Structures Overview 14 September 2011
Background image of page 1

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

View Full DocumentRight Arrow Icon
Data Structures Overview • Containers and Collections • Ways to Arrange a Collection • The Stack: Data and Operations • Separating Specifcation From Implementation • Inheritance: Distinguishable Objects
Background image of page 2
The Container Metaphor • Imagine a seaport like that on the cover of Lewis and Chase. • Containers come off of ships, for example, and are put on trucks or trains. • The containers are identical on the outside, different on the inside, but identiFable by labels. • Between the unloading from ships and loading onto something else we have a collection of containers. • This is a good metaphor for a collection of pieces of data, such as an array. We often want to move the objects around without looking at their contents.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Collections of Data • A Collection is a set of objects from the same class. • We can create Collections, insert elements, and remove elements. • We might want to remove an element that is “best” in some way, such as the container that needs to be shipped out next. • How the Collection is arranged internally might affect how quickly or easily we
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 11/22/2011 for the course COMPSCI 187 taught by Professor Barrington during the Fall '11 term at UMass (Amherst).

Page1 / 9

4 - CMPSCI 187: Programming With Data Structures Lecture 4:...

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