Question
For example, for the lists 2, 5, 5, 5 and 2, 2, 3, 5, 5, 7, the output should be 2, 5, 5.
What is the maximum number of comparisons your algorithm makes if the lengths of the two given lists are m and n respectively?
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
Solving idea:Let’s say |A|=m and |B|=n.
We use two variables i and j. The first iterates through the first sorted list and the second iterates through the second sorted list....