Engineering
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.

answer
Answers: 1

Other questions on the subject: Engineering

image
Engineering, 03.07.2019 14:10, BardiFan
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
image
Engineering, 04.07.2019 18:10, DestyHilBan1183
Adouble-strand no. 60 roller chain is used to transmit power between a 13-tooth driving sprocket rotating at 300 rev/min and a 52-tooth driven sprocket. a) what is the allowable horsepower of this drive? b) estimate the center-to-center distance if the chain length is 82 pitches. c) estimate the torque and bending force on the driving shaft by the chain if the actual horsepower transmitted is 30 percent less than the corrected (allowable) power.
Answers: 3
image
Engineering, 04.07.2019 18:10, qwertylol12345
Different types of steels contain different elements that alter the characteristics of the steel. for each of the following elements, explain what the element does when alloyed with steel.
Answers: 2
image
Engineering, 04.07.2019 18:10, aliopqwas
Condition monitoring is a major component of. (clo4) a)- predictive maintenance. b)-preventive maintenance c)-proactive maintenance d)-reactive maintenance.
Answers: 1
Do you know the correct answer?
Task: Implementation of a List interface and two concrete subclasses: ArrayList and LinkedList.

Questions in other subjects:

Konu
Spanish, 05.07.2019 06:50