for this type of q u take randomly short arrays and try to come up with worst case
let A1 and A2 are two arrays of length m and n .let i points to 1st index of A1 and j points to 1st index of A2
let R be the result array
A1: 1, 2, 3 A2: 4,5, 6 when both are in ascending then apply merge sort
compare 1 and 4, since1<4 so increament i e.g i++ and copy 1 to result array
compare 2 and 4 , 2< 4 so i++, copy 2 to R
compare 3 and 4 , 3<4 so i++ copy 3 to R
now A1 is over so simply copy A2 in resultant array
this is best case of comparison which is min(m,n)
now letus take
A1: 1 6 8 and A2: 2 7
compare 1 and 2, copy 1 to R and i++
compare 6 and 2, copy 2 and j++
compare 6 and 7, copy 6 and i++
compare 8 and 7, copy 7 and j++
henre no of comparison = 4 which is m+n-1
hence in worst case we get m+n-1 no. of comparison for 2 sorted arrays of length m and n
here we have 4sorted list so
we get two arrays of 16 element by doing(8+8-1) = 15 comparison
no.of comaprison = 15*2 = 30
then these two sorted arrays are merged to give array of 31 element by doing (16+16-1) comparison = 31
hece total = 30+31
=61
hope u will get it!