This is the final version but check back for any late updates.
Due dates: Check the Announcements.
Note you can do this and take an interview without turning in
the assignment, as long as it is before the turnin deadline (and
until the deadline is announced it is definitely before the deadline.)
A .class file is in the public directory.
Required reading: Savitch text Chapter 7. This exercise
should be done using only the material from Chapters 1 through
7, Section 10.1 of Chapter 10, and Chapter 11.
Programming: If you did a relatively good job on hw 3 and
4, then this one should be fairly easy.
Define a derived class named SuperVector that is a derived class
of the class Vector. You will assume that a SuperVector will only
be used to store objects of type String.
Your class SuperVector will have the following methods. It can
have more methods if you wish.
- A default constructor that makes the initial size of the vector
10.
- A constructor with one int argument for the initial capacity
of the vector.
/* Sorts the vector elements into alphabetical order */
public void sort()
Use the selection sort algorithm given in Chapter 6.
/* If target is in the vector, returns the first index for a vector
element that holds
target. If target is not in the vector, returns -1. */
public int locate(String target)
Important: You must implement locate with the RECURSIVE
binary search algorithm described in Chapter 11. Your program
must use locate to search for the words the user enters to see
if they are on the list.
Use the class SuperVector to write a program with an interface
like that of HW 3 and 4.
Call your program SuperVectorSearcher. Write your program using
the two files SuperVector.java and SuperVectorSearcher.java. However,
when you turn in your program, make SuperVector an inner class
in the class SuperVectorSearcher so that you have only one file
to turn in.
Last Update: Feb 03, 2003 (by Nakul
Verma)