Question: In Java how would I create a function, ArrayList numMax (ArrayList a, ArrayList> b) that takes two lists of integers, c and d, and calculates

 In Java how would I create a function, ArrayList numMax (ArrayList

In Java how would I create a function, ArrayList numMax (ArrayList a, ArrayList> b) that takes two lists of integers, c and d, and calculates the pairwise maximum of c and d. Which means, each element of the result is the greater of the corresponding element at the same index in a c and d, or the element in the longer list if there is no corresponding element in the other list. Meaning: The first element of the result is the greater of the first element in c and the first element in d The second element of the result is the greater of the second element in c and the second element in d and so on. c and d can be of different lengths. Therefore, if there is an element in a list with no corresponding element in the other list, then the result is the element in the longer list. For example, if c is {3,47,16} and d is {5,8,6,3,2,59}, then the returned value is {5,47,16,3,2,59}

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!