Answer to Question m20
Incorrect. This definition of merge
takes a different approach, using a loop.
Suppose that A = [1,3,5] and B = [2,4,6].
Here are the values of A, B and merge1 each time
the beginning of the while-loop is reached, including
the first time.
A B merge1
[1,3,5] [2,4,6] []
[3,5] [2,4,6] [1]
[3,5] [4,6] [2,1]
[5] [4,6] [3,2,1]
[5] [6] [4,3,2,1]
[] [6] [5,4,3,2,1]
Now the loop is done, and the function returns
[5,4,3,2,1]. The correct answer is [1,2,3,4,5,6].