Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions