Void mergelist (linklist la, linklist * LB, linklist * LC)/** // * algorithm 2.12 */
... {/** // * Elements of the known Single-Chain linear table la and lB are arranged in non-descending order by value. */
/** // * Merge La and lb to obtain the new single-chain linear table LC. The LC elements are also arranged in a non-descending order of values */
Linklist Pa = La-> next, Pb = (* lb)-> next, PC;
* Lc = pc = La;/** // * use the La header node as the LC header node */
While (PA & Pb)
If (Pa-> data <= Pb-> data)
...{
PC-> next = PA;
PC = PA;
Pa = pa-> next;
}
Else
...{
PC-> next = Pb;
PC = Pb;
PB = Pb-> next;
}
PC-> next = pa? PA: Pb;/** // * Insert the remaining segments */
Free (* lb);/** // * release the LB header node */
Lb = NULL;
}
I did not answer the last Microsoft Phone interview... Whow
Note: When linklist la, linklist * LB, linklist * LC is added with *, it indicates that changes will occur later.