Question: Fill out the schematic below by repeatedly stating the list content as the merge computation progresses to completion. Write p and q under the nodes

Fill out the schematic below by repeatedly stating the list content as the merge computation progresses to completion. Write p and q under the nodes they point to each step along the way. Mark L, M, and R on the final list.

node *merge(node *L, node *M, node *R); Land M mark the first elements in the left and right sublists. M and R mark the elements immediately following the last element in the left and right sublists. A pointer is returned to the first element in the sorted list. Internally, pointers p=Land q=M mark the next node being considered from each sublist. If the p-node holds the smaller of the two keys, p is advanced to the next node. Alternatively, the q-node is unliked and inserted in front of the p-node whereafter q is advanced to the next node. M R E B G S p q .. B E G S q node *merge(node *L, node *M, node *R); Land M mark the first elements in the left and right sublists. M and R mark the elements immediately following the last element in the left and right sublists. A pointer is returned to the first element in the sorted list. Internally, pointers p=Land q=M mark the next node being considered from each sublist. If the p-node holds the smaller of the two keys, p is advanced to the next node. Alternatively, the q-node is unliked and inserted in front of the p-node whereafter q is advanced to the next node. M R E B G S p q .. B E G S
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
