// 合并两个线性表,结果存储在第三个线性表中,不包含重复元素 voidunionList(List LA, List LB, List *LC) { int lena, i; ElemType e; InitList(LC); for (i = 1; i <= LA.Length; i++) { GetElem(LA, i, &e); ListInsert(LC, i, e); }
lena = LA.Length;
for (i = 1; i <= LB.Length; i++) { GetElem(LB, i, &e); if (!LocateList(LA,e)) { ListInsert(LC, ++lena, e); } } }