typedefstruct{ ElemType *elem//基地址 int length;//当前长度 int listsize;//当前容量 }Sqlist; typedefint Status; Status InitList_Sq(Sqlist &L) Status ListInsert(Sqlist &L, int i, ElemType e); //O(n) Status ListDelete_Sq(Sqlist &L, int i, ElemType e); //O(n) Status Locate_Sq(Sqlist L, ElemType e, Status (*compare)(ElemType, ElemType)); Status MergeList_Sq(Sqlist L1, Sqlist L2, Sqlist &L3);
LNode *p;//(*p)表示p指向的结点 (*p).data i.e. p->date p是一个指针 p=(LNode *)malloc(sizeof(LNode)); free(p); Status GetElem_L(Linklist L, int i, ElemType &c); //L是头指针 Status ListInsert(Linklist &L, int i, ElemType e); //O(n) Status ListDelete_Sq(Linklist &L, int i, ElemType e); //O(n) Status CreateList_L(Linklist &L, int n);// 逆位序输入
typedefstructDuLNode{ ElemType data; structDuLNode *prior, *next; } DuLNode, *DuLinkList; Status ListDelete_DuL(DuLinkList &L, int i, ElemType &e) Status ListDelete_DuL(DuLinkList &L, int i, ElemType &e) Status ListInsert_DuL(DuLinkList &L, int i, ElemType &e)