How many comparisons are needed to merge two sorted lists?

If we are merging two sorted lists of sizes m and n into a sorted list of size m+n then how many comparisons are required in worst case is

3Comments
Subhro Mukherjee @subhromukherjee
15 May 2017 10:56 am

max(m,n)

Abhishek @abhisinu
15 May 2017 04:48 pm

How? I think it will m+n

abhinandan @abhinandan
16 May 2017 03:04 am

i think in worst case it will take m+n comparison...

lets take an example m be 1,5,7,8 and n be 2,4,6,9 be the contents of array m and n respectively.

now you can see using the merging algorithm it will take m+n Comparision