构造A,B两元素的并(删B表补A表)
void union(List &La, List &Lb)
{
La_len = ListLength(La);
while(!ListEmpty(Lb)){
List(Delete,1,e);
if(!LocateELem(La,e))
ListInsert(La,++La_len,e)
}
Destroy(Lb)
}
非纯集合B化为纯集合A(本质上同上算法一样)
void purge(List &La, List &Lb)
{
InitList(La);
La_len = 0;
while(!ListEmpty(Lb)){
Delete(Lb,1,e);
if(!LocateElem(La,e)ListInsert(La,++La_len,e));
}
DestroyList(Lb);
}
判断A,B两集合相等(构造表List Lc = List Lb, 删相同元素,最后Lc为空则La ,Lb相等)
bool isequal(List La, List Lb)DestroyList(Lc)
}
}