Question: Union of two integer arrays. Write a method that returns all elements that are included in the set-union of integer array list1 and integer array

Union of two integer arrays. Write a method that returns all elements that are included in the set-union of integer array list1 and integer array list2. Assume the array data items are already sorted in ascending sequence. The methods header is:

public static int[] ArrayUnion (int[] list1, int[] list2)

Example: Assume list1 is {1, 2, 3, 4} and list2 is { 3, 4, 5, 8}. Your output should be {1, 2, 3, 4, 5, 8}. Observe that duplicate values (such as 3 and 4) must be listed only once.

Do not read - write anything! Create your own methods. Do not use routines from the Array class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!