subject
Engineering, 22.02.2020 03:11 laniflower737

Task: Implementation of a List interface and two concrete subclasses: ArrayList and LinkedList.
The ADT of the List interface is given below:
public interface List {
public int size();
public boolean isEmpty();
public Object get(int index) throws OutRangeException;
public void set(int index, Object o) throws OutRangeException;
public void add(int index, Object o) throws OutRangeException;
public Object remove(int index) thorws OutRangeException;
}

Requirements:

Implement the ArrayList and LinkedList classes as well as the List
interface as we discussed in the lectures.

Your implementation has to follow the specification given. Any
other implementation (there are tons of List code on the
Internet) will not receive any credit. In particular

Your ArrayList class does not need to consider the array epansion case,
you can always assume the initial constructed array has sufficient space.

Data fields of ArrayList:

Object[] items;
int size;

Data fields of LinkedList:

Link head;
int size;

Link class has the following data field:

Object e;
Link next;

Test: write a performance comparison program to compare the performance
of the remove operation of the two list classes in running time. To do that,
you need to construct
a big ArrayList and a big LinkedList with a large number of elements in your test program, such as
10,000.
In the performance comparison test, try to do the removing from the tail until the list if empty.
Assume we initially have a list with 10,000 elements (in the test, you have to manually add
10,000 elements to the list though), first you remove the 10,000th element, followed by removing
the 9,999th element, then 9,998th, and so on, until you have an empty list.
Compare their running
time by recording the timestamps before and after the operation.
Demonstrate your result in your test program.

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Thermal stresses are developed in a metal when its a) initial temperature is changed b) final temperature is changed c) density is changed d) thermal deformation is prevented e) expansion is prevented f) contraction is prevented
Answers: 2
question
Engineering, 04.07.2019 18:10
Consider a large isothermal enclosure that is maintained at a uniform temperature of 2000 k. calculate the emissive power of the radiation that emerges from a small aperture on the enclosure surface. what is the wavelength ? , below which 10% of the emission is concentrated? what is the wavelength ? 2 above which 10% of the emission is concentrated? determine the wavelength at which maximum spectral emissive power occurs. what is the irradiation incident on a small object placed inside the enclosure?
Answers: 2
question
Engineering, 04.07.2019 18:10
What are the two (02) benefits, which may result from a successful implementation of preventive maintenance (pm) program in an organization? (clo3)a)- lean manufacturing b)-overlapping responsibilities c)-the planner is not qualified d)-accurate contractor information e)-reduction in equipment redundancies f)-accurate stores information
Answers: 3
question
Engineering, 04.07.2019 19:10
Plan an experiment to measure the surface tension of a liquid similar to water. if necessary, review the ncfmf video surface tension for ideas. which method would be most suitable for use in an undergraduate laboratory? what experimental precision could be expected?
Answers: 2
You know the right answer?
Task: Implementation of a List interface and two concrete subclasses: ArrayList and LinkedList.
Questions
question
History, 08.03.2021 14:30
question
Chemistry, 08.03.2021 14:30
question
History, 08.03.2021 14:30
question
Chemistry, 08.03.2021 14:30
Questions on the website: 13722363