Ch3 - Chapter3 ADTsUnsorted List and SortedList...

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

View Full Document Right Arrow Icon
Chapter 3 ADTs  Unsorted List  and   Sorted List C H A P T E R   G O A L S To be able to describe the abstract data type List at a logical level To be able to use the list operations to implement utility routines to do the following application-level tasks: Print the list of elements Create a list of elements from a file To be able to implement the following list operations for both unsorted lists and sorted lists: Create and destroy a list Determine whether the list is full Insert an element Retrieve an element Delete an element To be able to write and execute a test plan for an abstract data type To be able to explain the use of Big-O notation to describe the amount of work done by an algorithm To be able to compare the unsorted list operations and the sorted list operations in terms of Big-O approximations To be able to define class constructors and class destructors To be able to overload the relational operators less than ( < ) and equality ( == ) 1
Background image of page 1

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

View Full Document Right Arrow Icon
2    Chapter  3   ADTs Unsorted  List and  Sorted List Chapter Outline We then review the categories of abstract data type operations and decide what operations the List ADT must have. We introduce the concept of a generic data type, one for which the operations are specified but the type of the objects being manipulated is not. We stress the concept of information hiding by requiring the user of the ADT to provide a class that defines the type of the objects on the list and a comparison function that determines the ordering of items on the list. This function is used in each operation that requires two items to be compared. This reinforces the idea that an abstract data type is truly abstract: the functions are provided by the ADT, but the user must declare the context in which these functions are being used. Specification The specifications used for this and other ADTs in the text are balanced between formal structure (function, preconditions, postconditions) and informal (English language) descriptions. We feel that the strength of recording the specification of a function can be demonstrated without resorting to formal notation. The main idea to be stressed here is that the user of the data type can understand the set of operations by looking at its specification, not by reading the code. The specification is a record of the logical perspective; we have not yet even discussed the implementation. The User Level In order to reinforce the concepts of encapsulation and abstraction, we present two operations on the List ADT which are context-dependent and write them using the operations on the List ADT without knowing how the list is implemented . The Implementation Level
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 12

Ch3 - Chapter3 ADTsUnsorted List and SortedList...

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

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