COP 3530
Assignment 3
Due Date: Monday, 14th Sep 2009
Have your name and UF ID on what you submit and only
soft copies
are REQUIRED.
1.
Extend the
ArrayLinearList
to a new class
ArrayLinearListExt
and
include a new
method
SetSize
,
which makes the list size equal to the specified size. If the original list size was less than
the new one,
null
elements are added at the end, but if the original size was larger than the new
one than, extra elements are removed from the end. Determine the complexity of your method?
Test your code.
Following is the template for
ArrayLinearListExt class:
/** Extension of ArrayLinearList as ArrayLinearList Ext*/
package dataStructures;
import java.util.*;
import utilities.*;
public class ArrayLinearListExt extends ArrayLinearList
{
public ArrayLinearListExt(int capacity)
{
super(capacity);
}
//The function SetSize need to be implemented here
public void SetSize(int size)
{
}
//The main function to test SetSize method
public static void main(String [] args)
{
// test default constructor
ArrayLinearListExt x = new ArrayLinearListExt(10);
// test size
System.out.println("Initial size is " + x.size());
// test isEmpty
if (x.isEmpty())
System.out.println("The list is empty");
else System.out.println("The list is not empty");
This
preview
has intentionally blurred sections.
Sign up to view the full version.

This is the end of the preview.
Sign up
to
access the rest of the document.
- Fall '08
- Davis
- Algorithms, Data Structures, Insertion Sort, list size, SetSize
-
Click to edit the document details