Searching, Sorting & Selection


Answer & solution
Answer: C: O(m+n) (no official key was published)
Compare the two current front items, emit the smaller and advance that list. Every comparison emits one item, and once one list is exhausted the remaining items can be copied without further comparisons. At most m+n−1 comparisons are therefore needed when both lists are nonempty. Balanced interleavings can attain this bound, giving linear worst-case work. Merely searching in logarithmic time would not output the entire merged list; the standard merge exploits the existing order of both inputs.