七、已知线性表A={a1、a2、……an}采用链接存储结构,其数据域由4个值域组成,假设依次为 char code[]
char name[] int max int min
要求:
1、定义单链表结点(包括对数据域的定义); 2、从单链表的表尾删除一个结点。 (参考答案)
答1:struct goods{ char code[5];
};
char name[15]; int max; int min;
typedef goods ElemType; struct LNode { ElemType data;
};
LNode *next;
答2:ElemType Delete(LNode *HL) { }
LNode *p=HL; while(p->next!=NULL)
p=p->next; temp=p->data; delete p; return temp;
6