October 2025
Intermediate to advanced
485 pages
13h 2m
English
The following diagram represents the arrays we want to merge. Note that the left and right pointers point to the beginning of each of their respective arrays. The merged array starts out as empty:

Now, let’s walk through the process of merging them. Each of our “steps” will consist of two parts. Part A appends a value to the merged array, while Part B consists of moving either the left or right pointer.
Step 1A: First, we compare the left pointer’s value to the right pointer’s value. We take whichever value is lower and append it to the array. In this case, the 1 is lower, so we append the 1:
Step 1B: Because we appended a value ...
Read now
Unlock full access