Write a method public static ArrayList mergeSorted(ArrayList a, ArrayList b) that merges two sorted array lists, producing

Question:

Write a method

public static ArrayList mergeSorted(ArrayList a,
ArrayList b)

that merges two sorted array lists, producing a new sorted array list. Keep an index into each array list, indicating how much of it has been processed already. Each time, append the smallest unprocessed element from either array list, then advance the index. For example, if a is 1 4 9 16 and b is 4 7 9 9 11 then mergeSorted returns the array list     1 4 4 7 9 9 9 11 16

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: