正在加载图片...
对应的线性表基本操作 1. ListDelete LB,1,e; 2. LocateElem(LA, e, equal); 3. Listinsert( LA, n+, e) void union (List &LA, List &LB) La_|en= ListLength(LA);∥求得线性表LA的长度 whle( ListEmpty(LB))∥依次处理LB中元素直至 LB为空表止 ∥从LB中删除第1个数据元素并赋给e ListDelete (LB, 1, e); ∥当LA中不存在和e值相同的数据元素时进行插入 if ! Elem (LA, e, equal()) ListInsert(LA, ++La len, e); Destroy List(LB) ∥销毁线性表LB }∥ union• 对应的线性表基本操作: 1. ListDelete( LB, 1, e ); 2. LocateElem( LA, e, equal() ); 3. ListInsert( LA, n+1,e ) • void union(List &LA, List &LB) { La_len = ListLength(LA);// 求得线性表 LA 的长度 while (!ListEmpty(LB)) // 依次处理 LB 中元素直至 LB 为空表止 { // 从 LB 中删除第1个数据元素并赋给 e ListDelete(LB,1,e); // 当LA中不存在和 e 值相同的数据元素时进行插入 if (!LocateElem(LA,e,equal( )) ListInsert(LA,++La_len,e); } DestroyList(LB); // 销毁线性表 LB } // union
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有