write a method using JAVA : public static ArrayList (lessthansymbol) Integer> me
ID: 3656242 • Letter: W
Question
write a method using JAVA : public static ArrayList (lessthansymbol) Integer> mergeSorted(ArrayList (lessthansymbol) Integer> a, ArrayList (lessthansymbol) Integer> 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 ex, 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 16Explanation / Answer
public static ArrayList mergeSorted(ArrayList list1, ArrayList list2) { ArrayList mergeList = new ArrayList(list1.size() + list2.size()); int listIndex = 0; int left = 0; int right = 0; while(leftRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.