# Ch5 - Chapter 5 LinkedStructures CHAPTERGOALS To be able to...

This preview shows pages 1–4. Sign up to view the full content.

C h a p t e r   5 Linked Structures C H A P T E R   G O A L S To be able to implement the Stack ADT as a linked data structure To be able to implement the Queue ADT as a linked data structure. To be able to implement the Unsorted List ADT as a linked data structure. To be able to implement the Sorted List ADT as a linked data structure. To be able to compare alternative implementations of an abstract data type with respect to performance. 1

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

View Full Document
2    Chapter  5   Linked  Structures Chapter Outline Teaching Notes Linked Stacks and Queues This chapter resivisits the ADTs Stack, Queue, Unsorted List, and Sorted List, introducing a new implementation structure: the pointer-based linked list. The text does not assume any previous knowledge of creating a linked data structure, and introduces the idea in the context of an alternate implementation for the ADT Stack. Linked structures are always difficult for students so the ideas are introduced with the help of a number of figures. An understanding of the idea of linking the elements in a structure is a prerequisite for the discussion of linked queues and lists in subsequent sections. In developing the linked stack operations, we use the same design notation that we developed for the array-based implementation: Node(location) refers to all the data at location , including implementation-specific data. Info(location) refers to the user's data at location . Info(last) refers to the user's data at the last location in the list. Next(location) gives the location of the node following Node( location ). The concept of linking is immediately reinforced with the linked implementation of the ADT Queue. The implementation of the ADTs Unsorted List and Sorted List follow in sequence. After each new implementation has been discussed thoroughly, the array-based and the pointer- based implementatsions are compared using Big-O notation. Workout The purpose of this exercise is to examine the relative storage requirements of array-based and linked implementations. The students are instructed to determine the amount of storage space required for various implementation structures. For each description, they should graph the storage requirements of both implementations, as the number of elements in the structure ranges from 0 to the maximum structure size. Use the following assumptions: Integers (array indexes) require 2 bytes, pointers require 4 bytes. The type of the items on the structure are described as follows: A maximum of 200 80-byte strings. A maximum of 200 2-byte integers. A maximum of 200 12-byte structs. Based on the results of their graphs, the students should be able to determine some guidelines for when one of the stack implementations might be preferable to the other, assuming that use of memory space is a strong factor in making the decision.
Chapter  5   Liked Structures  3 Linked Lists The Unsorted List is presented first. Because it is unsorted, we can put a new element in the

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 06/13/2011 for the course CSC 280 taught by Professor Lebre during the Spring '04 term at Moraine Valley Community College.

### Page1 / 11

Ch5 - Chapter 5 LinkedStructures CHAPTERGOALS To be able to...

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

View Full Document
Ask a homework question - tutors are online