Merge two sorted arrays

Combine two sorted lists into one, keeping the numbers in increasing order. This lets you merge the times from two races when the times in each race are already sorted.

Look at the first remaining number in each row. Take the smaller one. For a tie, take the number from the first row.

Move only the pointer in the row you took from. When one row runs out, copy the rest of the other row.

Rows of lengths n and m require n + m transfers. The time complexity is O(n + m).