Bootstrap

集合并

//A=A∪B
void union(List &LA, List &LB)
{
        La_len=ListLength(LA);
        while(!ListEmpty(LB))
        {
                ListDelete(LB, 1, e);
                if(!LocateElem(LA, e, equal()))
                        ListInsert(LA, ++La_len, e);
        }//while
        DestoryList(LB);
}//union


void purge(List &LA, List LB)
{
        InitList(LA);
        La_len=0;
        Lb-len=ListLength(LB);
        for(i=1; i<=Lb_len; i++)
        {
                GetElem(LB, i, e);
                if(!LocateElem(LA, e, equal()))
                        ListInsert(LA, ++La_len, e);
        }//for
}//purge

转载于:https://www.cnblogs.com/hansen/archive/2009/03/01/1400736.html

;