可否稍微讲解一下这个合并线性表的代码

//合并表
Status ListMerge(SqList &lc) {
SqList la;
SqList lb;
//初始化表A
cout << endl;
la.elem = (ElemType*)malloc(LIST_INIT_SIZE * sizeof(ElemType));
if (!la.elem)
{
cout << "线性表A存储分配失败,请您重新操作!" << endl;
}
else
{
la.length = 0;
la.listsize = LIST_INIT_SIZE;
cout << "线性表A的存储空间分配成功!" << endl;
cout << "请输入A中的元素,以负数结束:" << endl;
int a;
cin >> a;
while ( a > 0 )
{
la.length++;
la.elem[la.length - 1] = a;
cin >> a;
}
}

//初始化表B
cout << endl;
lb.elem = (ElemType*)malloc(LIST_INIT_SIZE * sizeof(ElemType));
if (!lb.elem)
{
    cout << "线性表B存储分配失败,请您重新操作!" << endl;
}
else
{
    lb.length = 0;
    lb.listsize = LIST_INIT_SIZE;
    cout << "线性表B的存储空间分配成功!" << endl;
    cout << "请输入B中的元素,以负数结束:" << endl;
    int a;
    cin >> a;
    while (a > 0)
    {
        lb.length++;
        lb.elem[lb.length - 1] = a;
        cin >> a;
    }
}
lc.elem = (ElemType*)malloc(LIST_INIT_SIZE * sizeof(ElemType));
if (!lc.elem) {
    cout << "合并线性表C创建失败,请重新创建!" << endl;
}
else {
    cout << "合并线性表C的内存空间分配成功!" << endl;
    cout << "合并线性表合并后:";
    lc.listsize = lc.length = la.length + lb.length;
    ElemType* pa = &la.elem[0];
    ElemType* pb = &lb.elem[0];
    ElemType* pc = &lc.elem[0];
    ElemType* pa_end = &la.elem[la.length - 1];
    ElemType* pb_end = &lb.elem[lb.length - 1];

    while (pa <= pa_end && pb <= pb_end)//合并线性表A、B。 
    {
        if (*pa <= *pb)
        {
            *pc = *pa;
            pa++;
            pc++;
        }
        else
        {
            *pc = *pb;
            pb++;
            pc++;
        }
    }
    while (pa <= pa_end)//把表A中的剩余元素插入C。 
    {
        *pc = *pa;
        pa++;
        pc++;
    }
    while (pb <= pb_end)//把表B中的剩余元素插入C。 
    {
        *pc = *pb;
        pb++;
        pc++;
    }
    for (int i = 0; i <= lc.length - 1; i++)//查重,去重复值。 
    {
        for (int j = i + 1; j <= lc.length - 1; j++) {
            if (lc.elem[i] == lc.elem[j]) {
                ElemType* q = &(lc.elem[lc.length - 1]);
                for (ElemType* p = &(lc.elem[i]); p < q; p++) {
                    *p = *(p + 1);
                }
                --lc.length;
                j--;
                i--;//删除了重复的元素lc.elem[i]和lc.elem[j]向前移动一位
            }
        }
    }
    for (int i = 0; i <= lc.length - 1; i++)//输出
    {
        cout << lc.elem[i] << " ";
    }
    cout << endl;
}

return OK;

}