Algorithmic idea ： first , Take down two smaller nodes of two sequence tables and store them in a new sequence table . then , Which table is left , Just add the rest to the new sequence table .

The answers in the book use 3 Cycles , I combined it into a loop to realize , The pseudo code is as follows ：
int Combin_List(SqList L1,SqList L2,SqList*L) { if (L1.Length + L2.Length >
MAXSIZE) { return ERROR; } int k = 0, k1 = 0, k2 = 0; while (1) { if
(L1.elems[k1] <= L2.elems[k2]&&k1<L1.Length) { L->elems[k++] = L1.elems[k1++];
L->Length++; if (k1 == L1.Length) { L1.elems[k1]= L2.elems[L2.Length-1];
// Set the first value exceeded by the sequence table to the maximum value of the other table , To ensure that another if The statement executes normally until the end of the copy } } if (L1.elems[k1] >=
L2.elems[k2] && k2 < L2.Length) { L->elems[k++] = L2.elems[k2++]; L->Length++;
if (k2 == L2.Length) { L2.elems[k2] = L1.elems[L1.Length - 1]; } } if
(L->Length == L1.Length + L2.Length) { return OK; } } }

Technology
Daily Recommendation