Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

The Project
For this assignment, you will write the LinearList class, a singly linked list based implementation of the LinearListADT interface (given below). A 'list' is a sequence of values. The ordering of the items in the list is not specified but does matter, and is in fact problem dependent. No insertion ever occurs at an arbitrary location. When an item is removed from the list, the ordering of the remaining elements in the list is unchanged.
We want to segregate our data structures and separate them from any application programs. Accordingly, you must place all data structures in a package nameddata_structures. Your LinearList class must implement the LinearListADT interface. Your project will consist of exactly the following two files, both of which must be in a data_structures/ package:
? LinearListADT.java The linear list interface (provided below)
? LinearList.java Your implementation of the this interface
Both of the above files must go in package data_structures. Any driver/tester programs will go in the level above the data_structures subdirectory. [ The sample tester program provided for assignment #1 will also work for this one. ] IMPORTANT: The package organization is of critical importance. If your project fails to compile during the grading process due to package errors, your grade for this project 
will be zero.
The LinearListADT interface:
/*  Your name
    Your masc account number
*/
package data_structures;
import java.util.Iterator;
import java.util.NoSuchElementException;
public interface LinearListADT extends Iterable {
    public static final int DEFAULT_MAX_CAPACITY = 100;
//  Adds the Object obj to the end of list.  
    public void addLast(E obj);
    
//  Adds the Object obj to the beginning of list.  
    public void addFirst(E obj);    
    
//  Inserts the Object obj at the position indicated.  If there is an element at
//  that location, all elements from that location to the end of the list are 
//  shifted down to make room for the new insertion.  The location is one based.
//  If the location > size()+1 then a RuntimeException is thrown. List elements 
//  must be contiguous.
    public void insert(E obj, int location);    
//  Removes the object located at the parameter location (one based).
//  Throws a RuntimeException if the location does not map to a valid position within the list.
    public E remove(int location);
    
//  Removes and returns the parameter object obj from the list if the list contains it, null otherwise.
//  The ordering of the list is preserved.  The list may contain duplicate elements.  This method
//  removes and returns the first matching element found when traversing the list from first position.
    public E remove(E obj);
    
//  Removes and returns the parameter object obj in first position in list if the list is not empty,  
//  null if the list is empty. The ordering of the list is preserved.
    public E removeFirst();   
    
//  Removes and returns the parameter object obj in last position in list if the list is not empty, 
//  null if the list is empty. The ordering of the list is preserved.
    public E removeLast();             
//  Returns the parameter object located at the parameter location position (one based).
//  Throws a RuntimeException if the location does not map to a valid position within the list.
    public E get(int location);      
//  Returns true if the parameter object obj is in the list, false otherwise.
    public boolean contains(E obj);  
    
//  Returns the one based location of the parameter object obj if it is in the list, -1 otherwise.
//  In the case of duplicates, this method returns the element closest to position #1.
    public int locate(E obj);       
//  The list is returned to an empty state.
    public void clear();
//  Returns true if the list is empty, otherwise false
    public boolean isEmpty();
//  Returns the number of Objects currently in the list.
    public int size();
    
//  Returns an Iterator of the values in the list, presented in
//  the same order as the underlying order of the list. (position #1 first)
    public Iterator iterator();
 }
Additional Details
? The DEFAULT_MAX_CAPACITY constant in the interface is not applicable to this implementation. 
Linked lists are never full unless the user has exhausted all available memory. You are not 
responsible for this situation, nor do you need to test for it. It should also be obvious that the 
array resizing operations needed for the first version are not applicable here.
? All references to list element position are one-based, not zero-based. The first element in the list 
is at position #1, not #0.
? The ordering of the elements in the list is user defined. Thus, you must never alter the ordering 
of items in the list internally. 
? Your LinearList class will have a single constructor that takes no arguments.
? Both files specified in this assignment must have the exact names and signatures as given.
? You must not make any changes to the LinearListADT interface; I will use my copy to compile 
and run your program. 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91528556

Have any Question?


Related Questions in Computer Engineering

Inverse elasticityimagine youve started a new pizza

Inverse Elasticity: Imagine you've started a new pizza restaurant. It costs you about $3 to produce a pizza. Last week you sold 450 pizzas for $12 each. This week you raised your price and sold 300 pizzas for $16 each. W ...

Systems analysis and design projectpersonal trainer inc

Systems Analysis and design project Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the company is planning an international expansion by opening a n ...

Are there more children diagnosed with autism spectrum

Are there more children diagnosed with Autism Spectrum Disorder (ASD) in states that have larger urban areas over states that are mostly rural? In the state of Pennsylvania, a fairly urban state, there are 245 eight year ...

Can you give me short cut of using excel word access share

Can you give me short cut of using excel, word, access, share point, and powerpoint microsoft, I am always have to rely on the back and forth, fleepng the pages, it is possible

Consider the following reactionccl4g 4 cl2g rarr ch4g 4

Consider the following reaction: CCl4(g) + 4 Cl2(g) → CH4(g) + 4 HCl(g) What mass of CCl4 is formed by the reaction of 2.00 g of methane with an excess of chlorine?

You work in a veterinarians office and need to organize the

You work in a Veterinarian's office and need to organize the data on pets that you treat. In your database, you want to keep track of the following information: Customer information: Name Address City State ZIP Phone # Y ...

What effect does the teacher have on creating a learning

What effect does the teacher have on creating a learning environment with little to no behavior problems?

Question suppose you had to design a wired ethernet network

Question : Suppose you had to design a wired Ethernet network for a 4-story office building containing 20 users per floor. Each floor is 90 meters in length and 5 meters in height. Draw a network topology of your propose ...

When using todays digital cameras file sizes are often

When using today's digital cameras file sizes are often saved in a format that is well over 1 Megabyte. This may be great for high definition photo reproductions but is a disaster for uploading to the web. Images on your ...

Question cyber attacks on critical infrastructures-a risk

Question: Cyber Attacks On Critical Infrastructures-A Risk To The Nation There has been a great deal of research related to cyber attacks and vulnerabilities and critical infrastructure, but there is an incomplete unders ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As