Question
create a program that builds two objects containing sorted integer arrays of random size. The size of each array will be between 20 and 60
create a program that builds two objects containing sorted integer arrays of random size. The size of each array will be between 20 and 60 inclusive. The arrays need to be of different sizes . You my use either an insertion sort or bubble sort to sort the arrays.. You must implement the sort. Do not use any built in java sort. After the two arrays are sorted merge them into a third object's array. Do not eliminate any duplicate values.
generate random integer values between 0 and 100 for the values in the array elements.
Display the two sorted arrays after they are built.
Display the merged array after it is built.
public class MergeDriver {
/** * @param args */ public static void main(String[] args) { IntegerArray array1 = new IntegerArray; IntegerArray array2 = new IntegerArray; IntegerArray array3 = null; System.out.println(array1.toString()); System.out.println(array2.toString()); array3 = array1.merge(array2); System.out.println(array3.toString());
}
}
Step 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