Question
Create an ExperimentController class. The class will have the following methods: a. timeAddToFront( int numberOfItems, int seed, int min, int max): i. create an instance
Create an ExperimentController class. The class will have the following methods:
a. timeAddToFront( int numberOfItems, int seed, int min, int max):
i. create an instance of a RandomIntegerContainer
ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addToFront() method.
iii. The method will return the time taken to add all the items to the container using addToFront().
b. timeAddToBack( int numberOfItems, int seed, int min, int max):
i. create an instance of a RandomIntegerContainer
ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addToBack() method.
iii. The method will return the time taken to add all the items to the container using addToBack().
c. timeAddSorted( int numberOfItems, int seed, int min, int max):
i. create an instance of a RandomIntegerContainer
ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addSorted() method.
iii. The method will return the time taken to add all the items to the container using addSorted().
d. timeProductdSorted( int numberOfItems, int seed, int min, int max):
i. create an instance of a RandomIntegerContainer
ii. for the specified numberOfItems, prepend random even numbers between min and max to the first element of the container using the productSorted() method.
iii. The method will return the time taken to add all the items to the container using productSorted().
e. timeSortofUnsortedList(int numberOfItems, int seed, int min, int max):
i. create an instance of a RandomIntegerContainer
ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addToBack() method.
iii. The method will call selectionSort().
iv. The method will return the time it took to sort the array.
f. timeSortOfSortedList(int numberOfItems, int seed, int min, int max):
i. create an instance of a RandomIntegerContainer
ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addToBack() method.
iii. The method will call selectionSort().
iv. The method will call selectionSort() again.
v. The method will return the time it took to sort the already sorted array.
import static org.junit. Assert. assertArrayEquals; import java.util.*; import org.junit. Test; public class Random IntegerContainer { private ArrayListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started