July 2018
Beginner
202 pages
5h 4m
English
How do you merge two sorted lists into a sorted one? This is the task of the merge() function, which is found at the end of the pseudocode shown in the preceding section. This process is shown in Figure 2.4. Merging two sorted lists is an easier task than sorting from scratch.
This is similar to the intersection problem we saw in Chapter 1, Algorithms and Complexities.
We can merge in linear time utilizing just two pointers and an empty array as shown in the following diagram:

Read now
Unlock full access