Then illustrate each of these cases on an appropriate diagram, based on the one above. For example, the inner do performs the role of pair-merge . The variable left indicates where the first of two groups start, and the inner do moves from group to group from the start of the vector to the end. Also, since merging involves copying from one vector to another, we begin by creating a second vector. Then we repeatedly merge from one vector to the other.
Some care is needed to keep track of which vector has the current data set.
This is accomplished with a count variable which is even or odd according to which vector has the current ordered groups. The above commentary outlines the purpose of the inner do expression. Write a similar commentary for the outer do expression. Print out the results of this test run, and explain what processing has occured at each step.