Task 1: Create and test an utility class ArrayUtility containing various utility

Task 1: Create and test an utility class ArrayUtility containing various utility methods for arrays.11. Create a package “hw” (under src folder), if not already created. Create a sub-package “a031” under the package hw. In this sub-package (a031), create a public class named ArrayUtility and a public class named ArrayUtilityTest.
12a. In ArrayUtility class, create a public static method toString that receives an array of int’s, a start string, a separator string and an end string. It returns a String starting with the start string, followed by the array elements separated by the separator and ending with the end string.
12b. In ArrayUtilityTest class, create a public static method toStringTest that prints the results for the following 5 lengths of arrays, using different types of brackets and separators for each: empty, singleton, two elements, 5 elements and 20 elements. Call only this class in the main method and check the results.
13a. In ArrayUtility class, create a public static method equals that receives two arrays of int’s and returns true if they have the same length and equal corresponding elements.
13b. In ArrayUtilityTest class, create a public static method equalsTest that prints the results for the following 6 cases: two empty arrays, one empty and one singleton, two singleton with the same element, two singleton with different elements, two arrays with two identical elements, two arrays with two different elements. Call only this class in the main method and check the results.
14. In ArrayUtility and ArrayUtilityTest, design, implement and test a method named isSorted that checks if an array of int-s is already sorted, i.e. all the elements are in increasing order.
15. In ArrayUtility and ArrayUtilityTest, design, implement and test a method named generateIntArray that generates a random array with the provided length having elements randomly generated between a minimum and maximum value, including those values
Task 2: Create a sorting class named SelectionSort containing various versions of selection sort algorithm.21. In the package a031, create a public class named SelectionSort, and a public class named SelectionSortTest.
22. In the SelectionSort class, design and implement the selection sort method for an array of int-s, without calling other methods for performing operations (in-line all the code).
23. In the SelectionSortTest, call the selection sort for some random arrays with length 0, 1, 2, 5 and 10. Check that they are sorted correctly (print them before and after).
Task 3: Create a class SelectionSortAnalysis containing time analysis methods.31. In the a031 package, create a public class named SelectionSortAnalysis
32. In the class SelectionSortAnalysis, create two methods meanTime, and printMeanExecutionTimeGrowthTable, similar with the methods developed for sum.
Task 4: Analyze the execution time and memory needs for the selection sort. 41. Explain in your own words which is the order of growth for the selection sort method.
42. Compute the growth table for some large arrays (at least 10 values for their length, with some large increment between them), draw a graph for the values.
43. Explain if the graph confirms or not the theoretical order of growth above.
44. Analyze the memory needs for the selection sort method. Are they relevant? Why?
Submission:All Java files in the package a031 in a ZIP file
A PDF file with the answers to the questions in Task 4
Requirements: as needed

Published
Categorized as Java