In this lab, you are to implement ArrayStack and LinkedStack -classes in the DataStructures package that implements StackADT.
ArrayStack is implemented based on Arrays
LinkedStack is implemented based on LinkedLists
After implementing, run tests in ArrayStackTest orLinkedStackTest respectively, to test your implementation.
Add java docs, and you are done. More details can be found inthe first lecture for Week 4.
Submission Requirements
JavaDoc implementation for DataStructures.ArrayStack (20points)
All tests passing in DataStructures.ArrayStackTest (80points)
JavaDoc implementation for DataStructures.LinkedStack (20points)
All tests passing in DataStructures.LinkedStackTest
ListADT.java
package ADTs;
import Exceptions.*;
/**
* An interface for an ordered (NOT SORTED) List
* Elements stay in the order they are put in to the list
* @author clatulip
*/
public interface ListADT<T> extends CollectionADT<T>{
/**
* Adds the specified element to the list at the front
*
* @param element: the element to be added
*
*/
public void addFirst(T element);
/**
* Adds the specified element to the end of the list
*
* @param element: the element to be added
*/
CollectionADT.java
/*
* To change this license header, choose License Headers inProject Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package src.ADTs;
/**
* An interface for an AbstractDataType
* Specific ADT interfaces will extend this
* For use in ITCS 2214 Data Structures & Algorithms
* UNC Charlotte, 2016
*
* @author clatulip
*/
public interface CollectionADT<T> {
/**
* Returns true if the collection contains no elements
*
* @return true if the collection is empty
*/
public boolean isEmpty();
/**
* Returns the number of elements in the collection
*
* @return the number of elements as an int
*/
public int size();
/**
* Returns a string representation of the collection
*
* @return a string representation of the collection
*/
@Override
public String toString();
}
In this lab, you are to implement ArrayStack and LinkedStack - classes in the DataStructures package that implements Sta
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am