Combining two sorted lists into one sorted list comes up on its own and as the merge step of merge sort. You walk both lists, always taking the smaller head, and a dummy node removes the special case for the first node. Use it when inputs are already sorted, since the merge is O(n + m) with no sorting needed. Putting all values into an array and sorting again works but throws away the order you were given.