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
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