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
Get step-by-step solutions from verified subject matter experts
