CS 261 University of Puget Sound Spring, 2020
 
Computer Science II
Abstract Data Types and their Implementations, Some Basic Algorithms,
Object-oriented Problem Solving, and Efficiency
 

Warning: This course is under development. Although the basic structure of this course is largely established, nothing on this Web site should be considered official or even possibly correct.
DO NOT MAKE PLANS BASED ON THE CONTENTS OF THIS SITE UNTIL JANUARY, 2020.

Laboratory Exercise on Linked Lists in Java using Iteration, Phase 2

Overview:

This laboratory continues work with the use of lists and pointers.


Introduction

This lab utilizes work done in the previous lab with the classes ListStringNode and NameList.

  1. Create a new OrderedNameList class that extends NameList.

The underlying theme for this lab is that OrderedNameList will also be a list of names, except in this case the names will be stored in dictionary order.


Work Started in Class

  1. Change the insert method, so that each new node is inserted so that the resulting list remains in dictionary order.

    Note: Since insertion must maintain a specified ordering, there is no need to ask the user where to place a new item.

  2. With order specified, finding the first name on the list is particularly easy. Revise the findMinimum method accordingly.

  3. Similarly, update findIndex, so that the method will be as efficient as possible (e.g., to determine an item is not present on the list).

  4. If a list is to remain ordered, a putFirst ( ) method is no longer appropriate.

    1. If putFirst ( ) is not mentioned in this OrderedNameList, what happens if putFirst is called (e.g., in main)?
    2. Although putFirst ( ) is not appropriate, explain why this method cannot actually be removed from the OrderNameList class.
    3. Change putFirst ( ), so that the call in this subclass simply states that the method is no longer implemented.



created 28 January 2020 by Henry M. Walker
revised 29 January 2020 by Henry M. Walker
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.