I was doing a problem and I am getting a bit confused on the worst cases for using merge sort on two arrays of lengths n and m. The question already says that they are sorted and I am assuming they are equal sizes respectively.
But I am having trouble deciding on if the worst case of running tome is n*m or the max(n, m). There can be more than one answer but I’m just struggling on whether the two would be correct with my understanding.
I looked through my notes, and since the two are already sorted, most of the problems I am thinking of seem to be just on whether it would be n + m or something else.
srises723 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1