lists 6 - The List ADT Specifying List ADT Behavior...

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

View Full Document Right Arrow Icon
The List ADT
Background image of page 1

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

View Full DocumentRight Arrow Icon
The List ADT 2 Specifying List ADT Behavior Consider the abstraction of a List. What operations are you thinking of? Create an empty list Destroy a list Determine whether a list is empty Determine the number of items on a list Insert an item at a given position in the list Delete the item at a given position in the list Retrieve the item at a given position in the list Display the contents of the list These operations specify an interface to a List ADT, regardless of which implementation we will choose.
Background image of page 2
The List ADT 3 Choosing an Implementation We have quite a few choices for our List data representation: 1. A statically allocated array: typedef int ListItemType; const int MAX_LIST = 100; class List{ private: ListItemType _data[MAX_LIST]; int _size; }; 2. A dynamically allocated array: typedef int ListItemType; class List{ private: ListItemType* _data; int _size; };
Background image of page 3

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

View Full DocumentRight Arrow Icon
The List ADT 4 Limitations??? Let’s analyze these implementations and
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 / 8

lists 6 - The List ADT Specifying List ADT Behavior...

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