Question: Write a static method named mergeSortedLists that takes two ArrayLists of Integers that are in increasing order and returns a new ArrayList of Integers that

Write a static method named mergeSortedLists that takes two ArrayLists of Integers that are in increasing order and returns a new ArrayList of Integers that contains the elements of the original lists "merged" together in increasing order. For example, if the first list contains the elements [1, 4, 4, 7, 22] and the second list is [3, 3, 5, 5, 21, 25, 30] then the new list should be [1, 3, 3, 4, 4, 5, 5, 7, 21, 22, 25, 30]. Again, if one list is longer than the other append the remaining elements to theend of the new list.

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!